Repository: kubernetes-sigs/security-profiles-operator
Pull request #406 (2021-04-19 11:13:58)

SelinuxProfile: Remove apply flag from CRD
#### What type of PR is this?

/kind cleanup
/kind api-change

#### What this PR does / why we need it:

Removes the `apply` flag from SelinuxProfile objects since it was not being
used and its usecase is not that useful after all.

#### Which issue(s) this PR fixes:

None

#### Does this PR have test?

N/A.

#### Does this PR introduce a user-facing change?

```release-note
The SelinuxProfile CRD no longer has the `apply` flag in the `spec`.
```

k8s-ci-robot: [APPROVALNOTIFIER] This PR is **NOT APPROVED**

This pull-request has been approved by: *<a href="https://github.com/kubernetes-sigs/security-profiles-operator/pull/406#" title="Author self-approved">JAORMX</a>*
To complete the [pull request process](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process), please assign **pjbgf** after the PR has been reviewed.
You can assign the PR to them by writing `/assign @pjbgf` in a comment when ready.

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=kubernetes-sigs%2Fsecurity-profiles-operator).

<details open>
Needs approval from an approver in each of these files:

- **[OWNERS](https://github.com/kubernetes-sigs/security-profiles-operator/blob/master/OWNERS)**

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":["pjbgf"]} -->
k8s-ci-robot: [APPROVALNOTIFIER] This PR is **APPROVED**

This pull-request has been approved by: *<a href="https://github.com/kubernetes-sigs/security-profiles-operator/pull/406#" title="Author self-approved">JAORMX</a>*, *<a href="https://github.com/kubernetes-sigs/security-profiles-operator/pull/406#pullrequestreview-638746566" title="Approved">saschagrunert</a>*

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=kubernetes-sigs%2Fsecurity-profiles-operator).

The pull request process is described [here](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process)

<details >
Needs approval from an approver in each of these files:

