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

flux_bootstrap_git cannot support >1 GitRepository #429

Closed
jamiezieziula opened this issue Mar 23, 2023 · 4 comments · Fixed by #480
Closed

flux_bootstrap_git cannot support >1 GitRepository #429

jamiezieziula opened this issue Mar 23, 2023 · 4 comments · Fixed by #480

Comments

@jamiezieziula
Copy link

I did a deep dive into migrating from the old way of deploying flux to a GKE cluster to the new flux_bootstrap_git resource today and was unable to complete the migration due to two main issues with its current implementation:

1 - flux_bootstrapt_git cannot be used to deploy >1 GitRepository into a single cluster, within a single terraform workspace (directory).

  • For some of our GKE clusters, we deploy 4 GitRepositorys. With the old TF implementation, I just added some minor logic to conditionally run the install portion of the flux implementation - that way I could install flux components once and only once. With this new setup - there is no way to conditionally install the flux core components (CRDs). I attempted to pass an empty array to the components parameter - but that resulted in the following error:
resource "flux_bootstrap_git" "repo_2" {
 path = "path/to/cluster/config"
 components = []
}
Error: Invalid Attribute Value
with flux_bootstrap_git.repo_2
on main.tf line 35, in resource "flux_bootstrap_git" "repo_2":
  components = []
Attribute components set must contain at least 2 elements, got: 0

Error: Missing Required Set Contents
with flux_bootstrap_git.repo_2
on main.tf line 35, in resource "flux_bootstrap_git" "repo_2":
  components = []
Set has to contain the items [source-controller kustomize-controller]

2 - there is no parameter in the flux_bootstrap_resource that allows you to override the name of the base GitRepository and Kustomization. The default (and unchangeable) value for these resources is flux-system.

  • This is equally relevant in allowing a user to implement >1 GitRepository in a single cluster because the GitRepository and Kustomization name cannot be changed, and therefore would conflict with each other.

I would venture to guess that at least some of fluxcd users are running more than a single GitRepository in their clusters, so I think that both of these configuration options would be relevant and worthwhile to implement.

@JulesLalu
Copy link

JulesLalu commented May 29, 2023

Hello, I am facing the second issue as well. Could we have some updates on this, or at least a workaround ?
The same issue is also reported here : #469

@stefanprodan
Copy link
Member

stefanprodan commented May 29, 2023

I would venture to guess that at least some of fluxcd users are running more than a single GitRepository in their clusters, so I think that both of these configuration options would be relevant and worthwhile to implement.

I expect users to create extra GitRepositories and Kustomizations in the bootstrap repo instead of applying them directly on the cluster with Terraform. Using TF for this breaks the GitOps promise, as any update to these objects need cluster access instead of doing them directly in the bootstrap repo. Anyway, if you really want to do this, please see #480

@JulesLalu
Copy link

Thank you for opening this PR, which solves the first issue and could be used as a workaround for the second one, too. However, would it be possible to open another PR to enable overriding the name of the base GitRepository and Kustomization in flux_bootstrap_resource ? I feel like this would be a lot easier to use in case of using one single repo, but that is not named 'flux-system'.

@stefanprodan
Copy link
Member

However, would it be possible to open another PR to enable overriding the name of the base GitRepository and Kustomization in flux_bootstrap_resource ?

I'm not for allowing this, the Terraform provider must subscribe to Flux bootstrap conventions as implemented in the CLI.

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 a pull request may close this issue.

3 participants