Skip to content

Commit

Permalink
Merge pull request #3978 from emissary-ingress/lukeshu/helm-changes
Browse files Browse the repository at this point in the history
Move apiext to live in `crds.yaml`
  • Loading branch information
LukeShu authored Dec 14, 2021
2 parents c5e36ba + 1342d24 commit 2adb804
Show file tree
Hide file tree
Showing 75 changed files with 1,397 additions and 11,289 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ test-chart-values.yaml: docker/$(LCNAME).docker.push.remote
sed -E -n '2s/.*:/ tag: /p' < $<; \
} >$@

test-chart: $(tools/k3d) test-chart-values.yaml
test-chart: $(tools/k3d) $(tools/kubectl) test-chart-values.yaml
PATH=$(abspath $(tools.bindir)):$(PATH) $(MAKE) -C charts/emissary-ingress HELM_TEST_VALUES=$(abspath test-chart-values.yaml) $@
.PHONY: test-chart

Expand Down
37 changes: 11 additions & 26 deletions build-aux/generate.mk
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ generate/files += $(OSS_HOME)/api/pb/
generate/files += $(OSS_HOME)/pkg/api/envoy/
generate/files += $(OSS_HOME)/pkg/api/pb/
generate/files += $(OSS_HOME)/pkg/envoy-control-plane/
generate-fast/files += $(OSS_HOME)/charts/emissary-ingress/crds/
generate-fast/files += $(OSS_HOME)/python/schemas/v3alpha1/
# Individual files: Misc
generate/files += $(OSS_HOME)/docker/test-ratelimit/ratelimit.proto
Expand All @@ -64,13 +63,10 @@ generate-fast/files += $(OSS_HOME)/pkg/api/getambassador.io/v2/zz_generated.conv
generate-fast/files += $(OSS_HOME)/pkg/api/getambassador.io/v3alpha1/zz_generated.conversion-hub.go
# Individual files: YAML
generate-fast/files += $(OSS_HOME)/manifests/emissary/emissary-crds.yaml
generate-fast/files += $(OSS_HOME)/manifests/emissary/emissary-ingress.yaml
generate-fast/files += $(OSS_HOME)/manifests/emissary/ambassador.yaml
generate-fast/files += $(OSS_HOME)/manifests/emissary/ambassador-crds.yaml
generate-fast/files += $(OSS_HOME)/manifests/emissary/emissary-emissaryns.yaml
generate-fast/files += $(OSS_HOME)/manifests/emissary/emissary-defaultns.yaml
generate-fast/files += $(OSS_HOME)/cmd/entrypoint/crds.yaml
generate-fast/files += $(OSS_HOME)/docs/yaml/ambassador/ambassador-rbac-prometheus.yaml
generate-fast/files += $(OSS_HOME)/python/tests/integration/manifests/ambassador.yaml
generate-fast/files += $(OSS_HOME)/python/tests/integration/manifests/apiext.yaml
generate-fast/files += $(OSS_HOME)/python/tests/integration/manifests/crds.yaml
generate-fast/files += $(OSS_HOME)/python/tests/integration/manifests/rbac_cluster_scope.yaml
generate-fast/files += $(OSS_HOME)/python/tests/integration/manifests/rbac_namespace_scope.yaml
Expand Down Expand Up @@ -440,28 +436,15 @@ $(OSS_HOME)/%/zz_generated.conversion-spoke.go: FORCE
gofmt; \
} >$@

$(OSS_HOME)/charts/emissary-ingress/crds: $(OSS_HOME)/_generate.tmp/crds $(tools/fix-crds)
rm -rf $@
mkdir $@
@PS4=; set -ex; for file in $</*.yaml; do $(tools/fix-crds) apiserver-helm "$${file}" >$@/"$${file##*/}"; done

