@@ -145,7 +145,7 @@ func (v *GatewayProxyCustomValidator) validateGatewayProxyConflict(ctx context.C
145145 if ! otherConfig .readyForConflict () {
146146 continue
147147 }
148- if current .adminKeyKey != otherConfig . adminKeyKey {
148+ if ! current .sharesAdminKeyWith ( otherConfig ) {
149149 continue
150150 }
151151 if current .serviceKey != "" && current .serviceKey == otherConfig .serviceKey {
@@ -172,7 +172,7 @@ func (v *GatewayProxyCustomValidator) validateGatewayProxyConflict(ctx context.C
172172}
173173
174174type gatewayProxyConfig struct {
175- adminKeyKey string
175+ inlineAdminKey string
176176 secretKey string
177177 serviceKey string
178178 serviceDescription string
@@ -190,10 +190,9 @@ func buildGatewayProxyConfig(gp *v1alpha1.GatewayProxy) gatewayProxyConfig {
190190
191191 if cp .Auth .AdminKey != nil {
192192 if value := strings .TrimSpace (cp .Auth .AdminKey .Value ); value != "" {
193- cfg .adminKeyKey = "value:" + value
193+ cfg .inlineAdminKey = value
194194 } else if cp .Auth .AdminKey .ValueFrom != nil && cp .Auth .AdminKey .ValueFrom .SecretKeyRef != nil {
195195 ref := cp .Auth .AdminKey .ValueFrom .SecretKeyRef
196- cfg .adminKeyKey = fmt .Sprintf ("secret:%s/%s:%s" , gp .GetNamespace (), ref .Name , ref .Key )
197196 cfg .secretKey = fmt .Sprintf ("%s/%s:%s" , gp .GetNamespace (), ref .Name , ref .Key )
198197 }
199198 }
@@ -220,8 +219,18 @@ func (c gatewayProxyConfig) adminKeyDetail() string {
220219 return "the same inline AdminKey value"
221220}
222221
222+ func (c gatewayProxyConfig ) sharesAdminKeyWith (other gatewayProxyConfig ) bool {
223+ if c .inlineAdminKey != "" && other .inlineAdminKey != "" {
224+ return c .inlineAdminKey == other .inlineAdminKey
225+ }
226+ if c .secretKey != "" && other .secretKey != "" {
227+ return c .secretKey == other .secretKey
228+ }
229+ return false
230+ }
231+
223232func (c gatewayProxyConfig ) readyForConflict () bool {
224- if c .adminKeyKey == "" {
233+ if c .inlineAdminKey == "" && c . secretKey == "" {
225234 return false
226235 }
227236 return c .serviceKey != "" || len (c .endpoints ) > 0
0 commit comments