Skip to content

Commit

Permalink
fix helm IfNotPresent (envoyproxy#3320)
Browse files Browse the repository at this point in the history
* fix helm IfNotPresent

Signed-off-by: zirain <zirain2009@gmail.com>

* fix gen

Signed-off-by: zirain <zirain2009@gmail.com>

---------

Signed-off-by: zirain <zirain2009@gmail.com>
  • Loading branch information
zirain authored May 2, 2024
1 parent 9a626f2 commit 1e4640a
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 14 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/build_and_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ jobs:
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- uses: ./tools/github-actions/setup-deps
# Generate the install manifests first so it can checked
# Generate the installation manifests first, so it can check
# for errors while running `make -k lint`
- run: make generate-manifests
- run: IMAGE_PULL_POLICY=Always make generate-manifests
- run: make lint-deps
- run: make -k lint

Expand Down Expand Up @@ -174,4 +174,5 @@ jobs:
- name: Build and Push EG Latest Helm Chart
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
# use `0.0.0` as the default latest version.
# use `Always` image pull policy for latest version.
run: IMAGE_PULL_POLICY=Always OCI_REGISTRY=oci://docker.io/envoyproxy CHART_VERSION=v0.0.0-latest TAG=latest make helm-package helm-push
3 changes: 2 additions & 1 deletion .github/workflows/latest_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ jobs:
- uses: ./tools/github-actions/setup-deps

- name: Generate Release Manifests
run: make generate-manifests IMAGE=envoyproxy/gateway-dev TAG=latest OUTPUT_DIR=release-artifacts
# Use `Always` image pull policy for latest version.
run: IMAGE_PULL_POLICY=Always make generate-manifests IMAGE=envoyproxy/gateway-dev TAG=latest OUTPUT_DIR=release-artifacts

- name: Build egctl latest multiarch binaries
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ jobs:
skopeo copy --all docker://docker.io/envoyproxy/gateway-dev:${{ env.sha_short }} docker://docker.io/envoyproxy/gateway:${{ env.release_tag }}
- name: Generate Release Artifacts
run: make generate-artifacts IMAGE=envoyproxy/gateway TAG=${{ env.release_tag }} OUTPUT_DIR=release-artifacts
run: IMAGE_PULL_POLICY=IfNotPresent make generate-artifacts IMAGE=envoyproxy/gateway TAG=${{ env.release_tag }} OUTPUT_DIR=release-artifacts

- name: Build and Push EG Release Helm Chart
run: OCI_REGISTRY=oci://docker.io/envoyproxy CHART_VERSION=${{ env.release_tag }} IMAGE=docker.io/envoyproxy/gateway TAG=${{ env.release_tag }} make helm-package helm-push
run: IMAGE_PULL_POLICY=IfNotPresent OCI_REGISTRY=oci://docker.io/envoyproxy CHART_VERSION=${{ env.release_tag }} IMAGE=docker.io/envoyproxy/gateway TAG=${{ env.release_tag }} make helm-package helm-push

- name: Upload Release Manifests
uses: softprops/action-gh-release@9d7c94cfd0a1f3ed45544c887983e9fa900f0564 # v0.1.15
Expand Down
2 changes: 1 addition & 1 deletion charts/gateway-helm/values.tmpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ deployment:
image:
repository: ${ImageRepository}
tag: '${ImageTag}'
imagePullPolicy: IfNotPresent
imagePullPolicy: ${ImagePullPolicy}
imagePullSecrets: []
resources:
limits:
Expand Down
4 changes: 2 additions & 2 deletions site/content/en/latest/install/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ The Helm chart for Envoy Gateway
| config.envoyGateway.logging.level.default | string | `"info"` | |
| config.envoyGateway.provider.type | string | `"Kubernetes"` | |
| createNamespace | bool | `false` | |
| deployment.envoyGateway.image.repository | string | `"${ImageRepository}"` | |
| deployment.envoyGateway.image.tag | string | `"${ImageTag}"` | |
| deployment.envoyGateway.image.repository | string | `"docker.io/envoyproxy/gateway"` | |
| deployment.envoyGateway.image.tag | string | `"latest"` | |
| deployment.envoyGateway.imagePullPolicy | string | `"IfNotPresent"` | |
| deployment.envoyGateway.imagePullSecrets | list | `[]` | |
| deployment.envoyGateway.resources.limits.cpu | string | `"500m"` | |
Expand Down
2 changes: 1 addition & 1 deletion tools/make/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export USAGE_OPTIONS

.PHONY: generate
generate: ## Generate go code from templates and tags
generate: kube-generate helm-generate helm-template go.generate docs-api
generate: kube-generate docs-api helm-generate helm-template go.generate

## help: Show this help info.
.PHONY: help
Expand Down
3 changes: 2 additions & 1 deletion tools/make/docs.mk
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ docs-api: docs-api-gen helm-readme-gen docs-api-headings
.PHONY: helm-readme-gen
helm-readme-gen: $(tools/helm-docs)
@$(LOG_TARGET)
$(tools/helm-docs) charts/gateway-helm/ -f values.tmpl.yaml -o api.md
@ImageRepository=docker.io/envoyproxy/gateway ImageTag=latest ImagePullPolicy=IfNotPresent envsubst < charts/gateway-helm/values.tmpl.yaml > ./charts/gateway-helm/values.yaml # use production ENV to generate helm api doc
$(tools/helm-docs) charts/gateway-helm/ -f values.yaml -o api.md
mv charts/gateway-helm/api.md site/content/en/latest/install/api.md

.PHONY: docs-api-gen
Expand Down
4 changes: 3 additions & 1 deletion tools/make/helm.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

include tools/make/env.mk

IMAGE_PULL_POLICY ?= IfNotPresent
OCI_REGISTRY ?= oci://docker.io/envoyproxy
CHART_NAME ?= gateway-helm
CHART_VERSION ?= ${RELEASE_VERSION}
Expand All @@ -25,8 +26,9 @@ helm-install: helm-generate ## Install envoy gateway helm chart from OCI registr
@$(LOG_TARGET)
helm install eg ${OCI_REGISTRY}/${CHART_NAME} --version ${CHART_VERSION} -n envoy-gateway-system --create-namespace

.PHONY: helm-generate
helm-generate:
ImageRepository=${IMAGE} ImageTag=${TAG} envsubst < charts/gateway-helm/values.tmpl.yaml > ./charts/gateway-helm/values.yaml
ImageRepository=${IMAGE} ImageTag=${TAG} ImagePullPolicy=${IMAGE_PULL_POLICY} envsubst < charts/gateway-helm/values.tmpl.yaml > ./charts/gateway-helm/values.yaml
helm lint charts/gateway-helm

helm-template: ## Template envoy gateway helm chart.
Expand Down
4 changes: 1 addition & 3 deletions tools/make/kube.mk
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ ifndef ignore-not-found
ignore-not-found = true
endif

IMAGE_PULL_POLICY ?= Always

.PHONY: kube-deploy
kube-deploy: manifests helm-generate ## Install Envoy Gateway into the Kubernetes cluster specified in ~/.kube/config.
@$(LOG_TARGET)
Expand Down Expand Up @@ -225,7 +223,7 @@ generate-manifests: helm-generate ## Generate Kubernetes release manifests.
@$(LOG_TARGET)
@$(call log, "Generating kubernetes manifests")
mkdir -p $(OUTPUT_DIR)/
helm template --set createNamespace=true eg charts/gateway-helm --include-crds --set deployment.envoyGateway.imagePullPolicy=$(IMAGE_PULL_POLICY) --namespace envoy-gateway-system > $(OUTPUT_DIR)/install.yaml
helm template --set createNamespace=true eg charts/gateway-helm --include-crds --namespace envoy-gateway-system > $(OUTPUT_DIR)/install.yaml
@$(call log, "Added: $(OUTPUT_DIR)/install.yaml")
cp examples/kubernetes/quickstart.yaml $(OUTPUT_DIR)/quickstart.yaml
@$(call log, "Added: $(OUTPUT_DIR)/quickstart.yaml")
Expand Down

0 comments on commit 1e4640a

Please sign in to comment.