Skip to content

Commit

Permalink
fix: fixed helm chart patch (#775)
Browse files Browse the repository at this point in the history
  • Loading branch information
RealAnna committed Feb 7, 2023
1 parent f2263b5 commit fd3e2b0
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 14 deletions.
11 changes: 9 additions & 2 deletions .github/actions/deploy-klt-on-cluster/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,13 @@ runs:
sed -i 's/imagePullPolicy: Always/imagePullPolicy: Never/g' ~/download/artifacts/keptn-lifecycle-operator-manifest-test/release.yaml
sed -i 's/ghcr.keptn.sh\/keptn\/functions-runtime:.*/localhost:5000\/keptn\/functions-runtime:${{ inputs.functions_runtime_tag }}/g' ~/download/artifacts/keptn-lifecycle-operator-manifest-test/release.yaml
kubectl create namespace keptn-lifecycle-toolkit-system
kubectl apply -f ~/download/artifacts/keptn-lifecycle-operator-manifest-test
sed -i 's/imagePullPolicy: Always/imagePullPolicy: Never/g' ~/download/artifacts/klt-cert-manager-manifest-test/release.yaml
kubectl apply -f ~/download/artifacts/klt-cert-manager-manifest-test
kubectl rollout status deployment klt-cert-manager -n keptn-lifecycle-toolkit-system -w
kubectl apply -f ~/download/artifacts/keptn-lifecycle-operator-manifest-test
sed -i 's/imagePullPolicy: Always/imagePullPolicy: Never/g' ~/download/artifacts/scheduler-manifest-test/release.yaml
kubectl apply -f ~/download/artifacts/scheduler-manifest-test
kubectl rollout status deployment keptn-scheduler -n keptn-lifecycle-toolkit-system -w
kubectl rollout status deployment klc-controller-manager -n keptn-lifecycle-toolkit-system -w
Expand All @@ -77,4 +81,7 @@ runs:
shell: bash
run: |
echo "Installing KLT using helm"
helm upgrade --install -n keptn-lifecycle-toolkit-system --create-namespace toolkit ~/download/artifacts/keptn-lifecycle-toolkit.tgz --debug --wait --timeout 1m
helm version
kubectl delete crds --all -n keptn-lifecycle-toolkit-system
helm install -n keptn-lifecycle-toolkit-system --create-namespace toolkit ~/download/artifacts/keptn-lifecycle-toolkit.tgz --set deployment.imagePullPolicy=Never --debug --wait --timeout 1m
kubectl get crds keptnappversions.lifecycle.keptn.sh -o yaml
2 changes: 1 addition & 1 deletion .github/workflows/helm-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ jobs:
run: |
make helm-package RELEASE_REGISTRY=${{ env.RELEASE_REGISTRY }} TAG=dev-${{ needs.prepare_ci_run.outputs.DATETIME }}
sed -i 's/imagePullPolicy: Always/imagePullPolicy: Never/g' ./helm/chart/templates/rendered.yaml
sed -i 's/ghcr.keptn.sh\/keptn\/functions-runtime:.*/localhost:5000\/keptn\/functions-runtime dev-${{ needs.prepare_ci_run.outputs.DATETIME }}/g' ./helm/chart/templates/rendered.yaml
sed -i 's/ghcr.keptn.sh\/keptn\/functions-runtime:.*/localhost:5000\/keptn\/functions-runtime:dev-${{ needs.prepare_ci_run.outputs.DATETIME }}/g' ./helm/chart/templates/rendered.yaml
rm -r ./helm/chart/charts
- name: Upload KLT helm charts archive
Expand Down
13 changes: 12 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,21 @@ release-helm-manifests:
kustomize build ./helm/overlay > ./helm/chart/templates/rendered.yaml

.PHONY: helm-package
helm-package: build-release-manifests release-helm-manifests
helm-package: clean-helm-charts build-release-manifests release-helm-manifests clean-helm-yaml
cd ./helm && helm package ./chart
cd ./helm && mv keptn-lifecycle-toolkit-*.tgz ./chart/charts

.PHONY: clean-helm-charts
clean-helm-charts:
@if test -f "/helm/chart/charts/keptn-lifecycle-toolkit-*.tgz" ; then \
rm "./helm/chart/charts/keptn-lifecycle-toolkit-*.tgz"; \
fi

.PHONY: clean-helm-yaml
clean-helm-yaml:
sed -i "s/'{{/{{/g" ./helm/chart/templates/rendered.yaml
sed -i "s/}}'/}}/g" ./helm/chart/templates/rendered.yaml

.PHONY: build-release-manifests
build-release-manifests:
$(MAKE) -C operator generate
Expand Down
2 changes: 1 addition & 1 deletion helm/chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ otelCollector:

deployment:
## @param deployment.imagePullPolicy Sets the image pull policy for kubernetes deployment
imagePullPolicy: "Always"
imagePullPolicy: Always
9 changes: 9 additions & 0 deletions helm/overlay/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,12 @@ bases:
namespace: "{{ .Release.Namespace }}"
patchesStrategicMerge:
- patches/patch_deployment.yaml

patches:
- patch: |
- op: replace
path: '/spec/template/spec/containers/0/imagePullPolicy'
value: "{{ .Values.deployment.imagePullPolicy}}"
target:
kind: Deployment
name: "(controller-manager|cert-manager|keptn-scheduler)"
6 changes: 0 additions & 6 deletions helm/overlay/patches/patch_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ spec:
spec:
containers:
- name: manager
imagePullPolicy: "{{ .Values.deployment.imagePullPolicy | default Always }}"

env:
- name: OTEL_COLLECTOR_URL
value: "{{ .Values.otelCollector.url }}"
Expand All @@ -28,8 +26,6 @@ spec:
spec:
containers:
- name: manager
imagePullPolicy: "{{ .Values.deployment.imagePullPolicy | default Always }}"

env:
# - name: NEW_ENV_VAR
# value: "{{ .Values.myNewEnvVar }}"
Expand All @@ -45,8 +41,6 @@ spec:
spec:
containers:
- name: keptn-scheduler
imagePullPolicy: "{{ .Values.deployment.imagePullPolicy | default Always }}"

env:
- name: OTEL_COLLECTOR_URL
value: "{{ .Values.otelCollector.url }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ spec:
drop:
- "ALL"
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.13.0
imagePullPolicy: IfNotPresent
args:
- "--secure-listen-address=0.0.0.0:8443"
- "--upstream=http://127.0.0.1:8080/"
Expand Down
1 change: 1 addition & 0 deletions klt-cert-manager/config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ spec:
args:
- --leader-elect
image: controller:latest
imagePullPolicy: Always
name: manager
env:
- name: NAMESPACE
Expand Down
5 changes: 2 additions & 3 deletions operator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,8 @@ manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and Cust
$(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases

.PHONY: gen-crds
gen-crds: controller-gen ## Generate CustomResourceDefinition objects.
echo $(shell pwd)
$(CONTROLLER_GEN) crd paths="./..." output:crd:artifacts:config=../helm/chart/crds
gen-crds: manifests #create CustomResourceDefinition objects for helm.
kustomize build config/crd > ../helm/chart/crds/crds.yaml


.PHONY: generate
Expand Down
1 change: 1 addition & 0 deletions operator/config/default/base/manager_auth_proxy_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ spec:
initialDelaySeconds: 5
periodSeconds: 20
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.13.0
imagePullPolicy: IfNotPresent
args:
- "--secure-listen-address=0.0.0.0:8443"
- "--upstream=http://127.0.0.1:8080/"
Expand Down
1 change: 1 addition & 0 deletions scheduler/manifests/install/base/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ spec:
- /bin/kube-scheduler
- --config=/etc/kubernetes/scheduler-config.yaml
image: scheduler:latest
imagePullPolicy: Always
env:
- name: OTEL_COLLECTOR_URL
value: otel-collector:4317
Expand Down

0 comments on commit fd3e2b0

Please sign in to comment.