Skip to content

Commit

Permalink
Added dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Viktor Farcic committed Dec 29, 2018
1 parent 4eeb808 commit 4405281
Show file tree
Hide file tree
Showing 4 changed files with 139 additions and 0 deletions.
3 changes: 3 additions & 0 deletions charts/go-demo-6/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ spec:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
- name: DB
value: {{ template "helm.fullname" . }}-db
ports:
- containerPort: {{ .Values.service.internalPort }}
livenessProbe:
Expand Down
46 changes: 46 additions & 0 deletions charts/go-demo-6/templates/rbac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{{- if .Values.rbac.enabled -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ template "helm.fullname" . }}-db
labels:
app: {{ template "helm.name" . }}-db
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}

---

kind: Role
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: {{ template "helm.fullname" . }}-db
labels:
app: {{ template "helm.name" . }}-db
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
rules:
- apiGroups: [""]
resources: ["pods"]
verbs: ["list"]

---

apiVersion: rbac.authorization.k8s.io/v1beta1
kind: RoleBinding
metadata:
name: {{ template "helm.fullname" . }}-db
labels:
app: {{ template "helm.name" . }}-db
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ template "helm.fullname" . }}-db
subjects:
- kind: ServiceAccount
name: {{ template "helm.fullname" . }}-db
{{- end -}}
19 changes: 19 additions & 0 deletions charts/go-demo-6/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,22 @@ spec:
name: http
selector:
app: {{ template "fullname" . }}

---

apiVersion: v1
kind: Service
metadata:
name: {{ template "helm.fullname" . }}-db
labels:
app: {{ template "helm.name" . }}-db
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
ports:
- port: 27017
clusterIP: None
selector:
app: {{ template "helm.name" . }}-db
release: {{ .Release.Name }}
71 changes: 71 additions & 0 deletions charts/go-demo-6/templates/sts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
apiVersion: apps/v1beta2
kind: StatefulSet
metadata:
name: {{ template "helm.fullname" . }}-db
labels:
app: {{ template "helm.name" . }}-db
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
serviceName: {{ template "helm.fullname" . }}-db
replicas: 3
selector:
matchLabels:
app: {{ template "helm.name" . }}-db
release: {{ .Release.Name }}
template:
metadata:
labels:
app: {{ template "helm.name" . }}-db
release: {{ .Release.Name }}
spec:
{{- if .Values.rbac.enabled }}
serviceAccountName: {{ template "helm.fullname" . }}-db
{{- end }}
terminationGracePeriodSeconds: 10
containers:
- name: db
image: "mongo:3.3
command:
- mongod
- "--replSet"
- rs0
- "--smallfiles"
- "--noprealloc"
ports:
- containerPort: 27017
resources:
limits:
memory: 200Mi
cpu: 100m
requests:
memory: 100Mi
cpu: 10m
volumeMounts:
- name: {{ template "helm.fullname" . }}-db
mountPath: /data/db
- name: db-sidecar
image: cvallance/mongo-k8s-sidecar
env:
- name: MONGO_SIDECAR_POD_LABELS
value: app={{ template "helm.name" . }}-db,release={{ .Release.Name }}
- name: KUBE_NAMESPACE
value: {{ .Release.Namespace }}
- name: KUBERNETES_MONGO_SERVICE_NAME
value: {{ template "helm.fullname" . }}-db
volumeClaimTemplates:
- metadata:
name: {{ template "helm.fullname" . }}-db
labels:
app: {{ template "helm.name" . }}-db
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 2Gi
storageClassName: ""

0 comments on commit 4405281

Please sign in to comment.