Skip to content

Commit ee1c132

Browse files
authored
Merge pull request #665 from dottorblaster/fix-ubuntu-leftovers-opensuse
chore: rename ubuntu identifiers to opensuse across tests and docs
2 parents 1b62b93 + 539ed91 commit ee1c132

8 files changed

Lines changed: 88 additions & 88 deletions

File tree

api/v1alpha1/samples/security_v1alpha1_workloadpolicy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ metadata:
55
spec:
66
mode: monitor # monitor/protect
77
rulesByContainer:
8-
ubuntu:
8+
opensuse:
99
executables:
1010
allowed:
1111
- /nginx-ingress-controller

api/v1alpha1/samples/security_v1alpha1_workloadpolicyproposal.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ metadata:
44
name: workloadpolicyproposal-sample
55
spec:
66
rulesByContainer:
7-
ubuntu:
7+
opensuse:
88
executables:
99
allowed:
1010
- /nginx-ingress-controller

docs/installation/quickstart.adoc

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ curl localhost:9090/metrics | grep runtime_enforcer_violations
106106
Once violations occur, you will see a counter like:
107107

108108
```
109-
runtime_enforcer_violations_total{action="monitor",k8s_namespace_name="default",node_name="node-1",policy_name="deploy-ubuntu-deployment"} 1
109+
runtime_enforcer_violations_total{action="monitor",k8s_namespace_name="default",node_name="node-1",policy_name="deploy-opensuse-deployment"} 1
110110
```
111111

112112
=== Summary
@@ -121,52 +121,52 @@ Executables that ran before the agent started won't be visible in the proposal.
121121

122122
=== Deploy a simple application
123123

124-
Let's create a fresh new Ubuntu Deployment.
124+
Let's create a fresh new openSUSE Deployment.
125125

126126
```bash
127-
kubectl apply -f https://raw.githubusercontent.com/rancher-sandbox/runtime-enforcer/main/docs/yaml/ubuntu-deployment.yaml
127+
kubectl apply -f https://raw.githubusercontent.com/rancher-sandbox/runtime-enforcer/main/docs/yaml/opensuse-deployment.yaml
128128

129129
# wait for the pod to be ready
130-
kubectl wait --for=condition=Ready pod -l app=ubuntu-deployment --timeout=300s
130+
kubectl wait --for=condition=Ready pod -l app=opensuse-deployment --timeout=300s
131131
```
132132

133133
=== Proposal generation
134134

135-
After a few seconds, you should see a new `WorkloadPolicyProposal` resource created for the Ubuntu deployment.
135+
After a few seconds, you should see a new `WorkloadPolicyProposal` resource created for the openSUSE deployment.
136136

137137
```bash
138-
kubectl get workloadpolicyproposals.security.rancher.io deploy-ubuntu-deployment -o yaml
138+
kubectl get workloadpolicyproposals.security.rancher.io deploy-opensuse-deployment -o yaml
139139
```
140140

141141
```yaml
142142
apiVersion: security.rancher.io/v1alpha1
143143
kind: WorkloadPolicyProposal
144144
metadata:
145-
name: deploy-ubuntu-deployment
145+
name: deploy-opensuse-deployment
146146
namespace: default
147147
ownerReferences:
148148
- apiVersion: apps/v1
149149
blockOwnerDeletion: true
150150
controller: true
151151
kind: Deployment
152-
name: ubuntu-deployment
152+
name: opensuse-deployment
153153
uid: f5e1a25e-8a80-4c2a-b21a-b70f28a0651c
154154
uid: 6aeac998-d4b6-4e17-9ce1-4d76bc4def61
155155
spec:
156156
rulesByContainer:
157-
ubuntu:
157+
opensuse:
158158
executables:
159159
allowed:
160160
- /usr/bin/ls
161161
- /usr/bin/sleep
162162
selector:
163163
matchLabels:
164-
app: ubuntu
164+
app: opensuse
165165
type: deployment
166166
```
167167

168168
Some notes on this proposal:
169-
* The proposal includes a list of observed executables for the `ubuntu` container. As expected, it captured the `ls` and `sleep` commands.
169+
* The proposal includes a list of observed executables for the `opensuse` container. As expected, it captured the `ls` and `sleep` commands.
170170
* As the name suggests, this is only a proposal and not a definitive policy yet, so nothing is enforced at this stage. To enforce it, we will create a `WorkloadPolicy`.
171171
* This proposal is tied to a specific workload. Its name is always in the form of `<workload-type>-<workload-name>`. There is also an owner reference to the Deployment so that when the workload is deleted, the proposal can be cleaned up automatically.
172172

