Skip to content

Instantly share code, notes, and snippets.

@ant31
Created December 13, 2016 16:30
Show Gist options
  • Save ant31/b47ab34e4b0b51e3a0a2e1620f61ef1c to your computer and use it in GitHub Desktop.
Save ant31/b47ab34e4b0b51e3a0a2e1620f61ef1c to your computer and use it in GitHub Desktop.
apiVersion: batch/v1
kind: Job
metadata:
name: heketi-init
labels:
glusterfs: heketi-init
annotations:
description: Defines how to deploy Heketi
spec:
template:
metadata:
name: heketi-init
labels:
name: heketi
glusterfs: heketi-pod
spec:
restartPolicy: Never
serviceAccountName: heketi-service-account
containers:
- image: quay.io/ant31/heketi:latest
imagePullPolicy: Always
name: heketi-init
command:
- "bash"
- "-c"
- |
1. /usr/bin/heketi-cli topology load --json=/var/lib/heketi/topology/topology.json && \
2. kubectl get secret heketi-init-db --from-file /var/lib/heketi/heketi.db; \
if [ $? != 0 ] ; then
--from-file /var/lib/heketi/heketi.db && \
heketi-cli create-endpoints-service | kubectl create -f
heketi-cli volume create --size=4 \
--persistent-volume
--persistent-volume-endpoint=heketi-storage-endpoints \
--persistent-volume-file=heketi-pv.json \
--name heketidbstorage && \
kubectl create -f heketi-pv.json;
kubectl create secret generic heketi-init-db --namespace $HEKETI_NAMESPACE
fi"
volumeMounts:
- name: db
mountPath: "/var/lib/heketi"
- name: topology
mountPath: "/var/lib/heketi/topology"
env:
- name: HEKETI_CLI_SERVER
value: http://localhost:8080
- name: HEKETI_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- image: heketi/heketi:dev
imagePullPolicy: IfNotPresent
name: heketi
command:
- "bin/bash"
- "-c"
- "ln -s /var/run/secrets/kubernetes.io/serviceaccount /var/lib/heketi/secret && /usr/bin/heketi -config=/etc/heketi/heketi.json"
env:
- name: HEKETI_EXECUTOR
value: kubernetes
- name: HEKETI_KUBE_USE_SECRET
value: "y"
- name: HEKETI_KUBE_TOKENFILE
value: "/var/lib/heketi/secret/token"
- name: HEKETI_KUBE_NAMESPACEFILE
value: "/var/lib/heketi/secret/namespace"
- name: HEKETI_FSTAB
value: "/var/lib/heketi/fstab"
- name: HEKETI_SNAPSHOT_LIMIT
value: '14'
- name: HEKETI_KUBE_INSECURE
value: "y"
- name: HEKETI_KUBE_APIHOST
value: "https://$(KUBERNETES_SERVICE_HOST):$(KUBERNETES_PORT_443_TCP_PORT)"
- name: HEKETI_KUBE_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: HEKETI_KUBE_GLUSTER_DAEMONSET
value: "y"
ports:
- containerPort: 8080
volumeMounts:
- name: db
mountPath: "/var/lib/heketi"
readinessProbe:
timeoutSeconds: 3
initialDelaySeconds: 3
httpGet:
path: "/hello"
port: 8080
livenessProbe:
timeoutSeconds: 3
initialDelaySeconds: 30
httpGet:
path: "/hello"
port: 8080
volumes:
- name: db
emptyDir: {}
- name: topology
configMap:
name: "heketi-topology"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment