From ced8514d3c19dc5ba4ae8e42797fc731ef25d200 Mon Sep 17 00:00:00 2001 From: mayankg2703 Date: Tue, 20 Mar 2018 05:42:53 +0000 Subject: Add Standardized Configuration to POLICY Change-Id: Iabdb2bba14b5095c08ff2920aec97a213e0acb30 Issue-ID: OOM-745 Signed-off-by: mayankg2703 Signed-off-by: Mike Elliott Signed-off-by: Mandeep Khinda --- kubernetes/policy/templates/NOTES.txt | 19 +++ kubernetes/policy/templates/all-services.yaml | 145 ------------------ kubernetes/policy/templates/configmap.yaml | 38 +++++ kubernetes/policy/templates/dep-brmsgw.yaml | 71 --------- kubernetes/policy/templates/dep-drools.yaml | 152 ------------------- kubernetes/policy/templates/dep-maria.yaml | 54 ------- kubernetes/policy/templates/dep-nexus.yaml | 61 -------- kubernetes/policy/templates/dep-pap.yaml | 131 ----------------- kubernetes/policy/templates/dep-pdp.yaml | 108 -------------- kubernetes/policy/templates/deployment.yaml | 162 +++++++++++++++++++++ .../templates/policy-deployment-configmap.yaml | 41 ------ .../policy/templates/policy-deployment-secret.yaml | 24 --- .../policy/templates/policy-log-configmap.yaml | 59 -------- kubernetes/policy/templates/service.yaml | 42 ++++++ 14 files changed, 261 insertions(+), 846 deletions(-) create mode 100644 kubernetes/policy/templates/NOTES.txt delete mode 100644 kubernetes/policy/templates/all-services.yaml create mode 100644 kubernetes/policy/templates/configmap.yaml delete mode 100644 kubernetes/policy/templates/dep-brmsgw.yaml delete mode 100644 kubernetes/policy/templates/dep-drools.yaml delete mode 100644 kubernetes/policy/templates/dep-maria.yaml delete mode 100644 kubernetes/policy/templates/dep-nexus.yaml delete mode 100644 kubernetes/policy/templates/dep-pap.yaml delete mode 100644 kubernetes/policy/templates/dep-pdp.yaml create mode 100644 kubernetes/policy/templates/deployment.yaml delete mode 100644 kubernetes/policy/templates/policy-deployment-configmap.yaml delete mode 100644 kubernetes/policy/templates/policy-deployment-secret.yaml delete mode 100644 kubernetes/policy/templates/policy-log-configmap.yaml create mode 100644 kubernetes/policy/templates/service.yaml (limited to 'kubernetes/policy/templates') diff --git a/kubernetes/policy/templates/NOTES.txt b/kubernetes/policy/templates/NOTES.txt new file mode 100644 index 0000000000..91d8ed42f1 --- /dev/null +++ b/kubernetes/policy/templates/NOTES.txt @@ -0,0 +1,19 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range .Values.ingress.hosts }} + http://{{ . }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ include "common.namespace" . }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "common.name" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ include "common.namespace" . }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get svc -w {{ include "common.name" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ include "common.namespace" . }} {{ include "common.name" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') + echo http://$SERVICE_IP:{{ .Values.service.externalPort }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ include "common.namespace" . }} -l "app={{ template "so.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl port-forward $POD_NAME 8080:{{ .Values.service.internalPort }} +{{- end }} diff --git a/kubernetes/policy/templates/all-services.yaml b/kubernetes/policy/templates/all-services.yaml deleted file mode 100644 index f8e435b1bc..0000000000 --- a/kubernetes/policy/templates/all-services.yaml +++ /dev/null @@ -1,145 +0,0 @@ -# Copyright © 2017 Amdocs, Bell Canada -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -#{{ if not .Values.disablePolicyMariadb }} -apiVersion: v1 -kind: Service -metadata: - name: mariadb - namespace: "{{ .Values.nsPrefix }}" - labels: - app: mariadb -spec: - ports: - - name: 3306-port - port: 3306 - selector: - app: mariadb - clusterIP: None -#{{ end }} -#{{ if not .Values.disablePolicyNexus }} ---- -apiVersion: v1 -kind: Service -metadata: - labels: - app: nexus - name: nexus - namespace: "{{ .Values.nsPrefix }}" -spec: - ports: - - name: nexus-port - port: 8081 - selector: - app: nexus - clusterIP: None -#{{ end }} -#{{ if not .Values.disablePolicyDrools }} ---- -apiVersion: v1 -kind: Service -metadata: - labels: - app: drools - name: drools - namespace: "{{ .Values.nsPrefix }}" -spec: - ports: - - name: "drools-port" - port: 6969 - nodePort: {{ .Values.nodePortPrefix }}17 - - name: "drools-port2" - port: 9696 - nodePort: {{ .Values.nodePortPrefix }}21 - selector: - app: drools - type: NodePort -#{{ end }} -#{{ if not .Values.disablePolicyPap }} ---- -apiVersion: v1 -kind: Service -metadata: - name: pap - namespace: "{{ .Values.nsPrefix }}" - labels: - app: pap -spec: - ports: - - name: 8443-port - port: 8443 - nodePort: {{ .Values.nodePortPrefix }}19 - - name: 9091-port - port: 9091 - nodePort: {{ .Values.nodePortPrefix }}18 - selector: - app: pap - type: NodePort -#{{ end }} -#{{ if not .Values.disablePolicyPdp }} ---- -apiVersion: v1 -kind: Service -metadata: - name: pdp - namespace: "{{ .Values.nsPrefix }}" - labels: - app: pdp - annotations: - msb.onap.org/service-info: '[ - { - "serviceName": "policy-pdp", - "version": "v1", - "url": "/pdp", - "protocol": "REST", - "port": "8081", - "visualRange":"1" - }, - { - "serviceName": "policy-pdp-deprecated", - "version": "v1", - "url": "/pdp", - "protocol": "REST", - "port": "8081", - "visualRange":"1", - "path":"/pdp" - } - ]' -spec: - ports: - - name: 8081-port - port: 8081 - nodePort: {{ .Values.nodePortPrefix }}20 - selector: - app: pdp - type: NodePort -#{{ end }} -#{{ if not .Values.disablePolicyBrmsgw }} ---- -apiVersion: v1 -kind: Service -metadata: - name: brmsgw - namespace: "{{ .Values.nsPrefix }}" - labels: - app: brmsgw -spec: - ports: - - name: 9989-port - port: 9989 - nodePort: {{ .Values.nodePortPrefix }}16 - selector: - app: brmsgw - type: NodePort -#{{ end }} diff --git a/kubernetes/policy/templates/configmap.yaml b/kubernetes/policy/templates/configmap.yaml new file mode 100644 index 0000000000..3a9564a04b --- /dev/null +++ b/kubernetes/policy/templates/configmap.yaml @@ -0,0 +1,38 @@ +# Copyright © 2017 Amdocs, Bell Canada +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.fullname" . }}-log-configmap + namespace: {{ include "common.namespace" . }} +data: +{{ tpl (.Files.Glob "resources/config/log/xacml-pap-rest/logback.xml").AsConfig . | indent 2 }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.fullname" . }}-sdk-log-configmap + namespace: {{ include "common.namespace" . }} +data: +{{ tpl (.Files.Glob "resources/config/log/ep_sdk_app/logback.xml").AsConfig . | indent 2 }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.fullname" . }}-pe-configmap + namespace: {{ include "common.namespace" . }} +data: +{{ tpl (.Files.Glob "resources/config/pe/*").AsConfig . | indent 2 }} + diff --git a/kubernetes/policy/templates/dep-brmsgw.yaml b/kubernetes/policy/templates/dep-brmsgw.yaml deleted file mode 100644 index 54b5565617..0000000000 --- a/kubernetes/policy/templates/dep-brmsgw.yaml +++ /dev/null @@ -1,71 +0,0 @@ -# Copyright © 2017 Amdocs, Bell Canada -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -#{{ if not .Values.disablePolicyBrmsgw }} -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - name: policy-brmsgw - namespace: "{{ .Values.nsPrefix }}" -spec: - replicas: {{ .Values.brmsgwReplicas }} - selector: - matchLabels: - app: brmsgw - template: - metadata: - labels: - app: brmsgw - name: policy-brmsgw - spec: - initContainers: - - command: - - /root/ready.py - args: - - --container-name - - pap - env: - - name: NAMESPACE - valueFrom: - fieldRef: - apiVersion: v1 - fieldPath: metadata.namespace - image: "{{ .Values.image.readiness }}:{{ .Values.image.readinessVersion }}" - imagePullPolicy: {{ .Values.pullPolicy }} - name: brmsgw-readiness - containers: - - command: - - /bin/bash - - ./do-start.sh - - brmsgw - image: "{{ .Values.image.policyPe }}:{{ .Values.image.policyPeVersion}}" - imagePullPolicy: {{ .Values.pullPolicy }} - name: brmsgw - volumeMounts: - - mountPath: /etc/localtime - name: localtime - readOnly: true - - mountPath: /tmp/policy-install/config - name: pe - volumes: - - name: localtime - hostPath: - path: /etc/localtime - - name: pe - configMap: - name: policy-dep-pe-configmap - defaultMode: 0755 - imagePullSecrets: - - name: "{{ .Values.nsPrefix }}-docker-registry-key" -#{{ end }} diff --git a/kubernetes/policy/templates/dep-drools.yaml b/kubernetes/policy/templates/dep-drools.yaml deleted file mode 100644 index ec0413aac5..0000000000 --- a/kubernetes/policy/templates/dep-drools.yaml +++ /dev/null @@ -1,152 +0,0 @@ -# Copyright © 2017 Amdocs, Bell Canada -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -#{{ if not .Values.disablePolicyDrools }} -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - name: policy-drools - namespace: "{{ .Values.nsPrefix }}" -spec: - replicas: {{ .Values.droolsReplicas }} - selector: - matchLabels: - app: drools - template: - metadata: - labels: - app: drools - name: policy-drools - spec: - initContainers: - - command: - - /root/ready.py - args: - - --container-name - - mariadb - - --container-name - - nexus - env: - - name: NAMESPACE - valueFrom: - fieldRef: - apiVersion: v1 - fieldPath: metadata.namespace - image: "{{ .Values.image.readiness }}:{{ .Values.image.readinessVersion }}" - imagePullPolicy: {{ .Values.pullPolicy }} - name: drools-readiness - hostAliases: - - ip: "{{ .Values.aaiServiceClusterIp }}" - hostnames: - - "aai.api.simpledemo.openecomp.org" - containers: - - command: - - /bin/bash - - -c - - ./do-start.sh - image: "{{ .Values.image.policyDrools }}:{{ .Values.image.policyDroolsVersion }}" - imagePullPolicy: {{ .Values.pullPolicy }} - name: drools - ports: - - containerPort: 6969 - readinessProbe: - tcpSocket: - port: 6969 - initialDelaySeconds: 5 - periodSeconds: 10 - volumeMounts: - - mountPath: /etc/localtime - name: localtime - readOnly: true - - mountPath: /tmp/policy-install/config/policy-keystore - name: drools-secret - subPath: policy-keystore - - mountPath: /tmp/policy-install/config/feature-healthcheck.conf - name: drools-secret - subPath: feature-healthcheck.conf - - mountPath: /tmp/policy-install/config/base.conf - name: drools-config - subPath: base.conf - - mountPath: /tmp/policy-install/config/policy-management.conf - name: drools-config - subPath: policy-management.conf - - mountPath: /tmp/policy-install/config/drools-tweaks.sh - name: drools-config - subPath: drools-tweaks.sh - - mountPath: /usr/share/maven/conf/settings.xml - name: drools-settingsxml - subPath: settings.xml - - mountPath: /var/log/onap - name: policy-logs - - mountPath: /tmp/logback.xml - name: policy-logback - subPath: logback.xml - lifecycle: - postStart: - exec: - command: ["/bin/sh", "-c", "export LOG=wait_logback.log; touch $LOG; export SRC=/tmp/logback.xml; export DST=/opt/app/policy/config/; while [ ! -e $DST ]; do echo 'Waiting for $DST...' >> $LOG; sleep 5; done; sleep 2; /bin/cp -f $SRC $DST; echo 'Done' >> $LOG"] - - image: {{ .Values.image.filebeat }} - imagePullPolicy: {{ .Values.pullPolicy }} - name: filebeat-onap - volumeMounts: - - mountPath: /usr/share/filebeat/filebeat.yml - name: filebeat-conf - subPath: filebeat.yml - - mountPath: /var/log/onap - name: policy-logs - - mountPath: /usr/share/filebeat/data - name: policy-data-filebeat - volumes: - - name: localtime - hostPath: - path: /etc/localtime - - name: filebeat-conf - configMap: - name: policy-filebeat-configmap - - name: policy-logs - emptyDir: {} - - name: policy-data-filebeat - emptyDir: {} - - name: policy-logback - configMap: - name: policy-drools-log-configmap - - name: drools-settingsxml - configMap: - name: policy-dep-drools-settings-configmap - - name: drools-config - configMap: - name: policy-dep-drools-configmap - items: - - key: base.conf - path: base.conf - mode: 0755 - - key: policy-management.conf - path: policy-management.conf - mode: 0755 - - key: drools-tweaks.sh - path: drools-tweaks.sh - mode: 0755 - - name: drools-secret - secret: - secretName: policy-dep-drools-secret - items: - - key: policy-keystore - path: policy-keystore - mode: 0644 - - key: feature-healthcheck.conf - path: feature-healthcheck.conf - mode: 0644 - imagePullSecrets: - - name: "{{ .Values.nsPrefix }}-docker-registry-key" -#{{ end }} diff --git a/kubernetes/policy/templates/dep-maria.yaml b/kubernetes/policy/templates/dep-maria.yaml deleted file mode 100644 index 302a052401..0000000000 --- a/kubernetes/policy/templates/dep-maria.yaml +++ /dev/null @@ -1,54 +0,0 @@ -# Copyright © 2017 Amdocs, Bell Canada -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -#{{ if not .Values.disablePolicyMariadb }} -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - name: policy-mariadb - namespace: "{{ .Values.nsPrefix }}" -spec: - replicas: {{ .Values.mariadbReplicas }} - selector: - matchLabels: - app: mariadb - template: - metadata: - labels: - app: mariadb - name: policy-mariadb - spec: - hostname: mariadb - containers: - - image: "{{ .Values.image.policyDb }}:{{ .Values.image.policyDbVersion }}" - imagePullPolicy: {{ .Values.pullPolicy }} - name: mariadb - ports: - - containerPort: 3306 - volumeMounts: - - mountPath: /etc/localtime - name: localtime - readOnly: true - readinessProbe: - tcpSocket: - port: 3306 - initialDelaySeconds: 5 - periodSeconds: 10 - volumes: - - name: localtime - hostPath: - path: /etc/localtime - imagePullSecrets: - - name: "{{ .Values.nsPrefix }}-docker-registry-key" -#{{ end }} diff --git a/kubernetes/policy/templates/dep-nexus.yaml b/kubernetes/policy/templates/dep-nexus.yaml deleted file mode 100644 index de0aeb0f30..0000000000 --- a/kubernetes/policy/templates/dep-nexus.yaml +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright © 2017 Amdocs, Bell Canada -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -#{{ if not .Values.disablePolicyNexus }} -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - name: policy-nexus - namespace: "{{ .Values.nsPrefix }}" -spec: - replicas: {{ .Values.nexusReplicas }} - selector: - matchLabels: - app: nexus - template: - metadata: - labels: - app: nexus - name: policy-nexus - spec: - initContainers: - - command: - - /root/ready.py - args: - - --container-name - - mariadb - env: - - name: NAMESPACE - valueFrom: - fieldRef: - apiVersion: v1 - fieldPath: metadata.namespace - image: "{{ .Values.image.readiness }}:{{ .Values.image.readinessVersion }}" - imagePullPolicy: {{ .Values.pullPolicy }} - name: nexus-readiness - containers: - - image: "{{ .Values.image.policyNexus }}:{{ .Values.image.policyNexusVersion }}" - imagePullPolicy: {{ .Values.pullPolicy }} - name: nexus - volumeMounts: - - name: localtime - mountPath: /etc/localtime - readOnly: true - volumes: - - name: localtime - hostPath: - path: /etc/localtime - imagePullSecrets: - - name: "{{ .Values.nsPrefix }}-docker-registry-key" -#{{ end }} diff --git a/kubernetes/policy/templates/dep-pap.yaml b/kubernetes/policy/templates/dep-pap.yaml deleted file mode 100644 index 5a0d0467eb..0000000000 --- a/kubernetes/policy/templates/dep-pap.yaml +++ /dev/null @@ -1,131 +0,0 @@ -# Copyright © 2017 Amdocs, Bell Canada -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -#{{ if not .Values.disablePolicyPap }} -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - name: policy-pap - namespace: "{{ .Values.nsPrefix }}" -spec: - replicas: {{ .Values.papReplicas }} - selector: - matchLabels: - app: pap - template: - metadata: - labels: - app: pap - name: policy-pap - spec: - initContainers: - - command: - - /root/ready.py - args: - - --container-name - - mariadb - env: - - name: NAMESPACE - valueFrom: - fieldRef: - apiVersion: v1 - fieldPath: metadata.namespace - image: "{{ .Values.image.readiness }}:{{ .Values.image.readinessVersion }}" - imagePullPolicy: {{ .Values.pullPolicy }} - name: pap-readiness - - command: ["/bin/bash", "-c", "echo $POD_IP > /config/ip_addr.txt"] - env: - - name: POD_IP - valueFrom: - fieldRef: - apiVersion: v1 - fieldPath: status.podIP - volumeMounts: - - mountPath: /config/ - name: pe - image: {{ .Values.image.ubuntu }} - imagePullPolicy: {{ .Values.pullPolicy }} - name: generate-ip-addr-txt - containers: - - command: - - /bin/bash - - ./do-start.sh - - pap - image: "{{ .Values.image.policyPe }}:{{ .Values.image.policyPeVersion }}" - imagePullPolicy: {{ .Values.pullPolicy }} - name: pap - env: - - name: PRELOAD_POLICIES - value: "true" - ports: - - containerPort: 8443 - - containerPort: 9091 - readinessProbe: - tcpSocket: - port: 9091 - initialDelaySeconds: 5 - periodSeconds: 10 - volumeMounts: - - mountPath: /etc/localtime - name: localtime - readOnly: true - - mountPath: /tmp/policy-install/config/ - name: pe - - mountPath: /var/log/onap - name: policy-logs - - mountPath: /tmp/policy-install/logback.xml - name: policy-sdk-logback - subPath: logback.xml - - mountPath: /tmp/logback.xml - name: policy-logback - subPath: logback.xml - lifecycle: - postStart: - exec: - command: ["/bin/sh", "-c", "export LOG=wait_logback.log; touch $LOG; export SRC=/tmp/logback.xml; export DST=/opt/app/policy/servers/pap/webapps/pap/WEB-INF/classes/; while [ ! -e $DST ]; do echo 'Waiting for $DST...' >> $LOG; sleep 5; done; sleep 2; /bin/cp -f $SRC $DST; export SRC=/tmp/policy-install/logback.xml; export DST=/opt/app/policy/servers/console/webapps/onap/WEB-INF/classes/; while [ ! -e $DST ]; do echo 'Waiting for $DST...' >> $LOG; sleep 5; done; sleep 2; /bin/cp -f $SRC $DST; echo 'Done' >> $LOG"] - - image: {{ .Values.image.filebeat }} - imagePullPolicy: {{ .Values.pullPolicy }} - name: filebeat-onap - volumeMounts: - - mountPath: /usr/share/filebeat/filebeat.yml - name: filebeat-conf - subPath: filebeat.yml - - mountPath: /var/log/onap - name: policy-logs - - mountPath: /usr/share/filebeat/data - name: policy-data-filebeat - volumes: - - name: localtime - hostPath: - path: /etc/localtime - - name: filebeat-conf - configMap: - name: policy-filebeat-configmap - - name: policy-logs - emptyDir: {} - - name: policy-data-filebeat - emptyDir: {} - - name: policy-logback - configMap: - name: policy-pap-log-configmap - - name: policy-sdk-logback - configMap: - name: policy-sdk-log-configmap - - name: pe - configMap: - name: policy-dep-pe-configmap - defaultMode: 0755 - imagePullSecrets: - - name: "{{ .Values.nsPrefix }}-docker-registry-key" -#{{ end }} diff --git a/kubernetes/policy/templates/dep-pdp.yaml b/kubernetes/policy/templates/dep-pdp.yaml deleted file mode 100644 index 6b28ed0fdb..0000000000 --- a/kubernetes/policy/templates/dep-pdp.yaml +++ /dev/null @@ -1,108 +0,0 @@ -# Copyright © 2017 Amdocs, Bell Canada -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -#{{ if not .Values.disablePolicyPdp }} -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - name: policy-pdp - namespace: "{{ .Values.nsPrefix }}" -spec: - replicas: {{ .Values.pdpReplicas }} - selector: - matchLabels: - app: pdp - template: - metadata: - labels: - app: pdp - name: policy-pdp - spec: - initContainers: - - command: - - /root/ready.py - args: - - --container-name - - pap - env: - - name: NAMESPACE - valueFrom: - fieldRef: - apiVersion: v1 - fieldPath: metadata.namespace - image: "{{ .Values.image.readiness }}:{{ .Values.image.readinessVersion }}" - imagePullPolicy: {{ .Values.pullPolicy }} - name: pdp-readiness - containers: - - command: - - /bin/bash - - ./do-start.sh - - pdp - image: "{{ .Values.image.policyPe }}:{{ .Values.image.policyPeVersion }}" - imagePullPolicy: {{ .Values.pullPolicy }} - name: pdp - ports: - - containerPort: 8081 - readinessProbe: - tcpSocket: - port: 8081 - initialDelaySeconds: 5 - periodSeconds: 10 - volumeMounts: - - mountPath: /etc/localtime - name: localtime - readOnly: true - - mountPath: /tmp/policy-install/config - name: pe - - mountPath: /var/log/onap - name: policy-logs - - mountPath: /tmp/logback.xml - name: policy-logback - subPath: logback.xml - lifecycle: - postStart: - exec: - command: ["/bin/sh", "-c", "export LOG=wait_logback.log; touch $LOG; export SRC=/tmp/logback.xml; export DST=/opt/app/policy/servers/pdp/webapps/pdp/WEB-INF/classes/; while [ ! -e $DST ]; do echo 'Waiting for $DST...' >> $LOG; sleep 5; done; sleep 2; /bin/cp -f $SRC $DST; echo 'Done' >> $LOG"] - - image: {{ .Values.image.filebeat }} - imagePullPolicy: {{ .Values.pullPolicy }} - name: filebeat-onap - volumeMounts: - - mountPath: /usr/share/filebeat/filebeat.yml - name: filebeat-conf - subPath: filebeat.yml - - mountPath: /var/log/onap - name: policy-logs - - mountPath: /usr/share/filebeat/data - name: policy-data-filebeat - volumes: - - name: localtime - hostPath: - path: /etc/localtime - - name: filebeat-conf - configMap: - name: policy-filebeat-configmap - - name: policy-logs - emptyDir: {} - - name: policy-data-filebeat - emptyDir: {} - - name: policy-logback - configMap: - name: policy-pdp-log-configmap - - name: pe - configMap: - name: policy-dep-pe-configmap - defaultMode: 0755 - imagePullSecrets: - - name: "{{ .Values.nsPrefix }}-docker-registry-key" -#{{ end }} diff --git a/kubernetes/policy/templates/deployment.yaml b/kubernetes/policy/templates/deployment.yaml new file mode 100644 index 0000000000..88b3de35c0 --- /dev/null +++ b/kubernetes/policy/templates/deployment.yaml @@ -0,0 +1,162 @@ +# Copyright © 2017 Amdocs, Bell Canada +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: {{ include "common.fullname" . }} + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + replicas: {{ .Values.replicaCount }} + template: + metadata: + labels: + app: {{ include "common.name" . }} + release: {{ .Release.Name }} + spec: + initContainers: + - command: + - /root/ready.py + args: + - --container-name + - {{ .Values.global.mariadb.nameOverride }} + env: + - name: NAMESPACE + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.namespace + image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}" + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} + name: {{ include "common.name" . }}-readiness + - command: ["/bin/bash", "-c", "echo $POD_IP > /config/ip_addr.txt"] + env: + - name: POD_IP + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: status.podIP + volumeMounts: + - mountPath: /config/ + name: pe + image: {{ .Values.global.ubuntuImage }} + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} + name: generate-ip-addr-txt + containers: + - command: + - /bin/bash + - ./do-start.sh + - pap + name: {{ include "common.name" . }} + image: "{{ .Values.global.repository | default .Values.repository }}/{{ .Values.image }}" + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} + ports: + - containerPort: {{ .Values.service.externalPort }} + - containerPort: {{ .Values.service.externalPort2 }} + {{- if eq .Values.liveness.enabled true }} + livenessProbe: + tcpSocket: + port: {{ .Values.service.externalPort }} + initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }} + periodSeconds: {{ .Values.liveness.periodSeconds }} + {{ end -}} + readinessProbe: + tcpSocket: + port: {{ .Values.service.externalPort }} + initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }} + periodSeconds: {{ .Values.readiness.periodSeconds }} + env: + - name: PRELOAD_POLICIES + value: "{{ .Values.config.preloadPolicies }}" + volumeMounts: + - mountPath: /etc/localtime + name: localtime + readOnly: true + - mountPath: /tmp/policy-install/config/base.conf + name: pe + subPath: base.conf + - mountPath: /tmp/policy-install/config/ + name: pe-pap + - mountPath: /tmp/policy-install/do-start.sh + name: pe-scripts + subPath: do-start.sh + - mountPath: /var/log/onap + name: policy-logs + - mountPath: /tmp/policy-install/logback.xml + name: policy-sdk-logback + subPath: logback.xml + - mountPath: /tmp/logback.xml + name: policy-logback + subPath: logback.xml + lifecycle: + postStart: + exec: + command: ["/bin/sh", "-c", "export LOG=wait_logback.log; touch $LOG; export SRC=/tmp/logback.xml; export DST=/opt/app/policy/servers/pap/webapps/pap/WEB-INF/classes/; while [ ! -e $DST ]; do echo 'Waiting for $DST...' >> $LOG; sleep 5; done; sleep 2; /bin/cp -f $SRC $DST; export SRC=/tmp/policy-install/logback.xml; export DST=/opt/app/policy/servers/console/webapps/onap/WEB-INF/classes/; while [ ! -e $DST ]; do echo 'Waiting for $DST...' >> $LOG; sleep 5; done; sleep 2; /bin/cp -f $SRC $DST; echo 'Done' >> $LOG"] + - image: "{{ .Values.global.loggingRepository | default .Values.loggingRepository }}/{{ .Values.global.loggingImage | default .Values.loggingImage }}" + imagePullPolicy: {{ .Values.pullPolicy }} + name: filebeat-onap + volumeMounts: + - mountPath: /usr/share/filebeat/filebeat.yml + name: filebeat-conf + subPath: filebeat.yml + - mountPath: /var/log/onap + name: policy-logs + - mountPath: /usr/share/filebeat/data + name: policy-data-filebeat + resources: +{{ toYaml .Values.resources | indent 12 }} + {{- if .Values.nodeSelector }} + nodeSelector: +{{ toYaml .Values.nodeSelector | indent 10 }} + {{- end -}} + {{- if .Values.affinity }} + affinity: +{{ toYaml .Values.affinity | indent 10 }} + {{- end }} + volumes: + - name: localtime + hostPath: + path: /etc/localtime + - name: filebeat-conf + configMap: + name: {{ .Release.Name }}-filebeat-configmap + - name: policy-logs + emptyDir: {} + - name: policy-data-filebeat + emptyDir: {} + - name: policy-logback + configMap: + name: {{ include "common.fullname" . }}-log-configmap + - name: policy-sdk-logback + configMap: + name: {{ include "common.fullname" . }}-sdk-log-configmap + - name: pe + configMap: + name: {{ .Release.Name }}-pe-configmap + defaultMode: 0755 + - name: pe-scripts + configMap: + name: {{ .Release.Name }}-pe-scripts-configmap + defaultMode: 0777 + - name: pe-pap + configMap: + name: {{ include "common.fullname" . }}-pe-configmap + defaultMode: 0755 + imagePullSecrets: + - name: "{{ include "common.namespace" . }}-docker-registry-key" diff --git a/kubernetes/policy/templates/policy-deployment-configmap.yaml b/kubernetes/policy/templates/policy-deployment-configmap.yaml deleted file mode 100644 index 9998b2c320..0000000000 --- a/kubernetes/policy/templates/policy-deployment-configmap.yaml +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright © 2017 Amdocs, Bell Canada -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -#{{ if not .Values.disablePolicyDrools }} -apiVersion: v1 -kind: ConfigMap -metadata: - name: policy-dep-drools-settings-configmap - namespace: {{ .Values.nsPrefix }} -data: -{{ tpl (.Files.Glob "resources/config/drools/settings.xml").AsConfig . | indent 2 }} -#{{ end }} ---- -#{{ if not .Values.disablePolicyPdp }} -apiVersion: v1 -kind: ConfigMap -metadata: - name: policy-dep-pe-configmap - namespace: {{ .Values.nsPrefix }} -data: -{{ tpl (.Files.Glob "resources/config/opt/policy/config/pe/*").AsConfig . | indent 2 }} ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: policy-dep-drools-configmap - namespace: {{ .Values.nsPrefix }} -data: -{{ tpl (.Files.Glob "resources/config/opt/policy/config/drools/*").AsConfig . | indent 2 }} -#{{ end }} diff --git a/kubernetes/policy/templates/policy-deployment-secret.yaml b/kubernetes/policy/templates/policy-deployment-secret.yaml deleted file mode 100644 index 59bfa11df2..0000000000 --- a/kubernetes/policy/templates/policy-deployment-secret.yaml +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright © 2017 Amdocs, Bell Canada -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -#{{ if not .Values.disablePolicyDrools }} -apiVersion: v1 -kind: Secret -metadata: - name: policy-dep-drools-secret - namespace: {{ .Values.nsPrefix }} -type: Opaque -data: -{{ (.Files.Glob "resources/config/opt/policy/config/drools/keys/*").AsSecrets | indent 2 }} -#{{ end }} diff --git a/kubernetes/policy/templates/policy-log-configmap.yaml b/kubernetes/policy/templates/policy-log-configmap.yaml deleted file mode 100644 index 3a62030bd5..0000000000 --- a/kubernetes/policy/templates/policy-log-configmap.yaml +++ /dev/null @@ -1,59 +0,0 @@ -# Copyright © 2017 Amdocs, Bell Canada -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -#{{ if not .Values.disablePolicyPap }} -apiVersion: v1 -kind: ConfigMap -metadata: - name: policy-pap-log-configmap - namespace: {{ .Values.nsPrefix }} -data: -{{ tpl (.Files.Glob "resources/config/log/xacml-pap-rest/*").AsConfig . | indent 2 }} ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: policy-sdk-log-configmap - namespace: {{ .Values.nsPrefix }} -data: -{{ tpl (.Files.Glob "resources/config/log/ep_sdk_app/*").AsConfig . | indent 2 }} ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: policy-filebeat-configmap - namespace: {{ .Values.nsPrefix }} -data: -{{ tpl (.Files.Glob "resources/config/log/filebeat/*").AsConfig . | indent 2 }} -#{{ end }} -#{{ if not .Values.disablePolicyPdp }} ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: policy-pdp-log-configmap - namespace: {{ .Values.nsPrefix }} -data: -{{ tpl (.Files.Glob "resources/config/log/xacml-pdp-rest/*").AsConfig . | indent 2 }} -#{{ end }} -#{{ if not .Values.disablePolicyDrools }} ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: policy-drools-log-configmap - namespace: {{ .Values.nsPrefix }} -data: -{{ tpl (.Files.Glob "resources/config/log/drools/*").AsConfig . | indent 2 }} -#{{ end }} diff --git a/kubernetes/policy/templates/service.yaml b/kubernetes/policy/templates/service.yaml new file mode 100644 index 0000000000..4d7996042d --- /dev/null +++ b/kubernetes/policy/templates/service.yaml @@ -0,0 +1,42 @@ +# Copyright © 2017 Amdocs, Bell Canada +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: v1 +kind: Service +metadata: + name: {{ include "common.fullname" . }} + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + type: {{ .Values.service.type }} + ports: + {{if eq .Values.service.type "NodePort" -}} + - port: {{ .Values.service.externalPort }} + nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.nodePort }} + name: {{ .Values.service.name }}-{{ .Values.service.externalPort }} + - port: {{ .Values.service.externalPort2 }} + nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.nodePort2 }} + name: {{ .Values.service.name }}-{{ .Values.service.externalPort2 }} + {{- else -}} + - port: {{ .Values.service.externalPort }} + targetPort: {{ .Values.service.internalPort }} + name: {{ .Values.service.name }} + {{- end}} + selector: + app: {{ include "common.name" . }} + release: {{ .Release.Name }} -- cgit 1.2.3-korg