- ~~[OWNERS](https://github.com/kubernetes-sigs/security-profiles-operator/blob/master/OWNERS)~~ [saschagrunert]

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":[]} -->
codecov-commenter: # [Codecov](https://codecov.io/gh/kubernetes-sigs/security-profiles-operator/pull/406?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) Report
> Merging [#406](https://codecov.io/gh/kubernetes-sigs/security-profiles-operator/pull/406?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) (3b8a204) into [master](https://codecov.io/gh/kubernetes-sigs/security-profiles-operator/commit/301267aabd08002512d04f573688bba6cd995e19?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) (301267a) will **not change** coverage.
> The diff coverage is `n/a`.


```diff
@@           Coverage Diff           @@
##           master     #406   +/-   ##
=======================================
  Coverage   38.00%   38.00%           
=======================================
  Files          20       20           
  Lines         950      950           
=======================================
  Hits          361      361           
  Misses        574      574           
  Partials       15       15           
```

k8s-ci-robot: New changes are detected. LGTM label has been removed.
k8s-ci-robot: @JAORMX: The following test **failed**, say `/retest` to rerun all failed tests:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
pull-security-profiles-operator-test-e2e | 74cff9b811cb3609e1eac61fec730add5b57b59b | [link](https://prow.k8s.io/view/gs/kubernetes-jenkins/pr-logs/pull/kubernetes-sigs_security-profiles-operator/406/pull-security-profiles-operator-test-e2e/1384128981573308416) | `/test pull-security-profiles-operator-test-e2e`

[Full PR test history](https://prow.k8s.io/pr-history?org=kubernetes-sigs&repo=security-profiles-operator&pr=406). [Your PR dashboard](https://prow.k8s.io/pr?query=is%3Apr%20state%3Aopen%20author%3AJAORMX). Please help us cut down on flakes by [linking to](https://git.k8s.io/community/contributors/devel/sig-testing/flaky-tests.md#filing-issues-for-flaky-tests) an [open issue](https://github.com/kubernetes-sigs/security-profiles-operator/issues?q=is:issue+is:open) when you hit one in your PR.

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
JAORMX: /retest

Patch:
diff --git a/api/selinuxprofile/v1alpha1/selinuxpolicy_types.go b/api/selinuxprofile/v1alpha1/selinuxpolicy_types.go
index 550e5c280..cdd0dcd44 100644
--- a/api/selinuxprofile/v1alpha1/selinuxpolicy_types.go
+++ b/api/selinuxprofile/v1alpha1/selinuxpolicy_types.go
@@ -27,7 +27,6 @@ var _ profilebasev1alpha1.StatusBaseUser = &SelinuxProfile{}
 
 // SelinuxProfileSpec defines the desired state of SelinuxProfile.
 type SelinuxProfileSpec struct {
-	Apply  bool   `json:"apply,omitempty"`
 	Policy string `json:"policy,omitempty"`
 }
 
@@ -45,7 +44,6 @@ type SelinuxProfileStatus struct {
 // +kubebuilder:subresource:status
 // +kubebuilder:resource:path=selinuxprofiles,scope=Namespaced
 // +kubebuilder:printcolumn:name="Usage",type="string",JSONPath=`.status.usage`
-// +kubebuilder:printcolumn:name="Apply",type="boolean",JSONPath=`.spec.apply`
 // +kubebuilder:printcolumn:name="State",type="string",JSONPath=`.status.status`
 type SelinuxProfile struct {
 	metav1.TypeMeta   `json:",inline"`
diff --git a/deploy/base/crd.yaml b/deploy/base/crd.yaml
index 6d840be98..b0329c6da 100644
--- a/deploy/base/crd.yaml
+++ b/deploy/base/crd.yaml
@@ -476,9 +476,6 @@ spec:
     - jsonPath: .status.usage
       name: Usage
       type: string
-    - jsonPath: .spec.apply
-      name: Apply
-      type: boolean
     - jsonPath: .status.status
       name: State
       type: string
@@ -502,8 +499,6 @@ spec:
           spec:
             description: SelinuxProfileSpec defines the desired state of SelinuxProfile.
             properties:
-              apply:
-                type: boolean
               policy:
                 type: string
             type: object
diff --git a/deploy/base/crds/selinuxpolicy.yaml b/deploy/base/crds/selinuxpolicy.yaml
index ae3a76e58..046fd8982 100644
--- a/deploy/base/crds/selinuxpolicy.yaml
+++ b/deploy/base/crds/selinuxpolicy.yaml
@@ -20,9 +20,6 @@ spec:
     - jsonPath: .status.usage
       name: Usage
       type: string
-    - jsonPath: .spec.apply
-      name: Apply
-      type: boolean
     - jsonPath: .status.status
       name: State
       type: string
@@ -46,8 +43,6 @@ spec:
           spec:
             description: SelinuxProfileSpec defines the desired state of SelinuxProfile.
             properties:
-              apply:
-                type: boolean
               policy:
                 type: string
             type: object
diff --git a/deploy/namespace-operator.yaml b/deploy/namespace-operator.yaml
index 344d6f277..535467e8a 100644
--- a/deploy/namespace-operator.yaml
+++ b/deploy/namespace-operator.yaml
@@ -679,9 +679,6 @@ spec:
     - jsonPath: .status.usage
       name: Usage
       type: string
-    - jsonPath: .spec.apply
-      name: Apply
-      type: boolean
     - jsonPath: .status.status
       name: State
       type: string
@@ -705,8 +702,6 @@ spec:
           spec:
             description: SelinuxProfileSpec defines the desired state of SelinuxProfile.
             properties:
-              apply:
-                type: boolean
               policy:
                 type: string
             type: object
diff --git a/deploy/operator.yaml b/deploy/operator.yaml
index 5be07421c..e74f3252e 100644
--- a/deploy/operator.yaml
+++ b/deploy/operator.yaml
@@ -679,9 +679,6 @@ spec:
     - jsonPath: .status.usage
       name: Usage
       type: string
-    - jsonPath: .spec.apply
-      name: Apply
-      type: boolean
     - jsonPath: .status.status
       name: State
       type: string
@@ -705,8 +702,6 @@ spec:
           spec:
             description: SelinuxProfileSpec defines the desired state of SelinuxProfile.
             properties:
-              apply:
-                type: boolean
               policy:
                 type: string
             type: object
diff --git a/examples/selinuxprofile.yaml b/examples/selinuxprofile.yaml
index bf3b1a5da..ce87ac4bf 100644
--- a/examples/selinuxprofile.yaml
+++ b/examples/selinuxprofile.yaml
@@ -3,7 +3,6 @@ kind: SelinuxProfile
 metadata:
   name: errorlogger
 spec:
-  apply: true
   policy: |
     (blockinherit container)
     (allow process var_log_t ( dir ( open read getattr lock search ioctl add_name remove_name write ))) 


Test patch:
diff --git a/tools.go b/internal/pkg/tools/tools.go
similarity index 100%
rename from tools.go
rename to internal/pkg/tools/tools.go
diff --git a/test/tc_selinux_base_usage_test.go b/test/tc_selinux_base_usage_test.go
index c031368c1..fadbf7db3 100644
--- a/test/tc_selinux_base_usage_test.go
+++ b/test/tc_selinux_base_usage_test.go
@@ -60,7 +60,6 @@ kind: SelinuxProfile
 metadata:
   name: errorlogger
 spec:
-  apply: true
   policy: |
     (blockinherit container)
     (allow process var_log_t ( dir ( open read getattr lock search ioctl add_name remove_name write )))