---
# Source: apache/templates/networkpolicy.yaml
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
metadata:
  name: apache
  namespace: "default"
  labels:
    app.kubernetes.io/instance: apache
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: apache
    app.kubernetes.io/version: 2.4.65
    helm.sh/chart: apache-11.4.29
spec:
  podSelector:
    matchLabels:
      app.kubernetes.io/instance: apache
      app.kubernetes.io/name: apache
  policyTypes:
    - Ingress
    - Egress
  egress:
    - {}
  ingress:
    - ports:
        - port: 8080
        - port: 8443
---
# Source: apache/templates/pdb.yaml
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
  name: apache
  namespace: "default"
  labels:
    app.kubernetes.io/instance: apache
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: apache
    app.kubernetes.io/version: 2.4.65
    helm.sh/chart: apache-11.4.29
spec:
  maxUnavailable: 1
  selector:
    matchLabels:
      app.kubernetes.io/instance: apache
      app.kubernetes.io/name: apache
---
# Source: apache/templates/serviceaccount.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
  name: apache
  namespace: "default"
  labels:
    app.kubernetes.io/instance: apache
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: apache
    app.kubernetes.io/version: 2.4.65
    helm.sh/chart: apache-11.4.29
automountServiceAccountToken: false
---
# Source: apache/templates/svc.yaml
apiVersion: v1
kind: Service
metadata:
  name: apache
  namespace: "default"
  labels:
    app.kubernetes.io/instance: apache
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: apache
    app.kubernetes.io/version: 2.4.65
    helm.sh/chart: apache-11.4.29
spec:
  type: LoadBalancer
  externalTrafficPolicy: "Cluster"

  loadBalancerSourceRanges: []

  sessionAffinity: None
  ports:
    - name: http
      port: 80
      targetPort: http
    - name: https
      port: 443
      targetPort: https
  selector:
    app.kubernetes.io/instance: apache
    app.kubernetes.io/name: apache
---
# Source: apache/templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: apache
  namespace: "default"
  labels:
    app.kubernetes.io/instance: apache
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: apache
    app.kubernetes.io/version: 2.4.65
    helm.sh/chart: apache-11.4.29
spec:
  selector:
    matchLabels:
      app.kubernetes.io/instance: apache
      app.kubernetes.io/name: apache
  # Have replicas Only if autoscaling is disabled
  replicas: 1
  revisionHistoryLimit: 10
  strategy:
    type: RollingUpdate
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: apache
        app.kubernetes.io/managed-by: Helm
        app.kubernetes.io/name: apache
        app.kubernetes.io/version: 2.4.65
        helm.sh/chart: apache-11.4.29
    spec:

      automountServiceAccountToken: false
      # yamllint disable rule:indentation
      hostAliases:
        - hostnames:
          - status.localhost
          ip: 127.0.0.1
      # yamllint enable rule:indentation
      priorityClassName: ""
      serviceAccountName: apache
      affinity:
        podAffinity:

        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
            - podAffinityTerm:
                labelSelector:
                  matchLabels:
                    app.kubernetes.io/instance: apache
                    app.kubernetes.io/name: apache
                topologyKey: kubernetes.io/hostname
              weight: 1
        nodeAffinity:

      securityContext:
        fsGroup: 1001
        fsGroupChangePolicy: Always
        supplementalGroups: []
        sysctls: []
      initContainers:
        - name: preserve-logs-symlinks
          image: docker.io/bitnamilegacy/apache:2.4.65-debian-12-r2
          imagePullPolicy: "IfNotPresent"
          securityContext:
            allowPrivilegeEscalation: false
            capabilities:
              drop:
              - ALL
            privileged: false
            readOnlyRootFilesystem: true
            runAsGroup: 1001
            runAsNonRoot: true
            runAsUser: 1001
            seLinuxOptions: {}
            seccompProfile:
              type: RuntimeDefault
          resources:
            limits:
              cpu: 150m
              ephemeral-storage: 2Gi
              memory: 192Mi
            requests:
              cpu: 100m
              ephemeral-storage: 50Mi
              memory: 128Mi
          command:
            - /bin/bash
          args:
            - -ec
            - |
              #!/bin/bash

              . /opt/bitnami/scripts/libfs.sh
              # We copy the logs folder because it has symlinks to stdout and stderr
              if ! is_dir_empty /opt/bitnami/apache/logs; then
                cp -r /opt/bitnami/apache/logs /emptydir/app-logs-dir
              fi
          volumeMounts:
            - name: empty-dir
              mountPath: /emptydir
      containers:
        - name: apache
          image: docker.io/bitnamilegacy/apache:2.4.65-debian-12-r2
          imagePullPolicy: "IfNotPresent"
          securityContext:
            allowPrivilegeEscalation: false
            capabilities:
              drop:
              - ALL
            privileged: false
            readOnlyRootFilesystem: true
            runAsGroup: 1001
            runAsNonRoot: true
            runAsUser: 1001
            seLinuxOptions: {}
            seccompProfile:
              type: RuntimeDefault
          env:
            - name: BITNAMI_DEBUG
              value: "false"
            - name: APACHE_HTTP_PORT_NUMBER
              value: "8080"
            - name: APACHE_HTTPS_PORT_NUMBER
              value: "8443"
          envFrom:
          ports:
            - name: http
              containerPort: 8080
            - name: https
              containerPort: 8443
          livenessProbe:
            tcpSocket:
              port: http
            initialDelaySeconds: 180
            periodSeconds: 20
            timeoutSeconds: 5
            successThreshold: 1
            failureThreshold: 6
          readinessProbe:
            httpGet:
              path: /
              port: http
            initialDelaySeconds: 30
            periodSeconds: 10
            timeoutSeconds: 5
            successThreshold: 1
            failureThreshold: 6
          resources:
            limits:
              cpu: 150m
              ephemeral-storage: 2Gi
              memory: 192Mi
            requests:
              cpu: 100m
              ephemeral-storage: 50Mi
              memory: 128Mi
          volumeMounts:
            - name: empty-dir
              mountPath: /opt/bitnami/apache/conf
              subPath: app-conf-dir
            - name: empty-dir
              mountPath: /opt/bitnami/apache/logs
              subPath: app-logs-dir
            - name: empty-dir
              mountPath: /tmp
              subPath: tmp-dir
            - name: empty-dir
              mountPath: /opt/bitnami/apache/var/run
              subPath: app-tmp-dir
      volumes:
        - name: empty-dir
          emptyDir: {}
