---
# Source: limesurvey-martial/charts/mariadb/templates/serviceaccount.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
  name: kk-mariadb
  namespace: "default"
  labels:
    app.kubernetes.io/name: mariadb
    helm.sh/chart: mariadb-11.4.2
    app.kubernetes.io/instance: kk
    app.kubernetes.io/managed-by: Helm
  annotations:
automountServiceAccountToken: false
---
# Source: limesurvey-martial/templates/serviceaccount.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
  name: kk-limesurvey-martial
  labels:
    helm.sh/chart: limesurvey-martial-0.8.2
    app.kubernetes.io/name: limesurvey-martial
    app.kubernetes.io/instance: kk
    app.kubernetes.io/version: "5-apache"
    app.kubernetes.io/managed-by: Helm
---
# Source: limesurvey-martial/charts/mariadb/templates/secrets.yaml
apiVersion: v1
kind: Secret
metadata:
  name: kk-mariadb
  namespace: "default"
  labels:
    app.kubernetes.io/name: mariadb
    helm.sh/chart: mariadb-11.4.2
    app.kubernetes.io/instance: kk
    app.kubernetes.io/managed-by: Helm
type: Opaque
data:
  mariadb-root-password: "bGltZXN1cnZleQ=="
  mariadb-password: "bGltZXN1cnZleQ=="
---
# Source: limesurvey-martial/templates/secrets.yaml
apiVersion: v1
kind: Secret
metadata:
  name: kk-limesurvey-martial-app-secrets
  namespace: "default"
  labels:
    helm.sh/chart: limesurvey-martial-0.8.2
    app.kubernetes.io/name: limesurvey-martial
    app.kubernetes.io/instance: kk
    app.kubernetes.io/version: "5-apache"
    app.kubernetes.io/managed-by: Helm
type: Opaque
data:
  limesurvey-admin-password: "cDlVak84cEswN0FsT2hP"
---
# Source: limesurvey-martial/charts/mariadb/templates/primary/configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: kk-mariadb
  namespace: "default"
  labels:
    app.kubernetes.io/name: mariadb
    helm.sh/chart: mariadb-11.4.2
    app.kubernetes.io/instance: kk
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/component: primary
data:
  my.cnf: |-
    [mysqld]
    skip-name-resolve
    explicit_defaults_for_timestamp
    basedir=/opt/bitnami/mariadb
    plugin_dir=/opt/bitnami/mariadb/plugin
    port=3306
    socket=/opt/bitnami/mariadb/tmp/mysql.sock
    tmpdir=/opt/bitnami/mariadb/tmp
    max_allowed_packet=16M
    bind-address=*
    pid-file=/opt/bitnami/mariadb/tmp/mysqld.pid
    log-error=/opt/bitnami/mariadb/logs/mysqld.log
    character-set-server=UTF8
    collation-server=utf8_general_ci
    slow_query_log=0
    slow_query_log_file=/opt/bitnami/mariadb/logs/mysqld.log
    long_query_time=10.0
    
    [client]
    port=3306
    socket=/opt/bitnami/mariadb/tmp/mysql.sock
    default-character-set=UTF8
    plugin_dir=/opt/bitnami/mariadb/plugin
    
    [manager]
    port=3306
    socket=/opt/bitnami/mariadb/tmp/mysql.sock
    pid-file=/opt/bitnami/mariadb/tmp/mysqld.pid
---
# Source: limesurvey-martial/templates/pvc.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: kk-limesurvey-martial
  labels:
    helm.sh/chart: limesurvey-martial-0.8.2
    app.kubernetes.io/name: limesurvey-martial
    app.kubernetes.io/instance: kk
    app.kubernetes.io/version: "5-apache"
    app.kubernetes.io/managed-by: Helm
  finalizers:
    - kubernetes.io/pvc-protection
spec:
  accessModes:
    - "ReadWriteOnce"
  resources:
    requests:
      storage: "5Gi"
---
# Source: limesurvey-martial/charts/mariadb/templates/primary/svc.yaml
apiVersion: v1
kind: Service
metadata:
  name: kk-mariadb
  namespace: "default"
  labels:
    app.kubernetes.io/name: mariadb
    helm.sh/chart: mariadb-11.4.2
    app.kubernetes.io/instance: kk
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/component: primary
  annotations:
