Skip to content

Conversation

@vlada-dudr
Copy link

lets use dev.localhost/dev as prefix

Fixes: #38

lets use dev.localhost/dev as prefix

Signed-off-by: Vladimír Dudr <[email protected]>
Copy link

@erhancagirici erhancagirici left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR 🚀 I've left some comments regarding some (edge) cases, feedbacks are welcome.

@$(KIND) load docker-image $(BUILD_REGISTRY)/$*-$(ARCH) -n $(KIND_CLUSTER_NAME)
@echo '{"apiVersion":"pkg.crossplane.io/v1beta1","kind":"DeploymentRuntimeConfig","metadata":{"name":"runtimeconfig-$*"},"spec":{"deploymentTemplate":{"spec":{"selector":{},"strategy":{},"template":{"spec":{"containers":[{"args":["--debug"],"image":"$(BUILD_REGISTRY)/$*-$(ARCH)","name":"package-runtime"}]}}}}}}' | $(KUBECTL) apply -f -
@echo '{"apiVersion":"pkg.crossplane.io/v1","kind":"Provider","metadata":{"name":"$*"},"spec":{"package":"$*-$(VERSION).gz","skipDependencyResolution": $(XPKG_SKIP_DEP_RESOLUTION), "packagePullPolicy":"Never","runtimeConfigRef":{"name":"runtimeconfig-$*"}}}' | $(KUBECTL) apply -f -
echo '{"apiVersion":"pkg.crossplane.io/v1","kind":"Provider","metadata":{"name":"$*"},"spec":{"package":"dev.localhost/dev/$*:$(VERSION).gz","skipDependencyResolution": $(XPKG_SKIP_DEP_RESOLUTION), "packagePullPolicy":"Never","runtimeConfigRef":{"name":"runtimeconfig-$*"}}}' | $(KUBECTL) apply -f -

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we might need the same for local.xpkg.deploy.configuration.% target, as it also expect a fully-qualified package.

@mkdir -p $(XPKG_OUTPUT_DIR)/cache
@for pkg in $(XPKG_OUTPUT_DIR)/linux_*/*; do $(CROSSPLANE_CLI) xpkg extract --from-xpkg $$pkg -o $(XPKG_OUTPUT_DIR)/cache/$$(basename $$pkg .xpkg).gz; done
@mkdir -p $(XPKG_OUTPUT_DIR)/cache/dev.localhost/dev/
@for pkg in $(XPKG_OUTPUT_DIR)/linux_*/*; do $(CROSSPLANE_CLI) xpkg extract --from-xpkg $$pkg -o $(XPKG_OUTPUT_DIR)/cache/dev.localhost/dev/$$(basename $$pkg .xpkg | sed 's/$(PROJECT_NAME)-/$(PROJECT_NAME):/').gz; done

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there are a few edge cases to consider here:

  • PROJECT_NAME might not necessarily be the xpkg name, it can be overridden or project can potentially build multiple xpkgs. AFAIK, an example is the family providers. e.g. the PROJECT_NAME is provider-aws but the xpkg is named likeprovider-aws-iam-v1.2.3.dev.xpkg for a family subpackage. For those, the replacement would be at the wrong place and possibly break it.
  • local.xpkg.sync runs on the whole directory, not only xpkgs built on the current make run. sed might fail to replace if there are other xpkgs, accumulated from multiple xpkg build invocations.

Maybe we can consider introducing local.xpkg.sync.%.
local.xpkg.deploy.provider.% depends on local.xpkg.sync, and copies the whole cache. It can be potentially scoped to copy only the relevant package for the current invocation. On the other hand, the "deployment" might potentially need multiple packages to be deployed (deps maybe?), therefore need the whole cache to be copied. Not sure we should consider this as a possibility.

Another (not so important) aspect is, if the main project defines a make target that deploys multiple providers (e.g. family providers testing), local.xpkg.deploy.provider.% target is invoked multiple times, causing local.xpkg.sync to be invoked multiple times, re-copying the same xpkgs again for each run. This does not affect the result, though we might save time, not doing the unnecessary sync.

@vlada-dudr
Copy link
Author

Hi, sorry @erhancagirici - I missed notifications about your comments - I guess this is already resolved by #42 .

@vlada-dudr vlada-dudr closed this Oct 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

local.xpkg.deploy targets are incompatible with crossplane v2 package spec validation

3 participants