-
Notifications
You must be signed in to change notification settings - Fork 33
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
Added security context and changed init container logic for onos #221
base: master
Are you sure you want to change the base?
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.
@pierventre @charlesmcchan @kuujo @hwchiu can you please take a look at this one too ?
@@ -54,3 +58,14 @@ ports: | |||
# log4j2.appender.console.name = Console | |||
# log4j2.appender.console.layout.type = PatternLayout | |||
# log4j2.appender.console.layout.pattern = %d{RFC3339} %-5level [%c{1}] %msg%n%throwable | |||
|
|||
podSecurityContext: |
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.
again might be worth run-in with these two disabled by default @kuujo thoughts ?
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.
no because default should be a secure setup and if a user wants to make it insecure he should do it explicitly otherwise we provide a non-secure definition by default
|
||
podSecurityContext: | ||
runAsUser: 1000 | ||
fsGroup: 2000 |
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.
Do we have any user with UID 1000 and group with GID 2000 in all images?
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 think this will be enforced by k8s
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.
Everything else LGTM. We should test this in TOST/SEBA.
@@ -54,3 +58,14 @@ ports: | |||
# log4j2.appender.console.name = Console | |||
# log4j2.appender.console.layout.type = PatternLayout | |||
# log4j2.appender.console.layout.pattern = %d{RFC3339} %-5level [%c{1}] %msg%n%throwable | |||
|
|||
podSecurityContext: | |||
runAsUser: 1000 |
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 is not very clear what this user and group are. May be better to use name or add a comment.
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.
no, k8s security context identifies a root user as a user having non-numbers in the id, so even admin or some123 will be considered to be root so we have to use numeric ids
I ran your changed in my environment but the ONOS container failed to start up.
It looks like some files are root accessed only and are installed during the docker build time ? |
it's missing the changes required in the ONOS docker file @breathbath is upstreaming those (pending ONOS gerrit issues here in Europe) |
@hwchiu can you try building ONOS with https://gerrit.onosproject.org/c/onos/+/24146 and then using this chart ? |
Be careful. Our released docker images were not built with this new Dockerfile. |
That's why the helm charts should reference hardcoded references to released docker images otherwise you cannot guarantee compatibility in future incompatible changes as well. Obviously you cannot prevent the incompatible changes to appear. |
Yes. I was just saying that we need to release a new ONOS and TOST image based on the new Dockerfile, and update the default image version in the helm chart accordingly before we can merge this. |
ok, I will test it in the next two days. |
@breathbath @Andrea-Campanella
Update:
It looks like we need to fix location of all mounted files. |
hey @hwchiu thanks for testing. I've made some changes to the dockerfile, can we verify the setup with the latest changes? |
I tried but had the different issue. see my post above. These files are mounted to the container in the run time, if we aren't the root, we should not mount files into /root directory. |
@breathbath |
Can one of the admins verify this patch? |
…rds atomix