Skip to content

Commit

Permalink
Change APIVersion of Kafka to v1beta2 (#1014)
Browse files Browse the repository at this point in the history
* Change APIVersion of Kafka to v1beta2

* Delete kafka CRD while unistalling kafka applications

* Remove redundant deletion of configmap from uninstall
  • Loading branch information
akankshakumari393 committed Jun 10, 2021
1 parent 9bd5c07 commit 2434637
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
9 changes: 4 additions & 5 deletions examples/kafka/adobe-s3-connector/kafka-cluster.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
apiVersion: kafka.strimzi.io/v1beta1
apiVersion: kafka.strimzi.io/v1beta2
kind: Kafka
metadata:
name: my-cluster
spec:
kafka:
version: 2.6.0
version: 2.8.0
replicas: 1
listeners:
- name: plain
Expand All @@ -17,15 +17,15 @@ spec:
tls: true
template:
pod:
restartPolicy: Always
securityContext:
runAsUser: 0
fsGroup: 0
config:
offsets.topic.replication.factor: 1
transaction.state.log.replication.factor: 1
transaction.state.log.min.isr: 1
log.message.format.version: "2.6"
log.message.format.version: "2.8"
inter.broker.protocol.version: "2.8"
storage:
type: jbod
volumes:
Expand All @@ -37,7 +37,6 @@ spec:
replicas: 1
template:
pod:
restartPolicy: Always
securityContext:
runAsUser: 0
fsGroup: 0
Expand Down
25 changes: 19 additions & 6 deletions pkg/app/kafka.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,18 +184,31 @@ func (kc *KafkaCluster) Uninstall(ctx context.Context) error {
return errors.Wrap(err, "failed to create helm client")
}

deleteConfig := []string{"delete", "-n", kc.namespace, "configmap", configMapName}
out, err := helm.RunCmdWithTimeout(ctx, "kubectl", deleteConfig)
if err != nil {
return errors.Wrapf(err, "Error deleting ConfigMap %s, %s", kc.name, out)
}

err = cli.Uninstall(ctx, kc.chart.Release, kc.namespace)
if err != nil {
log.WithError(err).Print("Failed to uninstall app, you will have to uninstall it manually.", field.M{"app": kc.name})
return err
}

deleteCRD := []string{
"delete",
"crd",
"kafkabridges.kafka.strimzi.io",
"kafkaconnectors.kafka.strimzi.io",
"kafkaconnects.kafka.strimzi.io",
"kafkaconnects2is.kafka.strimzi.io",
"kafkamirrormaker2s.kafka.strimzi.io",
"kafkamirrormakers.kafka.strimzi.io",
"kafkarebalances.kafka.strimzi.io",
"kafkas.kafka.strimzi.io",
"kafkatopics.kafka.strimzi.io",
"kafkausers.kafka.strimzi.io",
}
out, error := helm.RunCmdWithTimeout(ctx, "kubectl", deleteCRD)
if error != nil {
return errors.Wrapf(error, "Error deleting kafka CRD %s, %s", kc.name, out)
}

log.Print("Application deleted successfully.", field.M{"app": kc.name})
return nil
}
Expand Down

0 comments on commit 2434637

Please sign in to comment.