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

Handle filetype field in kubernetes.yaml files #17302

Merged
merged 1 commit into from
Feb 3, 2023

Conversation

rhatdan
Copy link
Member

@rhatdan rhatdan commented Jan 31, 2023

Signed-off-by: Daniel J Walsh dwalsh@redhat.com

Does this PR introduce a user-facing change?

podman kube generate and play now support SELinux filetype labels.

@openshift-ci openshift-ci bot added release-note approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jan 31, 2023
@rhatdan
Copy link
Member Author

rhatdan commented Jan 31, 2023

@Luap99 This is wiring the filetype labels to be used by podman kube play, to make the other PR #17249 work with kube play as well as standard containers.

@@ -347,6 +347,11 @@ function is_aarch64() {
[ "$(uname -m)" == "aarch64" ]
}

function is_selinux() {
/usr/sbin/selinuxenabled 2> /dev/null
return $?
Copy link
Member

Choose a reason for hiding this comment

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

Unnecessary; please remove, it's misleading.

run_podman inspect pod1-test1 --format "{{ .MountLabel }}"
is "$output" "system_u:object_r:usr_t:s0:c1,c2" "Generated container should use filetype usr_t"
fi
}
Copy link
Member

Choose a reason for hiding this comment

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

There's probably some cleanup missing here?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, it looks like the initial pod/container used in kube generate need to be removed as well.

Copy link
Member Author

Choose a reason for hiding this comment

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

run_podman pod rm --force pod1
Should remove it.

@@ -347,6 +347,11 @@ function is_aarch64() {
[ "$(uname -m)" == "aarch64" ]
}

function is_selinux() {
Copy link
Member

Choose a reason for hiding this comment

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

I mean, you're the expert, but wouldn't selinux_enabled be a better name?

@edsantiago
Copy link
Member

tests LGTM, I can't review the code though

run_podman create --pod new:pod1 --security-opt label=level:s0:c1,c2 --security-opt label=filetype:usr_t --name test1 $IMAGE true
run_podman kube generate pod1 -f $YAML
run cat $YAML
is "$output" ".*filetype: usr_t" "Generated YAML file should container filetype usr_t"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
is "$output" ".*filetype: usr_t" "Generated YAML file should container filetype usr_t"
is "$output" ".*filetype: usr_t" "Generated YAML file should contain filetype usr_t"

Copy link
Member Author

Choose a reason for hiding this comment

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

My fingers automatically add the er whenever I type contain ...

run_podman inspect pod1-test1 --format "{{ .MountLabel }}"
is "$output" "system_u:object_r:usr_t:s0:c1,c2" "Generated container should use filetype usr_t"
fi
}
Copy link
Member

Choose a reason for hiding this comment

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

Yes, it looks like the initial pod/container used in kube generate need to be removed as well.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Copy link
Member

@vrothberg vrothberg left a comment

Choose a reason for hiding this comment

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

LGTM

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 2, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rhatdan, vrothberg

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@baude
Copy link
Member

baude commented Feb 3, 2023

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Feb 3, 2023
@openshift-merge-robot openshift-merge-robot merged commit 5925baa into containers:main Feb 3, 2023
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 12, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. release-note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants