Merge "[AAI] Service Mesh compatibility"
authorSylvain Desbureaux <sylvain.desbureaux@orange.com>
Tue, 14 Sep 2021 14:00:16 +0000 (14:00 +0000)
committerGerrit Code Review <gerrit@onap.org>
Tue, 14 Sep 2021 14:00:16 +0000 (14:00 +0000)
12 files changed:
1  2 
kubernetes/aai/components/aai-babel/values.yaml
kubernetes/aai/components/aai-graphadmin/templates/deployment.yaml
kubernetes/aai/components/aai-graphadmin/values.yaml
kubernetes/aai/components/aai-modelloader/values.yaml
kubernetes/aai/components/aai-resources/values.yaml
kubernetes/aai/components/aai-schema-service/values.yaml
kubernetes/aai/components/aai-sparky-be/templates/deployment.yaml
kubernetes/aai/components/aai-sparky-be/values.yaml
kubernetes/aai/components/aai-traversal/values.yaml
kubernetes/aai/templates/deployment.yaml
kubernetes/aai/values.yaml
kubernetes/common/common/templates/_service.tpl

@@@ -55,7 -55,7 +55,7 @@@ readiness
  
  service:
    type: NodePort
-   portName: babel
+   portName: http
    externalPort: 9516
    internalPort: 9516
    nodePort: 79
@@@ -85,9 -85,3 +85,9 @@@ resources
        cpu: 2
        memory: 2Gi
    unlimited: {}
 +
 +#Pods Service Account
 +serviceAccount:
 +  nameOverride: aai-babel
 +  roles:
 +    - read
@@@ -32,12 -32,6 +32,12 @@@ metadata
      heritage: {{ .Release.Service }}
  spec:
    replicas: {{ .Values.replicaCount }}
 +  minReadySeconds: {{ .Values.minReadySeconds }}
 +  strategy:
 +    type: {{ .Values.updateStrategy.type }}
 +    rollingUpdate:
 +      maxUnavailable: {{ .Values.updateStrategy.maxUnavailable }}
 +      maxSurge: {{ .Values.updateStrategy.maxSurge }}
    selector:
      matchLabels:
        app: {{ include "common.name" . }}
@@@ -51,7 -45,6 +51,7 @@@
          checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
      spec:
        hostname: aai-graphadmin
 +      terminationGracePeriodSeconds: {{ .Values.service.terminationGracePeriodSeconds }}
      {{ if .Values.global.initContainers.enabled }}
        initContainers:
        - command:
            value: {{ .Values.global.config.userId | quote }}
          - name: LOCAL_GROUP_ID
            value: {{ .Values.global.config.groupId | quote }}
 +        - name: INTERNAL_PORT_1
 +          value: {{ .Values.service.internalPort | quote }}
 +        - name: INTERNAL_PORT_2
 +          value: {{ .Values.service.internalPort2 | quote }}
          volumeMounts:
          - mountPath: /etc/localtime
            name: localtime
          ports:
          - containerPort: {{ .Values.service.internalPort }}
          - containerPort: {{ .Values.service.internalPort2 }}
 +        lifecycle:
 +          # wait for active requests (long-running tasks) to be finished
 +          # Before the SIGTERM is invoked, Kubernetes exposes a preStop hook in the Pod.
 +          preStop:
 +            exec:
 +              command:
 +                - sh
 +                - -c
 +                - |
 +                  while (netstat -an | grep ESTABLISHED | grep -e $INTERNAL_PORT_1 -e $INTERNAL_PORT_2)
 +                  do sleep 10
 +                  done
          # disable liveness probe when breakpoints set in debugger
          # so K8s doesn't restart unresponsive container
          {{ if .Values.liveness.enabled }}
            name: {{ include "common.fullname" . }}-logs
          - mountPath: /usr/share/filebeat/data
            name: {{ include "common.fullname" . }}-filebeat
 -
 +      serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
        volumes:
        - name: localtime
          hostPath:
              {{ end }}
        restartPolicy: {{ .Values.restartPolicy }}
        imagePullSecrets:
-       - name: "{{ include "common.namespace" . }}-docker-registry-key"
+       - name: {{ include "common.namespace" . }}-docker-registry-key
@@@ -61,6 -61,7 +61,7 @@@ global: # global default
      # Schema specific properties that include supported versions of api
      schema:
        # Specifies if the connection should be one way ssl, two way ssl or no auth
