Skip to content

Commit 021ed04

Browse files
committed
Make use of the provider readiness probes in uptest by patching DeploymentRuntimeConfigs
Signed-off-by: Alper Rifat Ulucinar <ulucinar@users.noreply.github.com>
1 parent 4ff5990 commit 021ed04

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

Makefile

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ build-provider.%:
220220

221221
XPKG_SKIP_DEP_RESOLUTION := true
222222

223-
local-deploy.%: controlplane.up
223+
local-deploy.%: controlplane.up $(YQ)
224224
# uptest workaround for the behavior change at Crossplane 1.15 default registry
225225
# XP RBAC manager has a check for packages from the same provider family
226226
# that they come from the same org and assign RBACs for all providers.
@@ -229,12 +229,16 @@ local-deploy.%: controlplane.up
229229
# TODO: Remove this when https://github.com/crossplane/build/issues/38 is resolved
230230
# this workaround is only valid for uptest on Crossplane 1.x
231231
# Crossplane v2 needs the above issue to be resolved
232+
# TODO: We had better move the DeploymentRuntimeConfig patch to the build submodule.
232233
@$(KUBECTL) -n $(CROSSPLANE_NAMESPACE) patch deployment crossplane-rbac-manager -p '{"spec":{"template":{"spec":{"containers":[{"name":"crossplane","env":[{"name":"REGISTRY","value":"index.docker.io"}]}]}}}}'
233234
@for api in $$(tr ',' ' ' <<< $*); do \
234-
$(MAKE) local.xpkg.deploy.provider.$(PROJECT_NAME)-$${api}; \
235-
$(INFO) running locally built $(PROJECT_NAME)-$${api}; \
236-
$(KUBECTL) wait provider.pkg $(PROJECT_NAME)-$${api} --for condition=Healthy --timeout 5m; \
237-
$(KUBECTL) -n upbound-system wait --for=condition=Available deployment --all --timeout=5m; \
235+
$(MAKE) local.xpkg.deploy.provider.$(PROJECT_NAME)-$${api} && \
236+
container_patch="$$($(KUBECTL) get deploymentruntimeconfigs.pkg.crossplane.io runtimeconfig-$(PROJECT_NAME)-$${api} -o jsonpath='{.spec.deploymentTemplate.spec.template.spec.containers[?(.name == "package-runtime")]}' | $(YQ) '.ports = [{"containerPort": 8081, "name": "readyz", "protocol": "TCP"}]' | $(YQ) '.readinessProbe = {"httpGet": {"scheme": "HTTP", "port": "readyz", "path": "/readyz"}}' | $(YQ) e -o=json)" && \
237+
$(INFO) Patching DeploymentRuntimeConfig package-runtime container spec with a readiness probe using: $$container_patch && \
238+
$(KUBECTL) patch deploymentruntimeconfigs.pkg.crossplane.io runtimeconfig-$(PROJECT_NAME)-$${api} --type=merge -p="{\"spec\": {\"deploymentTemplate\":{\"spec\":{\"template\":{\"spec\":{\"containers\":[$$container_patch]}}}}}}" && \
239+
$(INFO) running locally built $(PROJECT_NAME)-$${api} && \
240+
$(KUBECTL) wait provider.pkg $(PROJECT_NAME)-$${api} --for condition=Healthy --timeout 5m && \
241+
$(KUBECTL) -n upbound-system wait --for=condition=Available deployment --all --timeout=5m && \
238242
$(OK) running locally built $(PROJECT_NAME)-$${api}; \
239243
done || $(FAIL)
240244

0 commit comments

Comments
 (0)