-
Notifications
You must be signed in to change notification settings - Fork 107
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
Implement SeccompProfile CRD and controller #125
Conversation
Hi @cmurphy. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
/ok-to-test |
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.
Great work so far, just two nits on the deployment.
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.
Thanks for the awesome work here @cmurphy! Excited to see this coming along! 🎉
deploy/namespace-operator.yaml
Outdated
resources: | ||
- seccompprofiles | ||
verbs: | ||
- create |
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 need create permissions on the SeccompProfile
resource?
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.
Nope, will remove
@@ -0,0 +1,94 @@ | |||
--- | |||
apiVersion: apiextensions.k8s.io/v1 |
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.
In regards to generating, I think it would be good to do this from the beginning to make sure we stay in sync. This is fairly straightforward with controller-tools
. Here is an example of doing so with go generate --> https://github.com/crossplane/crossplane/blob/3ea5d036778e0c257960983d0cdb9271f12dc895/apis/generate.go#L26
cmd/seccomp-operator/main.go
Outdated
) | ||
|
||
func init() { | ||
_ = clientgoscheme.AddToScheme(scheme) |
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 need to add the clientgoscheme
here?
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.
Apparently not, if I incorporate your other suggestion about the scheme
cmd/seccomp-operator/main.go
Outdated
@@ -103,6 +112,7 @@ func run(*cli.Context) error { | |||
|
|||
ctrlOpts := ctrl.Options{ | |||
SyncPeriod: &sync, | |||
Scheme: scheme, |
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.
nitpick: you can leave this empty and ctrl.NewManager()
will create a *runtime.Scheme
for you, which you can then add types to with something like:
if err := seccompoperatorv1alpha1.AddToScheme(mgr.GetScheme()); err != nil {
return errors.Wrap(err, "Cannot add core Seccomp APIs to scheme")
}
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.
👍
@cmurphy feel free to drop the |
@saschagrunert I will once I get the tests fixed 😄 |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cmurphy, saschagrunert 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 |
Noticed errors on the validation of flags and architectures, latest revision fixes them |
fdecb90
to
fa85960
Compare
Added an e2e test. |
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.
Thank you! PTAL @hasheddan @pjbgf
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.
Really good stuff, thank you for this contribution.
Overall it is a lgtm from me once we change the group to a temporary one.
api/v1alpha1/groupversion_info.go
Outdated
|
||
// Package v1alpha1 contains API Schema definitions for the seccomp-operator v1alpha1 API group | ||
// +kubebuilder:object:generate=true | ||
// +groupName=seccomp-operator.k8s-sigs.io |
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.
Tricky one! Would you be opposed to use something internal (without k8s-sigs.io) and open an issue for us to resolve this later on depending on whether or not the project gets renamed? I'd rather we go for a name submission/approval only once if possible.
We probably could start with seccompprofiles.seccomp-operator.io
and then change and submit for approval when/if we finally decide on the project renaming.
a86b843
to
7e01b20
Compare
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.
/lgtm
This change implements a SeccompProfile custom resource API. A new SeccompProfile type is created and the controller Reconciler is modified to handle either a SeccompProfile Kind or a ConfigMap describing a seccomp profile. The CRD manifest is generated by the new type.
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.
/lgtm
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.
/lgtm
Thanks for the awesome work here @cmurphy!!
/unhold |
Great work @cmurphy! Are there any follow ups we can consider? |
@saschagrunert yes, I just propose #138 as an idea to address #131. I think we might also want another PR to address part of #117 that is not addressed here, "provides a useful abstraction, like the minimum amount of syscalls needed for container runtimes like runc". Also, documentation 😄 |
This change implements a SeccompProfile custom resource API. A new
SeccompProfile type is created and the controller Reconciler is modified
to handle either a SeccompProfile Kind or a ConfigMap describing a
seccomp profile. The CRD manifest is generated by the new type.
What type of PR is this?
/kind feature
/kind api-change
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #117
Special notes for your reviewer:
Does this PR introduce a user-facing change?