+       # will be set to no-auth if tls is disabled
        service:
          client: one-way-ssl
        # Specifies which translator to use if it has schema-service, then it will
@@@ -125,21 -126,15 +126,23 @@@ flavor: smal
  flavorOverride: small
  # default number of instances
  replicaCount: 1
 +# the minimum number of seconds that a newly created Pod should be ready
 +minReadySeconds: 30
 +updateStrategy:
 +  type: RollingUpdate
 +  # The number of pods that can be unavailable during the update process
 +  maxUnavailable: 0
 +  # The number of pods that can be created above the desired amount of pods during an update
 +  maxSurge: 1
  
  # Configuration for the graphadmin deployment
  config:
  
    # Specify the profiles for the graphadmin microservice
    profiles:
-     active: "dmaap,one-way-ssl"
+     # one way ssl profile will be set unless tlsEnabled is set to false or serviceMesh is enabled and
+     # serviceMesh.tls is set to tru
+     active: dmaap #,one-way-ssl"
  
    # Specifies the timeout limit for the REST API requests
    timeout:
@@@ -208,11 -203,10 +211,11 @@@ readiness
  service:
    type: ClusterIP
    # REST API port for the graphadmin microservice
-   portName: aai-graphadmin-8449
+   portName: http
    internalPort: 8449
-   portName2: aai-graphadmin-5005
+   portName2: tcp-5005
    internalPort2: 5005
 +  terminationGracePeriodSeconds: 120
  
  ingress:
    enabled: false
@@@ -255,9 -249,3 +258,9 @@@ resources
        cpu: 1
        memory: 2Gi
    unlimited: {}
 +
 +#Pods Service Account
 +serviceAccount:
 +  nameOverride: aai-graphadmin
 +  roles:
 +    - read
@@@ -50,11 -50,11 +50,11 @@@ readiness
  
  service:
    type: NodePort
-   portName: aai-modelloader
+   portName: http
    externalPort: 8080
    internalPort: 8080
    nodePort: 10
-   portName2: aai-modelloader-ssl
+   portName2: https
    externalPort2: 8443
    internalPort2: 8443
    nodePort2: 29
@@@ -84,9 -84,3 +84,9 @@@ resources
        cpu: 1
        memory: 1536Mi
    unlimited: {}
 +
 +#Pods Service Account
 +serviceAccount:
 +  nameOverride: aai-modelloader
 +  roles:
 +    - read
@@@ -33,6 -33,8 +33,8 @@@ global: # global default
      migration:
        enabled: false
  
+   aafEnabled: false
    config:
      # Specifies that the cluster connected to a dynamic
      # cluster being spinned up by kubernetes deployment
@@@ -49,7 -51,8 +51,8 @@@
  
      # Active spring profiles for the resources microservice
      profiles:
-       active: production,dmaap,aaf-auth #,keycloak
+       # aaf-auth profile will be automatically set if aaf enabled is set to true 
+       active: production,dmaap #,aaf-auth
  
      # Notification event specific properties
      notification:
@@@ -161,14 -164,6 +164,14 @@@ flavor: smal
  flavorOverride: small
  # default number of instances
  replicaCount: 1
 +# the minimum number of seconds that a newly created Pod should be ready
 +minReadySeconds: 30
 +updateStrategy:
 +  type: RollingUpdate
 +  # The number of pods that can be unavailable during the update process
 +  maxUnavailable: 0
 +  # The number of pods that can be created above the desired amount of pods during an update
 +  maxSurge: 1
  
  # Configuration for the resources deployment
  config:
@@@ -224,11 -219,10 +227,11 @@@ readiness
  
  service:
    type: ClusterIP
-   portName: aai-resources-8447
+   portName: http
    internalPort: 8447
-   portName2: aai-resources-5005
+   portName2: tcp-5005
    internalPort2: 5005
 +  terminationGracePeriodSeconds: 120
  
  ingress:
    enabled: false
@@@ -266,9 -260,3 +269,9 @@@ resources
        cpu: 2
        memory: 4Gi
    unlimited: {}
 +
 +#Pods Service Account
 +serviceAccount:
 +  nameOverride: aai-resources
 +  roles:
 +    - read
@@@ -99,9 -99,9 +99,9 @@@ readiness
  
  service:
    type: ClusterIP
