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

Run GlanceAPI with GlanceUID user #610

Merged
merged 2 commits into from
Sep 27, 2024

Conversation

fmount
Copy link
Contributor

@fmount fmount commented Aug 20, 2024

When the backend is not Cinder (Cinder still has to be fully tested), GlanceAPI can reduce the permissions required for glance-api container, and run as GlanceUID/GlanceGID. This patch introduces scc for both glanceAPI and httpd.

Jira: https://issues.redhat.com/browse/OSPRH-9842
Jira: https://issues.redhat.com/browse/OSPRH-10149

@fmount fmount requested review from konan-abhi and abays August 20, 2024 12:32
@openshift-ci openshift-ci bot requested review from frenzyfriday and fultonj August 20, 2024 12:32
@fmount fmount changed the title Run GlanceAPI with GlanceUID user Draft: Run GlanceAPI with GlanceUID user Aug 20, 2024
@fmount
Copy link
Contributor Author

fmount commented Aug 20, 2024

/test glance-operator-build-deploy-kuttl

Copy link
Contributor

@konan-abhi konan-abhi left a comment

Choose a reason for hiding this comment

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

Looks good to me!


userID := glance.GlanceUID
if privileged {
userID = int64(0)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is actually used when Cinder is the backend, and the concern is mostly related to the os-brick locks here. I'm wondering if we can still run it as glance user, and let the kolla group access the os-brick locks shared by glance and cinder (/cc @eharney )

@fmount fmount mentioned this pull request Sep 9, 2024
@fmount fmount force-pushed the sec_context branch 2 times, most recently from e6a2ea4 to c0674fb Compare September 11, 2024 07:44
@fmount fmount force-pushed the sec_context branch 2 times, most recently from 3c4ebc1 to a6b45e2 Compare September 19, 2024 11:25
@fmount fmount changed the title Draft: Run GlanceAPI with GlanceUID user Run GlanceAPI with GlanceUID user Sep 19, 2024
@fmount fmount force-pushed the sec_context branch 2 times, most recently from 10a8187 to a5ab01f Compare September 26, 2024 08:21
When the backend is not Cinder (Cinder still has to be fully tested),
GlanceAPI can reduce the permissions required for glance-api container,
and run as GlanceUID/GlanceGID. This patch introduces scc for both
glanceAPI and Httpd.

Signed-off-by: Francesco Pantano <[email protected]>
ImageCache currently uses two different cronJobs associated to each
glance-api instance (-cleaner and -pruner cronJobs). They mount
/var/lib/glance/image-cache, a RWO Pvc, and execute a glance utility
on the filestem owned by glance kolla user/group. Without glance-api
being privileged, after the cronJob execution the Glance Pod is not
able to access the image-cache path anymore, resulting in a Permission
denied error.
This patch defines a FSGroup that should be set at Pod level to make
sure we always have the right privileges on the container fs, and,
in addition, it runs glance-api as a privileged container when Cache
is enabled.

Jira: https://issues.redhat.com/browse/OSPRH-9842

Signed-off-by: Francesco Pantano <[email protected]>
@fmount
Copy link
Contributor Author

fmount commented Sep 26, 2024

/test glance-operator-build-deploy-kuttl

1 similar comment
@fmount
Copy link
Contributor Author

fmount commented Sep 27, 2024

/test glance-operator-build-deploy-kuttl

Copy link
Contributor

@abays abays left a comment

Choose a reason for hiding this comment

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

/lgtm

Copy link
Contributor

openshift-ci bot commented Sep 27, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: abays, fmount, konan-abhi

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:
  • OWNERS [abays,fmount,konan-abhi]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@fmount
Copy link
Contributor Author

fmount commented Sep 27, 2024

Tested with uni*eta to make sure Glance + Cinder is not a problem. I think we can merge this patch, and follow up in case of unexpected issues.

@fmount
Copy link
Contributor Author

fmount commented Sep 27, 2024

Thank you @abays for the review.

@openshift-merge-bot openshift-merge-bot bot merged commit 94bf45f into openstack-k8s-operators:main Sep 27, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants