-
Notifications
You must be signed in to change notification settings - Fork 58
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
Create random hostname for GMSA #155
Conversation
Welcome @zylxjtu! |
(don't mind me, I just watch this repo out of curiosity) Why this feature ? Isn't hostname supposed to be same as gMSA name ? |
I believe this is an attempt to fix microsoft/Windows-Containers#405
I do not believe that is a requirement. With a standard k8s Deployment the pod name is randomized by kubernetes and the pod name is the Hostname by default so it already is different than the gmsa name in most deployments today. |
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.
Thanks for working on this! It would also be valuable to add a couple test cases to the integration suite: https://github.com/kubernetes-sigs/windows-gmsa/blob/master/admission-webhook/integration_tests/integration_test.go
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
/assign @marosset
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
admission-webhook/main.go
Outdated
if boolValue, err := strconv.ParseBool(v); err == nil { | ||
return boolValue | ||
} | ||
logrus.Warningf("unable to parse environment variable %s with value %s to bool, use default value false", key, v) |
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.
Can we add a test case for this?
Should we error here?
On one hand env_int
just fails silently and on the other hand env
will cause a panic.
I think that if the env var is set and we can't parse the value - we should consider throwing error'ing out because the intention was the enable new functionality (RANDOM_HOSTNAME in this case).
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 will add a test case. I would prefer that throw an error when parsing failure, will change accordingly for env_bool, but would like to keep env_int as it is, not part of this PR
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.
sounds good to me
This will only apply to gmsa pods which have the corresponding security context Disabling/enabling of this can be controlled through ENV
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jsturtevant, zylxjtu The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This will only apply to gmsa pods which have the corresponding security context
Disabling/enabling of this can be controlled through ENV