-   portName: aai-schema-service-8452
+   portName: http
    internalPort: 8452
-   portName2: aai-schema-service-5005
+   portName2: tcp-5005
    internalPort2: 5005
  
  ingress:
@@@ -140,9 -140,3 +140,9 @@@ resources
        cpu: 2
        memory: 4Gi
    unlimited: {}
 +
 +#Pods Service Account
 +serviceAccount:
 +  nameOverride: aai-schema-service
 +  roles:
 +    - read
@@@ -39,6 -39,7 +39,7 @@@ spec
        name: {{ include "common.name" . }}
      spec:
        initContainers: {{ include "common.certInitializer.initContainer" . | nindent 6 }}
+       {{- if ( include "common.needTLS" .) }}
        - command:
          - sh
          args:
@@@ -66,6 -67,7 +67,7 @@@
          image: {{ include "repositoryGenerator.image.envsubst" . }}
          imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
          name: {{ include "common.name" . }}-update-config
+       {{- end }}
        - command:
          - /app/ready.py
          args:
            name: aai-sparky-filebeat
          resources:
  {{ include "common.resources" . }}
 -
 +      serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
        volumes: {{ include "common.certInitializer.volumes" . | nindent 6 }}
        - name: localtime
          hostPath:
@@@ -113,7 -113,7 +113,7 @@@ readiness
  
  service:
    type: NodePort
-   portName: aai-sparky-be
+   portName: http
    internalPort: 8000
    nodePort: 20
  
@@@ -144,9 -144,3 +144,9 @@@ resources
        cpu: 0.5
        memory: 2Gi
    unlimited: {}
 +
 +#Pods Service Account
 +serviceAccount:
 +  nameOverride: aai-sparky-be
 +  roles:
 +    - read
@@@ -59,7 -59,7 +59,7 @@@ global: # global default
  
      # Active spring profiles for the resources microservice
      profiles:
-       active: production,dmaap,aaf-auth #,keycloak
+       active: production,dmaap #,aaf-auth ,keycloak
  
      # Notification event specific properties
      notification:
@@@ -145,14 -145,6 +145,14 @@@ pullPolicy: Alway
  restartPolicy: Always
  flavor: small
  flavorOverride: small
 +# the minimum number of seconds that a newly created Pod should be ready
 +minReadySeconds: 30
 +updateStrategy:
 +  type: RollingUpdate
 +  # The number of pods that can be unavailable during the update process
 +  maxUnavailable: 0
 +  # The number of pods that can be created above the desired amount of pods during an update
 +  maxSurge: 1
  
  api_list:
    - 11
@@@ -249,11 -241,10 +249,11 @@@ readiness
  
  service:
    type: ClusterIP
-   portName: aai-traversal-8446
+   portName: http
    internalPort: 8446
-   portName2: aai-traversal-5005
+   portName2: tcp-5005
    internalPort2: 5005
 +  terminationGracePeriodSeconds: 120
  
  ingress:
    enabled: false
@@@ -276,9 -267,3 +276,9 @@@ resources
        cpu: 2
        memory: 4Gi
    unlimited: {}
 +
 +#Pods Service Account
 +serviceAccount:
 +  nameOverride: aai-traversal
 +  roles:
 +    - read
@@@ -78,20 -78,22 +78,22 @@@ spec
          {{- include "common.certInitializer.volumeMount" . | nindent 8 }}
          ports:
          - containerPort: {{ .Values.service.internalPort }}
+         - containerPort: {{ .Values.service.internalPlainPort }}
          # disable liveness probe when breakpoints set in debugger
          # so K8s doesn't restart unresponsive container
          {{- if eq .Values.liveness.enabled true }}
          livenessProbe:
            tcpSocket:
-             port: {{ .Values.service.internalPort }}
+             port: {{ (eq "true" (include "common.needTLS" .)) | ternary .Values.service.internalPort .Values.service.internalPlainPort }}
            initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
            periodSeconds: {{ .Values.liveness.periodSeconds }}
          {{ end -}}
          readinessProbe:
            httpGet:
              path: /aai/util/echo
