@@ -153,7 +153,7 @@ func (v *GatewayProxyCustomValidator) validateGatewayProxyConflict(ctx context.C
153153 gp .GetNamespace (), gp .GetName (),
154154 other .GetNamespace (), other .GetName (),
155155 current .serviceDescription ,
156- current .adminKeyDescription ,
156+ current .adminKeyDetail () ,
157157 )
158158 }
159159 if len (current .endpoints ) > 0 && len (otherConfig .endpoints ) > 0 {
@@ -162,7 +162,7 @@ func (v *GatewayProxyCustomValidator) validateGatewayProxyConflict(ctx context.C
162162 gp .GetNamespace (), gp .GetName (),
163163 other .GetNamespace (), other .GetName (),
164164 strings .Join (overlap , ", " ),
165- current .adminKeyDescription ,
165+ current .adminKeyDetail () ,
166166 )
167167 }
168168 }
@@ -172,11 +172,11 @@ func (v *GatewayProxyCustomValidator) validateGatewayProxyConflict(ctx context.C
172172}
173173
174174type gatewayProxyConfig struct {
175- adminKeyKey string
176- adminKeyDescription string
177- serviceKey string
178- serviceDescription string
179- endpoints map [string ]struct {}
175+ adminKeyKey string
176+ secretKey string
177+ serviceKey string
178+ serviceDescription string
179+ endpoints map [string ]struct {}
180180}
181181
182182func buildGatewayProxyConfig (gp * v1alpha1.GatewayProxy ) gatewayProxyConfig {
@@ -191,11 +191,10 @@ func buildGatewayProxyConfig(gp *v1alpha1.GatewayProxy) gatewayProxyConfig {
191191 if cp .Auth .AdminKey != nil {
192192 if value := strings .TrimSpace (cp .Auth .AdminKey .Value ); value != "" {
193193 cfg .adminKeyKey = "value:" + value
194- cfg .adminKeyDescription = "the same inline AdminKey value"
195194 } else if cp .Auth .AdminKey .ValueFrom != nil && cp .Auth .AdminKey .ValueFrom .SecretKeyRef != nil {
196195 ref := cp .Auth .AdminKey .ValueFrom .SecretKeyRef
197196 cfg .adminKeyKey = fmt .Sprintf ("secret:%s/%s:%s" , gp .GetNamespace (), ref .Name , ref .Key )
198- cfg .adminKeyDescription = fmt .Sprintf ("AdminKey secret %s/%s key %s" , gp .GetNamespace (), ref .Name , ref .Key )
197+ cfg .secretKey = fmt .Sprintf ("%s/%s: %s" , gp .GetNamespace (), ref .Name , ref .Key )
199198 }
200199 }
201200
@@ -214,6 +213,13 @@ func buildGatewayProxyConfig(gp *v1alpha1.GatewayProxy) gatewayProxyConfig {
214213 return cfg
215214}
216215
216+ func (c gatewayProxyConfig ) adminKeyDetail () string {
217+ if c .secretKey != "" {
218+ return fmt .Sprintf ("AdminKey secret %s" , c .secretKey )
219+ }
220+ return "the same inline AdminKey value"
221+ }
222+
217223func (c gatewayProxyConfig ) readyForConflict () bool {
218224 if c .adminKeyKey == "" {
219225 return false
0 commit comments