-
Notifications
You must be signed in to change notification settings - Fork 988
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
Normalize automount_service_account_token to be in line with the K8s API #1054
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At first glance, this looks good! I ran a few tests on it and it didn't seem to cause any issues in resources that use PodSpec.
When you're ready, here is the acceptance test that works with SDKv2. I haven't updated the others yet. https://ci-oss.hashicorp.engineering/viewType.html?buildTypeId=Kubernetes_ProviderKubernetesGke118
Also, you might already know this, but I wanted to share a git trick I just learned:
To easily rebase this, you can do this:
git checkout master
git fetch --all # I did this to pull in your branch
git checkout -b rebased-automount # create a new branch
git cherry-pick c609e597627c55ab63c454b43cc88855fff41edf
And just like that, it's up-to-date with master and there are no merge conflicts! 😄 At that point, it can be force-pushed to this branch and it will make the PR merge-able.
c609e59
to
ea9e60f
Compare
73f03a0
to
05927bf
Compare
I found these by running But when I manually create a pod in Kubernetes, I see that it automatically mounts the service account token. So I believe this should be set to |
05927bf
to
ca0b901
Compare
ca0b901
to
4ecf48f
Compare
I've made this change but it does complicate things if you create a pod with a volume – you need to either explicitly disable automount or reconcile the diff you get after the Pod is created and the volume gets auto mounted. I think this is the right behaviour though. This should encourage using a different resource because using Terraform to manage a lonesome Pod has a slim number of use cases given that you can use Job, CronJob, or Deployment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good and works in my test.
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks! |
Description
This PR defaults
automount_service_account_token
to true for Service, Deployment, StatefulSet, and DaemonSet as this is what the Kubernetes API does.Acceptance tests
Output from acceptance testing:
Release Note
Release note for CHANGELOG:
References
Community Note