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

[CN-868] Allow to use TLS only with Hazelcast Enterprise version #756

Merged
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions api/v1alpha1/hazelcast_validation.go
Expand Up @@ -175,6 +175,11 @@ func validateTLS(h *Hazelcast) *field.Error {
return nil
}

if h.Spec.LicenseKeySecretName == "" {
return field.Required(field.NewPath("spec").Child("tls"),
"Hazelcast TLS requires enterprise version")
}

p := field.NewPath("spec").Child("tls").Child("secretName")

// if user skipped validation secretName can be empty
Expand Down
16 changes: 16 additions & 0 deletions test/integration/hazelcast_test.go
Expand Up @@ -1798,6 +1798,22 @@ var _ = Describe("Hazelcast CR", func() {
Spec: spec,
}

Expect(k8sClient.Create(context.Background(), hz)).Should(HaveOccurred())
})
It("should error when not using enterprise version", Label("fast"), func() {
if ee {
Skip("This test will only run in OS configuration")
}

spec := test.HazelcastSpec(defaultHazelcastSpecValues(), ee)
spec.TLS = &hazelcastv1alpha1.TLS{
SecretName: "example",
}
hz := &hazelcastv1alpha1.Hazelcast{
ObjectMeta: randomObjectMeta(namespace),
Spec: spec,
}

Expect(k8sClient.Create(context.Background(), hz)).Should(HaveOccurred())
})
})
Expand Down