spec:
  type: ClusterIP
  sessionAffinity: None
  ports:
    - name: mysql
      port: 3306
      protocol: TCP
      targetPort: mysql
      nodePort: null
  selector: 
    app.kubernetes.io/name: mariadb
    app.kubernetes.io/instance: kk
    app.kubernetes.io/component: primary
---
# Source: limesurvey-martial/templates/service.yaml
apiVersion: v1
kind: Service
metadata:
  name: kk-limesurvey-martial
  labels:
    helm.sh/chart: limesurvey-martial-0.8.2
    app.kubernetes.io/name: limesurvey-martial
    app.kubernetes.io/instance: kk
    app.kubernetes.io/version: "5-apache"
    app.kubernetes.io/managed-by: Helm
spec:
  type: ClusterIP
  ports:
    - port: 80
      targetPort: http
      protocol: TCP
      name: http
  selector:
    app.kubernetes.io/name: limesurvey-martial
    app.kubernetes.io/instance: kk
---
# Source: limesurvey-martial/templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: kk-limesurvey-martial
  labels:
    helm.sh/chart: limesurvey-martial-0.8.2
    app.kubernetes.io/name: limesurvey-martial
    app.kubernetes.io/instance: kk
    app.kubernetes.io/version: "5-apache"
    app.kubernetes.io/managed-by: Helm
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: limesurvey-martial
      app.kubernetes.io/instance: kk
  strategy:
    type: RollingUpdate
  template:
    metadata:
      labels:
        app.kubernetes.io/name: limesurvey-martial
        app.kubernetes.io/instance: kk
    spec:
      serviceAccountName: kk-limesurvey-martial
      securityContext:
        fsGroup: 33
        runAsGroup: 33
        runAsUser: 33
      initContainers:
        - name: wait-for-db
          image: docker.io/martialblog/limesurvey:5-apache
          securityContext:
            allowPrivilegeEscalation: false
          imagePullPolicy: IfNotPresent
          command: ['/bin/sh', '-c',
          'until nc -z -v -w30 "$DB_HOST" "$DB_PORT"; do
          echo "Info: Waiting for database connection...";
          sleep 5;
          done']
          resources:
            limits: {}
            requests:
              cpu: 300m
              memory: 512Mi
          env:
            - name: DB_HOST
              value: kk-mariadb
            - name: DB_PORT
              value: "3306"
      containers:
        - name: limesurvey-apache
          image: docker.io/martialblog/limesurvey:5-apache
          imagePullPolicy: IfNotPresent
          securityContext:
            allowPrivilegeEscalation: false
          ports:
            - name: http
              containerPort: 8080
              protocol: TCP
          livenessProbe:
            httpGet:
              path: /
              port: http
          readinessProbe:
            httpGet:
              path: /
              port: http
          resources:
            limits: {}
            requests:
              cpu: 300m
              memory: 512Mi
          volumeMounts:
            - name: storage
              mountPath: "/var/www/html/upload/"
          env:
            - name: DB_TYPE
              value: "mysql"
            - name: DB_HOST
              value: kk-mariadb
            - name: DB_PORT
              value: "3306"
            - name: DB_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: kk-mariadb
                  key: mariadb-password
            - name: DB_USERNAME
              value: limesurvey
            - name: DB_NAME
              value: limesurvey
            - name: DB_TABLE_PREFIX
              value: "lime_"
            - name: DB_MYSQL_ENGINE
              value: MyISAM
            - name: ADMIN_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: kk-limesurvey-martial-app-secrets
                  key: limesurvey-admin-password
            - name: ADMIN_USER
              value: admin
            - name: ADMIN_NAME
              value: Administrator
            - name: ADMIN_EMAIL
              value: admin@example.com
            - name: LISTEN_PORT
              value: "8080"
            - name: URL_FORMAT
              value: path
            - name: DEBUG
              value: "0"
            - name: DEBUG_SQL
              value: "0"
      volumes:
        - name: storage
          persistentVolumeClaim:
            claimName: kk-limesurvey-martial
---
# Source: limesurvey-martial/charts/mariadb/templates/primary/statefulset.yaml
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: kk-mariadb
  namespace: "default"
  labels:
    app.kubernetes.io/name: mariadb
    helm.sh/chart: mariadb-11.4.2
    app.kubernetes.io/instance: kk
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/component: primary
spec:
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels: 
      app.kubernetes.io/name: mariadb
      app.kubernetes.io/instance: kk
      app.kubernetes.io/component: primary
  serviceName: kk-mariadb
  updateStrategy:
    type: RollingUpdate
  template:
    metadata:
      annotations:
        checksum/configuration: b3411557986920434145fefbbb8e1a0360e22dcecd5084ab5a4ecab3e2b6d6a4
      labels:
        app.kubernetes.io/name: mariadb
        helm.sh/chart: mariadb-11.4.2
        app.kubernetes.io/instance: kk
        app.kubernetes.io/managed-by: Helm
        app.kubernetes.io/component: primary
    spec:
      
      serviceAccountName: kk-mariadb
      affinity:
        podAffinity:
          
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
            - podAffinityTerm:
                labelSelector:
                  matchLabels:
                    app.kubernetes.io/name: mariadb
                    app.kubernetes.io/instance: kk
                    app.kubernetes.io/component: primary
                topologyKey: kubernetes.io/hostname
              weight: 1
        nodeAffinity:
          
      securityContext:
        fsGroup: 1001
      containers:
        - name: mariadb
          image: docker.io/bitnami/mariadb:10.6.11-debian-11-r12
          imagePullPolicy: "IfNotPresent"
          securityContext:
            runAsNonRoot: true
            runAsUser: 1001
          env:
            - name: BITNAMI_DEBUG
              value: "false"
            - name: MARIADB_ROOT_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: kk-mariadb
                  key: mariadb-root-password
            - name: MARIADB_USER
              value: "limesurvey"
            - name: MARIADB_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: kk-mariadb
                  key: mariadb-password
            - name: MARIADB_DATABASE
              value: "limesurvey"
          ports:
            - name: mysql
              containerPort: 3306
          livenessProbe:
            failureThreshold: 3
            initialDelaySeconds: 120
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 1
            exec:
              command:
                - /bin/bash
                - -ec
                - |
                  password_aux="${MARIADB_ROOT_PASSWORD:-}"
                  if [[ -f "${MARIADB_ROOT_PASSWORD_FILE:-}" ]]; then
                      password_aux=$(cat "$MARIADB_ROOT_PASSWORD_FILE")
                  fi
                  mysqladmin status -uroot -p"${password_aux}"
          readinessProbe:
            failureThreshold: 3
            initialDelaySeconds: 30
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 1
            exec:
              command:
                - /bin/bash
                - -ec
                - |
                  password_aux="${MARIADB_ROOT_PASSWORD:-}"
                  if [[ -f "${MARIADB_ROOT_PASSWORD_FILE:-}" ]]; then
                      password_aux=$(cat "$MARIADB_ROOT_PASSWORD_FILE")
                  fi
                  mysqladmin status -uroot -p"${password_aux}"
          resources: 
            limits: {}
            requests: {}
          volumeMounts:
            - name: data
              mountPath: /bitnami/mariadb
            - name: config
              mountPath: /opt/bitnami/mariadb/conf/my.cnf
              subPath: my.cnf
      volumes:
        - name: config
          configMap:
            name: kk-mariadb
  volumeClaimTemplates:
    - metadata:
        name: data
        labels: 
          app.kubernetes.io/name: mariadb
          app.kubernetes.io/instance: kk
          app.kubernetes.io/component: primary
      spec:
        accessModes:
          - "ReadWriteOnce"
        resources:
          requests:
            storage: "8Gi"
---
# Source: limesurvey-martial/templates/ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: kk-limesurvey-martial
  labels:
    helm.sh/chart: limesurvey-martial-0.8.2
    app.kubernetes.io/name: limesurvey-martial
    app.kubernetes.io/instance: kk
    app.kubernetes.io/version: "5-apache"
    app.kubernetes.io/managed-by: Helm
spec:
  rules:
