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

Fix 1324: Add fs_group_change_policy for the pod security_context #1451

Conversation

GDegrove
Copy link
Contributor

@GDegrove GDegrove commented Oct 12, 2021

Description

Update the pod specification to allow the usage of the security_context option fsGroupChangePolicy.
This options is available in version 1.20.0+ of kubernetes prevents pods from starting if they mount volumes with a high amount a files.

Acceptance tests

  • Have you added an acceptance test for the functionality being added?
  • Have you run the acceptance tests on this branch?

Output from acceptance testing:

KUBE_CONFIG_PATH='~/.kube/config' make testacc TESTARGS='-run=TestAccKubernetesPod_with_pod_security_context_fs_group_change_policy'
==> Checking that code complies with gofmt requirements...
go vet .
rm -rf /home/<username>/dev/repo/misc/terraform-provider-kubernetes/kubernetes/test-infra/external-providers/.terraform /home/<username>/dev/repo/misc/terraform-provider-kubernetes/kubernetes/test-infra/external-providers/.terraform.lock.hcl || true
mkdir /home/<username>/dev/repo/misc/terraform-provider-kubernetes/kubernetes/test-infra/external-providers/.terraform
mkdir -p /tmp/.terraform.d/localhost/test/kubernetes/9.9.9/linux_amd64 || true
ls /tmp/.terraform.d/localhost/test/kubernetes/9.9.9/linux_amd64/terraform-provider-kubernetes_9.9.9_linux_amd64 || go build -o /tmp/.terraform.d/localhost/test/kubernetes/9.9.9/linux_amd64/terraform-provider-kubernetes_9.9.9_linux_amd64
/tmp/.terraform.d/localhost/test/kubernetes/9.9.9/linux_amd64/terraform-provider-kubernetes_9.9.9_linux_amd64
cd /home/<username>/dev/repo/misc/terraform-provider-kubernetes/kubernetes/test-infra/external-providers && TF_CLI_CONFIG_FILE=/home/<username>/dev/repo/misc/terraform-provider-kubernetes/kubernetes/test-infra/external-providers/.terraformrc TF_PLUGIN_CACHE_DIR=/home/<username>/dev/repo/misc/terraform-provider-kubernetes/kubernetes/test-infra/external-providers/.terraform terraform init -upgrade

Initializing the backend...

Initializing provider plugins...
- Finding localhost/test/kubernetes versions matching "9.9.9"...
- Installing localhost/test/kubernetes v9.9.9...
- Installed localhost/test/kubernetes v9.9.9 (unauthenticated)

Terraform has created a lock file .terraform.lock.hcl to record the provider
selections it made above. Include this file in your version control repository
so that Terraform can guarantee to make the same selections by default when
you run "terraform init" in the future.

Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.
TF_CLI_CONFIG_FILE=/home/<username>/dev/repo/misc/terraform-provider-kubernetes/kubernetes/test-infra/external-providers/.terraformrc TF_PLUGIN_CACHE_DIR=/home/<username>/dev/repo/misc/terraform-provider-kubernetes/kubernetes/test-infra/external-providers/.terraform TF_ACC=1 go test "/home/<username>/dev/repo/misc/terraform-provider-kubernetes/kubernetes" -v -run=TestAccKubernetesPod_with_pod_security_context_fs_group_change_policy -timeout 120m
=== RUN   TestAccKubernetesPod_with_pod_security_context_fs_group_change_policy
--- PASS: TestAccKubernetesPod_with_pod_security_context_fs_group_change_policy (22.95s)
PASS
ok  	github.com/hashicorp/terraform-provider-kubernetes/kubernetes	23.010s

Release Note

Release note for CHANGELOG:

Add `fs_group_change_policy` for pod `security_context` 

References

resolves #1324

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

This allow to add the option fs_group_on_change_policy
in the pod security_context
@hashicorp-cla
Copy link

hashicorp-cla commented Oct 12, 2021

CLA assistant check
All committers have signed the CLA.

@GDegrove GDegrove changed the title Fix 1324: Add fs_group_on_change_policy for the pod security_context DRAFT: Fix 1324: Add fs_group_on_change_policy for the pod security_context Oct 12, 2021
@GDegrove GDegrove changed the title DRAFT: Fix 1324: Add fs_group_on_change_policy for the pod security_context DRAFT: Fix 1324: Add fs_group_change_policy for the pod security_context Oct 12, 2021
@github-actions github-actions bot added size/M and removed size/XS labels Oct 12, 2021
@GDegrove GDegrove changed the title DRAFT: Fix 1324: Add fs_group_change_policy for the pod security_context Fix 1324: Add fs_group_change_policy for the pod security_context Oct 12, 2021
@GDegrove
Copy link
Contributor Author

GDegrove commented Oct 13, 2021

The new option is only available in version 1.20.0 of k8s.
What is the preferred way to handle that in the provider? I did not see anything related to that (yet).
I think there are tests that are only run when the version accept the option, would it be something that is required to add here?

@yecs1999
Copy link

Any way to get a reviewer on this?

@arybolovlev
Copy link
Contributor

Hi @GDegrove,

Thank you for your contribution. I am going to review your changes. In the meantime, could you please update related provider documentation in website/docs?

Thanks!

@arybolovlev
Copy link
Contributor

Can you please rebase your branch to address conflicts and catch up with all the latest changes?

Thank you.

@sheneska
Copy link
Contributor

sheneska commented Nov 9, 2022

Merged in #1892

@sheneska sheneska closed this Nov 9, 2022
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fsGroupChangePolicy missing in pod security_context
5 participants