Merge "[AAI] Kyverno - disallow-host-path policy"
authorLukasz Rajewski <lukasz.rajewski@t-mobile.pl>
Mon, 25 Mar 2024 10:10:40 +0000 (10:10 +0000)
committerGerrit Code Review <gerrit@onap.org>
Mon, 25 Mar 2024 10:10:40 +0000 (10:10 +0000)
12 files changed:
1  2 
kubernetes/aai/components/aai-babel/templates/deployment.yaml
kubernetes/aai/components/aai-graphadmin/templates/deployment.yaml
kubernetes/aai/components/aai-graphadmin/templates/job-copy-db-backup.yaml
kubernetes/aai/components/aai-graphadmin/templates/job-create-db.yaml
kubernetes/aai/components/aai-graphadmin/templates/job-migration.yaml
kubernetes/aai/components/aai-modelloader/templates/deployment.yaml
kubernetes/aai/components/aai-resources/templates/deployment.yaml
kubernetes/aai/components/aai-schema-service/templates/deployment.yaml
kubernetes/aai/components/aai-sparky-be/templates/deployment.yaml
kubernetes/aai/components/aai-traversal/templates/deployment.yaml
kubernetes/aai/components/aai-traversal/templates/job.yaml
kubernetes/aai/templates/deployment.yaml

@@@ -58,9 -58,6 +58,6 @@@ spec
              - name: CONFIG_HOME
                value: /opt/app/babel/config
            volumeMounts:
-           - mountPath: /etc/localtime
-             name: localtime
-             readOnly: true
            - mountPath: /opt/app/babel/config/application.properties
              name: config
              subPath: application.properties
@@@ -94,9 -91,6 +91,6 @@@
        {{ include "common.log.sidecar" . | nindent 8 }}
        serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
        volumes:
-         - name: localtime
-           hostPath:
-             path: /etc/localtime
          - name: config
            configMap:
              name: {{ include "common.fullname" . }}-configmap
            emptyDir: {}
          {{ include "common.log.volumes" (dict "dot" . "configMapNamePrefix" (tpl .Values.logConfigMapNamePrefix .)) | nindent 8 }}
  
 -      imagePullSecrets:
 -      - name: "{{ include "common.namespace" . }}-docker-registry-key"
 +      {{- include "common.imagePullSecrets" . | nindent 6 }}
@@@ -123,9 -123,6 +123,6 @@@ spec
          - name: INTERNAL_PORT_3
            value: {{ .Values.service.internalPort3 | quote }}
          volumeMounts:
-         - mountPath: /etc/localtime
-           name: localtime
-           readOnly: true
          - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/janusgraph-realtime.properties
            name: config
            subPath: janusgraph-realtime.properties
        {{ include "common.log.sidecar" . | nindent 6 }}
        serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
        volumes:
-       - name: localtime
-         hostPath:
-           path: /etc/localtime
        - name: logs
          emptyDir: {}
        {{ include "common.log.volumes" (dict "dot" . "configMapNamePrefix" (tpl .Values.logConfigMapNamePrefix .)) | nindent 6 }}
          configMap:
            name: {{ include "common.fullname" . }}-properties
        restartPolicy: {{ .Values.restartPolicy }}
 -      imagePullSecrets:
 -      - name: {{ include "common.namespace" . }}-docker-registry-key
 +      {{- include "common.imagePullSecrets" . | nindent 6 }}
@@@ -101,9 -101,6 +101,6 @@@ spec
          - name: LOCAL_GROUP_ID
            value: {{ .Values.securityContext.group_id | quote }}
          volumeMounts:
-         - mountPath: /etc/localtime
-           name: localtime
-           readOnly: true
          - mountPath: /opt/app/aai-graphadmin/logs/data/dataSnapshots
            name: snapshots
          - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/janusgraph-realtime.properties
        {{- end }}
        serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
        volumes:
-       - name: localtime
-         hostPath:
-           path: /etc/localtime
        - name: logs
          emptyDir: {}
        - name: config
          persistentVolumeClaim:
            claimName: {{ include "common.fullname" . }}-migration
        restartPolicy: Never
 -      imagePullSecrets:
 -      - name: "{{ include "common.namespace" . }}-docker-registry-key"
 +      {{- include "common.imagePullSecrets" . | nindent 6 }}
  {{ end }}
@@@ -101,9 -101,6 +101,6 @@@ spec
          - name: LOCAL_GROUP_ID
            value: {{ .Values.securityContext.group_id | quote }}
          volumeMounts:
-         - mountPath: /etc/localtime
-           name: localtime
-           readOnly: true
          - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/janusgraph-realtime.properties
            name: config
            subPath: janusgraph-realtime.properties
        {{- end }}
        serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
        volumes:
