Consul Helm Chart Standardization 49/37549/12
authorjasmineWen <jasmine.wen@amdocs.com>
Wed, 21 Mar 2018 18:21:17 +0000 (18:21 +0000)
committerMike Elliott <mike.elliott@amdocs.com>
Mon, 2 Apr 2018 15:48:48 +0000 (11:48 -0400)
Issue-ID: OOM-730

Change-Id: I742979aa27022e553b33062762a1ad5f80940726
Signed-off-by: jasmineWen <jasmine.wen@amdocs.com>
13 files changed:
kubernetes/consul/Chart.yaml
kubernetes/consul/charts/consul-server/Chart.yaml [moved from kubernetes/consul/templates/consul-server-service.yaml with 54% similarity]
kubernetes/consul/charts/consul-server/requirements.yaml [new file with mode: 0644]
kubernetes/consul/charts/consul-server/templates/NOTES.txt [new file with mode: 0644]
kubernetes/consul/charts/consul-server/templates/deployment.yaml [moved from kubernetes/consul/templates/consul-server-deployment.yaml with 54% similarity]
kubernetes/consul/charts/consul-server/templates/service.yaml [new file with mode: 0644]
kubernetes/consul/charts/consul-server/values.yaml [new file with mode: 0644]
kubernetes/consul/requirements.yaml [new file with mode: 0644]
kubernetes/consul/templates/configmap.yaml [moved from kubernetes/consul/templates/consul-agent-configmap.yaml with 67% similarity]
kubernetes/consul/templates/deployment.yaml [moved from kubernetes/consul/templates/consul-agent-deployment.yaml with 59% similarity]
kubernetes/consul/templates/secrets.yaml [new file with mode: 0644]
kubernetes/consul/values.yaml
kubernetes/onap/requirements.yaml

index b82c39b..8cb1f1b 100644 (file)
@@ -13,6 +13,6 @@
 # limitations under the License.
 
 apiVersion: v1
-description: ONAP Consul Heath Monitor
+description: ONAP Consul Agent
 name: consul
-version: 1.1.0
+version: 2.0.0
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-#{{ if not .Values.disableConsulConsulServer }}
 apiVersion: v1
-kind: Service
-metadata:
-  labels:
-    app: consul-server
-  name: consul-server
-  namespace: "{{ .Values.nsPrefix }}"
-spec:
-  ports:
-  - name: consul-ui
-    nodePort: {{ .Values.nodePortPrefix }}70
-    port: 8500
-    protocol: TCP
-    targetPort: 8500
-  - name: consul-join
-    nodePort: {{ .Values.nodePortPrefix }}71
-    port: 8301
-    protocol: TCP
-    targetPort: 8301
-  selector:
-    app: consul-server
-  type: {{ .Values.service.type | quote }}
-#{{ end }}
\ No newline at end of file
+description: ONAP Consul Server
+name: consul-server
+version: 2.0.0
diff --git a/kubernetes/consul/charts/consul-server/requirements.yaml b/kubernetes/consul/charts/consul-server/requirements.yaml
new file mode 100644 (file)
index 0000000..f639633
--- /dev/null
@@ -0,0 +1,21 @@
+# 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.
+
+dependencies:
+  - name: common
+    version: ~2.0.0
+    # local reference to common chart, as it is
+    # a part of this chart's package and will not
+    # be published independently to a repo (at this point)
+    repository: '@local'
diff --git a/kubernetes/consul/charts/consul-server/templates/NOTES.txt b/kubernetes/consul/charts/consul-server/templates/NOTES.txt
new file mode 100644 (file)
index 0000000..2465e03
--- /dev/null
@@ -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.fullname" . }})
+  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.fullname" . }}'
+  export SERVICE_IP=$(kubectl get svc --namespace {{ include "common.namespace" . }} {{ include "common.fullname" . }} -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 }}
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-#{{ if not .Values.disableConsulConsulServer }}
 apiVersion: extensions/v1beta1
 kind: Deployment
 metadata:
+  name: {{ include "common.fullname" . }}
+  namespace: {{ include "common.namespace" . }}
   labels:
-    app: consul-server
-  name: consul-server
-  namespace: "{{ .Values.nsPrefix }}"
+    app: {{ include "common.name" . }}
+    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
+    release: {{ .Release.Name }}
+    heritage: {{ .Release.Service }}
 spec:
-  replicas: {{ .Values.consulServerReplicas }}
+  replicas: {{ .Values.replicaCount }}
   selector:
     matchLabels:
-      app: consul-server
+      app: {{ include "common.name" . }}
   template:
     metadata:
       labels:
-        app: consul-server
-      name: consul-server
+        app: {{ include "common.name" . }}
+        release: {{ .Release.Name }}
+      name: {{ include "common.name" . }}
     spec:
       containers:
-      - image: "{{ .Values.consulserverRegistry }}"
+      - image: "{{ .Values.repository | default .Values.global.repository }}/{{ .Values.image }}"
         command: ["/usr/local/bin/docker-entrypoint.sh"]
