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

[WIP-Refactor part 1] Move container mounts to internal/factory/container #7859

Open
wants to merge 23 commits into
base: main
Choose a base branch
from

Conversation

hasan4791
Copy link
Contributor

What type of PR is this?

/kind api-change
/kind ci
/kind cleanup
/kind other

What this PR does / why we need it:

This PR is part-1 of container creation code refactoring where the mount related codes are moved to internal/factory/container/mounts file.

Which issue(s) this PR fixes:

Fixes #7275

Special notes for your reviewer:

Does this PR introduce a user-facing change?

None

hasan4791 and others added 22 commits March 11, 2024 09:09
Signed-off-by: Amit Kumar <kramit6662@gmail.com>
Signed-off-by: T K Chandra Hasan <t.k.chandra.hasan@ibm.com>
Signed-off-by: T K Chandra Hasan <t.k.chandra.hasan@ibm.com>
Signed-off-by: T K Chandra Hasan <t.k.chandra.hasan@ibm.com>
Signed-off-by: T K Chandra Hasan <t.k.chandra.hasan@ibm.com>
Signed-off-by: T K Chandra Hasan <t.k.chandra.hasan@ibm.com>
Signed-off-by: T K Chandra Hasan <t.k.chandra.hasan@ibm.com>
Signed-off-by: T K Chandra Hasan <t.k.chandra.hasan@ibm.com>
Signed-off-by: T K Chandra Hasan <t.k.chandra.hasan@ibm.com>
Signed-off-by: T K Chandra Hasan <t.k.chandra.hasan@ibm.com>
Signed-off-by: T K Chandra Hasan <t.k.chandra.hasan@ibm.com>
@hasan4791 hasan4791 requested a review from mrunalp as a code owner March 11, 2024 09:15
@openshift-ci openshift-ci bot added release-note-none Denotes a PR that doesn't merit a release note. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API dco-signoff: no Indicates the PR's author has not DCO signed all their commits. kind/ci Categorizes issue or PR as related to CI labels Mar 11, 2024
@openshift-ci openshift-ci bot added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label Mar 11, 2024
@openshift-ci openshift-ci bot added the kind/other Categorizes issue or PR as not clearly related to any existing kind/* category label Mar 11, 2024
Copy link
Contributor

openshift-ci bot commented Mar 11, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: hasan4791
Once this PR has been reviewed and has the lgtm label, please assign mrunalp for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

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

@hasan4791
Copy link
Contributor Author

hasan4791 commented Mar 11, 2024

UTs are still in progress.
As per the current changes, the integrations & other build related test should pass without having issues.
Also this PR has lot of changes and would be great if it can be reviewed as it requires considerable effort.

@hasan4791 hasan4791 changed the title [Refactor part 1] Move container mounts to internal/factory/container [WIP-Refactor part 1] Move container mounts to internal/factory/container Mar 11, 2024
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 11, 2024
if err == nil && currentLabel == canonicalSecLabel {
logrus.Debugf(
"Skipping relabel for %s, as TrySkipVolumeSELinuxLabel is true and the label of the top level of the volume is already correct",
path)

Check failure

Code scanning / CodeQL

Clear-text logging of sensitive information High

Sensitive data returned by an access to passwdPath
flows to a logging call.
@hasan4791
Copy link
Contributor Author

@dfr FYI as you're working on freebsd changes!!!

Signed-off-by: T K Chandra Hasan <t.k.chandra.hasan@ibm.com>
Copy link
Contributor

openshift-ci bot commented Mar 11, 2024

Thanks for your pull request. Before we can look at it, you'll need to add a 'DCO signoff' to your commits.

📝 Please follow instructions in the contributing guide to update your commits with the DCO

Full details of the Developer Certificate of Origin can be found at developercertificate.org.

The list of commits missing DCO signoff:

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

Copy link
Contributor

openshift-ci bot commented Mar 11, 2024

@hasan4791: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/ci-fedora-critest 65affef link true /test ci-fedora-critest
ci/prow/ci-rhel-critest 65affef link true /test ci-rhel-critest
ci/prow/ci-fedora-integration 65affef link true /test ci-fedora-integration
ci/prow/ci-cgroupv2-e2e-crun 65affef link true /test ci-cgroupv2-e2e-crun
ci/prow/ci-crun-e2e 65affef link true /test ci-crun-e2e
ci/prow/ci-e2e-evented-pleg 65affef link true /test ci-e2e-evented-pleg
ci/prow/ci-e2e 65affef link true /test ci-e2e
ci/prow/ci-e2e-conmonrs 65affef link true /test ci-e2e-conmonrs
ci/prow/ci-rhel-e2e 65affef link true /test ci-rhel-e2e
ci/prow/ci-cgroupv2-e2e 65affef link true /test ci-cgroupv2-e2e

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 12, 2024
@openshift-merge-robot
Copy link
Contributor

PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

}

// SpecAddPostOCIMounts add mounts after creating ocicontainer
func (c *container) SpecAddPostOCIMounts(ctx context.Context, serverConfig *sconfig.Config, containerInfo storage.ContainerInfo, ociContainer *oci.Container, mountPoint string, timeZone string, rootPair idtools.IDPair) error {
Copy link
Member

Choose a reason for hiding this comment

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

So this doesn't add mounts to the spec, it directly changes the rootfs. Maybe consider changing the name to reflect this?

@@ -0,0 +1,58 @@
FROM fedora:latest
Copy link
Member

Choose a reason for hiding this comment

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

what is this included for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please ignore this file, currently im running integration tests in container locally and using this file.

Comment on lines +327 to +332
testunit-package:
mkdir -p ${TESTBIN_PATH}
go test ${PACKAGE} \
--tags "test $(BUILDTAGS)" \
--gcflags '-N' -c -o ${TESTBIN_PATH}/$$(basename ${PACKAGE})

Copy link
Member

Choose a reason for hiding this comment

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

this can be acheieved by doing TESTFLAGS='--focus="package' make testunit

Comment on lines +1 to +6
package container

// Impl is the main implementation interface of this package.
type Impl interface {
SecurityLabel(path, secLabel string, shared, maybeRelabel bool) error
}
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this is needed if you just add a label_unsupported.go file that defines SecurityLabel as an empty function

Comment on lines +281 to +285
func clearMountInfo(c *container) {
c.mountInfo.criMounts = nil
c.mountInfo.mounts = nil
c.mountInfo = nil
}
Copy link
Member

Choose a reason for hiding this comment

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

why not leave it for the duration of the container creation process? the container factory won't live that long

// SpecAddPreOCIMounts add mounts to the spec before creating ocicontainer
func (c *container) SpecAddPreOCIMounts(ctx context.Context, resourceStore *resourcestore.ResourceStore, serverConfig *sconfig.Config, sb *sandbox.Sandbox, containerInfo storage.ContainerInfo, mountPoint string, idMapSupport bool) ([]oci.ContainerVolume, []rspec.Mount, error) {
// Create temp mountInfo
c.mountInfo = newMountInfo()
Copy link
Member

Choose a reason for hiding this comment

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

do we need to save mountInfo into the container if we're not referencing it after this function?

Comment on lines +37 to +38
// Clear temp mountInfo
defer clearMountInfo(c)
Copy link
Member

Choose a reason for hiding this comment

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

if we clear mountinfo between these two calls (pre and post) then we lose the deduplication right?

Copy link

github-actions bot commented May 6, 2024

A friendly reminder that this PR had no activity for 30 days.

@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 6, 2024
@sohankunkerkar sohankunkerkar removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dco-signoff: no Indicates the PR's author has not DCO signed all their commits. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API kind/ci Categorizes issue or PR as related to CI kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. kind/other Categorizes issue or PR as not clearly related to any existing kind/* category needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. release-note-none Denotes a PR that doesn't merit a release note.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor of taking container creation pieces from server to internal/factory
5 participants