$(OSS_HOME)/manifests/emissary/emissary-crds.yaml: $(OSS_HOME)/_generate.tmp/crds $(tools/fix-crds)
@printf ' $(CYN)$@$(END)\n'
$(tools/fix-crds) apiserver-kubectl $(sort $(wildcard $</*.yaml)) > $@

$(OSS_HOME)/manifests/emissary/ambassador-crds.yaml: $(OSS_HOME)/_generate.tmp/crds $(tools/fix-crds)
$(OSS_HOME)/manifests/emissary/emissary-crds.yaml: $(OSS_HOME)/_generate.tmp/crds $(tools/fix-crds) $(tools/yq) $(OSS_HOME)/charts/emissary-ingress/values.yaml
@printf ' $(CYN)$@$(END)\n'
$(tools/fix-crds) apiserver-kubectl $(sort $(wildcard $</*.yaml)) > $@
$(tools/fix-crds) --target=apiserver-kubectl --image-version=$$($(tools/yq) read $(filter %/values.yaml,$^) image.tag) $(sort $(wildcard $</*.yaml)) >$@

$(OSS_HOME)/python/tests/integration/manifests/crds.yaml: $(OSS_HOME)/_generate.tmp/crds $(tools/fix-crds)
$(tools/fix-crds) apiserver-kat $(sort $(wildcard $</*.yaml)) > $@
$(tools/fix-crds) --target=apiserver-kat $(sort $(wildcard $</*.yaml)) >$@

$(OSS_HOME)/cmd/entrypoint/crds.yaml: $(OSS_HOME)/_generate.tmp/crds $(tools/fix-crds)
$(tools/fix-crds) internal-validator $(sort $(wildcard $</*.yaml)) > $@

$(OSS_HOME)/docs/yaml/ambassador/ambassador-rbac-prometheus.yaml: %: %.m4 $(OSS_HOME)/manifests/emissary/ambassador-crds.yaml
@printf ' $(CYN)$@$(END)\n'
cd $(@D) && m4 < $(<F) > $(@F)
$(tools/fix-crds) --target=internal-validator $(sort $(wildcard $</*.yaml)) >$@

$(OSS_HOME)/python/schemas/v3alpha1: $(OSS_HOME)/cmd/entrypoint/crds.yaml $(tools/crds2schemas)
rm -rf $@
Expand All @@ -471,14 +454,16 @@ python-setup: create-venv
$(OSS_HOME)/venv/bin/python -m pip install ruamel.yaml
.PHONY: python-setup

helm-namespace.emissary-ingress = emissary
helm-namespace.ambassador = default
helm.name.emissary-emissaryns = emissary-ingress
helm.name.emissary-defaultns = emissary-ingress
helm.namespace.emissary-emissaryns = emissary
helm.namespace.emissary-defaultns = default
$(OSS_HOME)/k8s-config/%/helm-expanded.yaml: \
$(OSS_HOME)/k8s-config/%/values.yaml \
$(OSS_HOME)/charts/emissary-ingress/templates $(wildcard $(OSS_HOME)/charts/emissary-ingress/templates/*.yaml) \
$(OSS_HOME)/charts/emissary-ingress/values.yaml \
FORCE
helm template --namespace=$(helm-namespace.$*) --values=$(@D)/values.yaml $* $(OSS_HOME)/charts/emissary-ingress >$@
helm template --namespace=$(helm.namespace.$*) --values=$(@D)/values.yaml $(or $(helm.name.$*),$*) $(OSS_HOME)/charts/emissary-ingress >$@
$(OSS_HOME)/k8s-config/%/output.yaml: \
$(OSS_HOME)/k8s-config/%/helm-expanded.yaml \
$(OSS_HOME)/k8s-config/%/require.yaml \
Expand Down
2 changes: 1 addition & 1 deletion builder/builder.mk
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ INGRESS_TEST_LOCAL_ADMIN_PORT = 8877
# directory with the manifests for loading Ambassador for running the Ingress Conformance tests
# NOTE: these manifests can be slightly different to the regular ones asd they include
INGRESS_TEST_MANIF_DIR = $(BUILDER_HOME)/../manifests/emissary/
INGRESS_TEST_MANIFS = ambassador-crds.yaml ambassador.yaml
INGRESS_TEST_MANIFS = emissary-crds.yaml emissary-emissaryns.yaml

# export DOCKER_BUILDKIT := 0

Expand Down
6 changes: 6 additions & 0 deletions charts/emissary-ingress/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,15 @@ preflight-kubeconfig:
touch $(CHART_KUBECONFIG)
.PHONY: preflight-kubeconfig

# TODO(lukeshu): De-duplicate chart-create-cluster with
# build-aux/ci.mk's `ci/setup-k3d` target.
chart-create-cluster: preflight-kubeconfig
$(MAKE) chart-delete-cluster || true
$(K3D_EXEC) cluster create $(K3D_CLUSTER_NAME) --image=docker.io/rancher/k3s:v$(subst +,-,$(K3S_VERSION)) $(K3D_ARGS)
while ! kubectl --kubeconfig=$(CHART_KUBECONFIG) get serviceaccount default >/dev/null; do sleep 1; done
kubectl --kubeconfig=$(CHART_KUBECONFIG) version
kubectl --kubeconfig=$(CHART_KUBECONFIG) apply -f ../../manifests/emissary/emissary-crds.yaml
kubectl --kubeconfig=$(CHART_KUBECONFIG) --namespace=emissary-system wait --timeout=90s --for=condition=available Deployments/emissary-apiext
.PHONY: chart-create-cluster

chart-delete-cluster:
Expand Down
Loading

0 comments on commit 2adb804

Please sign in to comment.