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 ability to run Atlantis as a deployment #315

Closed
wants to merge 18 commits into from

Conversation

jacob-jameson
Copy link

what

My team and I have added the ability to deploy Atlantis using a deployment controller rather than a statefulSet. This also included adding the ability to create a seperate PVC for atlantis-data, which may help with PR 304 - Move atlantis-data volume to a separate PVC.

The type of controller used to deploy Atlantis is determined by a new setting .Values.atlantisController which has a default value of statefulSet. In the absence of this setting, a statefulSet controller will be created by default. This means that the changes are completely backwards compatible with the current default values.yaml file.

The deployment is configured through the values.yaml file in the .Values.deployment object.

In the event that the Atlantis cluster is scaled to zero and quickly scaled to one again, to prevent two pods from simultaneously trying to access the same lock and plan files we use .Values.deployment.strategy: "Recreate" by default.

why

We use KEDA to scale our Kubernetes clusters based on events, but we would like the ability to scale our Atlantis clusters based on HTTPS events. To do this we need to use the KEDA http-add-on, which currently only supports deployment type controllers.

tests

Deployment

We tested these changes by deploying Atlantis with deployment and statefulSet controllers using the modified Helm chart in this request. Both are able to successfully deploy and pass the UI test suggested in the README by running

helm test my-atlantis

Scaling

When running Atlantis with a deployment controller, one of the main concerns is data in the PVC surviving pod failure. To confirm that data in the atlantis-data directory in the PVC does survive pod failure we;

  1. Launched an interactive terminal in the Atlantis Pod
  2. Created a text file in the atlantis-data directory
  3. Exited the interactive terminal
  4. Scale down the cluster to zero and Immediately scale back up to 1
  5. Launched an interactive terminal in the new Atlantis Pod
  6. Checked that the text file was still present in theatlantis-data directory

Backwards Compatibility

We also used the following command to test the Manifests produced.

helm install atlantis-release atlantis/ --values atlantis/values.yaml --dry-run --debug | tee manifests.txt

I ran this command in three scenarios:

  1. Old Helm Chart, with old default values file
  2. New Helm Chart, with old default values file
  3. New Helm Chart. with new default values file (with default statefulSet controller)

In all of these scenarios the manifests produced were exactly the same. (Tested by comparing stringified YAML output)

references

No references.

@jacob-jameson jacob-jameson requested a review from a team as a code owner August 4, 2023 03:36
@jamengual
Copy link
Contributor

thanks for the contribution @jacob-jameson , we will review shortly

@jacob-jameson
Copy link
Author

The lint test failed because I forgot to bump the chart version number. What should I bump the version number to? Does this count as a Major/Minor/Patch update?

@jamengual
Copy link
Contributor

since is not a breaking change let's update the minor version.

@jacob-jameson
Copy link
Author

Ignore the previous commit. There is a mistake in the Maintainers section of the Chart

@jacob-jameson
Copy link
Author

jacob-jameson commented Aug 9, 2023

Could a Maintainer approve the Test Workflows please?

GenPage
GenPage previously approved these changes Sep 11, 2023
Copy link
Member

@GenPage GenPage left a comment

Choose a reason for hiding this comment

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

LGTM, just need to dance around other pending approved PRs and bumping chart version

@jacob-jameson
Copy link
Author

Is there anything I need to do pre-merge?

@jseiser
Copy link
Contributor

jseiser commented Sep 13, 2023

@jacob-jameson

You need to set the chart version to 4.15.2 to it will pass the lint/test charts step.

@jacob-jameson
Copy link
Author

Is it acceptable to give a reviewer write permissions on my branch so that they can update the chart version when they review my code? I can't keep up with the chart version changes, and I have no idea when the linting pipelines will be run, so they always fail.

@jamengual
Copy link
Contributor

no, you should wait until is reviewed and approved and then bump the chart version

Remove a comment on line 231
@jacob-jameson
Copy link
Author

I think all linting tests should pass now. Could I please get a code review?

@jacob-jameson
Copy link
Author

Can I get a review please?

@jamengual jamengual added waiting-for-review Waiting for a review from a maintainer enhancement New feature or request labels Oct 24, 2023
@cc-robertson
Copy link

we also have the same requirement. LGTM, can we get a review?

@jamengual
Copy link
Contributor

@jacob-jameson could you fix the conflict? Thanks.

@jamengual jamengual added waiting-on-response Waiting for a response from the user and removed waiting-for-review Waiting for a review from a maintainer labels Nov 16, 2023
@jacob-jameson
Copy link
Author

Conflicts have been resolved. Awaiting Review

@jamengual
Copy link
Contributor

jamengual commented Nov 30, 2023

@jacob-jameson please update the chart version

@jamengual
Copy link
Contributor

@jacob-jameson I bumped the version for you but now we have a JSON schema validation so please update the values there.

Copy link

This issue is stale because it has been open for 1 month with no activity. Remove stale label or comment or this will be closed in 1 month.

@github-actions github-actions bot added the Stale label Feb 29, 2024
@github-actions github-actions bot closed this Mar 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Stale waiting-on-response Waiting for a response from the user
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants