Skip to content
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

WIP: add support for Oberve Only resources #167

Closed

Conversation

yardbirdsax
Copy link
Contributor

Description of your changes

This is a work in progress; I'm just opening this in draft mode to signal intent in case other folks were thinking of the same thing (and to get early feedback if anyone wants to 😄 ). Once I finish the implementation, I'll mark it ready for review.

This adds the new ManagementPolicy field to the Workflow resource by updating the crossplane/crossplane-runtime module to the latest master commit. It also resolves a dependency conflict when the API types or other packages from this module are imported simultaneously as ones from other providers, such as upbound/provider-aws since those use the newer crossplane-runtime versions already. Related dependencies have also been updated. I also updated the version of golangci-lint; the older version (1.50.0) has some known performance issues that this resolves (see the various comments on golangci/golangci-lint#3414).

I have:

  • Run make reviewable to ensure this PR is ready for review.

How has this code been tested

I ran the existing unit tests which all passed. I may try and add some new ones as part of finishing the implementation. When running the end-to-end tests (make e2e) it fails with the error uptest-v0.5.0: error: No manifest to test provided.; I confirmed this is also true on the main head, so it seems to be an existing problem.

This adds the new ManagementPolicy field to the Workspace resource by way of updating the 'crossplane-runtime' package to the latest trunk branch version. This also resolves a dependency conflict if anyone imports both the API types from this module and the AWS provider, which was already using the newer version. Related dependencies were also updated.

Signed-off-by: Josh Feierman <josh@sqljosh.com>
This updates the version of golangci-lint used. The previous version (1.50.0) had performance issues that prevented the lint command from completing on my local machine.

Signed-off-by: Josh Feierman <josh@sqljosh.com>
@Upbound-CLA
Copy link

Upbound-CLA commented Jun 10, 2023

CLA assistant check
All committers have signed the CLA.

This adds the required changes to the internal/controller/config package due to changes in the upstream controller-runtime API.
If the flag to enable Management Policies is set, the Reconciler is now passed the equivalent option.
@ytsarev
Copy link
Member

ytsarev commented Jun 13, 2023

@yardbirdsax that is interesting. How do you envision Observe Only resources working in combination with provider-terraform Workspace? What is the desired result if we compare with the execution of standard terraform data source as in the following example https://github.com/upbound/provider-terraform/tree/main/examples/observe-only-composition ?

@yardbirdsax
Copy link
Contributor Author

Good questions!

How do you envision Observe Only resources working in combination with provider-terraform Workspace?

I would imagine this (setting managementPolicy: Observe, or managementPolicy: [Observe] in the newly proposed model) would mean that the Provider would essentially only run terraform init and terraform plan, but not terraform apply. This would allow someone to, say, point Crossplane and the Provider at an existing state file and set of Terraform code, and leverage functionality like transposing Terraform outputs into secrets, without necessitating going all in on having Crossplane and the Provider reconcile the state of the resources itself. It might also allow us to detect drift in resources, while not automatically correcting them. (The latter is very similar to what's described with the Weaveworks Flux Terraform Controller [here](https://docs.gitops.weave.works/docs/terraform/Using Terraform CRD/drift-detection/).)

What is the desired result if we compare with the execution of standard terraform data source as in the following example?

In that case, at least if the intent is similar to how I've typically seen datasources used, we're trying to observe something created by something else, and use attributes of that thing in defining another resource that we are creating and managing. Sort of like a lookup, versus "I want you to watch this thing and report on its status and if it matches how we want it to, but don't actually change it."

@yardbirdsax yardbirdsax marked this pull request as ready for review June 18, 2023 14:02
@yardbirdsax yardbirdsax marked this pull request as draft June 19, 2023 10:32
@yardbirdsax
Copy link
Contributor Author

Based on comments in the Crossplane Slack channel, I’m moving this back to draft mode until the new style (I.e., array vs single value) managementPolicy field is implemented upstream in the Crossplane runtime (supposedly next release).

@ytsarev
Copy link
Member

ytsarev commented Jun 20, 2023

@yardbirdsax thanks a lot for the clarification, makes total sense, let's try it out. I will be happy to test it e2e when we get to the final implementation.

@ytsarev
Copy link
Member

ytsarev commented Oct 18, 2023

@yardbirdsax #195 should implement this. I will close this PR, feel free to reopen if needed 👍

@ytsarev ytsarev closed this Oct 18, 2023
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.

3 participants