-        args: ["agent","-server","-client","0.0.0.0","-enable-script-checks","-bootstrap-expect=3","-ui","-join","consul-server.{{ .Values.nsPrefix }}"]
-        name: consul-server
-#{{ end }}
+        args: ["agent","-server","-client","0.0.0.0","-enable-script-checks","-bootstrap-expect=3","-ui","-join","{{ include "common.fullname" . }}.{{ include "common.namespace" . }}"]
+        name: {{ include "common.name" . }}
diff --git a/kubernetes/consul/charts/consul-server/templates/service.yaml b/kubernetes/consul/charts/consul-server/templates/service.yaml
new file mode 100644 (file)
index 0000000..3b17164
--- /dev/null
@@ -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: 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:
+    - port: {{ .Values.service.internalPort }}
+      targetPort: {{ .Values.service.internalPort }}
+      nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.nodePort }}
+      name: {{ .Values.service.name }}
+    - port: {{ .Values.service.internalPort2 }}
+      targetPort: {{ .Values.service.internalPort2 }}
+      nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.nodePort2 }}
+      name: {{ .Values.service.name2 }}
+  selector:
+    app: {{ template "common.name" . }}
+    release: {{ .Release.Name }}
diff --git a/kubernetes/consul/charts/consul-server/values.yaml b/kubernetes/consul/charts/consul-server/values.yaml
new file mode 100644 (file)
index 0000000..2a57e3a
--- /dev/null
@@ -0,0 +1,67 @@
+# 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.
+#################################################################
+# Global configuration defaults.
+#################################################################
+global:
+  nodePortPrefix: 302
+  repository: nexus3.onap.org:10001
+  repositorySecret: eyJuZXh1czMub25hcC5vcmc6MTAwMDEiOnsidXNlcm5hbWUiOiJkb2NrZXIiLCJwYXNzd29yZCI6ImRvY2tlciIsImVtYWlsIjoiQCIsImF1dGgiOiJaRzlqYTJWeU9tUnZZMnRsY2c9PSJ9fQ==
+  readinessRepository: oomk8s
+  readinessImage: readiness-check:1.0.0
+  loggingRepository: docker.elastic.co
+  loggingImage: beats/filebeat:5.5.0
+
+#################################################################
+# Application configuration defaults.
+#################################################################
+# application image
+repository: docker.io
+image: consul:1.0.6
+pullPolicy: Always
+
+# flag to enable debugging - application support required
+debugEnabled: false
+
+replicaCount: 3
+
+nodeSelector: {}
+
+affinity: {}
+
+# probe configuration parameters
+liveness:
+  initialDelaySeconds: 10
+  periodSeconds: 10
+  # necessary to disable liveness probe when setting breakpoints
+  # in debugger so K8s doesn't restart unresponsive container
+  enabled: true
+
+readiness:
+  initialDelaySeconds: 10
+  periodSeconds: 10
+
+service:
+  type: NodePort
+  name: consul-ui
+  nodePort: 70
+  internalPort: 8500
+  name2: consul-join
+  nodePort2: 71
+  internalPort2: 8301
+
+ingress:
+  enabled: false
+
+resources: {}
diff --git a/kubernetes/consul/requirements.yaml b/kubernetes/consul/requirements.yaml
new file mode 100644 (file)
index 0000000..f639633
--- /dev/null
@@ -0,0 +1,21 @@
+# 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.
+
+dependencies:
+  - name: common
+    version: ~2.0.0
+    # local reference to common chart, as it is
+    # a part of this chart's package and will not
+    # be published independently to a repo (at this point)
+    repository: '@local'
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-#{{ if not .Values.disableConsulConsulAgent }}
 apiVersion: v1
 kind: ConfigMap
 metadata:
-  name: consul-agent-configmap
-  namespace: {{ .Values.nsPrefix }}
+  name: {{ include "common.fullname" . }}-configmap
+  namespace: {{ include "common.namespace" . }}
 data:
 {{ tpl (.Files.Glob "resources/config/consul-agent-config/*").AsConfig . | indent 2 }}
 ---
 apiVersion: v1
 kind: ConfigMap
 metadata:
-  name: consul-agent-scripts-configmap
-  namespace: {{ .Values.nsPrefix }}
+  name: {{ include "common.fullname" . }}-scripts-configmap
+  namespace: {{ include "common.namespace" . }}
 data:
 {{ tpl (.Files.Glob "resources/config/consul-agent-config/scripts/*").AsConfig . | indent 2 }}
----
-apiVersion: v1
-kind: Secret
-metadata:
-  name: consul-agent-certs-secret
-  namespace: {{ .Values.nsPrefix }}
-data:
-{{ tpl (.Files.Glob "resources/config/consul-agent-config/certs/*").AsSecrets . | indent 2 }}
-#{{ end }}
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-#{{ if not .Values.disableConsulConsulAgent }}
 apiVersion: extensions/v1beta1
 kind: Deployment
 metadata:
