diff --git a/kubernetes/k8s-gencfg b/kubernetes/k8s-gencfg index 093c102..2fccb52 100755 --- a/kubernetes/k8s-gencfg +++ b/kubernetes/k8s-gencfg @@ -12,11 +12,15 @@ def parse_file(args, input_file, output_file): with open(input_file) as file: input_data = file.read() - # IMAGE_SECRET is an optional argument - # ~ means null in yaml output_data = input_data.replace("{{IMAGE_PATH}}", args.image_path) \ - .replace("{{IMAGE_TAG}}", args.image_tag) \ - .replace("{{IMAGE_SECRET}}", args.image_secret if (args.image_secret != None) else "~") + .replace("{{IMAGE_TAG}}", args.image_tag) + + # IMAGE_SECRET is an optional argument + # but we don't want an empty value if the argument isn't provided + # so only add the field if the argument was provided + if (args.image_secret != None) and (output_file.endswith('-depl.yaml')): + output_data += ' imagePullSecrets:\n' \ + ' - name: %s' % args.image_secret with open(output_file, "w") as file: file.write(output_data) diff --git a/kubernetes/templates/astaire-depl.tmpl b/kubernetes/templates/astaire-depl.tmpl index ea07f30..8db9421 100644 --- a/kubernetes/templates/astaire-depl.tmpl +++ b/kubernetes/templates/astaire-depl.tmpl @@ -50,6 +50,4 @@ spec: volumes: - name: astairelogs emptyDir: {} - imagePullSecrets: - - name: {{IMAGE_SECRET}} restartPolicy: Always diff --git a/kubernetes/templates/bono-depl.tmpl b/kubernetes/templates/bono-depl.tmpl index 9a2a697..89b0fa2 100644 --- a/kubernetes/templates/bono-depl.tmpl +++ b/kubernetes/templates/bono-depl.tmpl @@ -60,6 +60,4 @@ spec: volumes: - name: bonologs emptyDir: {} - imagePullSecrets: - - name: {{IMAGE_SECRET}} restartPolicy: Always diff --git a/kubernetes/templates/cassandra-depl.tmpl b/kubernetes/templates/cassandra-depl.tmpl index 38560a6..54ab203 100644 --- a/kubernetes/templates/cassandra-depl.tmpl +++ b/kubernetes/templates/cassandra-depl.tmpl @@ -34,6 +34,4 @@ spec: readinessProbe: exec: command: ["/bin/bash", "/usr/share/kubernetes/liveness.sh", "7000 9042 9160"] - imagePullSecrets: - - name: {{IMAGE_SECRET}} restartPolicy: Always diff --git a/kubernetes/templates/chronos-depl.tmpl b/kubernetes/templates/chronos-depl.tmpl index 52e3bbe..dbb42b1 100644 --- a/kubernetes/templates/chronos-depl.tmpl +++ b/kubernetes/templates/chronos-depl.tmpl @@ -51,6 +51,4 @@ spec: volumes: - name: chronoslogs emptyDir: {} - imagePullSecrets: - - name: {{IMAGE_SECRET}} restartPolicy: Always diff --git a/kubernetes/templates/ellis-depl.tmpl b/kubernetes/templates/ellis-depl.tmpl index 918852f..ce36f20 100644 --- a/kubernetes/templates/ellis-depl.tmpl +++ b/kubernetes/templates/ellis-depl.tmpl @@ -31,6 +31,4 @@ spec: readinessProbe: tcpSocket: port: 80 - imagePullSecrets: - - name: {{IMAGE_SECRET}} restartPolicy: Always diff --git a/kubernetes/templates/etcd-depl.tmpl b/kubernetes/templates/etcd-depl.tmpl index ce8fdc5..32de43a 100644 --- a/kubernetes/templates/etcd-depl.tmpl +++ b/kubernetes/templates/etcd-depl.tmpl @@ -55,6 +55,4 @@ spec: readinessProbe: tcpSocket: port: 4001 - imagePullSecrets: - - name: {{IMAGE_SECRET}} restartPolicy: Always diff --git a/kubernetes/templates/homer-depl.tmpl b/kubernetes/templates/homer-depl.tmpl index 87fb354..dbc24d0 100644 --- a/kubernetes/templates/homer-depl.tmpl +++ b/kubernetes/templates/homer-depl.tmpl @@ -31,6 +31,4 @@ spec: readinessProbe: tcpSocket: port: 7888 - imagePullSecrets: - - name: {{IMAGE_SECRET}} restartPolicy: Always diff --git a/kubernetes/templates/homestead-depl.tmpl b/kubernetes/templates/homestead-depl.tmpl index 4124d3c..ef6eea8 100644 --- a/kubernetes/templates/homestead-depl.tmpl +++ b/kubernetes/templates/homestead-depl.tmpl @@ -47,6 +47,4 @@ spec: volumes: - name: homesteadlogs emptyDir: {} - imagePullSecrets: - - name: {{IMAGE_SECRET}} restartPolicy: Always diff --git a/kubernetes/templates/homestead-prov-depl.tmpl b/kubernetes/templates/homestead-prov-depl.tmpl index 51481a2..629faa9 100644 --- a/kubernetes/templates/homestead-prov-depl.tmpl +++ b/kubernetes/templates/homestead-prov-depl.tmpl @@ -35,6 +35,4 @@ spec: readinessProbe: exec: command: ["/bin/bash", "/usr/share/clearwater/bin/poll_homestead-prov.sh"] - imagePullSecrets: - - name: {{IMAGE_SECRET}} restartPolicy: Always diff --git a/kubernetes/templates/ralf-depl.tmpl b/kubernetes/templates/ralf-depl.tmpl index 3241e71..7b86531 100644 --- a/kubernetes/templates/ralf-depl.tmpl +++ b/kubernetes/templates/ralf-depl.tmpl @@ -47,6 +47,4 @@ spec: volumes: - name: ralflogs emptyDir: {} - imagePullSecrets: - - name: {{IMAGE_SECRET}} restartPolicy: Always diff --git a/kubernetes/templates/sprout-depl.tmpl b/kubernetes/templates/sprout-depl.tmpl index 65a43cc..54d8437 100644 --- a/kubernetes/templates/sprout-depl.tmpl +++ b/kubernetes/templates/sprout-depl.tmpl @@ -47,6 +47,4 @@ spec: volumes: - name: sproutlogs emptyDir: {} - imagePullSecrets: - - name: {{IMAGE_SECRET}} restartPolicy: Always