-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[yaml/v2] Support for resource ordering (implicit and explicit) (#2894)
<!--Thanks for your contribution. See [CONTRIBUTING](CONTRIBUTING.md) for Pulumi's contribution guidelines. Help us merge your changes more quickly by adding more details such as labels, milestones, and reviewers.--> ### Proposed changes <!--Give us a brief description of what you've done and what it solves. --> This PR adds support for resource ordering within a `ConfigGroup` or `ConfigFile`. Two approaches are supported (and work in combination): 1. implicit dependencies: the provider uses heuristics to install CRDs and namespaces first. 2. explicit dependencies: the provider understands the `config.kubernetes.io/depends-on` annotation to explicitly declare a dependency on a given resource. The implementation is based on [kubernetes-sigs/cli-utils](https://github.com/kubernetes-sigs/cli-utils) and its support for resource ordering ([documentation](https://github.com/kubernetes-sigs/cli-utils?tab=readme-ov-file#resource-ordering)). To be clear, ordering _across_ `ConfigGroup` resources is supported already, simply using the `dependsOn` option. This PR adds a more granular ordering _within_ the group. ### Testing New test cases were added to verify the new behavior. Many tests rely on a common manifest file, and it is updated to include a CRD and a namespace. Manual testing was performed with the following well-known manifests: 1. knative-serving-core ([ref](https://github.com/knative/serving/releases/download/knative-v1.13.1/serving-core.yaml)) 2. cert-manager ([ref](https://github.com/cert-manager/cert-manager/releases/download/v1.14.4/cert-manager.yaml)) ### Example Here's an example that installs cert-manager then provisions a certificate issuer and a TLS certificate. An explicit dependency is drawn between the `Certificate` and `Issuer`. ```yaml name: issue-2881-cert-manager runtime: yaml description: Installs cert-manager. See https://cert-manager.io/docs/installation/kubectl/ for details. variables: {} resources: install: type: kubernetes:yaml/v2:ConfigGroup properties: files: - https://github.com/cert-manager/cert-manager/releases/download/v1.14.4/cert-manager.yaml test: type: kubernetes:yaml/v2:ConfigGroup options: dependsOn: - ${install} properties: yaml: | apiVersion: v1 kind: Namespace metadata: name: cert-manager-test --- apiVersion: cert-manager.io/v1 kind: Issuer metadata: name: test-selfsigned namespace: cert-manager-test spec: selfSigned: {} --- apiVersion: cert-manager.io/v1 kind: Certificate metadata: name: selfsigned-cert namespace: cert-manager-test annotations: config.kubernetes.io/depends-on: cert-manager.io/namespaces/cert-manager-test/Issuer/test-selfsigned spec: dnsNames: - example.com secretName: selfsigned-cert-tls issuerRef: name: test-selfsigned ``` Within the stack state, one sees dependencies, e.g. on the `Certificate` resource. ```json { "urn": "urn:pulumi:dev::issue-2881-cert-manager::kubernetes:yaml/v2:ConfigGroup$kubernetes:cert-manager.io/v1:Certificate::test-cert-manager-test/selfsigned-cert", "id": "cert-manager-test/selfsigned-cert", "type": "kubernetes:cert-manager.io/v1:Certificate", "dependencies": [ "urn:pulumi:dev::issue-2881-cert-manager::kubernetes:yaml/v2:ConfigGroup$kubernetes:cert-manager.io/v1:Issuer::test-cert-manager-test/test-selfsigned", "urn:pulumi:dev::issue-2881-cert-manager::kubernetes:yaml/v2:ConfigGroup$kubernetes:core/v1:Namespace::test-cert-manager-test" ] } ``` ### Related issues (optional) <!--Refer to related PRs or issues: #1234, or 'Fixes #1234' or 'Closes #1234'. Or link to full URLs to issues or pull requests in other GitHub repositories. --> Closes #2881
- Loading branch information
1 parent
a6d364a
commit e006410
Showing
19 changed files
with
812 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.