+  name: {{ include "common.fullname" . }}
+  namespace: {{ include "common.namespace" . }}
   labels:
-    app: consul-agent
-  name: consul-agent
-  namespace: "{{ .Values.nsPrefix }}"
+    app: {{ include "common.name" . }}
+    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
+    release: {{ .Release.Name }}
+    heritage: {{ .Release.Service }}
 spec:
-  replicas: {{ .Values.consulAgentReplicas }}
+  replicas: {{ .Values.replicaCount }}
   selector:
     matchLabels:
-      app: consul-agent
+      app: {{ include "common.name" . }}
   template:
     metadata:
       labels:
-        app: consul-agent
-      name: consul-agent
+        app: {{ include "common.name" . }}
+        release: {{ .Release.Name }}
+      name: {{ include "common.name" . }}
     spec:
       containers:
-      - image: "{{ .Values.consulagentRegistry }}"
+      - image: "{{ .Values.repository | default .Values.global.repository }}/{{ .Values.image }}"
         command: ["/usr/local/bin/docker-entrypoint.sh"]
-        args: ["agent","-client","0.0.0.0","-enable-script-checks","-join","consul-server.{{ .Values.nsPrefix }}"]
-        name: consul-server
+        args: ["agent","-client","0.0.0.0","-enable-script-checks","-join","{{ .Release.Name }}-{{ index .Values "consul-server" "nameOverride" }}.{{ include "common.namespace" .}}"]
+        name: {{ include "common.name" . }}
         volumeMounts:
         - mountPath: /consul/config
           name: consul-agent-config
@@ -45,13 +48,13 @@ spec:
           name: consul-agent-certs-config
       volumes:
       - configMap:
-          name: consul-agent-configmap
+          name: {{ include "common.fullname" . }}-configmap
         name: consul-agent-config
       - configMap:
-          name: consul-agent-scripts-configmap
+          name: {{ include "common.fullname" . }}-scripts-configmap
           defaultMode: 0755
         name: consul-agent-scripts-config
       - secret:
-          secretName: consul-agent-certs-secret
+          secretName: {{ include "common.fullname" . }}-certs-secret
         name: consul-agent-certs-config
-#{{ end }}
+
diff --git a/kubernetes/consul/templates/secrets.yaml b/kubernetes/consul/templates/secrets.yaml
new file mode 100644 (file)
index 0000000..2535437
--- /dev/null
@@ -0,0 +1,7 @@
+apiVersion: v1
+kind: Secret
+metadata:
+  name: {{ include "common.fullname" . }}-certs-secret
+  namespace: {{ include "common.namespace" . }}
+data:
+{{ tpl (.Files.Glob "resources/config/consul-agent-config/certs/*").AsSecrets . | indent 2 }}
index e86937a..74d0ccd 100644 (file)
 # 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.
+#################################################################
+# Global configuration defaults.
+#################################################################
+global:
+  nodePortPrefix: 302
+  repository: nexus3.onap.org:10001
+  repositorySecret: eyJuZXh1czMub25hcC5vcmc6MTAwMDEiOnsidXNlcm5hbWUiOiJkb2NrZXIiLCJwYXNzd29yZCI6ImRvY2tlciIsImVtYWlsIjoiQCIsImF1dGgiOiJaRzlqYTJWeU9tUnZZMnRsY2c9PSJ9fQ==
+  readinessRepository: oomk8s
+  readinessImage: readiness-check:1.0.0
+  loggingRepository: docker.elastic.co
+  loggingImage: beats/filebeat:5.5.0
 
-nsPrefix: "onap"
-nodePortPrefix: 302
-consulserverRegistry: "docker.io/consul:1.0.6"
-consulagentRegistry: "oomk8s/consul:1.0.0"
-consulAgentReplicas: 1
-consulServerReplicas: 3
-service:
-      type: NodePort
+#################################################################
+# Application configuration defaults.
+#################################################################
+# application image
+repository: oomk8s
+image: consul:1.0.0
+pullPolicy: Always
+
+#subchart name
+consul-server:
+  nameOverride: consul-server
+
+# flag to enable debugging - application support required
+debugEnabled: false
+
+# default number of instances
+replicaCount: 1
+
+nodeSelector: {}
+
+affinity: {}
+
+# probe configuration parameters
+liveness:
+  initialDelaySeconds: 10
+  periodSeconds: 10
+  # necessary to disable liveness probe when setting breakpoints
+  # in debugger so K8s doesn't restart unresponsive container
+  enabled: true
+
+readiness:
+  initialDelaySeconds: 10
+  periodSeconds: 10
+
+service: {}
+
+ingress:
+  enabled: false
+
+resources: {}
index 7d33742..2efbb5c 100644 (file)
@@ -41,7 +41,7 @@ dependencies:
     version: ~2.0.0
     repository: '@local'
   - name: consul
-    version: ~1.1.0
+    version: ~2.0.0
     repository: '@local'
     condition: consul.enabled
   - name: dcaegen2