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

Add applications sync to application set sync policies #337

Conversation

ahublersos
Copy link
Contributor

@ahublersos ahublersos commented Sep 15, 2023

Fixes #333.
Adds support for applications_sync to the application set resource.

I also nearly installed the test manifests into a live cluster by running testacc_prepare_env so I added a few safety safety nets to prevent that from happening in the future. Happy to split this out into a new PR if that's preferred.

@ahublersos ahublersos marked this pull request as ready for review September 16, 2023 14:53
@ahublersos
Copy link
Contributor Author

I don't know why the TestAccArgoCDCluster_invalidSameServer test is failing. That passed in local testing and doesn't seem related to changes in the application_set resource.

@onematchfox
Copy link
Collaborator

I don't know why the TestAccArgoCDCluster_invalidSameServer test is failing. That passed in local testing and doesn't seem related to changes in the application_set resource.

Yeah, that's just a flaky test. Everything passing now. Will try take a look at the changes a some point today/tomorrow morning.

Copy link
Collaborator

@onematchfox onematchfox left a comment

Choose a reason for hiding this comment

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

Sorry for the slow feedback. Hopefully just one small change - otherwise LGTM.

@@ -12,14 +12,14 @@ import (
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
)

func expandApplicationSet(d *schema.ResourceData, featureMultipleApplicationSourcesSupported bool) (metadata meta.ObjectMeta, spec application.ApplicationSetSpec, err error) {
func expandApplicationSet(d *schema.ResourceData, featureMultipleApplicationSourcesSupported bool, featureApplicationSetApplicationsSyncPolicy bool) (metadata meta.ObjectMeta, spec application.ApplicationSetSpec, err error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I realise this is a bit confusing, but can you please drop this parameter (and it's usage in this file) and rather use the feature flag to implement a check on the user's provided configuration as per https://github.com/oboukili/terraform-provider-argocd/blob/d84d09101f8c1954cf613df69890a846540692b7/argocd/resource_argocd_application_set.go#L49-L51.

In essence, this is the pattern used by all other feature flags - we check the user's configuration of the Terraform resource and return an error if they try to configure something via Terraform that isn't supported by their version of ArgoCD (thereby preventing the configuration from being applied to the resulting CRUD call the provider makes). Multiple applications sources is the exception here in that we support versions that both have and do not have the feature and thus, need branching logic in what we set on the CRUD call.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it, thanks for the explanation! I've removed this parameter and added a feature flag check in the resource.

@github-actions
Copy link

This pr is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 10 days.

@github-actions github-actions bot added the Stale label Oct 13, 2023
@onematchfox
Copy link
Collaborator

This isn't stale. I just need to get around to looking at the failing tests.

@github-actions github-actions bot removed the Stale label Oct 14, 2023
@onematchfox onematchfox changed the title 333 add applications sync to application set sync policies Add applications sync to application set sync policies Oct 16, 2023
@onematchfox
Copy link
Collaborator

Sorry for the delay here @ahublersos and thanks for your patience!

@onematchfox onematchfox merged commit 1f84b3c into argoproj-labs:master Oct 16, 2023
6 checks passed
@onematchfox
Copy link
Collaborator

@ahublersos can/should I go ahead and cut a new release now?

@ahublersos
Copy link
Contributor Author

@onematchfox yes, please do!

@onematchfox
Copy link
Collaborator

@onematchfox yes, please do!

Sorry... more delays. Our release pipeline is broken. Will try upgrade/fix this weekend.

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.

Add support for ApplicationSet level Application modification Policies
2 participants