-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Develop Component resource for: kubernetes:kustomize:Directory #3036
Conversation
Does the PR have any schema changes?Looking good! No breaking changes found. New resources:
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3036 +/- ##
==========================================
+ Coverage 36.45% 36.64% +0.18%
==========================================
Files 70 71 +1
Lines 9167 9249 +82
==========================================
+ Hits 3342 3389 +47
- Misses 5496 5522 +26
- Partials 329 338 +9 ☔ View full report in Codecov by Sentry. |
b541bb2
to
008e888
Compare
008e888
to
33c8a0b
Compare
Second pass of the PR looks good. I'd prefer if we could also include a integration test flow to ensure that we can actually create these resources. |
This PR has been shipped in release v4.13.1. |
Proposed changes
This PR implements the Kustomize
Directory
resource (v2) as a multi-language component resource.The
Directory
resource creates child resources based on a kustomization directory. The input is a path to a directory containing 'kustomization.yaml', or a git repository URL with a path suffix and other qualifiers.Related issues (optional)
Closes #2786
API
directory
namespace
skipAwait
resourcePrefix
Feature: Remote Targets
This implementation supports remote kustomization targets as described here.
Note: the v1 implementation also supports git references, but resolves them using the Pulumi SDK (
RetrieveGitFolder
) rather than using Kustomize's own implementation. This is to ensure a consistent experience for nested git targets and to support git authentication.Feature: Enable Alpha Plugins
This implementation always enables Kustomize's plugin support, akin to
kustomize build --enable-alpha-plugins
.Plugins are drawn from
KUSTOMIZE_PLUGIN_HOME
(default:~/.config/kustomize/plugin/
). Note: the kustomize library doesn't allow for easy customization of the plugin home.Feature: Unrestricted Loading
Kustomize has a strict and a relaxed mode with respect to path references outside the kustomization base directory (
--load-restrictor
, default isstrict
). The feature seems intended to encourage portability, similarly to paths in Dockerfiles. This implementation simply enables the relaxed mode.Feature: Enable Helm Charts
This implementation enables Helm chart support in Kustomize, which is an experimental feature of Directory v1 (see: #2470). Note that chart support in Kustomize is limited and evolving; see kubernetes-sigs/kustomize#4401 for the long-term support plan.
The
helm
binary is assumed to be on the path.Feature: Namespace Override
New to v2 is support for overriding the default namespace (default is from provider configuration), as a convenience. Kustomize itself has a similar facility (see: namespace) but it makes sense to support it natively.
Feature: Resource Ordering
The Directory resource uses Pulumi's engine to install the resources produced by kustomize. It automatically detects dependencies between some resources. For example, it knows to install namespaces and Custom Resource Definitions (CRDs) first.
Use the
config.kubernetes.io/depends-on
annotation to declare an explicit resource dependency. See blog post for more info.Limitation: Kubernetes-Style Transformations
The older v1 implementation provides the ability to transform the Kubernetes objects produced by kustomize before being sent to the server. That feature isn't available in Directory v2 at this time. You may still use Pulumi's transform option to modify the child resources.
Tests
The PR includes unit tests covering the provider implementation code.
Also includes an integration test that is similar to the below example.
Example
Here's an example of deploying a couple of kustomizations. The
local
kustomization (see: helloWorld for details) shows how to use a variable to select a kustomization overlay.