Kubernetes-related file

Create a Kubernetes file in the templates directory. Use the variables defined in values.yaml and _helpers.tpl. In this example, rc is replaced with deployment, and the shared storage mounted with ISCSI is replaced with pvc.

If the Helm package contains the NodePort service, you must specify a NodePort number and make sure it does not conflict with the existing port numbers. As a best practice, specify a NodePort number from 30000 to 32767.

 

xwiki-deployment.yaml

apiVersion:apps/v1beta2

kind:Deployment

metadata:

  name:{{ .Values.name }}

  labels:

    app:{{ .Values.appName }}

    chart:{{ template "chartName" . }}

    release:{{ .Release.Name }}

    heritage:{{ .Release.Service }}

spec:

  replicas:{{ .Values.replicasCount }}

  selector:

    matchLabels:

      app:{{ .Values.appName }}

      release:{{ .Release.Name }}

  template:

    metadata:

      labels:

        app:{{ .Values.appName }}

        release:{{ .Release.Name }}

    spec:

      containers:

      - name:{{ .Values.containerName }}

        image:"{{ .Values.image.repository }}:{{ .Values.image.tag }}"

        imagePullPolicy:{{ .Values.image.pullPolicy }}

        env:

{{toYaml .Values.env | indent 12}}

        ports:

        - containerPort:21260

        resources:

{{toYaml .Values.resources | indent 12}}

        volumeMounts:

        - mountPath:/etc/localtime

          name:time

        - mountPath:/usr/local/xwiki

          name:devopscloud-xwiki-data

        securityContext:

          privileged:true

      nodeSelector:

{{toYaml .Values.nodeSelector | indent 8}}

      volumes:

      - name:time

        hostPath:

          path:/etc/localtime

      - name:devopscloud-xwiki-data

        persistentVolumeClaim:

          claimName:{{ .Values.pvc.data.name }}

      terminationGracePeriodSeconds:5

xwiki-service.yaml

apiVersion:v1

kind:Service

metadata:

  name:{{ .Values.serviceName }}

  labels:

    app:{{ .Values.appName }}

    chart:{{ template "chartName" . }}

    release:{{ .Release.Name }}

    heritage:{{ .Release.Service }}

spec:

  type:{{ .Values.service.type }}

  ports:           # The name key value of the ports cannot exceed 15 characters.

{{toYaml .Values.ports | indent 2}}

  selector:

    app:{{ .Values.appName }}

    release:{{ .Release.Name }}

xwiki-data-pvc.yaml

apiVersion:v1

kind:PersistentVolumeClaim

metadata:

  name:{{ .Values.pvc.data.name }}

  labels:

    app:{{ .Values.appName }}

    chart:{{ template "chartName" . }}

    release:{{ .Release.Name }}

    heritage:{{ .Release.Service }}

spec:

  accessModes:

  - ReadWriteOnce

  resources:

    requests:

      storage:{{ .Values.pvc.data.size | quote}}

xwiki-configmap.yaml

apiVersion: v1

kind: ConfigMap

metadata:

  name: {{.Values.name}}-version-{{.Values.version}}  # To display this setting in configuration management, place "-version-" between the name and version.

  namespace: {{ .Release.Namespace }}

  annotations:

    cm-name: {{.Values.name}}    # To display this setting in configuration management, specify this parameter.

  labels:

    app: {{.Values.appName}}

    chart: {{template"chartName".}}

    heritage: {{ .Release.Service }}

    release: {{ .Release.Name }}

data:

  demo: demo

 

The following Kubernetes resource objects are supported in the current version: Deployment, StatefulSet, Service, Secret, and ConfigMap.