-             port: {{ .Values.service.internalPort }}
-             scheme: HTTPS
+             port: {{ (eq "true" (include "common.needTLS" .)) | ternary .Values.service.internalPort .Values.service.internalPlainPort }}
+             #scheme: HTTPS
+             scheme: {{ (eq "true" (include "common.needTLS" .)) | ternary "HTTPS" "HTTP" }}
              httpHeaders:
              - name: X-FromAppId
                value: OOM_ReadinessCheck
        affinity:
  {{ toYaml .Values.affinity | indent 8 }}
        {{- end }}
 -
 +      serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
        volumes:
          - name: localtime
            hostPath:
@@@ -202,8 -202,9 +202,9 @@@ global: # global default
          passwd: AAI
  
      # Active spring profiles for the resources microservice
+     # aaf-auth profile will be automatically set if aaf enabled is set to true
      profiles:
-       active: production,dmaap,aaf-auth
+       active: production,dmaap #,aaf-auth
  
      # Notification event specific properties
      notification:
      # Schema specific properties that include supported versions of api
      schema:
        # Specifies if the connection should be one way ssl, two way ssl or no auth
+       # will be set to no-auth if tls is disabled
        service:
          client: one-way-ssl
        # Specifies which translator to use if it has schema-service, then it will make a rest request to schema service
@@@ -359,13 -361,16 +361,16 @@@ readiness
  
  service:
    type: NodePort
-   portName: aai-ssl
+   portName: http
    externalPort: 8443
    internalPort: 8443
    nodePort: 33
    # POLICY hotfix - Note this must be temporary
    # See https://jira.onap.org/browse/POLICY-510
    aaiServiceClusterIp:
+   externalPlainPort: 80
+   internalPlainPort: 8080
+   nodeport: 33
  
  ingress:
    enabled: false
      - baseaddr: "aai.api"
        name: "aai"
        port: 8443
-   config:
-     ssl: "redirect"
+       config:
+        ssl: "redirect"
  
  resources:
    small:
        cpu: 2
        memory: 2Gi
    unlimited: {}
 +
 +#Pods Service Account
 +serviceAccount:
 +  nameOverride: aai
 +  roles:
 +    - read
@@@ -13,6 -13,7 +13,6 @@@
  # See the License for the specific language governing permissions and
  # limitations under the License.
  */}}
 -
  {{/*
    Resolve the name of a chart's service.
  
@@@ -121,11 -122,6 +121,11 @@@ labels: {{- include "common.labels" (di
  {{-     if (include "common.needTLS" $dot) }}
  - port: {{ $port.port }}
    targetPort: {{ $port.name }}
 +{{-       if $port.l4_protocol }}
 +  protocol: {{ $port.l4_protocol }}
 +{{-       else }}
 +  protocol: TCP
 +{{-       end }}
  {{-       if $port.port_protocol }}
    name: {{ printf "%ss-%s" $port.port_protocol $port.name }}
  {{-       else }}
  {{-     else }}
  - port: {{ default $port.port $port.plain_port }}
    targetPort: {{ $port.name }}
 +{{-       if $port.plain_port_l4_protocol }}
 +  protocol: {{ $port.plain_port_l4_protocol }}
 +{{-       else }}
 +  protocol: {{ default "TCP" $port.l4_protocol  }}
 +{{-       end }}
  {{-       if $port.port_protocol }}
    name: {{ printf "%s-%s" $port.port_protocol $port.name }}
  {{-       else }}
  {{-       if (eq $serviceType "ClusterIP")  }}
  - port: {{ $port.plain_port }}
    targetPort: {{ $port.name }}-plain
 +{{-       if $port.plain_l4_port_protocol }}
 +  protocol: {{ $port.plain_port_l4_protocol }}
 +{{-       else }}
 +  protocol: {{ default "TCP" $port.l4_protocol  }}
 +{{-       end }}
  {{-         if $port.port_protocol }}
    name: {{ printf "%s-%s" $port.port_protocol $port.name }}
  {{-         else }}
@@@ -323,6 -309,16 +323,16 @@@ tru
  {{-   end }}
  {{- end -}}
  
+ {{/*
+   generate needed scheme:
+     - https if needTLS
+     - http if not
+ */}}
+ {{- define "common.scheme" -}}
+   {{- ternary "https" "http" (eq "true" (include "common.needTLS" .)) }}
+ {{- end -}}
  {{- define "common.port.buildCache" -}}
    {{- $global := . }}
    {{- if not $global.Values._DmaapDrNodePortsCache }}