Closed EronWright closed 4 months ago
Looking good! No breaking changes found.
kustomize/v2.Directory
Attention: Patch coverage is 55.05618%
with 40 lines
in your changes are missing coverage. Please review.
Project coverage is 36.64%. Comparing base (
4eaacba
) to head (dd6fee1
).
Files | Patch % | Lines |
---|---|---|
provider/pkg/provider/kustomize/v2/directory.go | 61.53% | 22 Missing and 8 partials :warning: |
provider/pkg/gen/schema.go | 0.00% | 10 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
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: https://github.com/pulumi/pulumi-kubernetes/issues/2470). Note that chart support in Kustomize is limited and evolving; see https://github.com/kubernetes-sigs/kustomize/issues/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.