-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Implement fs writer #57
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
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.
Took a quick looks, good overall, a few comments.
limitations under the License. | ||
*/ | ||
|
||
package atomic |
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.
Is this pkg copied from somewhere ? Was wondering if I can skip reviewing this ?
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.
Yes, it's from k8s.io/kubernetes/pkg/volume/util.
I wrote that in the 1st commit message.
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.
ok, sorry I missed that.
Mode: 0666, | ||
}, | ||
} | ||
} |
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.
Don't see test for this ?
pkg/admission/cert/writer/fs.go
Outdated
return map[string]atomic.FileProjection{ | ||
CACertName: { | ||
Data: cert.CACert, | ||
Mode: 0666, |
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.
I'm curious about this mode. Does it really need to be open to everyone?
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.
Added a TODO.
Let's figure it out later :)
return f.doWrite(webhookName) | ||
} | ||
|
||
func (f *fsCertWriter) overwrite(webhookName string) (*certgenerator.Artifacts, error) { |
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.
overwrite
is the same as write
. Can we remove it?
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.
It's part of the interface.
var _ certReadWriter = &fsCertWriter{}
PTAL |
test.sh
Outdated
@@ -137,7 +137,23 @@ gometalinter.v2 --disable-all \ | |||
--enable=lll \ | |||
--dupl-threshold=400 \ | |||
--enable=dupl \ | |||
./pkg/... | |||
./pkg/admission/ \ |
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.
Is there any -exclude
flag so that you don't need to list all other directories?
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.
Yeah, found the skip
flag.
Updated.
pkg/admission/cert/writer/fs_test.go
Outdated
vwc = &admissionregistration.ValidatingWebhookConfiguration{ | ||
TypeMeta: metav1.TypeMeta{ | ||
APIVersion: "admissionregistration.k8s.io/v1beta1", | ||
Kind: "MutatingWebhookConfiguration", |
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.
vwc
is declared to be validating web hook configuration, but the Kind
filed is mutating webhook configuration.
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.
Good catch!
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.
/lgtm
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.
LGTM
Implement fs writer
As in the commit message, the 1st commit is porting an util pkg from k/k.