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

Allow setting permission mode bits on secrets, configmaps and downwardAPI files #28936

Merged
merged 3 commits into from
Aug 18, 2016

Conversation

rata
Copy link
Member

@rata rata commented Jul 14, 2016

cc @thockin @pmorie

Here is the first round to implement: #28733.

I made two commits: one with the actual change and the other with the auto-generated code. I think it's easier to review this way, but let me know if you prefer in some other way.

I haven't written any tests yet, I wanted to have a first glance and not write them till this (and the API) are more close to the "LGTM" :)

There are some things:

  • I'm not sure where to do the "AND 0777". I'll try to look better in the code base, but suggestions are always welcome :)
  • The write permission on group and others is not set when you do an ls -l on the running container. It does work with write permissions to the owner. Debugging seems to show that is something happening after this is correctly set on creation. Will look closer.
  • The default permission (when the new fields are not specified) are the same that on kubernetes v1.3
  • I do realize there are conflicts with master, but I think this is good enough to have a look. The conflicts is with the autog-enerated code, so the actual code is actually the same (and it takes like ~30 minutes to generate it here)
  • I didn't generate the docs (generated-docs and generated-swagger-docs from hack/update-all.sh) because my machine runs out of mem. So that's why it isn't in this first PR, will try to investigate and see why it happens.

Other than that, this works fine here with some silly scripts I did to create a secret&configmap&downwardAPI, a pod and check the file permissions. Tested the "defaultMode" and "mode" for all. But of course, will write tests once this is looking fine :)

Thanks a lot again!
Rodrigo


This change is Reviewable

@k8s-bot
Copy link

k8s-bot commented Jul 14, 2016

Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test".
(Note: "add to whitelist" is no longer supported. Please update configurations in kubernetes/test-infra/jenkins/job-configs/kubernetes-jenkins-pull instead.)

This message may repeat a few times in short succession due to jenkinsci/ghprb-plugin#292. Sorry.

Otherwise, if this message is too spammy, please complain to ixdy.

1 similar comment
@k8s-bot
Copy link

k8s-bot commented Jul 14, 2016

Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test".
(Note: "add to whitelist" is no longer supported. Please update configurations in kubernetes/test-infra/jenkins/job-configs/kubernetes-jenkins-pull instead.)

This message may repeat a few times in short succession due to jenkinsci/ghprb-plugin#292. Sorry.

Otherwise, if this message is too spammy, please complain to ixdy.

@k8s-github-robot k8s-github-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API size/L Denotes a PR that changes 100-499 lines, ignoring generated files. release-note-label-needed labels Jul 14, 2016
@k8s-bot
Copy link

k8s-bot commented Jul 14, 2016

Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test".
(Note: "add to whitelist" is no longer supported. Please update configurations in kubernetes/test-infra/jenkins/job-configs/kubernetes-jenkins-pull instead.)

This message may repeat a few times in short succession due to jenkinsci/ghprb-plugin#292. Sorry.

Otherwise, if this message is too spammy, please complain to ixdy.

2 similar comments
@k8s-bot
Copy link

k8s-bot commented Jul 14, 2016

Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test".
(Note: "add to whitelist" is no longer supported. Please update configurations in kubernetes/test-infra/jenkins/job-configs/kubernetes-jenkins-pull instead.)

This message may repeat a few times in short succession due to jenkinsci/ghprb-plugin#292. Sorry.

Otherwise, if this message is too spammy, please complain to ixdy.

@k8s-bot
Copy link

k8s-bot commented Jul 14, 2016

Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test".
(Note: "add to whitelist" is no longer supported. Please update configurations in kubernetes/test-infra/jenkins/job-configs/kubernetes-jenkins-pull instead.)

This message may repeat a few times in short succession due to jenkinsci/ghprb-plugin#292. Sorry.

Otherwise, if this message is too spammy, please complain to ixdy.

@rata rata changed the title [[NOT MERGE] Allow to set permission mode bits on secrets, configmaps and downwardAPI files [NOT MERGE] Allow to set permission mode bits on secrets, configmaps and downwardAPI files Jul 14, 2016
@bgrant0607
Copy link
Member

ok to test

@bgrant0607 bgrant0607 added the do-not-merge DEPRECATED. Indicates that a PR should not merge. Label can only be manually applied/removed. label Jul 21, 2016
@bgrant0607 bgrant0607 assigned pmorie and unassigned bgrant0607 Jul 21, 2016
@bgrant0607
Copy link
Member

This is an example of a PR that sat for over a week without me noticing.

  1. We need to explicitly notify assignees in order to break through email filters.
  2. We need to ping again when an assignee doesn't respond.
  3. We need to reassign if the assignee still doesn't respond. People may be OOO, too busy, etc.

cc @apelisse @kubernetes/contributor-experience

@rata
Copy link
Member Author

rata commented Jul 21, 2016

@bgrant0607: thanks!
The test seem to failed for a network issue on jenkins:

ERROR: Error fetching remote repo 'remote1'
hudson.plugins.git.GitException: Failed to fetch from https://github.com/kubernetes/kubernetes

Can you ask to re-test, please? :)

@rata rata force-pushed the secret-configmap-file-mode branch from ba0159d to 24f078d Compare July 23, 2016 00:28
@rata
Copy link
Member Author

rata commented Jul 23, 2016

Well, there was a typo that I was using hexa instead of octal. That fixed, everything is working fine now :-)

The only "weird" thing is that the mode in the yaml needs to be in base 10 or 16, I didn't find how to write in octal in the yaml and get that number when reading it. Probably just because I don't know about protobufs.

