Skip to content

Commit 9b77e23

Browse files
committed
fix: r
Signed-off-by: Ashing Zheng <axingfly@gmail.com>
1 parent 2e2ddeb commit 9b77e23

File tree

2 files changed

+11
-17
lines changed

2 files changed

+11
-17
lines changed

internal/webhook/v1/ssl/conflict_detector.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ func (d *ConflictDetector) BuildGatewayMappings(ctx context.Context, gateway *ga
203203
mappings = append(mappings, HostCertMapping{
204204
Host: host,
205205
CertificateHash: info.hash,
206-
ResourceRef: fmt.Sprintf("Gateway/%s/%s", gateway.Namespace, gateway.Name),
206+
ResourceRef: fmt.Sprintf("%s/%s/%s", internaltypes.KindGateway, gateway.Namespace, gateway.Name),
207207
})
208208
}
209209
}
@@ -238,7 +238,7 @@ func (d *ConflictDetector) BuildIngressMappings(ctx context.Context, ingress *ne
238238
mappings = append(mappings, HostCertMapping{
239239
Host: host,
240240
CertificateHash: info.hash,
241-
ResourceRef: fmt.Sprintf("Ingress/%s/%s", ingress.Namespace, ingress.Name),
241+
ResourceRef: fmt.Sprintf("%s/%s/%s", internaltypes.KindIngress, ingress.Namespace, ingress.Name),
242242
})
243243
}
244244
}
@@ -276,7 +276,7 @@ func (d *ConflictDetector) BuildApisixTlsMappings(ctx context.Context, tls *apiv
276276
mappings = append(mappings, HostCertMapping{
277277
Host: host,
278278
CertificateHash: info.hash,
279-
ResourceRef: fmt.Sprintf("ApisixTls/%s/%s", tls.Namespace, tls.Name),
279+
ResourceRef: fmt.Sprintf("%s/%s/%s", internaltypes.KindApisixTls, tls.Namespace, tls.Name),
280280
})
281281
}
282282

internal/webhook/v1/ssl/conflict_detector_test.go

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,10 @@ func TestConflictDetectorDetectsGatewayConflict(t *testing.T) {
101101
Spec: networkingv1.IngressClassSpec{
102102
Controller: config.ControllerConfig.ControllerName,
103103
Parameters: &networkingv1.IngressClassParametersReference{
104-
APIGroup: ptr.To(v1alpha1.GroupVersion.Group),
105-
Kind: internaltypes.KindGatewayProxy,
106-
Name: gatewayProxy.Name,
107-
Namespace: func() *string {
108-
ns := testNamespace
109-
return &ns
110-
}(),
104+
APIGroup: ptr.To(v1alpha1.GroupVersion.Group),
105+
Kind: internaltypes.KindGatewayProxy,
106+
Name: gatewayProxy.Name,
107+
Namespace: ptr.To(testNamespace),
111108
},
112109
},
113110
}
@@ -206,13 +203,10 @@ func TestConflictDetectorAllowedWhenCertificateMatches(t *testing.T) {
206203
Spec: networkingv1.IngressClassSpec{
207204
Controller: config.ControllerConfig.ControllerName,
208205
Parameters: &networkingv1.IngressClassParametersReference{
209-
APIGroup: ptr.To(v1alpha1.GroupVersion.Group),
210-
Kind: internaltypes.KindGatewayProxy,
211-
Name: gatewayProxy.Name,
212-
Namespace: func() *string {
213-
ns := testNamespace
214-
return &ns
215-
}(),
206+
APIGroup: ptr.To(v1alpha1.GroupVersion.Group),
207+
Kind: internaltypes.KindGatewayProxy,
208+
Name: gatewayProxy.Name,
209+
Namespace: ptr.To(testNamespace),
216210
},
217211
},
218212
}

0 commit comments

Comments
 (0)