@@ -176,46 +176,46 @@ This proposal looks reasonable for our Deployment, so the next step is convertin
176176
To do that, we label the `WorkloadPolicyProposal` with the `security.rancher.io/policy-ready` label set to `true`.
177177

178178
```bash
179-
kubectl label workloadpolicyproposals.security.rancher.io deploy-ubuntu-deployment security.rancher.io/policy-ready=true
179+
kubectl label workloadpolicyproposals.security.rancher.io deploy-opensuse-deployment security.rancher.io/policy-ready=true
180180
```
181181

182182
You can also use the kubectl plugin to perform the same step:
183183

184184
```bash
185-
kubectl runtime-enforcer proposal promote deploy-ubuntu-deployment
185+
kubectl runtime-enforcer proposal promote deploy-opensuse-deployment
186186
```
187187

188188
After a few seconds, you should see a new Custom Resource called `WorkloadPolicy`.
189189

190190
```bash
191-
kubectl get workloadpolicy.security.rancher.io deploy-ubuntu-deployment -o yaml
191+
kubectl get workloadpolicy.security.rancher.io deploy-opensuse-deployment -o yaml
192192
```
193193

194194
```yaml
195195
apiVersion: security.rancher.io/v1alpha1
196196
kind: WorkloadPolicy
197197
metadata:
198-
name: deploy-ubuntu-deployment
198+
name: deploy-opensuse-deployment
199199
namespace: default
200200
ownerReferences:
201201
- apiVersion: security.rancher.io/v1alpha1
202202
blockOwnerDeletion: true
203203
controller: true
204204
kind: WorkloadPolicyProposal
205-
name: deploy-ubuntu-deployment
205+
name: deploy-opensuse-deployment
206206
uid: 3dcb1758-cbde-4523-bbbf-4170758aa1dd
207207
uid: 394449cb-db06-4a15-aec0-6274d1f34d8e
208208
spec:
209209
mode: monitor
210210
rulesByContainer:
211-
ubuntu:
211+
opensuse:
212212
executables:
213213
allowed:
214214
- /usr/bin/ls
215215
- /usr/bin/sleep
216216
selector:
217217
matchLabels:
218-
app: ubuntu-deployment
218+
app: opensuse-deployment
219219
```
220220

221221
The syntax is very similar to the proposal, but there is one important difference: the `spec.mode: monitor` field.
@@ -238,9 +238,9 @@ WARNING: The `security.rancher.io/policy` label must be set at Pod creation time
238238
WARNING: By default in the runtime-enforcer Helm chart, pods with a non-existing policy will be prevented from running. This ensures that when a pod starts, it has all protection ready. To enable fail-open behavior, set `agent.nriFailopen=true`.
239239

240240
```bash
241-
kubectl patch deployment ubuntu-deployment --type=merge -p '{"spec":{"template":{"metadata":{"labels":{"security.rancher.io/policy":"deploy-ubuntu-deployment"}}}}}'
241+
kubectl patch deployment opensuse-deployment --type=merge -p '{"spec":{"template":{"metadata":{"labels":{"security.rancher.io/policy":"deploy-opensuse-deployment"}}}}}'
242242
# wait for the new pods to be ready
243-
kubectl wait --for=condition=Ready pod -l security.rancher.io/policy=deploy-ubuntu-deployment --timeout=300s
243+
kubectl wait --for=condition=Ready pod -l security.rancher.io/policy=deploy-opensuse-deployment --timeout=300s
244244
```
245245

246246
[WARNING]
@@ -259,27 +259,27 @@ kubectl logs -n runtime-enforcer deployment/runtime-enforcer-otel-collector -f
259259
In another terminal, run an allowed command:
260260

261261
```bash
262-
kubectl exec -n default deployment/ubuntu-deployment -- ls
262+
kubectl exec -n default deployment/opensuse-deployment -- ls
263263
```
264264

265265
Nothing should be reported.
266266

267267
Now, run a command that is not in the allowlist:
268268

269269
```bash
270-
kubectl exec -n default deployment/ubuntu-deployment -- ps
270+
kubectl exec -n default deployment/opensuse-deployment -- ps
271271
```
272272

273273
In the OTEL collector logs you should see an event for the `ps` command being executed.
274274

