kolla-kubernetes/helm/microservice/test-ceph-init-osd-job/templates/test-ceph-init-osd-job.yaml

119 lines
4.5 KiB
YAML

{{- $resourceName := "test-ceph-init-mon-job" }}
{{- $searchPath := ":global.kolla.ceph.osd.init.job:global.kolla.ceph.osd.all:global.kolla.ceph.all:global.kolla.all" }}
{{- $c := dict "searchPath" $searchPath "Values" .Values }}
{{- $_ := set $c "contName" "ceph-osd" }}
{{- $_ := set $c "imageName" "image_full" }}
{{- $_ := set $c "tagName" "image_tag" }}
{{- $imageFull := include "kolla_build_image_full" $c }}
{{- $imagePullPolicy := include "kolla_val_get_str" (dict "key" "image_pull_policy" "searchPath" $searchPath "Values" .Values ) }}
{{- $storageInterface := include "kolla_val_get_str" (dict "key" "storage_interface" "searchPath" $searchPath "Values" .Values ) }}
{{- $node := include "kolla_val_get_str" (dict "key" "node" "searchPath" $searchPath "Values" .Values ) }}
{{- $containerConfigDirectory := include "kolla_val_get_str" (dict "key" "container_config_directory" "searchPath" $searchPath "Values" .Values ) }}
{{- $index := .Values.index }}
{{- $initial_mon := .Values.initial_mon }}
{{- $netHostTrue := true }}
{{- $podTypeBootstrap := false }}
{{- with $env := dict "netHostTrue" $netHostTrue "podTypeBootstrap" false "resourceName" $resourceName "Values" .Values "Release" .Release "searchPath" $searchPath }}
apiVersion: v1
kind: Pod
metadata:
name: ceph-bootstrap-osd{{ $index }}
spec:
dnsPolicy: ClusterFirstWithHostNet
hostNetwork: True
hostPID: True
nodeSelector:
kubernetes.io/hostname: {{ $initial_mon }}
restartPolicy: Never
initContainers:
- name: update-config
image: {{ include "kolla_toolbox_image_full" . | quote }}
imagePullPolicy: IfNotPresent
command:
- /bin/sh
- -c
- |
cp -a /srv/configmap/..data/* /srv/pod-main-config/;
STORAGE_INTERFACE={{ $storageInterface }};
F=/var/lib/kolla-kubernetes/ceph-osd/storage_interface;
[ -f $F ] && STORAGE_INTERFACE=$(<$F) || true;
IP=$(ip addr list {{ $storageInterface }} | grep 'inet ' |cut -d' ' -f6|cut -d/ -f1);
CONF=/srv/pod-main-config/ceph.conf;
sed -i '/^mon host.*/d;/^mon host/d;/^mon addr/d' $CONF;
sed -i '/^\[global\]/a mon host = '$IP $CONF;
sed -i '/^\[global\]/a mon addr = '$IP':6789' $CONF;
sed -i '/^\[global\]/a mon initial members = {{ $initial_mon }}' $CONF;
volumeMounts:
- name: ceph-osd-config
mountPath: /srv/configmap
- name: pod-main-config
mountPath: /srv/pod-main-config
- name: ceph-osd
mountPath: /var/lib/ceph/osd
containers:
- image: "{{ $imageFull }}"
imagePullPolicy: {{ $imagePullPolicy }}
name: main
securityContext:
privileged: true
env:
{{- include "common_bootstrap_env_vars" . | indent 8 }}
- name: KOLLA_BOOTSTRAP
value: ""
- name: KOLLA_CONFIG_STRATEGY
value: COPY_ONCE
- name: USE_EXTERNAL_JOURNAL
value: "True"
- name: JOURNAL_DEV
value: "/dev/loop{{ $index }}"
- name: JOURNAL_PARTITION_NUM
value: "1"
- name: JOURNAL_PARTITION
value: "/dev/loop{{ $index }}p1"
- name: OSD_DEV
value: "/dev/loop{{ $index }}"
- name: OSD_PARTITION_NUM
value: "2"
- name: OSD_PARTITION
value: "/dev/loop{{ $index }}p2"
- name: OSD_INITIAL_WEIGHT
value: "1"
- name: OSD_FILESYSTEM
value: "xfs"
- name: HOSTNAME
value: {{ $initial_mon }}
volumeMounts:
{{- include "common_volume_mounts" $env | indent 8 }}
- mountPath: {{ $containerConfigDirectory }}/ceph.conf
name: pod-main-config
readOnly: true
subPath: ceph.conf
- mountPath: {{ $containerConfigDirectory }}/config.json
name: pod-main-config
readOnly: true
subPath: config.json
- mountPath: /var/lib/ceph
name: ceph-osd
- mountPath: {{ $containerConfigDirectory }}/ceph.client.admin.keyring
subPath: data
name: ceph-client-admin-keyring
- mountPath: /dev
name: host-dev
volumes:
{{- include "common_volumes" $env | indent 4 }}
- name: pod-main-config
emptyDir: {}
- name: ceph-osd-config
configMap:
name: ceph-osd
- name: ceph-osd
hostPath:
path: /var/lib/kolla/volumes/ceph-osd
- name: host-dev
hostPath:
path: /dev
- name: ceph-client-admin-keyring
secret:
secretName: ceph-client-admin-keyring
{{- end }}