Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
mwangggg committed Nov 29, 2023
1 parent 64acdbb commit 16caf4e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion internal/controllers/certmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func (r *Reconciler) setupTLS(ctx context.Context, cr *model.CryostatInstance) (
Name: caCert.Spec.SecretName,
Namespace: ns,
},
Type: secret.Type,
Type: corev1.SecretTypeOpaque,
}
err = r.createOrUpdateSecret(ctx, namespaceSecret, cr.Object, func() error {
if namespaceSecret.Data == nil {
Expand Down
15 changes: 9 additions & 6 deletions internal/controllers/reconciler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2341,12 +2341,15 @@ func (t *cryostatTestInput) expectCertificates() {
// Check CA Cert secrets in each target namespace
Expect(t.TargetNamespaces).ToNot(BeEmpty())
for _, ns := range t.TargetNamespaces {
namespaceSecret := t.NewCACertSecret(ns)
secret := &corev1.Secret{}
err := t.Client.Get(context.Background(), types.NamespacedName{Name: namespaceSecret.Name, Namespace: ns}, secret)
Expect(err).ToNot(HaveOccurred())
t.checkMetadata(secret, namespaceSecret)
Expect(secret.Data).To(Equal(namespaceSecret.Data))
if ns != t.Namespace {
namespaceSecret := t.NewCACertSecret(ns)
secret := &corev1.Secret{}
err := t.Client.Get(context.Background(), types.NamespacedName{Name: namespaceSecret.Name, Namespace: ns}, secret)
Expect(err).ToNot(HaveOccurred())
t.checkMetadata(secret, namespaceSecret)
Expect(secret.Data).To(Equal(namespaceSecret.Data))
Expect(secret.Type).To(Equal(namespaceSecret.Type))
}
}
}

Expand Down
3 changes: 2 additions & 1 deletion internal/test/clients.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ func (c *testClient) createCertSecret(ctx context.Context, cert *certv1.Certific
Namespace: cert.Namespace,
},
Data: map[string][]byte{
corev1.TLSCertKey: []byte(cert.Name + "-bytes"),
corev1.TLSCertKey: []byte(cert.Name + "-bytes"),
corev1.TLSPrivateKeyKey: []byte(cert.Name + "-key"),
},
}
err := c.Create(ctx, secret)
Expand Down
1 change: 1 addition & 0 deletions internal/test/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -886,6 +886,7 @@ func (r *TestResources) NewCACertSecret(ns string) *corev1.Secret {
Name: r.Name + "-ca",
Namespace: ns,
},
Type: corev1.SecretTypeOpaque,
Data: map[string][]byte{
corev1.TLSCertKey: []byte(r.Name + "-ca-bytes"),
},
Expand Down

0 comments on commit 16caf4e

Please sign in to comment.