Replies: 6 comments 13 replies
-
First of all, you should not have these parts there:
Just set the Spec and the Metadata. For the rest, just use some IDE and follow the DSL language it offers you. You should end up for example with something like this: KafkaUser user = new KafkaUserBuilder()
.withNewMetadata()
.withName(kafkaUserName)
.withNamespace(NAMESPACE)
.withLabels(Map.of("strimzi.io/cluster", KAFKA_NAME))
.endMetadata()
.withNewSpec()
.withNewKafkaUserScramSha512ClientAuthentication()
.withNewPassword()
.withNewValueFrom()
.withNewSecretKeyRef("my-secret", "my-key", false)
.endValueFrom()
.endPassword()
.endKafkaUserScramSha512ClientAuthentication()
.endSpec()
.build(); |
Beta Was this translation helpful? Give feedback.
-
how to add acl to the above code |
Beta Was this translation helpful? Give feedback.
-
how can i add secret in K8 and how to use custom password to the above code |
Beta Was this translation helpful? Give feedback.
-
can you explain this line what does falsee means here |
Beta Was this translation helpful? Give feedback.
-
corrected the code package org.example; import io.fabric8.kubernetes.client.KubernetesClient; public class CreateStrimziUser {
} Getting Error |
Beta Was this translation helpful? Give feedback.
-
Thank You, I'm able to solve it what if i want to update the acl to the existing user, i dont see replace method. Do i need to use update() or edit the specification. Working code i have as of now List aclRules = new ArrayList<>();
|
Beta Was this translation helpful? Give feedback.
-
Hi everyone,
I have been working on Strimzi API development, and I successfully created Kafka topics using the provided Maven dependencies. Currently, I am working on creating a Kafka user with Scram-SHA-512 authentication, but I am struggling with the following tasks:
I’ve been unable to find concrete examples or documentation for this specific use case.
If anyone has any working code examples, documentation, or guidance, I would greatly appreciate it.
Thanks in advance!
Topic working code:
try (KubernetesClient client = new KubernetesClientBuilder().build()) {
KafkaTopic topic = new KafkaTopicBuilder()
.withApiVersion("kafka.strimzi.io/v1beta2\n" +
"kind: KafkaTopic")
.withNewMetadata()
.withName(TOPIC_NAME)
.withNamespace(NAMESPACE)
.withLabels(Map.of("strimzi.io/cluster", KAFKA_NAME))
.endMetadata()
.withNewSpec()
.withPartitions(3)
.withReplicas(3)
.withConfig(Map.of("retention.ms", 7200000,
"segment.bytes", 107374182,
"min.insync.replicas", 2))
.endSpec()
.build();
User code which is not working
String encodedPassword = Base64.getEncoder().encodeToString(password.getBytes());
try (KubernetesClient client = new KubernetesClientBuilder().build()) {
Beta Was this translation helpful? Give feedback.
All reactions