275275
```txt
276-
monitor 3f3235e0e92e6143965d46b967691cc1 9a6b46fa3165e86d evt.time=2026-01-14T10:39:01Z evt.rawtime=1768387141935180372 policy.name=deploy-ubuntu-deployment k8s.ns.name=default k8s.workload.name=ubuntu-deployment k8s.workload.kind=Deployment k8s.pod.name=ubuntu-deployment-f69df6b94-7s7f4 container.full_id=2f6eb089830e2c281551274e8d0e94bdb182a5444fc1a4ab7316f33dff8a5017 container.name=ubuntu proc.exepath=/usr/bin/ps action=monitor
276+
monitor 3f3235e0e92e6143965d46b967691cc1 9a6b46fa3165e86d evt.time=2026-01-14T10:39:01Z evt.rawtime=1768387141935180372 policy.name=deploy-opensuse-deployment k8s.ns.name=default k8s.workload.name=opensuse-deployment k8s.workload.kind=Deployment k8s.pod.name=opensuse-deployment-f69df6b94-7s7f4 container.full_id=2f6eb089830e2c281551274e8d0e94bdb182a5444fc1a4ab7316f33dff8a5017 container.name=opensuse proc.exepath=/usr/bin/ps action=monitor
277277
```
278278

279279
Violations are also visible directly on the WorkloadPolicy status. After the controller's next sync tick (up to 30 seconds), you can inspect them with `kubectl`:
280280

281281
```bash
282-
kubectl describe workloadpolicy.security.rancher.io deploy-ubuntu-deployment -n default
282+
kubectl describe workloadpolicy.security.rancher.io deploy-opensuse-deployment -n default
283283
```
284284

285285
In the output, look for the `Violations` section under `Status`:
@@ -288,8 +288,8 @@ In the output, look for the `Violations` section under `Status`:
288288
Status:
289289
Violations:
290290
- timestamp: "2026-01-14T10:39:01Z"
291-
podName: ubuntu-deployment-f69df6b94-7s7f4
292-
containerName: ubuntu
291+
podName: opensuse-deployment-f69df6b94-7s7f4
292+
containerName: opensuse
293293
executablePath: /usr/bin/ps
294294
nodeName: node-1
295295
action: monitor
@@ -306,25 +306,25 @@ Once we are confident in our policy and we want to enforce it, we can change the
306306
From now on, every violation of the executable list will be blocked.
307307

308308
```bash
309-
kubectl patch workloadpolicy deploy-ubuntu-deployment -n default --type='json' -p='[{"op": "replace", "path": "/spec/mode", "value": "protect"}]'
309+
kubectl patch workloadpolicy deploy-opensuse-deployment -n default --type='json' -p='[{"op": "replace", "path": "/spec/mode", "value": "protect"}]'
310310
```
311311

312312
You can also use the kubectl plugin to perform the same step:
313313

314314
```bash
315-
kubectl runtime-enforcer policy protect deploy-ubuntu-deployment -n default
315+
kubectl runtime-enforcer policy protect deploy-opensuse-deployment -n default
316316
```
317317

318318
Now we can try again an allowed binary, nothing should be reported.
319319

320320
```bash
321-
kubectl exec -n default deployment/ubuntu-deployment -- ls
321+
kubectl exec -n default deployment/opensuse-deployment -- ls
322322
```
323323

324324
This time, if we run a not allowed binary, we should see not only a report but also the process being blocked.
325325

326326
```bash
327-
kubectl exec -n default deployment/ubuntu-deployment -- ps
327+
kubectl exec -n default deployment/opensuse-deployment -- ps
328328
```
329329

330330
The terminal tells us the process is blocked with `EPERM`.
@@ -337,7 +337,7 @@ command terminated with exit code 255
337337
And we have a log entry for it:
338338

339339
```txt
340-
protect 37298bcde8726ade2516b5d3c63aa663 cb28aa0b03259160 evt.time=2026-01-14T10:49:11Z evt.rawtime=1768387751471907924 policy.name=deploy-ubuntu-deployment k8s.ns.name=default k8s.workload.name=ubuntu-deployment k8s.workload.kind=Deployment k8s.pod.name=ubuntu-deployment-f69df6b94-7s7f4 container.full_id=2f6eb089830e2c281551274e8d0e94bdb182a5444fc1a4ab7316f33dff8a5017 container.name=ubuntu proc.exepath=/usr/bin/ps action=protect
340+
protect 37298bcde8726ade2516b5d3c63aa663 cb28aa0b03259160 evt.time=2026-01-14T10:49:11Z evt.rawtime=1768387751471907924 policy.name=deploy-opensuse-deployment k8s.ns.name=default k8s.workload.name=opensuse-deployment k8s.workload.kind=Deployment k8s.pod.name=opensuse-deployment-f69df6b94-7s7f4 container.full_id=2f6eb089830e2c281551274e8d0e94bdb182a5444fc1a4ab7316f33dff8a5017 container.name=opensuse proc.exepath=/usr/bin/ps action=protect
341341
```
342342

343343
== Advanced Configuration

