Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Commit

Permalink
fix: Add servicename in certs (#491)
Browse files Browse the repository at this point in the history
Before:
A hardcoded string was used for setting the secret namespace

After:
The value for the secret namespace for settings is grabbed dynamically.

Signed-off-by: Francisco J. Solis <siscomagma@gmail.com>

Signed-off-by: Francisco J. Solis <siscomagma@gmail.com>
Co-authored-by: Dan Rammer <daniel@union.ai>
  • Loading branch information
sisco0 and hamersaw authored Oct 12, 2022
1 parent f0eef3f commit 7ffb502
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pkg/webhook/init_cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func InitCerts(ctx context.Context, propellerCfg *config.Config, cfg *webhookCon
}

logger.Infof(ctx, "Issuing certs")
certs, err := createCerts(podNamespace)
certs, err := createCerts(cfg.ServiceName, podNamespace)
if err != nil {
return err
}
Expand Down Expand Up @@ -153,7 +153,7 @@ func createWebhookSecret(ctx context.Context, namespace string, cfg *webhookConf
return err
}

func createCerts(serviceNamespace string) (certs webhookCerts, err error) {
func createCerts(serviceName string, serviceNamespace string) (certs webhookCerts, err error) {
// CA config
caRequest := &x509.Certificate{
SerialNumber: big.NewInt(2021),
Expand Down Expand Up @@ -190,9 +190,9 @@ func createCerts(serviceNamespace string) (certs webhookCerts, err error) {
return webhookCerts{}, err
}

dnsNames := []string{"flyte-pod-webhook",
"flyte-pod-webhook." + serviceNamespace, "flyte-pod-webhook." + serviceNamespace + ".svc"}
commonName := "flyte-pod-webhook." + serviceNamespace + ".svc"
dnsNames := []string{serviceName,
serviceName + "." + serviceNamespace, serviceName + "." + serviceNamespace + ".svc"}
commonName := serviceName + "." + serviceNamespace + ".svc"

// server cert config
certRequest := &x509.Certificate{
Expand Down

0 comments on commit 7ffb502

Please sign in to comment.