Also, checking the code for fsGroup, the "OR'd" is done in the lower layer in volume_linux.go so I guess the AND in atomic_writer.go is fine (I guess there isn't a "higher level" where I should do this). But please confirm. The comments are still in the code to make it easy to see what I refer to.

Also, it seems a validation is not needed, so I didn't wrote one.

@pmorie can you please have a look? If it looks mostly fine, I'd like to proceed with some tests (suggestions welcome!), improve some comments and have this merged =)

@rata rata changed the title [NOT MERGE] Allow to set permission mode bits on secrets, configmaps and downwardAPI files WIP: Allow to set permission mode bits on secrets, configmaps and downwardAPI files Jul 24, 2016
@thockin
Copy link
Member

thockin commented Jul 29, 2016

@k8s-bot test this: github issue #IGNORE

@@ -607,6 +607,10 @@ type SecretVolumeSource struct {
// the volume setup will error. Paths must be relative and may not contain
// the '..' path or start with '..'.
Items []KeyToPath `json:"items,omitempty"`
// Mode bits to use on created files by default. The used mode bits will
Copy link
Member

Choose a reason for hiding this comment

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

s/used/final (same in all cases)

@pmorie pmorie force-pushed the secret-configmap-file-mode branch from 377743d to 4e9a14a Compare August 17, 2016 18:50
@k8s-github-robot
Copy link

PR changed after LGTM, removing LGTM. @pmorie @rata

@k8s-github-robot k8s-github-robot removed lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Aug 17, 2016
@thockin thockin added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 17, 2016
@k8s-bot
Copy link

k8s-bot commented Aug 17, 2016

GCE e2e build/test passed for commit 4e9a14a.

@rata
Copy link
Member Author

rata commented Aug 17, 2016

Should this have the milestone v1.4? It is in the queue, but after all the v1.4 PRs. But if it will make it anyways, no problem :)

@pmorie pmorie added this to the v1.4 milestone Aug 17, 2016
@rata
Copy link
Member Author

rata commented Aug 17, 2016

@thockin @pmorie thanks again! :-)

@pmorie
Copy link
Member

pmorie commented Aug 18, 2016

Reviewed 3 of 12 files at r1, 6 of 13 files at r3, 3 of 3 files at r5, 10 of 22 files at r6, 12 of 12 files at r7.
Review status: all files reviewed at latest revision, 7 unresolved discussions.


Comments from Reviewable

@pmorie
Copy link
Member

pmorie commented Aug 18, 2016

Review status: all files reviewed at latest revision, all discussions resolved.


pkg/volume/configmap/configmap_test.go, line 39 [r6] (raw file):

Previously, pmorie (Paul Morie) wrote…

caseMappingMode is the prefered style in golang

OK

Comments from Reviewable

@k8s-github-robot
Copy link

@k8s-bot test this [submit-queue is verifying that this PR is safe to merge]

@k8s-bot
Copy link

k8s-bot commented Aug 18, 2016

GCE e2e build/test passed for commit 4e9a14a.

@k8s-github-robot
Copy link

@k8s-bot test this [submit-queue is verifying that this PR is safe to merge]

@k8s-bot
Copy link

k8s-bot commented Aug 18, 2016

GCE e2e build/test passed for commit 4e9a14a.

@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit 6824f4c into kubernetes:master Aug 18, 2016
rata added a commit to rata/kubernetes.github.io that referenced this pull request Sep 7, 2016
The patch that adds this feature in core kubernetes,
kubernetes/kubernetes#28936, was merged and will be
released with kubernetes 1.4.
rata added a commit to rata/kubernetes.github.io that referenced this pull request Sep 7, 2016
The patch that adds this feature in core kubernetes,
kubernetes/kubernetes#28936, was merged and will be
released with kubernetes 1.4.
rata added a commit to rata/kubernetes.github.io that referenced this pull request Sep 7, 2016
The patch that adds this feature in core kubernetes,
kubernetes/kubernetes#28936, was merged and will be
released with kubernetes 1.4.
rata added a commit to rata/kubernetes.github.io that referenced this pull request Sep 8, 2016
The patch that adds this feature in core kubernetes,
kubernetes/kubernetes#28936, was merged and will be
released with kubernetes 1.4.
rata added a commit to rata/kubernetes.github.io that referenced this pull request Sep 9, 2016
The patch that adds this feature in core kubernetes,
kubernetes/kubernetes#28936, was merged and will be
released with kubernetes 1.4.
k8s-github-robot pushed a commit that referenced this pull request Oct 7, 2016
Automatic merge from submit-queue

Remove duplicated code in secret e2e tests

<!--  Thanks for sending a pull request!  Here are some tips for you:
1. If this is your first time, read our contributor guidelines https://github.com/kubernetes/kubernetes/blob/master/CONTRIBUTING.md and developer guide https://github.com/kubernetes/kubernetes/blob/master/docs/devel/development.md
2. If you want *faster* PR reviews, read how: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/faster_reviews.md
3. Follow the instructions for writing a release note: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/pull-requests.md#release-notes
-->

**What this PR does / why we need it**: This come up when writing another PR: #28936 as a comment from @thockin. 

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, #<issue_number>, ...)` format, will close that issue when PR gets merged)*: 

**Special notes for your reviewer**:

**Release note**:
<!--  Steps to write your release note:
1. Use the release-note-* labels to set the release note state (if you have access) 
2. Enter your extended release note in the below block; leaving it blank means using the PR title as the release note. If no release note is required, just write `NONE`. 
-->
```NONE
```

This patch just removes duplicated code in secret e2e tests.
ApsOps added a commit to ApsOps/git-sync that referenced this pull request Dec 19, 2016
ApsOps added a commit to ApsOps/git-sync that referenced this pull request Dec 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants