Skip to content

Commit

Permalink
fix: add missing owner on knative-serving-cert
Browse files Browse the repository at this point in the history
- why using default ingress cert, owner is not set to FTer: serverless-serving-gateway

Signed-off-by: Wen Zhou <[email protected]>
  • Loading branch information
zdtsw committed Sep 20, 2024
1 parent d73b3da commit 12de2a9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions pkg/cluster/cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func generateCertificate(addr string) ([]byte, []byte, error) {
}

// PropagateDefaultIngressCertificate copies ingress cert secrets from openshift-ingress ns to given namespace.
func PropagateDefaultIngressCertificate(ctx context.Context, c client.Client, secretName, namespace string) error {
func PropagateDefaultIngressCertificate(ctx context.Context, c client.Client, secretName, namespace string, metaOptions ...MetaOptions) error {
defaultIngressCtrl, err := FindAvailableIngressController(ctx, c)
if err != nil {
return fmt.Errorf("failed to get ingress controller: %w", err)
Expand All @@ -137,6 +137,9 @@ func PropagateDefaultIngressCertificate(ctx context.Context, c client.Client, se
return err
}

if err := ApplyMetaOptions(defaultIngressSecret, metaOptions...); err != nil {
return err
}
return copySecretToNamespace(ctx, c, defaultIngressSecret, secretName, namespace)
}

Expand Down Expand Up @@ -169,8 +172,9 @@ func GetSecret(ctx context.Context, c client.Client, namespace, name string) (*c
func copySecretToNamespace(ctx context.Context, c client.Client, secret *corev1.Secret, newSecretName, namespace string) error {
newSecret := &corev1.Secret{
ObjectMeta: metav1.ObjectMeta{
Name: newSecretName,
Namespace: namespace,
Name: newSecretName,
Namespace: namespace,
OwnerReferences: secret.OwnerReferences,
},
Data: secret.Data,
Type: secret.Type,
Expand Down
2 changes: 1 addition & 1 deletion pkg/feature/serverless/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func ServingCertificateResource(ctx context.Context, cli client.Client, f *featu
case infrav1.Provided:
return nil
default:
return cluster.PropagateDefaultIngressCertificate(ctx, cli, secretData.Name, secretData.Namespace)
return cluster.PropagateDefaultIngressCertificate(ctx, cli, secretData.Name, secretData.Namespace, feature.DefaultMetaOptions(f)...)
}
}

Expand Down

0 comments on commit 12de2a9

Please sign in to comment.