Skip to content

feat(argocd-understack): split operator install from configs install#1896

Merged
cardoe merged 4 commits intomainfrom
external-secrets-update
Mar 31, 2026
Merged

feat(argocd-understack): split operator install from configs install#1896
cardoe merged 4 commits intomainfrom
external-secrets-update

Conversation

@cardoe
Copy link
Copy Markdown
Contributor

@cardoe cardoe commented Mar 30, 2026

For some of the operators we need to install them and sometimes install
additional things into their namespace. Like the webhook component or
additional drivers. Start on this support path with cert-manager and
external-secrets as a first start but this will expand to others.

@cardoe cardoe requested a review from a team March 30, 2026 21:54
Copy link
Copy Markdown
Contributor

@ctria ctria left a comment

Choose a reason for hiding this comment

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

In general looks good to me. It is better to split the application installation from the configuration wherever possible.

Copy link
Copy Markdown
Collaborator

@skrobul skrobul left a comment

Choose a reason for hiding this comment

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

LGTM, we just have to evaluate if keeping 'enabled' has any meaning and use case

Copy link
Copy Markdown
Collaborator

@skrobul skrobul left a comment

Choose a reason for hiding this comment

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

One more thing - there seems to be a conflict on what the default for installConfigs is - the config.go has it default to true, while the docs have it as default to false

cardoe added 3 commits March 31, 2026 08:37
For some of the operators we need to install them and sometimes install
additional things into their namespace. Like the webhook component or
additional drivers. Start on this support path with cert-manager and
external-secrets as a first start but this will expand to others.
Support the split configuration in the argocd-understack chart and
handle the deploy configuration updates to match the behavior.
@cardoe cardoe force-pushed the external-secrets-update branch from a8c1dd4 to a065ee7 Compare March 31, 2026 13:39
Copy link
Copy Markdown
Collaborator

@skrobul skrobul left a comment

Choose a reason for hiding this comment

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

Thanks for fixing the defaults. In regards to the merging behavior, I think it still may need some love.

enabledComponents() currently emits one ComponentConfig per scope match, and runDeployUpdate() applies each entry in sequence. For components present in both global and site, that means later entries can undo file changes from earlier entries.
Concrete cert-manager example (deploy.yaml):

global:
  enabled: true
  cert_manager:
    installApp: true
    installConfigs: false
site:
  enabled: true
  cert_manager:
    installApp: false
    installConfigs: true

Walkthrough with current logic:

  1. enabledComponents() returns two entries for cert-manager (one from global, one from site).
  2. First pass (global) creates cert-manager/values.yaml and removes config files.
  3. Second pass (site) removes cert-manager/values.yaml and creates cert-manager/kustomization.yaml.
  4. Final state depends on pass order; one scope can undo the other.

Following test should cover this I think:

func TestDeployUpdateAIOInstallOptionsAreMergedPerComponent(t *testing.T) {
	tmpDir := t.TempDir()
	clusterName := filepath.Join(tmpDir, "aio-cluster")

	config := map[string]any{
		"global": map[string]any{
			"enabled": true,
			"cert_manager": map[string]any{
				"installApp":     true,
				"installConfigs": false,
			},
		},
		"site": map[string]any{
			"enabled": true,
			"cert_manager": map[string]any{
				"installApp":     false,
				"installConfigs": true,
			},
		},
	}

	if err := os.MkdirAll(clusterName, 0755); err != nil {
		t.Fatalf("failed to create cluster dir: %v", err)
	}

	data, err := yaml.Marshal(&config)
	if err != nil {
		t.Fatalf("failed to marshal config: %v", err)
	}

	deployYaml := filepath.Join(clusterName, "deploy.yaml")
	if err := os.WriteFile(deployYaml, data, 0644); err != nil {
		t.Fatalf("failed to write deploy.yaml: %v", err)
	}

	if err := runDeployUpdate(clusterName); err != nil {
		t.Fatalf("runDeployUpdate failed: %v", err)
	}

	compDir := filepath.Join(clusterName, "cert-manager")
	valuesPath := filepath.Join(compDir, "values.yaml")
	kustomPath := filepath.Join(compDir, "kustomization.yaml")

	if _, err := os.Stat(valuesPath); os.IsNotExist(err) {
		t.Fatalf("expected values.yaml for merged installApp=true")
	}

	if _, err := os.Stat(kustomPath); os.IsNotExist(err) {
		t.Fatalf("expected kustomization.yaml for merged installConfigs=true")
	}

	if err := runDeployCheck(clusterName); err != nil {
		t.Fatalf("deploy check should pass for merged AIO config: %v", err)
	}
}

If something was enabled in global but disabled in site due to the
ordering it would be disabled which is not correct. Update the flow to
handle this as an OR like the Helm chart does and add a test to validate
this case.
@cardoe
Copy link
Copy Markdown
Contributor Author

cardoe commented Mar 31, 2026

Good point. I've added your test case and fixed the problem.

Copy link
Copy Markdown
Collaborator

@skrobul skrobul left a comment

Choose a reason for hiding this comment

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

thanks!

@cardoe cardoe added this pull request to the merge queue Mar 31, 2026
Merged via the queue into main with commit dcaef80 Mar 31, 2026
26 checks passed
@cardoe cardoe deleted the external-secrets-update branch March 31, 2026 16:24
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.

4 participants