Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-1.15] Fix bug in cert manager config #15437

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pkg/reconciler/certificate/config/cert_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ type CertManagerConfig struct {
func NewCertManagerConfigFromConfigMap(configMap *corev1.ConfigMap) (*CertManagerConfig, error) {
// Use Knative self-signed ClusterIssuer as default
config := &CertManagerConfig{
IssuerRef: knativeSelfSignedIssuer,
ClusterLocalIssuerRef: knativeSelfSignedIssuer,
SystemInternalIssuerRef: knativeSelfSignedIssuer,
IssuerRef: knativeSelfSignedIssuer.DeepCopy(),
ClusterLocalIssuerRef: knativeSelfSignedIssuer.DeepCopy(),
SystemInternalIssuerRef: knativeSelfSignedIssuer.DeepCopy(),
}

if v, ok := configMap.Data[issuerRefKey]; ok {
Expand Down
32 changes: 31 additions & 1 deletion pkg/reconciler/certificate/config/cert_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,41 @@ func TestIssuerRef(t *testing.T) {
Kind: "ClusterIssuer",
},
},
config: &corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Namespace: system.Namespace(),
Name: CertManagerConfigName,
},
Data: map[string]string{
systemInternalIssuerRef: "kind: ClusterIssuer\nname: system-internal-issuer",
},
},
}, {
name: "all issuer valid",
wantErr: false,
wantConfig: &CertManagerConfig{
IssuerRef: &cmmeta.ObjectReference{
Name: "letsencrypt-issuer",
Kind: "ClusterIssuer",
},
ClusterLocalIssuerRef: &cmmeta.ObjectReference{
Name: "system-internal-issuer",
Kind: "ClusterIssuer",
},
SystemInternalIssuerRef: &cmmeta.ObjectReference{
Name: "system-internal-issuer",
Kind: "ClusterIssuer",
},
},
config: &corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Namespace: system.Namespace(),
Name: CertManagerConfigName,
},
Data: map[string]string{
clusterLocalIssuerRefKey: "kind: ClusterIssuer\nname: system-internal-issuer",
systemInternalIssuerRef: "kind: ClusterIssuer\nname: system-internal-issuer",
issuerRefKey: "kind: ClusterIssuer\nname: letsencrypt-issuer",
},
},
}}
Expand All @@ -129,7 +157,9 @@ func TestIssuerRef(t *testing.T) {
if (err != nil) != tt.wantErr {
t.Fatalf("Test: %q; NewCertManagerConfigFromConfigMap() error = %v, WantErr %v", tt.name, err, tt.wantErr)
}
if diff := cmp.Diff(actualConfig, tt.wantConfig); diff != "" {

if !cmp.Equal(actualConfig, tt.wantConfig) {
t.Log(cmp.Diff(actualConfig, tt.wantConfig))
t.Fatalf("Want %v, but got %v", tt.wantConfig, actualConfig)
}
})
Expand Down
Loading