From 29f1a62b98e1b0ef33ddfae9aaf0d6a44f19538f Mon Sep 17 00:00:00 2001 From: Tim Hutchens <timhutchens@seed-innovations.com> Date: Wed, 24 Feb 2021 15:30:08 -0500 Subject: [PATCH] feat: add initial support for openshift (ocp) --- .../controlplane/istio-controlplane-helmrelease.yaml | 1 + chart/templates/istio/controlplane/namespace.yaml | 11 +++++++++++ .../logging/fluentbit/fluentbit-helmrelease.yaml | 5 +++++ .../templates/monitoring/monitoring-helmrelease.yaml | 5 +++++ chart/values.yaml | 3 +++ scripts/lint_changelog.sh | 5 +++-- 6 files changed, 28 insertions(+), 2 deletions(-) diff --git a/chart/templates/istio/controlplane/istio-controlplane-helmrelease.yaml b/chart/templates/istio/controlplane/istio-controlplane-helmrelease.yaml index 9c28d6af50..b2ae33aa15 100644 --- a/chart/templates/istio/controlplane/istio-controlplane-helmrelease.yaml +++ b/chart/templates/istio/controlplane/istio-controlplane-helmrelease.yaml @@ -47,6 +47,7 @@ spec: imagePullSecrets: - private-registry + openshift: {{ .Values.openshift }} {{- if .Values.istio.sso.enabled }} ingress: diff --git a/chart/templates/istio/controlplane/namespace.yaml b/chart/templates/istio/controlplane/namespace.yaml index 451102e7ed..fc17057228 100644 --- a/chart/templates/istio/controlplane/namespace.yaml +++ b/chart/templates/istio/controlplane/namespace.yaml @@ -21,6 +21,17 @@ metadata: type: kubernetes.io/dockerconfigjson data: .dockerconfigjson: {{ template "imagePullSecret" . }} +{{- if .Values.openshift }} +--- +apiVersion: v1 +kind: Secret +metadata: + name: private-registry + namespace: kube-system +type: kubernetes.io/dockerconfigjson +data: + .dockerconfigjson: {{ template "imagePullSecret" . }} +{{- end }} {{- end }} --- {{- if and .Values.istio.ingress.key .Values.istio.ingress.cert }} diff --git a/chart/templates/logging/fluentbit/fluentbit-helmrelease.yaml b/chart/templates/logging/fluentbit/fluentbit-helmrelease.yaml index 60dcbc10ef..98a73b5313 100644 --- a/chart/templates/logging/fluentbit/fluentbit-helmrelease.yaml +++ b/chart/templates/logging/fluentbit/fluentbit-helmrelease.yaml @@ -48,6 +48,11 @@ spec: imagePullSecrets: - name: private-registry + {{- if .Values.openshift }} + podSecurityContext: + seLinuxOptions: + type: "spc_t" + {{- end }} {{/* ECK and Logging _always_ depend on .Values.logging being enabled, so can assume they exist here */}} dependsOn: diff --git a/chart/templates/monitoring/monitoring-helmrelease.yaml b/chart/templates/monitoring/monitoring-helmrelease.yaml index 91a558e158..d12aa0d9e6 100644 --- a/chart/templates/monitoring/monitoring-helmrelease.yaml +++ b/chart/templates/monitoring/monitoring-helmrelease.yaml @@ -90,6 +90,11 @@ spec: serviceAccount: imagePullSecrets: - name: private-registry + {{- if .Values.openshift }} + service: + targetPort: 9102 + port: 9102 + {{- end }} kube-state-metrics: imagePullSecrets: - name: private-registry diff --git a/chart/values.yaml b/chart/values.yaml index 99ad02dd2b..bd570ca518 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -24,6 +24,9 @@ registryCredentials: # password: "" # email: "" +# Openshift Container Platform Feature Toggle +openshift: false + # -- Git credential settings for accessing private repositories # Order of precedence is: # 1. existingSecret diff --git a/scripts/lint_changelog.sh b/scripts/lint_changelog.sh index cd52786548..5d493e99d0 100755 --- a/scripts/lint_changelog.sh +++ b/scripts/lint_changelog.sh @@ -2,9 +2,10 @@ # diff the file silently, while still printing errors git diff --exit-code origin/${CI_DEFAULT_BRANCH}:${CHANGELOG_FILE} ${CHANGELOG_FILE} >/dev/null +differr=$? # exit code of 0 indicates non changed file -if [ $? -eq 0 ]; then +if [ $differr -eq 0 ]; then echo "No changes were detected in ${CHANGELOG_FILE}, please update this file" exit 1 fi @@ -12,7 +13,7 @@ fi # exit code other than 0 and 1 is an error # IE - different file names between branches # check for this and fail accordingly -if [ $? -ne 1 ]; then +if [ $differr -ne 1 ]; then echo "Error: An unknown error has occurred while linting ${CHANGELOG_FILE}" exit 1 fi -- GitLab