diff --git a/variants/docker-desktop/Readme.md b/variants/docker-desktop/Readme.md new file mode 100644 index 00000000..1f77f21f --- /dev/null +++ b/variants/docker-desktop/Readme.md @@ -0,0 +1,26 @@ +docker-desktop variant enables quick development on docker-desktop += + +Used simple bash scripts to deploy in order to simplify debugging +first time the deployment is slow due to fetching images +Tested on mac + +To init: apply.sh +To delete: delete.sh + + +To purge pvc after delete.sh +- +``` +kubectl get all,pv,pvc -n kafka + + +kubectl patch persistentvolume/pvc-a1c7bd1e-11f9-11ea-9768-025000000001 -p '{"metadata":{"finalizers": []}}' --type=merge +kubectl patch persistentvolume/pvc-a1c92058-11f9-11ea-9768-025000000001 -p '{"metadata":{"finalizers": []}}' --type=merge +kubectl patch persistentvolume/pvc-a2200b1f-11f9-11ea-9768-025000000001 -p '{"metadata":{"finalizers": []}}' --type=merge +kubectl patch persistentvolume/pvc-a221cf45-11f9-11ea-9768-025000000001 -p '{"metadata":{"finalizers": []}}' --type=merge +kubectl patch persistentvolume/pvc-a223ceca-11f9-11ea-9768-025000000001 -p '{"metadata":{"finalizers": []}}' --type=merge +kubectl patch -p '{"metadata":{"finalizers": []}}' --type=merge +kubectl patch -p '{"metadata":{"finalizers": []}}' --type=merge +kubectl patch -p '{"metadata":{"finalizers": []}}' --type=merge +``` \ No newline at end of file diff --git a/variants/docker-desktop/apply.sh b/variants/docker-desktop/apply.sh new file mode 100755 index 00000000..556ef636 --- /dev/null +++ b/variants/docker-desktop/apply.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash + +# Abasic bash script (I know it repeats itself) for simplicity + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +echo "$0 is located at: $DIR" + +# make this file's location parents parent the working dir +cd $DIR/../../ + +base=$(pwd) +echo "working directory is base:\n$base" + + +kubectl apply -f 00-namespace.yml + + +kubectl apply -f variants/docker-desktop/docker-storage.yaml + + +kubectl apply -f rbac-namespace-default/node-reader.yml + +kubectl apply -f rbac-namespace-default/pod-labler.yml + + +kubectl apply -f variants/docker-desktop/default-privilege-add.yaml + + +kubectl apply -f zookeeper/10zookeeper-config.yml + +kubectl apply -f zookeeper/20pzoo-service.yml + +kubectl apply -f zookeeper/21zoo-service.yml + +kubectl apply -f zookeeper/30service.yml + +kubectl apply -f zookeeper/50pzoo.yml + +kubectl apply -f zookeeper/51zoo.yml + + +kubectl apply -f kafka/10broker-config.yml + +kubectl apply -f kafka/20dns.yml + +kubectl apply -f kafka/30bootstrap-service.yml + +kubectl apply -f kafka/50kafka.yml \ No newline at end of file diff --git a/variants/docker-desktop/default-privilege-add.yaml b/variants/docker-desktop/default-privilege-add.yaml new file mode 100644 index 00000000..1eb39a1d --- /dev/null +++ b/variants/docker-desktop/default-privilege-add.yaml @@ -0,0 +1,35 @@ +--- +apiVersion: v1 +kind: Namespace +metadata: + name: my-namespace + +--- +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRole +metadata: + name: default-privilege-add +rules: +- apiGroups: [""] + resources: + - endpoints + - services + - pods + verbs: ["get", "list", "watch"] + +--- +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRoleBinding +metadata: + name: default-privilege-add +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: default-privilege-add +subjects: +- kind: ServiceAccount + name: default + namespace: default +- kind: ServiceAccount + name: my-namespace + namespace: my-namespace \ No newline at end of file diff --git a/variants/docker-desktop/delete.sh b/variants/docker-desktop/delete.sh new file mode 100755 index 00000000..5aea7001 --- /dev/null +++ b/variants/docker-desktop/delete.sh @@ -0,0 +1,66 @@ +#!/usr/bin/env bash + +# Abasic bash script (I know it repeats itself) for simplicity + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +echo "$0 is located at: $DIR" + +# make this file's location parents parent the working dir +cd $DIR/../../ + +base=$(pwd) +echo "working directory is base:\n$base" + + +kubectl delete -f kafka/50kafka.yml + +kubectl delete -f kafka/30bootstrap-service.yml + +kubectl delete -f kafka/20dns.yml + +kubectl delete -f kafka/10broker-config.yml + + + +kubectl delete -f zookeeper/51zoo.yml + +kubectl delete -f zookeeper/50pzoo.yml + + +#kubectl delete pv,pvc -n kafka --all + +kubectl delete -f variants/docker-desktop/docker-storage.yaml + + +kubectl delete -f zookeeper/30service.yml + +kubectl delete -f zookeeper/21zoo-service.yml + +kubectl delete -f zookeeper/20pzoo-service.yml + +kubectl delete -f zookeeper/10zookeeper-config.yml + + +kubectl delete -f variants/docker-desktop/default-privilege-add.yaml + + +kubectl delete -f rbac-namespace-default/pod-labler.yml + +kubectl delete -f rbac-namespace-default/node-reader.yml + + +#kubectl delete -f 00-namespace.yml + + + + + + + + + + + + + + diff --git a/variants/docker-desktop/docker-storage.yaml b/variants/docker-desktop/docker-storage.yaml new file mode 100644 index 00000000..2df99561 --- /dev/null +++ b/variants/docker-desktop/docker-storage.yaml @@ -0,0 +1,9 @@ +kind: StorageClass +apiVersion: storage.k8s.io/v1 +metadata: + name: standard + namespace: kafka +provisioner: docker.io/hostpath +reclaimPolicy: Retain +allowVolumeExpansion: true +volumeBindingMode: Immediate \ No newline at end of file