Skip to content

Commit

Permalink
e2e: Only create registry ca-cert secret when using local registry pr…
Browse files Browse the repository at this point in the history
…ovider (#1464)
  • Loading branch information
tiffanny29631 authored Oct 29, 2024
1 parent ba2a1d7 commit 744c865
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions e2e/nomostest/oci-image-verification-server.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,17 @@ func auth(nt *NT) error {
return err
}

// Create secret for the public ca-cert in the oci-image-verification namespace
// for the oci-signature-verification webhook server to verify certificate.
sharedTmpDir := filepath.Join(os.TempDir(), NomosE2E, nt.ClusterName)
sharedTestRegistrySSLDir := filepath.Join(sharedTmpDir, string(RegistrySyncSource), sslDirName)
testRegistryCACertPath := filepath.Join(sharedTestRegistrySSLDir, caCertFile)
if err := createSecret(nt, OCISignatureVerificationNamespace, PublicCertSecretName(RegistrySyncSource),
fmt.Sprintf("cert=%s", testRegistryCACertPath)); err != nil {
return err
// When OCI provider is set to local, create secret for the public ca-cert in
// the oci-image-verification namespace for the oci-signature-verification
// webhook server to verify certificate.
if *e2e.OCIProvider == e2e.Local {
sharedTmpDir := filepath.Join(os.TempDir(), NomosE2E, nt.ClusterName)
sharedTestRegistrySSLDir := filepath.Join(sharedTmpDir, string(RegistrySyncSource), sslDirName)
testRegistryCACertPath := filepath.Join(sharedTestRegistrySSLDir, caCertFile)
if err := createSecret(nt, OCISignatureVerificationNamespace, PublicCertSecretName(RegistrySyncSource),
fmt.Sprintf("cert=%s", testRegistryCACertPath)); err != nil {
return err
}
}

return nil
Expand Down

0 comments on commit 744c865

Please sign in to comment.