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 affinity support to TerraformRepository CRD #530

Closed
clementsol opened this issue Feb 25, 2025 · 2 comments · Fixed by #532
Closed

Add affinity support to TerraformRepository CRD #530

clementsol opened this issue Feb 25, 2025 · 2 comments · Fixed by #532
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@clementsol
Copy link

We would like the Burrito runners to run on the same nodes as Hermit Crab for FinOps considerations.

The validation fails when trying to add the following code to a TerrafomRepository:

  affinity:
    podAffinity:
      requiredDuringSchedulingIgnoredDuringExecution:
      - labelSelector:
          matchExpressions:
          - key: "app.kubernetes.io/name"
            operator: In
            values:
            - burrito-hermitcrab

When looking at the code, it looks like the CRD is missing support for affinity, contrary to nodeSeletor for example.

@corrieriluca corrieriluca added enhancement New feature or request good first issue Good for newcomers labels Feb 25, 2025
@corrieriluca
Copy link
Member

corrieriluca commented Feb 25, 2025

Thanks for your issue. The good news is that it's very simple to implement!

If you want to contribute, here is a breakdown of the implementation:

  • Add a field for affinity in the OverrideRunnerSpec structure in api/v1alpha1/common.go
  • Implement the override or merge strategy (between layer or repo) in the GetOverrideRunnerSpec function in the same file. In the case of affinity, I think the layer should override the repo.
  • Update the tests in api/v1alpha1/common_test.go
  • Assign the obtained affinity to the spec of the Pod that the TerraformRun Controller will create (here)
  • Test on a local or non-production environment if it works correctly

@smeelock
Copy link
Contributor

hi!
thanks for pointing out the changes 🙏 I opened a PR can you have a look?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants