Skip to content

Commit

Permalink
Merge pull request #92 from robertchoi80/refactor_prepare_etcd
Browse files Browse the repository at this point in the history
Refactor prepare etcd
  • Loading branch information
Jaesang authored Feb 3, 2022
2 parents f8d31fa + a8790a9 commit c7f3700
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
2 changes: 1 addition & 1 deletion prepare-etcd-secret/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.1
version: 0.2.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
23 changes: 21 additions & 2 deletions prepare-etcd-secret/templates/job-secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,36 @@ spec:
- -c
- |
kubectl create secret generic etcd-client-cert \
--namespace {{ .Release.Namespace }} \
{{- if eq .Values.deployer "tks" }}
--from-file=etcd-ca=/ssl/{{ .Values.etcd.certfile }} \
--from-file=etcd-client=/ssl/{{ .Values.etcd.client_certfile }} \
--from-file=etcd-client-key=/ssl/{{ .Values.etcd.client_keyfile }} \
--namespace {{ .Release.Namespace }}
--from-file=etcd-client-key=/ssl/{{ .Values.etcd.client_keyfile }}
{{- else if eq .Values.deployer "tacoplay" }}
--from-file=etcd-ca=/ssl/{{ .Values.etcd.tacoplay_certfile }} \
--from-file=etcd-client=/ssl/member-${MY_NODE_NAME}.pem \
--from-file=etcd-client-key=/ssl/member-${MY_NODE_NAME}-key.pem
env:
- name: MY_NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
{{- else }}
--wrong-value-for-deployer
{{- end }}
volumeMounts:
- name: ssldir
mountPath: /ssl
volumes:
- name: ssldir
hostPath:
{{- if eq .Values.deployer "tks" }}
path: {{ .Values.etcd.certdir }}
{{- else if eq .Values.deployer "tacoplay" }}
path: {{ .Values.etcd.tacoplay_certdir }}
{{- else }}
wrong-value-for-deployer: recheck
{{- end }}
type: Directory
{{- with .Values.nodeSelector }}
nodeSelector:
Expand Down
8 changes: 8 additions & 0 deletions prepare-etcd-secret/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
etcd:
# For TKS #
certdir: /etc/kubernetes/pki/etcd
certfile: ca.crt
client_certfile: peer.crt
client_keyfile: peer.key
# For Tacoplay #
tacoplay_certdir: /etc/ssl/etcd/ssl
tacoplay_certfile: ca.pem

image:
repository: k8s.gcr.io/hyperkube
Expand All @@ -31,3 +35,7 @@ tolerations: []
#- key: "node-role.kubernetes.io/master"
# effect: "NoSchedule"
# operator: "Exists"


# Valid values: 'tks' or 'tacoplay'
deployer: "tks"

0 comments on commit c7f3700

Please sign in to comment.