95 lines
3.0 KiB
YAML
95 lines
3.0 KiB
YAML
{{/*
|
|
#
|
|
# Copyright (c) 2020 Wind River Systems, Inc.
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
*/}}
|
|
|
|
{{- $defaults := .Values.classdefaults }}
|
|
{{- $cephfs_provisioner_storage_init := .Values.images.tags.cephfs_provisioner_storage_init }}
|
|
|
|
---
|
|
apiVersion: v1
|
|
kind: ConfigMap
|
|
metadata:
|
|
name: ceph-config-file
|
|
namespace: {{ $defaults.cephFSNamespace }}
|
|
data:
|
|
ceph.conf: |
|
|
{{ tuple "conf/_ceph-conf.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
|
|
|
|
---
|
|
apiVersion: v1
|
|
kind: ConfigMap
|
|
metadata:
|
|
name: cephfs-storage-init
|
|
namespace: {{ $defaults.cephFSNamespace }}
|
|
data:
|
|
storage-init.sh: |
|
|
{{ tuple "bin/_storage_init.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
|
|
|
|
---
|
|
apiVersion: batch/v1
|
|
kind: Job
|
|
metadata:
|
|
name: cephfs-storage-init
|
|
namespace: {{ $defaults.cephFSNamespace }}
|
|
annotations:
|
|
"helm.sh/hook": "post-install, pre-upgrade, pre-rollback"
|
|
"helm.sh/hook-delete-policy": "before-hook-creation"
|
|
spec:
|
|
backoffLimit: 5
|
|
template:
|
|
spec:
|
|
serviceAccountName: {{ $defaults.provisionerConfigName }}
|
|
volumes:
|
|
- name: cephfs-storage-init
|
|
configMap:
|
|
name: cephfs-storage-init
|
|
defaultMode: 0555
|
|
- name: ceph-config
|
|
configMap:
|
|
name: ceph-config-file
|
|
defaultMode: 0555
|
|
containers:
|
|
{{- range $classConfig := .Values.classes }}
|
|
- name: storage-init-{{- $classConfig.name }}
|
|
image: {{ $cephfs_provisioner_storage_init | quote }}
|
|
command: ["/bin/bash", "/tmp/storage-init.sh"]
|
|
env:
|
|
- name: NAMESPACE
|
|
value: {{ $defaults.cephFSNamespace }}
|
|
- name: ADDITIONAL_NAMESPACES
|
|
value: {{ include "helm-toolkit.utils.joinListWithComma" $classConfig.additionalNamespaces | quote }}
|
|
- name: CEPH_USER_SECRET
|
|
value: {{ $defaults.adminSecretName }}
|
|
- name: USER_ID
|
|
value: {{ $classConfig.userId }}
|
|
- name: DATA_POOL_NAME
|
|
value: {{ $classConfig.data_pool_name }}
|
|
- name: METADATA_POOL_NAME
|
|
value: {{ $classConfig.metadata_pool_name }}
|
|
- name: FS_NAME
|
|
value: {{ $classConfig.fs_name }}
|
|
- name: CHUNK_SIZE
|
|
value: {{ $classConfig.chunk_size | quote }}
|
|
- name: POOL_REPLICATION
|
|
value: {{ $classConfig.replication | quote }}
|
|
- name: POOL_CRUSH_RULE_NAME
|
|
value: {{ $classConfig.crush_rule_name | quote }}
|
|
volumeMounts:
|
|
- name: cephfs-storage-init
|
|
mountPath: /tmp/storage-init.sh
|
|
subPath: storage-init.sh
|
|
readOnly: true
|
|
- name: ceph-config
|
|
mountPath: /etc/ceph/ceph.conf
|
|
subPath: ceph.conf
|
|
readOnly: true
|
|
{{- end }}
|
|
restartPolicy: OnFailure
|
|
{{- if .Values.global.nodeSelector }}
|
|
nodeSelector:
|
|
{{ .Values.global.nodeSelector | toYaml | trim | indent 8 }}
|
|
{{- end }} |