docs/troubleshooting.adoc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,34 +118,34 @@ For workloads that you want to ensure have runtime-enforcer protection present,
118118
apiVersion: apps/v1
119119
kind: Deployment
120120
metadata:
121-
name: ubuntu-deployment
121+
name: opensuse-deployment
122122
labels:
123-
app: ubuntu
123+
app: opensuse
124124
spec:
125125
replicas: 1
126126
selector:
127127
matchLabels:
128-
app: ubuntu
128+
app: opensuse
129129
template:
130130
metadata:
131131
labels:
132-
app: ubuntu
132+
app: opensuse
133133
security.rancher.io/policy: workloadpolicy-sample
134134
annotations:
135135
# This specifies "runtime-enforcer-agent" plugin to be required.
136136
required-plugins.noderesource.dev: '["runtime-enforcer-agent"]'
137137
spec:
138138
containers:
139-
- name: ubuntu
140-
image: ubuntu:24.04
139+
- name: opensuse
140+
image: registry.opensuse.org/opensuse/bci/bci-ci:3
141141
stdin: true
142142
tty: true
143143
----
144144

145145
When the required plugin is not available for any reason, the workload will fail to start with errors in Kubernetes events:
146146

147147
----
148-
4s Warning Failed pod/ubuntu-deployment-6655f5c7ff-xghnd Error: failed to create containerd container: failed to get NRI adjustment for container: validator "00-default-validator" rejected container adjustment, reason: validation error: required plugin "runtime-enforcer-agent" not present
148+
4s Warning Failed pod/opensuse-deployment-6655f5c7ff-xghnd Error: failed to create containerd container: failed to get NRI adjustment for container: validator "00-default-validator" rejected container adjustment, reason: validation error: required plugin "runtime-enforcer-agent" not present
149149
----
150150

151151
==== containerd: required_plugins

internal/controller/workloadpolicyproposals_webhook_test.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ import (
1515
var _ = Describe("WorkloadPolicyProposal Webhook", func() {
1616
Context("When learning a process", func() {
1717
typeNamespacedName := types.NamespacedName{
18-
Name: "ubuntu-deployment",
18+
Name: "opensuse-deployment",
1919
Namespace: "default",
2020
}
2121

2222
proposal := &securityv1alpha1.WorkloadPolicyProposal{
2323
ObjectMeta: metav1.ObjectMeta{
24-
Name: "deploy-ubuntu-deployment",
24+
Name: "deploy-opensuse-deployment",
2525
Namespace: "default",
2626
},
2727
Spec: securityv1alpha1.WorkloadPolicyProposalSpec{},
@@ -35,21 +35,21 @@ var _ = Describe("WorkloadPolicyProposal Webhook", func() {
3535
Spec: appsv1.DeploymentSpec{
3636
Selector: &metav1.LabelSelector{
3737
MatchLabels: map[string]string{
38-
"app": "ubuntu",
38+
"app": "opensuse",
3939
},
4040
},
4141
Template: corev1.PodTemplateSpec{
4242
ObjectMeta: metav1.ObjectMeta{
43-
Name: "ubuntu",
43+
Name: "opensuse",
4444
Labels: map[string]string{
45-
"app": "ubuntu",
45+
"app": "opensuse",
4646
},
4747
},
4848
Spec: corev1.PodSpec{
4949
Containers: []corev1.Container{
5050
{
51-
Name: "ubuntu",
52-
Image: "ubuntu",
51+
Name: "opensuse",
52+
Image: "opensuse",
5353
},
5454
},
5555
},
@@ -88,25 +88,25 @@ var _ = Describe("WorkloadPolicyProposal Webhook", func() {
8888
{
8989
Resource: &securityv1alpha1.WorkloadPolicyProposal{
9090
ObjectMeta: metav1.ObjectMeta{
91-
Name: "deploy-ubuntu-deployment",
91+
Name: "deploy-opensuse-deployment",
9292
Namespace: "default",
9393
OwnerReferences: []metav1.OwnerReference{
9494
{
9595
Kind: "Deployment",
96-
Name: "ubuntu-deployment",
96+
Name: "opensuse-deployment",
9797
},
9898
},
9999
},
100100
Spec: securityv1alpha1.WorkloadPolicyProposalSpec{},
101101
},
102102
Expected: &securityv1alpha1.WorkloadPolicyProposal{
103103
ObjectMeta: metav1.ObjectMeta{
104-
Name: "deploy-ubuntu-deployment",
104+
Name: "deploy-opensuse-deployment",
105105
Namespace: "default",
106106
OwnerReferences: []metav1.OwnerReference{
107107
{
108108
Kind: "Deployment",
109-
Name: "ubuntu-deployment",
109+
Name: "opensuse-deployment",
110110
APIVersion: "apps/v1",
111111
Controller: new(true),
112112
BlockOwnerDeletion: new(true),

0 commit comments

Comments
 (0)