Skip to content

Commit 6ccf6f4

Browse files
authored
Merge pull request #98326 from xiaojiey/spo-cr-scope
CMP-3405: Update seccompprofile and seclinuxprofile related commands as both CRD scope…
2 parents f5e1553 + eb59c94 commit 6ccf6f4

9 files changed

+26
-30
lines changed

modules/spo-applying-profiles.adoc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ spec:
4040
runAsNonRoot: true
4141
seccompProfile:
4242
type: Localhost
43-
localhostProfile: operator/my-namespace/profile1.json
43+
localhostProfile: operator/profile1.json
4444
containers:
4545
- name: test-container
4646
image: quay.io/security-profiles-operator/test-nginx-unprivileged:1.21
@@ -54,14 +54,14 @@ spec:
5454
+
5555
[source,terminal]
5656
----
57-
$ oc -n my-namespace get seccompprofile profile1 --output wide
57+
$ oc get seccompprofile profile1 --output wide
5858
----
5959
+
6060
.Example output
6161
[source,terminal]
6262
----
6363
NAME STATUS AGE SECCOMPPROFILE.LOCALHOSTPROFILE
64-
profile1 Installed 14s operator/my-namespace/profile1.json
64+
profile1 Installed 14s operator/profile1.json
6565
----
6666

6767
. View the path to the localhost profile by running the following command:
@@ -74,7 +74,7 @@ $ oc get sp profile1 --output=jsonpath='{.status.localhostProfile}'
7474
.Example output
7575
[source,terminal]
7676
----
77-
operator/my-namespace/profile1.json
77+
operator/profile1.json
7878
----
7979

8080
. Apply the `localhostProfile` output to the patch file:
@@ -87,7 +87,7 @@ spec:
8787
securityContext:
8888
seccompProfile:
8989
type: Localhost
90-
localhostProfile: operator/my-namespace/profile1.json
90+
localhostProfile: operator/profile1.json
9191
----
9292

9393
. Apply the profile to any other workload, such as a `Deployment` object, by running the following command:
@@ -117,7 +117,7 @@ $ oc -n my-namespace get deployment myapp --output=jsonpath='{.spec.template.spe
117117
----
118118
{
119119
"seccompProfile": {
120-
"localhostProfile": "operator/my-namespace/profile1.json",
120+
"localhostProfile": "operator/profile1.json",
121121
"type": "localhost"
122122
}
123123
}
@@ -143,13 +143,13 @@ $ oc label ns nginx-deploy --overwrite=true pod-security.kubernetes.io/enforce=p
143143
+
144144
[source,terminal]
145145
----
146-
$ oc get selinuxprofile.security-profiles-operator.x-k8s.io/nginx-secure -n nginx-deploy -ojsonpath='{.status.usage}'
146+
$ oc get selinuxprofile.security-profiles-operator.x-k8s.io/nginx-secure -ojsonpath='{.status.usage}'
147147
----
148148
+
149149
.Example output
150150
[source,terminal]
151151
----
152-
nginx-secure_nginx-deploy.process
152+
nginx-secure_.process
153153
----
154154

155155
. Apply the output string in the workload manifest in the `.spec.containers[].securityContext.seLinuxOptions` attribute:
@@ -175,7 +175,7 @@ spec:
175175
drop: [ALL]
176176
seLinuxOptions:
177177
# NOTE: This uses an appropriate SELinux type
178-
type: nginx-secure_nginx-deploy.process
178+
type: nginx-secure_.process
179179
----
180180
+
181181
[IMPORTANT]