-       - name: localtime
-         hostPath:
-           path: /etc/localtime
        {{ include "common.log.volumes" (dict "dot" . "configMapNamePrefix" (tpl .Values.logConfigMapNamePrefix .)) | nindent 6 }}
        - name: logs
          emptyDir: {}
          configMap:
            name: {{ include "common.fullname" . }}-properties
        restartPolicy: Never
 -      imagePullSecrets:
 -      - name: {{ include "common.namespace" . }}-docker-registry-key
 +      {{- include "common.imagePullSecrets" . | nindent 6 }}
  {{ end }}
@@@ -99,9 -99,6 +99,6 @@@ spec
          - name: LOCAL_GROUP_ID
            value: {{ .Values.securityContext.group_id | quote }}
          volumeMounts:
-         - mountPath: /etc/localtime
-           name: localtime
-           readOnly: true
          - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/janusgraph-realtime.properties
            name: config
            subPath: janusgraph-realtime.properties
          - name: LOCAL_GROUP_ID
            value: {{ .Values.securityContext.group_id | quote }}
          volumeMounts:
-         - mountPath: /etc/localtime
-           name: localtime
-           readOnly: true
          - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/janusgraph-realtime.properties
            name: config
            subPath: janusgraph-realtime.properties
        {{- end }}
        serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
        volumes:
-       - name: localtime
-         hostPath:
-           path: /etc/localtime
        {{ include "common.log.volumes" (dict "dot" . "configMapNamePrefix" (tpl .Values.logConfigMapNamePrefix .)) | nindent 8 }}
        - name: {{ include "common.fullname" . }}-logs
          emptyDir: {}
          configMap:
            name: {{ include "common.fullname" . }}-properties
        restartPolicy: Never
 -      imagePullSecrets:
 -      - name: "{{ include "common.namespace" . }}-docker-registry-key"
 +      {{- include "common.imagePullSecrets" . | nindent 6 }}
  ---
  apiVersion: batch/v1
  kind: Job
@@@ -261,9 -253,6 +252,6 @@@ spec
          - name: LOCAL_GROUP_ID
            value: {{ .Values.securityContext.group_id | quote }}
          volumeMounts:
-         - mountPath: /etc/localtime
-           name: localtime
-           readOnly: true
          - mountPath: /opt/app/aai-graphadmin/logs/data/dataSnapshots
            name: snapshots
          - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/janusgraph-realtime.properties
        {{- end }}
        serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
        volumes: {{ include "common.resources" . | nindent 10 }}
-       - name: localtime
-         hostPath:
-           path: /etc/localtime
        - name: logs
          emptyDir: {}
        - name: config
          persistentVolumeClaim:
            claimName: {{ include "common.fullname" . }}-migration
        restartPolicy: Never
 -      imagePullSecrets:
 -      - name: "{{ include "common.namespace" . }}-docker-registry-key"
 +      {{- include "common.imagePullSecrets" . | nindent 6 }}
  {{ end }}
@@@ -77,9 -77,6 +77,6 @@@ spec
                name: {{ include "common.name" . }}-ku
                key: sasl.jaas.config
          volumeMounts:
-         - mountPath: /etc/localtime
-           name: localtime
-           readOnly: true
          - mountPath: /opt/app/model-loader/config/model-loader.properties
            subPath: model-loader.properties
            name: prop-config
@@@ -93,9 -90,6 +90,6 @@@
          {{ include "common.log.sidecar" . | nindent 6 }}
        serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
        volumes:
-       - name: localtime
-         hostPath:
-           path: /etc/localtime
        - name: prop-config
          configMap:
            name: {{ include "common.fullname" . }}-prop
          configMap:
            name: {{ include "common.fullname" . }}-log
        restartPolicy: {{ .Values.global.restartPolicy | default .Values.restartPolicy }}
 -      imagePullSecrets:
 -      - name: "{{ include "common.namespace" . }}-docker-registry-key"
 +      {{- include "common.imagePullSecrets" . | nindent 6 }}
@@@ -167,9 -167,6 +167,6 @@@ spec
          - name: INTERNAL_PORT_3
            value: {{ .Values.service.internalPort3 | quote }}
          volumeMounts:
-         - mountPath: /etc/localtime
-           name: localtime
-           readOnly: true
          - mountPath: /opt/app/aai-resources/resources/etc/appprops/janusgraph-realtime.properties
            name: {{ include "common.fullname" . }}-config
            subPath: janusgraph-realtime.properties
        {{ include "common.log.sidecar" . | nindent 6 }}
        serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
        volumes:
-       - name: localtime
-         hostPath:
-           path: /etc/localtime
        - name: logs
          emptyDir: {}
        {{ include "common.log.volumes" (dict "dot" . "configMapNamePrefix" (tpl .Values.logConfigMapNamePrefix .)) | nindent 6 }}
          configMap:
            name: {{ include "common.fullname" . }}
        restartPolicy: {{ .Values.restartPolicy }}
 -      imagePullSecrets:
 -      - name: "{{ include "common.namespace" . }}-docker-registry-key"
 +      {{- include "common.imagePullSecrets" . | nindent 6 }}
@@@ -70,9 -70,6 +70,6 @@@ spec
          - name: LOCAL_GROUP_ID
            value: {{ .Values.securityContext.group_id | quote }}
          volumeMounts:
