-
Notifications
You must be signed in to change notification settings - Fork 771
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
Add support for user directive #245
Conversation
if service.User != "" { | ||
uid, err := strconv.ParseInt(service.User, 10, 64) | ||
if err != nil { | ||
logrus.Warn("Ignoring User directive. User has to specfied as uid (numeric).") |
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.
Just a little spelling error :)
Ignoring user directive. User to be specified as a UID (numeric).
securityContext.Privileged = &service.Privileged | ||
} | ||
if service.User != "" { | ||
uid, err := strconv.ParseInt(service.User, 10, 64) |
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.
What are these numbers? 10
and 64
?
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.
10 is base of the number. (maybe i can change it to 0
that should do autodetection)
and 64 means that number has to fit into int64 (it will throw error if it is bigger than in64 :-) ) - runAsUser in Kubernetes SecurityContext is int64
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.
Ahhhh, makes sense xD
Failing tests? |
yeah :-( It adds empty security context for every container ( |
3abe292
to
e917947
Compare
fixed and rebased |
unit tests? |
rebased and added test |
@kadel It needs rebase again |
rebased |
This is little a bit user unfriendly :-(
Issue is that in docker-compose you can set
user
by user name or uid. But K8S allows you to set user only by its uid (has to be int).This is why I added warning that tells user that
user
directive will be ignored if its not a number.Here is user unfriendly part, in docker-compose even if you set user by it uid, it has to be string. (user: "2324") If you set it as int (user: 2324) libcompose parser will complain about this not being string.
So now Kompose requires
user
to be number but written as string :-(fixes #244