Skip to content

Commit

Permalink
Don't validate credentialName in gateway secrets analyzer if it isn't…
Browse files Browse the repository at this point in the history
… specified (istio#19905)
  • Loading branch information
sushicw authored and istio-testing committed Jan 3, 2020
1 parent d0cc6de commit df73e76
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
4 changes: 4 additions & 0 deletions galley/pkg/config/analysis/analyzers/gateway/secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ func (a *SecretAnalyzer) Analyze(ctx analysis.Context) {
}

cn := tls.GetCredentialName()
if cn == "" {
continue
}

if !ctx.Exists(collections.K8SCoreV1Secrets.Name(), resource.NewShortOrFullName(gwNs, cn)) {
ctx.Report(collections.IstioNetworkingV1Alpha3Gateways.Name(), msg.NewReferencedResourceNotFound(r, "credentialName", cn))
}
Expand Down
17 changes: 17 additions & 0 deletions galley/pkg/config/analysis/analyzers/testdata/gateway-secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,21 @@ spec:
mode: SIMPLE
credentialName: "httpbin-credential"
hosts:
- "httpbin.example.com"
---
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: defaultgateway-nocredential # No credentialName specified, we shouldn't generate any errors
spec:
selector:
istio: ingressgateway
servers:
- port:
number: 443
name: https
protocol: HTTPS
tls:
mode: SIMPLE
hosts:
- "httpbin.example.com"

0 comments on commit df73e76

Please sign in to comment.