github.com/1aal/kubeblocks@v0.0.0-20231107070852-e1c03e598921/deploy/bytebase/templates/statefulset.yaml (about)

     1  {{- $external_url := index .Values.bytebase.option "external-url" -}}
     2  {{- $existingPgURLSecret := .Values.bytebase.option.existingPgURLSecret -}}
     3  {{- $existingPgURLSecretKey := .Values.bytebase.option.existingPgURLSecretKey -}}
     4  {{- $port := .Values.bytebase.option.port -}}
     5  {{- $pg := .Values.bytebase.option.pg -}}
     6  {{- $data := .Values.bytebase.option.data -}}
     7  {{- $version := .Values.bytebase.version -}}
     8  {{- $registryMirrorHost := .Values.bytebase.registryMirrorHost -}}
     9  {{- $disable_sample := index .Values.bytebase.option "disable-sample" -}}
    10  apiVersion: apps/v1
    11  kind: StatefulSet
    12  metadata:
    13    name: bytebase
    14    namespace: {{ template "bytebase.namespace" . }}
    15    labels:
    16      {{- include "bytebase.labels" . | nindent 4}}
    17  spec:
    18    selector:
    19      matchLabels:
    20        app: bytebase
    21    serviceName: "bytebase"
    22    replicas: 1
    23    template:
    24      metadata:
    25        labels:
    26          app: bytebase
    27      spec:
    28        containers:
    29          - name: bytebase
    30            image: {{ .Values.images.bytebase.registry  }}/{{ .Values.images.bytebase.repository }}:{{ .Values.images.bytebase.tag }}
    31            imagePullPolicy: {{.Values.images.bytebase.pullPolicy}}
    32            env:
    33              - name: PG_URL
    34              {{ if $existingPgURLSecret }}
    35                # If user specifies an existing secret, we should read the external pg connection string in that secret.
    36                valueFrom:
    37                  secretKeyRef:
    38                    name: {{ $existingPgURLSecret }}
    39                    key: {{ $existingPgURLSecretKey }}
    40              {{ else }}
    41                value: {{ $pg }}
    42              {{ end }}
    43            args:
    44              [
    45                "--data",
    46                {{ $data | quote }},
    47                "--port",
    48                {{ $port | quote }},
    49                "--external-url",
    50                # helm parser cannot handle the dash in the value, so we need to quote it, so we use $external_url instead of $external-url.
    51                {{ $external_url | quote }},
    52                {{ if $disable_sample }}
    53                "--disable-sample",
    54                {{ end }}
    55            ]
    56            ports:
    57              - containerPort: {{ $port }}
    58                name: web
    59            livenessProbe:
    60              httpGet:
    61                path: /healthz
    62                port: {{ $port }}
    63              initialDelaySeconds: 300
    64              periodSeconds: 300
    65              timeoutSeconds: 60
    66            volumeMounts:
    67              - mountPath: {{ $data }}
    68                {{ if .Values.bytebase.persistence.existingClaim }}
    69                # If user specifies an existing PVC, use that instead of "bytebase-volume".
    70                name: {{ .Values.bytebase.persistence.existingClaim | quote }}
    71                {{ else }}
    72                # Either user disable persistence or enable persistence but not specify an existing PVC, use "bytebase-volume" as the volume name. It means
    73                # that we will request to create a PVC with the specified storage class with name "bytebase-volume".
    74                name: bytebase-volume
    75                {{ end }}
    76        volumes:
    77          {{ if .Values.bytebase.persistence.enabled }}
    78          {{ if .Values.bytebase.persistence.existingClaim }}
    79          # If user specifies an existing PVC, use that instead of "bytebase-volume".
    80          - name: {{ .Values.bytebase.persistence.existingClaim | quote }}
    81            persistentVolumeClaim:
    82              claimName: {{ .Values.bytebase.persistence.existingClaim | quote }}
    83          {{ else }}
    84          # If user enable persistence, but not specify an existing PVC, create a PVC with the specified storage class with name "bytebase-volume".
    85          - name: bytebase-volume
    86            persistentVolumeClaim:
    87              claimName: bytebase-volume
    88          {{ end }}
    89          {{ else }}
    90          # If user disable persistence, use an emptyDir volume.
    91          - name: bytebase-volume
    92            emptyDir: {}
    93          {{ end }}
    94  
    95  ---
    96  {{ if .Values.bytebase.persistence.enabled }}
    97  {{ if not .Values.bytebase.persistence.existingClaim }}
    98  apiVersion: v1
    99  kind: PersistentVolumeClaim
   100  metadata:
   101    name: bytebase-volume
   102    namespace: {{ template "bytebase.namespace" . }}
   103    labels:
   104      {{- include "bytebase.labels" . | nindent 4}}
   105  spec:
   106    storageClassName: {{ .Values.bytebase.persistence.storageClass | quote }}
   107    accessModes:
   108      - ReadWriteOnce
   109    resources:
   110      requests:
   111        storage: {{ .Values.bytebase.persistence.storage }}
   112  {{ end }}
   113  {{ end }}
   114