Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use MetaIssuers to simulate EKS / GKE in e2e test. #225

Merged
merged 1 commit into from
Oct 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Comment on lines +236 to +240
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the bug. It got lost in a merge conflict 😞


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