modules/spo-base-syscalls.adoc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ You can use the `baseProfileName` attribute to establish the minimum required `s
1717
apiVersion: security-profiles-operator.x-k8s.io/v1beta1
1818
kind: SeccompProfile
1919
metadata:
20-
namespace: my-namespace
2120
name: example-name
2221
spec:
2322
defaultAction: SCMP_ACT_ERRNO

modules/spo-binding-workloads.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ $ oc get pod test-pod -o jsonpath='{.spec.containers[*].securityContext.seccompP
9292
.Example output
9393
[source,terminal]
9494
----
95-
{"localhostProfile":"operator/my-namespace/profile.json","type":"Localhost"}
95+
{"localhostProfile":"operator/profile.json","type":"Localhost"}
9696
----
9797
endif::[]
9898
ifdef::selinux[]
@@ -106,7 +106,7 @@ $ oc get pod test-pod -o jsonpath='{.spec.containers[*].securityContext.seLinuxO
106106
.Example output
107107
[source,terminal]
108108
----
109-
profile_nginx-binding.process
109+
profile_.process
110110
----
111111
endif::[]
112112

modules/spo-container-profile-instances.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ ifdef::selinux[]
104104
.Example output for {object}
105105
[source,terminal]
106106
----
107-
NAME USAGE STATE
108-
test-recording-nginx-record test-recording-nginx-record_my-namespace.process Installed
107+
NAME USAGE STATE
108+
test-recording-nginx-record test-recording-nginx-record_.process Installed
109109
----
110110
endif::[]
111111
ifdef::seccomp[]

modules/spo-creating-profiles.adoc

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ $ oc new-project my-namespace
4040
apiVersion: security-profiles-operator.x-k8s.io/v1beta1
4141
kind: {kind}
4242
metadata:
43-
namespace: my-namespace
4443
name: profile1
4544
spec:
4645
defaultAction: SCMP_ACT_LOG
@@ -76,7 +75,6 @@ apiVersion: security-profiles-operator.x-k8s.io/v1alpha2
7675
kind: {kind}
7776
metadata:
7877
name: nginx-secure
79-
namespace: nginx-deploy
8078
spec:
8179
allow:
8280
'@self':
@@ -97,7 +95,7 @@ spec:
9795
+
9896
[source,terminal]
9997
----
100-
$ oc wait --for=condition=ready -n nginx-deploy selinuxprofile nginx-secure
98+
$ oc wait --for=condition=ready selinuxprofile nginx-secure
10199
----
102100
+
103101
.Example output
@@ -121,15 +119,15 @@ $ oc -n openshift-security-profiles rsh -c selinuxd ds/spod
121119
+
122120
[source,terminal]
123121
----
124-
$ cat /etc/selinux.d/nginx-secure_nginx-deploy.cil
122+
$ cat /etc/selinux.d/nginx-secure_.cil
125123
----
126124
+
127125
.Example output
128126
[source,terminal]
129127
----
130-
(block nginx-secure_nginx-deploy
128+
(block nginx-secure_
131129
(blockinherit container)
132-
(allow process nginx-secure_nginx-deploy.process ( tcp_socket ( listen )))
130+
(allow process nginx-secure_.process ( tcp_socket ( listen )))
133131
(allow process http_cache_port_t ( tcp_socket ( name_bind )))
134132
(allow process node_t ( tcp_socket ( node_bind )))
135133
)
@@ -145,7 +143,7 @@ $ semodule -l | grep nginx-secure
145143
.Example output
146144
[source,terminal]
147145
----
148-
nginx-secure_nginx-deploy
146+
nginx-secure_
149147
----
150148
endif::[]
151149

modules/spo-log-enricher-app-trace.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ apiVersion: security-profiles-operator.x-k8s.io/v1beta1
1818
kind: SeccompProfile
1919
metadata:
2020
name: log
21-
namespace: default
2221
spec:
2322
defaultAction: SCMP_ACT_LOG
2423
----
@@ -31,12 +30,13 @@ apiVersion: v1
3130
kind: Pod
3231
metadata:
3332
name: log-pod
33+
namespace: default
3434
spec:
3535
securityContext:
3636
runAsNonRoot: true
3737
seccompProfile:
3838
type: Localhost
39-
localhostProfile: operator/default/log.json
39+
localhostProfile: operator/log.json
4040
containers:
4141
- name: log-container
4242
image: quay.io/security-profiles-operator/test-nginx-unprivileged:1.21

modules/spo-recording-profiles.adoc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ endif::[]
142142
+
143143
[source,terminal]
144144
----
145-
$ oc -n my-namepace delete pod my-pod
145+
$ oc -n my-namespace delete pod my-pod
146146
----
147147

148148
. Confirm the Security Profiles Operator reconciles the two {type} profiles:
@@ -151,7 +151,7 @@ ifdef::seccomp[]
151151
+
152152
[source,terminal]
153153
----
154-
$ oc get seccompprofiles -lspo.x-k8s.io/recording-id=test-recording -n my-namespace
154+
$ oc get seccompprofiles -lspo.x-k8s.io/recording-id=test-recording
155155
----
156156
+
157157
.Example output for seccompprofile
@@ -167,15 +167,15 @@ ifdef::selinux[]
167167
+
168168
[source,terminal]
169169
----
170-
$ oc get selinuxprofiles -lspo.x-k8s.io/recording-id=test-recording -n my-namespace
170+
$ oc get selinuxprofiles -lspo.x-k8s.io/recording-id=test-recording
171171
----
172172
+
173173
.Example output for selinuxprofile
174174
[source,terminal]
175175
----
176176
NAME USAGE STATE
177-
test-recording-nginx test-recording-nginx_my-namespace.process Installed
178-
test-recording-redis test-recording-redis_my-namespace.process Installed
177+
test-recording-nginx test-recording-nginx_.process Installed
178+
test-recording-redis test-recording-redis_.process Installed
179179
----
180180
endif::[]
181181

modules/spo-replicating-controllers.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ spec:
9393
serviceAccountName: spo-deploy-test
9494
securityContext:
9595
seLinuxOptions:
96-
type: nginx-secure_nginx-secure.process <1>
96+
type: nginx-secure_.process <1>
9797
containers:
9898
- name: nginx-unpriv
9999
image: quay.io/security-profiles-operator/test-nginx-unprivileged:1.21

modules/spo-selinux-permissive.adoc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ apiVersion: security-profiles-operator.x-k8s.io/v1alpha2
2323
kind: SelinuxProfile
2424
metadata:
2525
name: nginx-secure
26-
namespace: nginx-deploy
2726
spec:
2827
permissive: true
2928
----

0 commit comments

Comments
 (0)