Skip to content

Commit

Permalink
Use MetaIssuers to simular EKS / GKE in e2e test.
Browse files Browse the repository at this point in the history
Add dropped LRU initialization (oops merge conflict).

Signed-off-by: Matt Moore <mattomata@gmail.com>
  • Loading branch information
mattmoor committed Oct 28, 2021
1 parent d3ce3b1 commit b82aa0d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
22 changes: 15 additions & 7 deletions .github/workflows/verify-k8s.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,20 @@ jobs:

verify-k8s-deployment:
runs-on: ubuntu-latest
strategy:
fail-fast: false # Keep running if one leg fails.
matrix:
issuer:
- "OIDC Issuer"
- "Meta Issuer"

include:
- issuer: "OIDC Issuer"
issuer-config: |
"OIDCIssuers": {"https://kubernetes.default.svc": {"IssuerURL": "https://kubernetes.default.svc","ClientID": "sigstore","Type": "kubernetes"}}
- issuer: "Meta Issuer"
issuer-config: |
"MetaIssuers": {"https://kubernetes.*.svc": {"ClientID": "sigstore","Type": "kubernetes"}}
env:
# https://github.com/google/go-containerregistry/pull/125 allows insecure registry for
Expand Down Expand Up @@ -149,13 +163,7 @@ jobs:
data:
config.json: |-
{
"OIDCIssuers": {
"https://kubernetes.default.svc": {
"IssuerURL": "https://kubernetes.default.svc",
"ClientID": "sigstore",
"Type": "kubernetes"
}
}
${{ matrix.issuer-config }}
}
EOF
Expand Down
8 changes: 7 additions & 1 deletion pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ func Load(configPath string) error {
return err
}

if _, ok := cfg.OIDCIssuers["https://kubernetes.default.svc"]; ok {
if _, ok := cfg.GetIssuer("https://kubernetes.default.svc"); ok {
// Add the Kubernetes cluster's CA to the system CA pool, and to
// the default transport.
rootCAs, _ := x509.SystemCertPool()
Expand Down Expand Up @@ -233,6 +233,12 @@ func Load(configPath string) error {
cfg.verifiers[iss.IssuerURL] = verifier
}

cache, err := lru.New2Q(100 /* size */)
if err != nil {
return err
}
cfg.lru = cache

config = cfg
log.Logger.Infof("Loaded config %v from %s", cfg, configPath)
return nil
Expand Down

0 comments on commit b82aa0d

Please sign in to comment.