summaryrefslogtreecommitdiffstats
path: root/kubernetes/common
diff options
context:
space:
mode:
Diffstat (limited to 'kubernetes/common')
-rw-r--r--kubernetes/common/common/templates/_repository.tpl31
-rw-r--r--kubernetes/common/common/templates/_service.tpl30
-rw-r--r--kubernetes/common/common/values.yaml2
-rw-r--r--kubernetes/common/dgbuilder/resources/config/svclogic.properties2
-rwxr-xr-xkubernetes/common/dgbuilder/resources/scripts/createReleaseDir.sh12
-rw-r--r--kubernetes/common/dgbuilder/resources/scripts/customSettings.js2
-rw-r--r--kubernetes/common/dgbuilder/templates/deployment.yaml8
-rw-r--r--kubernetes/common/dgbuilder/values.yaml9
-rw-r--r--kubernetes/common/mysql/Chart.yaml14
-rw-r--r--kubernetes/common/mysql/requirements.yaml16
-rw-r--r--kubernetes/common/mysql/templates/configmap.yaml16
-rw-r--r--kubernetes/common/mysql/templates/nfs-provisoner.yaml24
-rw-r--r--kubernetes/common/mysql/templates/pv.yaml18
-rw-r--r--kubernetes/common/mysql/templates/pvc.yaml18
-rw-r--r--kubernetes/common/mysql/templates/secrets.yaml18
-rw-r--r--kubernetes/common/mysql/templates/service.yaml42
-rw-r--r--kubernetes/common/mysql/templates/statefulset.yaml63
-rw-r--r--kubernetes/common/mysql/templates/storageclass.yaml18
-rw-r--r--kubernetes/common/mysql/values.yaml26
-rw-r--r--kubernetes/common/postgres/.helmignore21
-rw-r--r--kubernetes/common/postgres/Chart.yaml18
-rw-r--r--kubernetes/common/postgres/requirements.yaml18
-rw-r--r--kubernetes/common/postgres/templates/pv.yaml58
-rw-r--r--kubernetes/common/postgres/templates/secrets.yaml31
-rw-r--r--kubernetes/common/postgres/templates/service.yaml95
-rw-r--r--kubernetes/common/postgres/templates/statefulset.yaml147
-rw-r--r--kubernetes/common/postgres/values.yaml127
27 files changed, 826 insertions, 58 deletions
diff --git a/kubernetes/common/common/templates/_repository.tpl b/kubernetes/common/common/templates/_repository.tpl
new file mode 100644
index 0000000000..e054b571ad
--- /dev/null
+++ b/kubernetes/common/common/templates/_repository.tpl
@@ -0,0 +1,31 @@
+{{/*
+# 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.
+*/}}
+
+{{/*
+ Resolve the name of the common image repository.
+ The value for .Values.repository is used by default,
+ unless either override mechanism is used.
+
+ - .Values.global.repository : override default image repository for all images
+ - .Values.repositoryOverride : override global and default image repository on a per image basis
+*/}}
+{{- define "common.repository" -}}
+ {{if .Values.repositoryOverride }}
+ {{- printf "%s" .Values.repositoryOverride -}}
+ {{else}}
+ {{- default .Values.repository .Values.global.repository -}}
+ {{end}}
+{{- end -}} \ No newline at end of file
diff --git a/kubernetes/common/common/templates/_service.tpl b/kubernetes/common/common/templates/_service.tpl
new file mode 100644
index 0000000000..25e373a7c9
--- /dev/null
+++ b/kubernetes/common/common/templates/_service.tpl
@@ -0,0 +1,30 @@
+{{/*
+# 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.
+*/}}
+
+{{/*
+ Resolve the name of a chart's service.
+
+ The default will be the chart name, unless
+ overridden in the service configuration.
+
+ - .Values.service.name : override default service (ie. chart) name
+*/}}
+{{/*
+ Expand the service name for a chart.
+*/}}
+{{- define "common.servicename" -}}
+ {{- default .Chart.Name .Values.service.name | trunc 63 | trimSuffix "-" -}}
+{{- end -}} \ No newline at end of file
diff --git a/kubernetes/common/common/values.yaml b/kubernetes/common/common/values.yaml
index c8ded9a5dd..f834896677 100644
--- a/kubernetes/common/common/values.yaml
+++ b/kubernetes/common/common/values.yaml
@@ -27,7 +27,7 @@ global:
# readiness check
readinessRepository: oomk8s
- readinessImage: readiness-check:1.1.0
+ readinessImage: readiness-check:2.0.0
# logging agent
loggingRepository: docker.elastic.co
diff --git a/kubernetes/common/dgbuilder/resources/config/svclogic.properties b/kubernetes/common/dgbuilder/resources/config/svclogic.properties
index fdaf5779e2..dc3980de21 100644
--- a/kubernetes/common/dgbuilder/resources/config/svclogic.properties
+++ b/kubernetes/common/dgbuilder/resources/config/svclogic.properties
@@ -1,5 +1,5 @@
org.onap.ccsdk.sli.dbtype=jdbc
-org.onap.ccsdk.sli.jdbc.url=jdbc:mysql://{{.Values.dbServiceName}}.{{ include "common.namespace" . }}:3306/sdnctl
+org.onap.ccsdk.sli.jdbc.url=jdbc:mysql://{{.Values.config.dbServiceName}}.{{ include "common.namespace" . }}:3306/sdnctl
org.onap.ccsdk.sli.jdbc.database=sdnctl
org.onap.ccsdk.sli.jdbc.user=sdnctl
org.onap.ccsdk.sli.jdbc.password=gamma
diff --git a/kubernetes/common/dgbuilder/resources/scripts/createReleaseDir.sh b/kubernetes/common/dgbuilder/resources/scripts/createReleaseDir.sh
index 38f7fe2720..76d17700b0 100755
--- a/kubernetes/common/dgbuilder/resources/scripts/createReleaseDir.sh
+++ b/kubernetes/common/dgbuilder/resources/scripts/createReleaseDir.sh
@@ -6,7 +6,7 @@ then
echo "Usage $0 releaseDir loginId emailAddress [gitLocalRepository]"
echo "Note: Specify the gitLocalRepository path if you would want to be able to import flows from your local git repository"
exit
-fi
+fi
if [ ! -e "releases" ]
then
mkdir releases
@@ -15,7 +15,7 @@ releaseDir="$1"
name="Release $releaseDir"
loginId="$2"
emailid="$3"
-dbHost="{{.Values.dbServiceName}}.{{.Release.Namespace}}"
+dbHost="{{.Values.config.dbServiceName}}.{{.Release.Namespace}}"
dbPort="3306"
dbName="sdnctl"
dbUser="sdnctl"
@@ -76,7 +76,7 @@ fi
#echo "Created custom settings file $customSettingsFile"
echo "Done ....."
else
- echo "ERROR:customSettings file $customSettingsFile already exists for $releaseDir"
+ echo "ERROR:customSettings file $customSettingsFile already exists for $releaseDir"
exit
fi
#echo "Content of custom settings file"
@@ -86,17 +86,17 @@ fi
svclogicPropFile="./conf/svclogic.properties"
if [ ! -d "${appDir}/yangFiles" ]
then
- mkdir -p "${appDir}/yangFiles"
+ mkdir -p "${appDir}/yangFiles"
fi
if [ ! -d "${appDir}/generatedJS" ]
then
- mkdir -p "${appDir}/generatedJS"
+ mkdir -p "${appDir}/generatedJS"
fi
if [ ! -e "./$svclogicPropFile" ]
then
echo "org.onap.ccsdk.sli.dbtype=jdbc" >$svclogicPropFile
- echo "org.onap.ccsdk.sli.jdbc.url=jdbc:mysql://{{.Values.dbServiceName}}.{{.Release.Namespace}}:3306/sdnctl" >>$svclogicPropFile
+ echo "org.onap.ccsdk.sli.jdbc.url=jdbc:mysql://{{.Values.config.dbServiceName}}.{{.Release.Namespace}}:3306/sdnctl" >>$svclogicPropFile
echo "org.onap.ccsdk.sli.jdbc.database=sdnctl" >>$svclogicPropFile
echo "org.onap.ccsdk.sli.jdbc.user=sdnctl" >>$svclogicPropFile
echo "org.onap.ccsdk.sli.jdbc.password=gamma" >>$svclogicPropFile
diff --git a/kubernetes/common/dgbuilder/resources/scripts/customSettings.js b/kubernetes/common/dgbuilder/resources/scripts/customSettings.js
index 01bbcc733d..22810baabd 100644
--- a/kubernetes/common/dgbuilder/resources/scripts/customSettings.js
+++ b/kubernetes/common/dgbuilder/resources/scripts/customSettings.js
@@ -29,7 +29,7 @@ module.exports={
"user": "dguser",
"pass": "cc03e747a6afbbcbf8be7668acfebee5"
},
- "dbHost": "{{.Values.dbServiceName}}.{{ include "common.namespace" . }}",
+ "dbHost": "{{.Values.config.dbServiceName}}.{{ include "common.namespace" . }}",
"dbPort": "3306",
"dbName": "sdnctl",
"dbUser": "sdnctl",
diff --git a/kubernetes/common/dgbuilder/templates/deployment.yaml b/kubernetes/common/dgbuilder/templates/deployment.yaml
index 4e1f1019ee..a1e95682ee 100644
--- a/kubernetes/common/dgbuilder/templates/deployment.yaml
+++ b/kubernetes/common/dgbuilder/templates/deployment.yaml
@@ -21,7 +21,7 @@ spec:
- /root/ready.py
args:
- --container-name
- - {{ .Values.dbPodName }}
+ - {{ .Values.config.dbPodName }}
env:
- name: NAMESPACE
valueFrom:
@@ -35,10 +35,8 @@ spec:
- name: {{ include "common.name" . }}
image: "{{ .Values.global.repository | default .Values.repository }}/{{ .Values.image }}"
imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
- command:
- - /bin/bash
- - -c
- - cd /opt/onap/sdnc/dgbuilder/ && ./start.sh sdnc1.0 && wait
+ command: ["/bin/bash"]
+ args: ["-c", "cd /opt/onap/ccsdk/dgbuilder/ && ./start.sh sdnc1.0 && wait"]
ports:
- containerPort: {{ .Values.service.internalPort }}
readinessProbe:
diff --git a/kubernetes/common/dgbuilder/values.yaml b/kubernetes/common/dgbuilder/values.yaml
index 23f8eea78e..8b4a07a350 100644
--- a/kubernetes/common/dgbuilder/values.yaml
+++ b/kubernetes/common/dgbuilder/values.yaml
@@ -12,7 +12,7 @@ global:
# readiness check
readinessRepository: oomk8s
- readinessImage: readiness-check:1.0.0
+ readinessImage: readiness-check:2.0.0
# logging agent
loggingRepository: docker.elastic.co
@@ -28,13 +28,13 @@ global:
# flag to enable debugging - application support required
debugEnabled: true
-
+
#################################################################
# Application configuration defaults.
#################################################################
# application image
repository: nexus3.onap.org:10001
-image: onap/ccsdk-dgbuilder-image:v0.1.0
+image: onap/ccsdk-dgbuilder-image:0.2.1-SNAPSHOT
pullPolicy: Always
# flag to enable debugging - application support required
@@ -43,6 +43,9 @@ debugEnabled: false
# application configuration
config:
dbRootPassword: openECOMP1.0
+ dbPodName: mysql-db
+ dbServiceName: sdnc-dbhost
+
# default number of instances
replicaCount: 1
diff --git a/kubernetes/common/mysql/Chart.yaml b/kubernetes/common/mysql/Chart.yaml
index 99e7c44fb9..b2e7d4aa93 100644
--- a/kubernetes/common/mysql/Chart.yaml
+++ b/kubernetes/common/mysql/Chart.yaml
@@ -1,3 +1,17 @@
+# 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
description: MySQL Server
name: mysql
diff --git a/kubernetes/common/mysql/requirements.yaml b/kubernetes/common/mysql/requirements.yaml
index acca8ef7e2..ce82a2f838 100644
--- a/kubernetes/common/mysql/requirements.yaml
+++ b/kubernetes/common/mysql/requirements.yaml
@@ -1,4 +1,18 @@
+# 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
- repository: '@local' \ No newline at end of file
+ repository: '@local'
diff --git a/kubernetes/common/mysql/templates/configmap.yaml b/kubernetes/common/mysql/templates/configmap.yaml
index dd2b5b7db2..ff127e48cd 100644
--- a/kubernetes/common/mysql/templates/configmap.yaml
+++ b/kubernetes/common/mysql/templates/configmap.yaml
@@ -1,3 +1,19 @@
+{{/*
+# 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:
diff --git a/kubernetes/common/mysql/templates/nfs-provisoner.yaml b/kubernetes/common/mysql/templates/nfs-provisoner.yaml
index 478224e1a1..35894df7a7 100644
--- a/kubernetes/common/mysql/templates/nfs-provisoner.yaml
+++ b/kubernetes/common/mysql/templates/nfs-provisoner.yaml
@@ -1,8 +1,24 @@
-#{{ if not .Values.disableNfsProvisioner }}
+{{/*
+# 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.disableNfsProvisioner }}
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
- name: {{ .Values.nfsprovisionerPrefix }}-nfs-provisioner
+ name: {{ .Release.Name }}-{{ .Values.nfsprovisionerPrefix }}-nfs-provisioner
namespace: {{ include "common.namespace" . }}
labels:
app: {{ include "common.name" . }}
@@ -46,7 +62,7 @@ spec:
fieldRef:
fieldPath: status.podIP
- name: SERVICE_NAME
- value: {{ .Values.nfsprovisionerPrefix }}-nfs-provisioner
+ value: {{ .Release.Name }}-{{ .Values.nfsprovisionerPrefix }}-nfs-provisioner
- name: POD_NAMESPACE
valueFrom:
fieldRef:
@@ -59,4 +75,4 @@ spec:
- name: export-volume
hostPath:
path: {{ .Values.global.persistence.mountPath | default .Values.persistence.mountPath }}/{{ .Release.Namespace }}/{{ .Values.persistence.mountSubPath }}
-#{{ end }}
+{{ end }}
diff --git a/kubernetes/common/mysql/templates/pv.yaml b/kubernetes/common/mysql/templates/pv.yaml
index ba128b95d0..1cc92ace44 100644
--- a/kubernetes/common/mysql/templates/pv.yaml
+++ b/kubernetes/common/mysql/templates/pv.yaml
@@ -1,4 +1,20 @@
-{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) -}}
+{{/*
+# 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 (and (and (.Values.persistence.enabled) (not .Values.persistence.existingClaim)) ( .Values.disableNfsProvisioner)) -}}
kind: PersistentVolume
apiVersion: v1
metadata:
diff --git a/kubernetes/common/mysql/templates/pvc.yaml b/kubernetes/common/mysql/templates/pvc.yaml
index a2949fef36..d1558f131f 100644
--- a/kubernetes/common/mysql/templates/pvc.yaml
+++ b/kubernetes/common/mysql/templates/pvc.yaml
@@ -1,3 +1,19 @@
+{{/*
+# 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 and .Values.persistence.enabled (not .Values.persistence.existingClaim) -}}
kind: PersistentVolumeClaim
apiVersion: v1
@@ -20,4 +36,4 @@ spec:
requests:
storage: {{ .Values.persistence.size }}
storageClassName: "{{ include "common.fullname" . }}-data"
-{{- end -}} \ No newline at end of file
+{{- end -}}
diff --git a/kubernetes/common/mysql/templates/secrets.yaml b/kubernetes/common/mysql/templates/secrets.yaml
index 7604be8239..7f9b1230eb 100644
--- a/kubernetes/common/mysql/templates/secrets.yaml
+++ b/kubernetes/common/mysql/templates/secrets.yaml
@@ -1,3 +1,19 @@
+{{/*
+# 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: Secret
metadata:
@@ -10,4 +26,4 @@ metadata:
heritage: {{ .Release.Service }}
type: Opaque
data:
- db-root-password: {{ .Values.config.dbRootPassword | b64enc | quote }} \ No newline at end of file
+ db-root-password: {{ .Values.config.dbRootPassword | b64enc | quote }}
diff --git a/kubernetes/common/mysql/templates/service.yaml b/kubernetes/common/mysql/templates/service.yaml
index c6a28c4605..032920c760 100644
--- a/kubernetes/common/mysql/templates/service.yaml
+++ b/kubernetes/common/mysql/templates/service.yaml
@@ -1,3 +1,19 @@
+{{/*
+# 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:
@@ -21,7 +37,7 @@ spec:
kind: Service
apiVersion: v1
metadata:
- name: {{ .Values.nfsprovisionerPrefix }}-nfs-provisioner
+ name: {{ .Release.Name }}-{{ .Values.nfsprovisionerPrefix }}-nfs-provisioner
namespace: {{ include "common.namespace" . }}
labels:
app: {{ .Values.nfsprovisionerPrefix }}-nfs-provisioner
@@ -88,3 +104,27 @@ spec:
app: {{ include "common.name" . }}
release: {{ .Release.Name }}
clusterIP: None
+---
+{{ if .Values.geoEnabled }}
+apiVersion: v1
+kind: Service
+metadata:
+ name: {{ .Values.service.name }}-nodeport
+ namespace: {{ include "common.namespace" . }}
+ labels:
+ statefulset.kubernetes.io/pod-name: {{ include "common.fullname" . }}-0
+spec:
+ ports:
+ - name: {{ .Values.service.internalPort }}
+ port: {{ .Values.service.internalPort }}
+ targetPort: {{ .Values.service.internalPort }}
+ nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.externalPort1 }}
+ - name: {{ .Values.xtrabackup.internalPort }}
+ port: {{ .Values.xtrabackup.internalPort }}
+ targetPort: {{ .Values.xtrabackup.internalPort }}
+ nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.externalPort2 }}
+ type: NodePort
+ selector:
+ statefulset.kubernetes.io/pod-name: {{ include "common.fullname" . }}-0
+ release: {{ .Release.Name }}
+{{ end }}
diff --git a/kubernetes/common/mysql/templates/statefulset.yaml b/kubernetes/common/mysql/templates/statefulset.yaml
index 7b55bf2be0..ff73b45620 100644
--- a/kubernetes/common/mysql/templates/statefulset.yaml
+++ b/kubernetes/common/mysql/templates/statefulset.yaml
@@ -1,3 +1,19 @@
+{{/*
+# 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: apps/v1beta1
kind: StatefulSet
metadata:
@@ -35,7 +51,7 @@ spec:
imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
#{{ end }}
- name: init-mysql
- image: "{{ .Values.repository | default .Values.repository }}/{{ .Values.image }}"
+ image: "{{ .Values.dockerHubRepository }}/{{ .Values.image }}"
imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
command:
- bash
@@ -45,10 +61,11 @@ spec:
# Generate mysql server-id from pod ordinal index.
[[ `hostname` =~ -([0-9]+)$ ]] || exit 1
ordinal=${BASH_REMATCH[1]}
+ siteId={{ .Values.geoSiteId }}
echo BASH_REMATCH=${BASH_REMATCH}
echo [mysqld] > /mnt/conf.d/server-id.cnf
# Add an offset to avoid reserved server-id=0 value.
- echo server-id=$((100 + $ordinal)) >> /mnt/conf.d/server-id.cnf
+ echo server-id=$(($siteId*100 + $ordinal)) >> /mnt/conf.d/server-id.cnf
# Copy appropriate conf.d files from config-map to emptyDir.
if [[ $ordinal -eq 0 ]]; then
cp /mnt/config-map/master.cnf /mnt/conf.d/
@@ -83,21 +100,19 @@ spec:
echo ${BASH_REMATCH}
[[ $ordinal -eq 0 ]] && exit 0
# Clone data from previous peer.
- ncat --recv-only {{ template "common.name" . }}-$(($ordinal-1)).{{ .Values.service.name }}.{{ include "common.namespace" . }} 3307 | xbstream -x -C /var/lib/mysql
+ ncat --recv-only {{ include "common.fullname" . }}-$(($ordinal-1)).{{ .Values.service.name }}.{{ include "common.namespace" . }} 3307 | xbstream -x -C /var/lib/mysql
# Prepare the backup.
xtrabackup --user=root --password=$MYSQL_ROOT_PASSWORD --prepare --target-dir=/var/lib/mysql
ls -l /var/lib/mysql
volumeMounts:
- name: {{ include "common.fullname" . }}-data
mountPath: /var/lib/mysql
- subPath: mysql
- name: conf
mountPath: /etc/mysql/conf.d
-
+
containers:
- #sdnc-db-container
- name: {{ include "common.name" . }}
- image: "{{ .Values.repository | default .Values.repository }}/{{ .Values.image }}"
+ image: "{{ .Values.dockerHubRepository }}/{{ .Values.image }}"
imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
ports:
- containerPort: {{ .Values.service.internalPort }}
@@ -129,7 +144,6 @@ spec:
volumeMounts:
- mountPath: /var/lib/mysql
name: {{ include "common.fullname" . }}-data
- subPath: mysql
- mountPath: /etc/mysql/conf.d
name: conf
resources:
@@ -179,20 +193,24 @@ spec:
MASTER_LOG_POS=${BASH_REMATCH[2]}" > change_master_to.sql.in
fi
+ [[ `hostname` =~ -([0-9]+)$ ]] || exit 1
+ ordinal=${BASH_REMATCH[1]}
+ echo $ordinal
+
+ mysqlhost={{ include "common.fullname" . }}-$(($ordinal)).{{ .Values.service.name }}.{{ include "common.namespace" . }}
+ echo $mysqlhost
+
# Check if we need to complete a clone by starting replication.
if [[ -f change_master_to.sql.in ]]; then
echo "Waiting for mysqld to be ready (accepting connections)"
- [[ `hostname` =~ -([0-9]+)$ ]] || exit 1
- ordinal=${BASH_REMATCH[1]}
- echo $ordinal
- until mysql --user=root --password=$MYSQL_ROOT_PASSWORD -h localhost -e "SELECT 1"; do sleep 1; done
+ until mysql --user=root --password=$MYSQL_ROOT_PASSWORD -h $mysqlhost -e "SELECT 1"; do sleep 1; done
echo "Initializing replication from clone position"
# In case of container restart, attempt this at-most-once.
mv change_master_to.sql.in change_master_to.sql.orig
- mysql --user=root --password=$MYSQL_ROOT_PASSWORD -h localhost <<EOF
+ mysql --user=root --password=$MYSQL_ROOT_PASSWORD -h $mysqlhost <<EOF
$(<change_master_to.sql.orig),
- MASTER_HOST="{{ template "common.name" . }}-0.{{ .Values.service.name }}.{{ include "common.namespace" . }}",
+ MASTER_HOST="{{ include "common.fullname" . }}-0.{{ .Values.service.name }}.{{ include "common.namespace" . }}",
MASTER_USER="root",
MASTER_PASSWORD="$MYSQL_ROOT_PASSWORD",
MASTER_CONNECT_RETRY=10;
@@ -202,11 +220,10 @@ spec:
# Start a server to send backups when requested by peers.
exec ncat --listen --keep-open --send-only --max-conns=1 3307 -c \
- "xtrabackup --user=root --password=$MYSQL_ROOT_PASSWORD --backup --slave-info --stream=xbstream --host=localhost"
+ "xtrabackup --user=root --password=$MYSQL_ROOT_PASSWORD --backup --slave-info --stream=xbstream --host=$mysqlhost"
volumeMounts:
- name: {{ include "common.fullname" . }}-data
mountPath: /var/lib/mysql
- subPath: mysql
- name: conf
mountPath: /etc/mysql/conf.d
volumes:
@@ -219,20 +236,10 @@ spec:
hostPath:
path: /etc/localtime
- name: {{ include "common.fullname" . }}-data
-#{{ if not .Values.disableNfsProvisioner }}
- volumeClaimTemplates:
- - metadata:
- name: {{ include "common.fullname" . }}-data
- annotations:
- volume.beta.kubernetes.io/storage-class: "{{ include "common.fullname" . }}-data"
- spec:
- accessModes: ["ReadWriteMany"]
- resources:
- requests:
- storage: 1Gi
-#{{ else if .Values.persistence.enabled }}
+#{{ if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ include "common.fullname" . }}-data
#{{ else }}
emptyDir: {}
#{{ end }}
+
diff --git a/kubernetes/common/mysql/templates/storageclass.yaml b/kubernetes/common/mysql/templates/storageclass.yaml
index 1a4e6b6bb7..3cd502ea30 100644
--- a/kubernetes/common/mysql/templates/storageclass.yaml
+++ b/kubernetes/common/mysql/templates/storageclass.yaml
@@ -1,6 +1,24 @@
+{{/*
+# 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.disableNfsProvisioner }}
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: "{{ include "common.fullname" . }}-data"
namespace: {{ include "common.namespace" . }}
provisioner: {{ include "common.fullname" . }}/nfs
+{{ end }}
diff --git a/kubernetes/common/mysql/values.yaml b/kubernetes/common/mysql/values.yaml
index c0beb6fd22..40310a89d7 100644
--- a/kubernetes/common/mysql/values.yaml
+++ b/kubernetes/common/mysql/values.yaml
@@ -1,3 +1,17 @@
+# 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.
#################################################################
@@ -6,15 +20,14 @@ global:
repositorySecret: eyJuZXh1czMub25hcC5vcmc6MTAwMDEiOnsidXNlcm5hbWUiOiJkb2NrZXIiLCJwYXNzd29yZCI6ImRvY2tlciIsImVtYWlsIjoiQCIsImF1dGgiOiJaRzlqYTJWeU9tUnZZMnRsY2c9PSJ9fQ==
persistence: {}
readinessRepository: oomk8s
- readinessImage: readiness-check:1.0.0
+ readinessImage: readiness-check:2.0.0
#################################################################
# Application configuration defaults.
#################################################################
-#repository: mysql
-repository: registry.hub.docker.com
+dockerHubRepository: registry.hub.docker.com
image: library/mysql:5.7
pullPolicy: Always
@@ -29,6 +42,8 @@ nodeSelector: {}
affinity: {}
+disableNfsProvisioner: true
+
# probe configuration parameters
liveness:
initialDelaySeconds: 30
@@ -61,7 +76,7 @@ persistence:
accessMode: ReadWriteMany
size: 1Gi
mountPath: /dockerdata-nfs
- mountSubPath: mysql/data
+ mountSubPath: "mysql/data"
service:
name: mysql
@@ -109,3 +124,6 @@ nfsprovisionerImage: kubernetes_incubator/nfs-provisioner:v1.0.8
nfsprovisionerPrefix: mysql
sdnctlPrefix: mysql
+
+geoEnabled: false
+geoSiteId: 1
diff --git a/kubernetes/common/postgres/.helmignore b/kubernetes/common/postgres/.helmignore
new file mode 100644
index 0000000000..f0c1319444
--- /dev/null
+++ b/kubernetes/common/postgres/.helmignore
@@ -0,0 +1,21 @@
+# Patterns to ignore when building packages.
+# This supports shell glob matching, relative path matching, and
+# negation (prefixed with !). Only one pattern per line.
+.DS_Store
+# Common VCS dirs
+.git/
+.gitignore
+.bzr/
+.bzrignore
+.hg/
+.hgignore
+.svn/
+# Common backup files
+*.swp
+*.bak
+*.tmp
+*~
+# Various IDEs
+.project
+.idea/
+*.tmproj
diff --git a/kubernetes/common/postgres/Chart.yaml b/kubernetes/common/postgres/Chart.yaml
new file mode 100644
index 0000000000..1d00b8526b
--- /dev/null
+++ b/kubernetes/common/postgres/Chart.yaml
@@ -0,0 +1,18 @@
+# Copyright © 2018 Amdocs, AT&T, 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
+description: ONAP Postgres Server
+name: postgres
+version: 2.0.0
diff --git a/kubernetes/common/postgres/requirements.yaml b/kubernetes/common/postgres/requirements.yaml
new file mode 100644
index 0000000000..e597fca563
--- /dev/null
+++ b/kubernetes/common/postgres/requirements.yaml
@@ -0,0 +1,18 @@
+# Copyright © 2018 Amdocs, AT&T, 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
+ repository: '@local'
diff --git a/kubernetes/common/postgres/templates/pv.yaml b/kubernetes/common/postgres/templates/pv.yaml
new file mode 100644
index 0000000000..e08c934a6c
--- /dev/null
+++ b/kubernetes/common/postgres/templates/pv.yaml
@@ -0,0 +1,58 @@
+{{/*
+# Copyright © 2018 Amdocs, AT&T, 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 and .Values.persistence.enabled (not .Values.persistence.existingClaim) -}}
+kind: PersistentVolume
+apiVersion: v1
+metadata:
+ name: {{ include "common.fullname" . }}-data0
+ namespace: {{ include "common.namespace" . }}
+ labels:
+ app: {{ include "common.fullname" . }}
+ chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
+ release: "{{ .Release.Name }}"
+ heritage: "{{ .Release.Service }}"
+ name: {{ include "common.fullname" . }}
+spec:
+ capacity:
+ storage: {{ .Values.persistence.size}}
+ accessModes:
+ - {{ .Values.persistence.accessMode }}
+ storageClassName: "{{ include "common.fullname" . }}-data"
+ persistentVolumeReclaimPolicy: {{ .Values.persistence.volumeReclaimPolicy }}
+ hostPath:
+ path: {{ .Values.global.persistence.mountPath | default .Values.persistence.mountPath }}/{{ .Release.Namespace }}/{{ .Values.persistence.mountSubPath }}0
+---
+kind: PersistentVolume
+apiVersion: v1
+metadata:
+ name: {{ include "common.fullname" . }}-data1
+ namespace: {{ include "common.namespace" . }}
+ labels:
+ app: {{ include "common.fullname" . }}
+ chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
+ release: "{{ .Release.Name }}"
+ heritage: "{{ .Release.Service }}"
+ name: {{ include "common.fullname" . }}
+spec:
+ capacity:
+ storage: {{ .Values.persistence.size}}
+ accessModes:
+ - {{ .Values.persistence.accessMode }}
+ storageClassName: "{{ include "common.fullname" . }}-data"
+ persistentVolumeReclaimPolicy: {{ .Values.persistence.volumeReclaimPolicy }}
+ hostPath:
+ path: {{ .Values.global.persistence.mountPath | default .Values.persistence.mountPath }}/{{ .Release.Namespace }}/{{ .Values.persistence.mountSubPath }}1
+{{- end -}}
diff --git a/kubernetes/common/postgres/templates/secrets.yaml b/kubernetes/common/postgres/templates/secrets.yaml
new file mode 100644
index 0000000000..29de3af260
--- /dev/null
+++ b/kubernetes/common/postgres/templates/secrets.yaml
@@ -0,0 +1,31 @@
+{{/*
+# Copyright © 2018 Amdocs, AT&T, 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: Secret
+metadata:
+ name: {{ include "common.fullname" . }}
+ namespace: {{ include "common.namespace" . }}
+ labels:
+ app: {{ include "common.fullname" . }}
+ chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
+ release: {{ .Release.Name }}
+ heritage: {{ .Release.Service }}
+type: Opaque
+data:
+ pg-primary-password: {{ .Values.config.pgPrimaryPassword | b64enc | quote }}
+ pg-user-password: {{ .Values.config.pgUserPassword | b64enc | quote }}
+ pg-root-password: {{ .Values.config.pgRootPassword | b64enc | quote }}
+
diff --git a/kubernetes/common/postgres/templates/service.yaml b/kubernetes/common/postgres/templates/service.yaml
new file mode 100644
index 0000000000..2a4e369ef4
--- /dev/null
+++ b/kubernetes/common/postgres/templates/service.yaml
@@ -0,0 +1,95 @@
+{{/*
+# Copyright © 2018 Amdocs, AT&T, 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: {{ .Values.service.name }}
+ namespace: {{ include "common.namespace" . }}
+ labels:
+ app: {{ include "common.name" . }}
+ chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
+ release: {{ .Release.Name }}
+ heritage: {{ .Release.Service }}
+ annotations:
+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 }}
+ {{- else -}}
+ - port: {{ .Values.service.externalPort }}
+ targetPort: {{ .Values.service.internalPort }}
+ name: {{ .Values.service.name }}
+ {{- end}}
+ selector:
+ app: {{ include "common.name" . }}
+ release: {{ .Release.Name }}
+---
+apiVersion: v1
+kind: Service
+metadata:
+ name: {{ .Values.service.name2 }}
+ namespace: {{ include "common.namespace" . }}
+ labels:
+ app: {{ include "common.name" . }}
+ chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
+ release: {{ .Release.Name }}
+ heritage: {{ .Release.Service }}
+ annotations:
+spec:
+ type: {{ .Values.service.type2 }}
+ ports:
+ {{if eq .Values.service.type "NodePort" -}}
+ - port: {{ .Values.service.externalPort2 }}
+ nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.nodePort2 }}
+ name: {{ .Values.service.name2 }}
+ {{- else -}}
+ - port: {{ .Values.service.externalPort2 }}
+ targetPort: {{ .Values.service.internalPort2 }}
+ name: {{ .Values.service.name2 }}
+ {{- end}}
+ selector:
+ name: "{{.Values.container.name.primary}}"
+ release: {{ .Release.Name }}
+---
+apiVersion: v1
+kind: Service
+metadata:
+ name: {{ .Values.service.name3 }}
+ namespace: {{ include "common.namespace" . }}
+ labels:
+ app: {{ include "common.name" . }}
+ chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
+ release: {{ .Release.Name }}
+ heritage: {{ .Release.Service }}
+ annotations:
+spec:
+ type: {{ .Values.service.type3 }}
+ ports:
+ {{if eq .Values.service.type "NodePort" -}}
+ - port: {{ .Values.service.externalPort3 }}
+ nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.nodePort3 }}
+ name: {{ .Values.service.name3 }}
+ {{- else -}}
+ - port: {{ .Values.service.externalPort3 }}
+ targetPort: {{ .Values.service.internalPort3 }}
+ name: {{ .Values.service.name3 }}
+ {{- end}}
+ selector:
+ name: "{{.Values.container.name.replica}}"
+ release: {{ .Release.Name }}
diff --git a/kubernetes/common/postgres/templates/statefulset.yaml b/kubernetes/common/postgres/templates/statefulset.yaml
new file mode 100644
index 0000000000..e42e9eb924
--- /dev/null
+++ b/kubernetes/common/postgres/templates/statefulset.yaml
@@ -0,0 +1,147 @@
+{{/*
+# Copyright © 2018 Amdocs, AT&T, 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: apps/v1beta1
+kind: StatefulSet
+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:
+ serviceName: {{ .Values.service.name }}
+ replicas: {{ .Values.replicaCount }}
+ template:
+ metadata:
+ labels:
+ app: {{ include "common.name" . }}
+ release: {{ .Release.Name }}
+ spec:
+ initContainers:
+ - command:
+ - /bin/sh
+ - -c
+ - |
+ for i in $(seq 0 $(({{ .Values.replicaCount }}-1))); do mkdir -p /podroot/data$i; done
+ chmod 777 /podroot/*
+ env:
+ - name: POD_NAME
+ valueFrom: { fieldRef: { fieldPath: metadata.name } }
+ securityContext:
+ privileged: true
+ image: {{ .Values.global.busyboxRepository | default .Values.busyboxRepository }}/{{ .Values.busyboxImage }}
+ imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
+ name: init-sysctl
+ volumeMounts:
+ - name: {{ include "common.fullname" . }}-init
+ mountPath: /podroot/
+ containers:
+ - name: {{ include "common.name" . }}
+ image: "{{ .Values.postgresRepository }}/{{ .Values.image }}"
+ imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
+ ports:
+ - containerPort: {{ .Values.service.internalPort }}
+ name: postgres
+ # 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 }}
+ initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
+ periodSeconds: {{ .Values.liveness.periodSeconds }}
+ timeoutSeconds: {{ .Values.liveness.timeoutSeconds }}
+ {{end -}}
+ readinessProbe:
+ tcpSocket:
+ port: {{ .Values.service.internalPort }}
+ initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
+ periodSeconds: {{ .Values.readiness.periodSeconds }}
+ env:
+ - name: PGHOST
+ value: /tmp
+ - name: PG_PRIMARY_USER
+ value: primaryuser
+ - name: PG_MODE
+ value: set
+ - name: PG_PRIMARY_HOST
+ value: "{{.Values.container.name.primary}}"
+ - name: PG_REPLICA_HOST
+ value: "{{.Values.container.name.replica}}"
+ - name: PG_PRIMARY_PORT
+ value: "{{.Values.service.internalPort}}"
+ - name: PG_PRIMARY_PASSWORD
+ valueFrom:
+ secretKeyRef:
+ name: {{ template "common.fullname" . }}
+ key: pg-primary-password
+ - name: PG_USER
+ value: "{{.Values.config.pgUserName}}"
+ - name: PG_PASSWORD
+ valueFrom:
+ secretKeyRef:
+ name: {{ template "common.fullname" . }}
+ key: pg-user-password
+ - name: PG_DATABASE
+ value: "{{.Values.config.pgDatabase}}"
+ - name: PG_ROOT_PASSWORD
+ valueFrom:
+ secretKeyRef:
+ name: {{ template "common.fullname" . }}
+ key: pg-root-password
+ volumeMounts:
+ - mountPath: /pgdata
+ name: {{ include "common.fullname" . }}-data
+ - mountPath: /backup
+ name: {{ include "common.fullname" . }}-backup
+ readOnly: true
+ 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: {{ include "common.fullname" . }}-init
+ hostPath:
+ path: {{ .Values.global.persistence.mountPath | default .Values.persistence.mountPath }}/{{ .Release.Namespace }}/{{ .Values.persistence.mountInitPath }}
+ - name: {{ include "common.fullname" . }}-backup
+ emptyDir: {}
+#{{ if not .Values.persistence.enabled }}
+ - name: {{ include "common.fullname" . }}-data
+ emptyDir: {}
+#{{ else }}
+ volumeClaimTemplates:
+ - metadata:
+ name: {{ include "common.fullname" . }}-data
+ labels:
+ name: {{ include "common.fullname" . }}
+ spec:
+ accessModes: [ {{ .Values.persistence.accessMode }} ]
+ storageClassName: {{ include "common.fullname" . }}-data
+ resources:
+ requests:
+ storage: {{ .Values.persistence.size }}
+#{{ end }}
diff --git a/kubernetes/common/postgres/values.yaml b/kubernetes/common/postgres/values.yaml
new file mode 100644
index 0000000000..0ae7459074
--- /dev/null
+++ b/kubernetes/common/postgres/values.yaml
@@ -0,0 +1,127 @@
+# Copyright © 2018 Amdocs, AT&T, 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
+ repositorySecret: eyJuZXh1czMub25hcC5vcmc6MTAwMDEiOnsidXNlcm5hbWUiOiJkb2NrZXIiLCJwYXNzd29yZCI6ImRvY2tlciIsImVtYWlsIjoiQCIsImF1dGgiOiJaRzlqYTJWeU9tUnZZMnRsY2c9PSJ9fQ==
+ persistence: {}
+ readinessRepository: oomk8s
+ readinessImage: readiness-check:2.0.0
+
+#################################################################
+# Application configuration defaults.
+#################################################################
+
+# BusyBox image
+busyboxRepository: registry.hub.docker.com
+busyboxImage: library/busybox:latest
+
+postgresRepository: crunchydata
+image: crunchy-postgres:centos7-10.3-1.8.2
+pullPolicy: Always
+
+# application configuration
+config:
+ pgUserName: testuser
+ pgDatabase: userdb
+ pgPrimaryPassword: password
+ pgUserPassword: password
+ pgRootPassword: password
+
+container:
+ name:
+ primary: pgset-primary
+ replica: pgset-replica
+
+# default number of instances
+replicaCount: 2
+
+nodeSelector: {}
+
+affinity: {}
+
+# probe configuration parameters
+liveness:
+ initialDelaySeconds: 30
+ periodSeconds: 10
+ timeoutSeconds: 5
+ # necessary to disable liveness probe when setting breakpoints
+ # in debugger so K8s doesn't restart unresponsive container
+ enabled: true
+
+readiness:
+ initialDelaySeconds: 5
+ periodSeconds: 10
+
+## Persist data to a persitent volume
+persistence:
+ enabled: true
+
+ ## A manually managed Persistent Volume and Claim
+ ## Requires persistence.enabled: true
+ ## If defined, PVC must be created manually before volume will be bound
+ # existingClaim:
+ volumeReclaimPolicy: Retain
+
+ ## database data Persistent Volume Storage Class
+ ## If defined, storageClassName: <storageClass>
+ ## If set to "-", storageClassName: "", which disables dynamic provisioning
+ ## If undefined (the default) or set to null, no storageClassName spec is
+ ## set, choosing the default provisioner. (gp2 on AWS, standard on
+ ## GKE, AWS & OpenStack)
+ accessMode: ReadWriteOnce
+ size: 1Gi
+ mountPath: /dockerdata-nfs
+ mountSubPath: postgres/data
+ mountInitPath: postgres
+
+service:
+ type: ClusterIP
+ name: pgset
+ externalPort: 5432
+ internalPort: 5432
+ type2: ClusterIP
+ name2: pgset-primary
+ externalPort2: 5432
+ internalPort2: 5432
+ type3: ClusterIP
+ name3: pgset-replica
+ externalPort3: 5432
+ internalPort3: 5432
+
+ingress:
+ enabled: false
+
+resources: {}
+ # We usually recommend not to specify default resources and to leave this as a conscious
+ # choice for the user. This also increases chances charts run on environments with little
+ # resources, such as Minikube. If you do want to specify resources, uncomment the following
+ # lines, adjust them as necessary, and remove the curly braces after 'resources:'.
+ #
+ # Example:
+ # Configure resource requests and limits
+ # ref: http://kubernetes.io/docs/user-guide/compute-resources/
+ # Minimum memory for development is 2 CPU cores and 4GB memory
+ # Minimum memory for production is 4 CPU cores and 8GB memory
+#resources:
+# limits:
+# cpu: 2
+# memory: 4Gi
+# requests:
+# cpu: 2
+# memory: 4Gi
+