-         - mountPath: /etc/localtime
-           name: localtime
-           readOnly: true
          - mountPath: /opt/app/aai-schema-service/resources/etc/appprops/aaiconfig.properties
            name: aaiconfig-conf
            subPath: aaiconfig.properties
        - name: aai-common-aai-auth-mount
          secret:
            secretName: aai-common-aai-auth
-       - name: localtime
-         hostPath:
-           path: /etc/localtime
        - name: logs
          emptyDir: {}
        {{ include "common.log.volumes" (dict "dot" . "configMapNamePrefix" (tpl .Values.logConfigMapNamePrefix .)) | nindent 6 }}
          configMap:
            name: {{ include "common.fullname" . }}-realm
        restartPolicy: {{ .Values.restartPolicy }}
 -      imagePullSecrets:
 -      - name: "{{ include "common.namespace" . }}-docker-registry-key"
 +      {{- include "common.imagePullSecrets" . | nindent 6 }}
@@@ -67,9 -67,6 +67,6 @@@ spec
            echo "*** actual launch of AAI Sparky BE"
            /opt/app/sparky/bin/start.sh
          volumeMounts:
-         - mountPath: /etc/localtime
-           name: localtime
-           readOnly: true
          - mountPath: {{ .Values.log.path }}
            name: logs
          - mountPath:  /opt/app/sparky/config/application.properties
        {{ include "common.log.sidecar" . | nindent 6 }}
        serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
        volumes:
-       - name: localtime
-         hostPath:
-           path: /etc/localtime
        - name: config
          configMap:
            name: {{ include "common.fullname" . }}
        - name: modeldir
          emptyDir: {}
        restartPolicy: {{ .Values.global.restartPolicy | default .Values.restartPolicy }}
 -      imagePullSecrets:
 -      - name: "{{ include "common.namespace" . }}-docker-registry-key"
 +      {{- include "common.imagePullSecrets" . | nindent 6 }}
@@@ -188,9 -188,6 +188,6 @@@ spec
          - name: INTERNAL_PORT_3
            value: {{ .Values.service.internalPort3 | quote }}
          volumeMounts:
-         - mountPath: /etc/localtime
-           name: localtime
-           readOnly: true
          - mountPath: /opt/app/aai-traversal/resources/etc/appprops/janusgraph-realtime.properties
            name: {{ include "common.fullname" . }}-config
            subPath: janusgraph-realtime.properties
        {{ include "common.log.sidecar" . | nindent 6 }}
        serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
        volumes:
-       - name: localtime
-         hostPath:
-           path: /etc/localtime
        - name: logs
          emptyDir: {}
        - name: {{ include "common.fullname" . }}-logs-misc
          configMap:
            name: {{ include "common.fullname" . }}
        restartPolicy: {{ .Values.global.restartPolicy | default .Values.restartPolicy }}
 -      imagePullSecrets:
 -      - name: "{{ include "common.namespace" . }}-docker-registry-key"
 +      {{- include "common.imagePullSecrets" . | nindent 6 }}
@@@ -86,9 -86,6 +86,6 @@@ spec
            value: {{ .Values.global.config.groupId | quote }}
          resources: {{ include "common.resources" . | nindent 10 }}
          volumeMounts:
-         - mountPath: /etc/localtime
-           name: localtime
-           readOnly: true
          - mountPath: /opt/app/aai-traversal/resources/etc/appprops/janusgraph-realtime.properties
            name: {{ include "common.fullname" . }}-config
            subPath: janusgraph-realtime.properties
          # so K8s doesn't restart unresponsive container
        serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
        volumes:
-       - name: localtime
-         hostPath:
-           path: /etc/localtime
        - name: {{ include "common.fullname" . }}-logs
          emptyDir: {}
        - name: {{ include "common.fullname" . }}-logs-misc
          configMap:
            name: {{ include "common.fullname" . }}
        restartPolicy: OnFailure
 -      imagePullSecrets:
 -      - name: "{{ include "common.namespace" . }}-docker-registry-key"
 +      {{- include "common.imagePullSecrets" . | nindent 6 }}
  {{ end }}
@@@ -91,9 -91,6 +91,6 @@@ spec
          image: "{{ include "repositoryGenerator.dockerHubRepository" . }}/{{ .Values.image }}"
          imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
          volumeMounts:
-         - mountPath: /etc/localtime
-           name: localtime
-           readOnly: true
          - mountPath: /dev/log
            name: aai-service-log
          - mountPath: /usr/local/etc/haproxy/haproxy.cfg
        {{- end }}
        serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
        volumes:
-         - name: localtime
-           hostPath:
-             path: /etc/localtime
          - name: aai-service-log
            hostPath:
              path: "/dev/log"
          - name: haproxy-cfg
            configMap:
              name: aai-deployment-configmap
 -      imagePullSecrets:
 -      - name: "{{ include "common.namespace" . }}-docker-registry-key"
 +      {{- include "common.imagePullSecrets" . | nindent 6 }}