Skip to content

Commit cbc16e1

Browse files
authored
Merge pull request #59677 from bergerhoffer/pr-58550
OSDOCS-1207 Run once duration override operator docs
2 parents b4471f9 + 381d24c commit cbc16e1

18 files changed

+370
-42
lines changed

_attributes/common-attributes.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,3 +179,4 @@ endif::[]
179179
:3no: three-node OpenShift
180180
:3no-caps: Three-node OpenShift
181181
:web-terminal-op: Web Terminal Operator
182+
:run-once-operator: Run Once Duration Override Operator

_topic_maps/_topic_map.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2261,6 +2261,18 @@ Topics:
22612261
- Name: Placing pods on specific nodes using node selectors
22622262
File: nodes-pods-node-selectors
22632263
Distros: openshift-enterprise,openshift-origin
2264+
- Name: Run Once Duration Override Operator
2265+
Dir: run_once_duration_override
2266+
Distros: openshift-enterprise
2267+
Topics:
2268+
- Name: Run Once Duration Override Operator overview
2269+
File: index
2270+
- Name: Run Once Duration Override Operator release notes
2271+
File: run-once-duration-override-release-notes
2272+
- Name: Overriding the active deadline for run-once pods
2273+
File: run-once-duration-override-install
2274+
- Name: Uninstalling the Run Once Duration Override Operator
2275+
File: run-once-duration-override-uninstall
22642276
- Name: Controlling pod placement onto nodes (scheduling)
22652277
Dir: scheduling
22662278
Distros: openshift-enterprise,openshift-origin

modules/nodes-pods-configuring-run-once.adoc

Lines changed: 0 additions & 40 deletions
This file was deleted.

modules/rodoo-about.adoc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * nodes/pods/run_once_duration_override/index.adoc
4+
5+
:_content-type: CONCEPT
6+
[id="run-once-about_{context}"]
7+
= About the {run-once-operator}
8+
9+
{product-title} relies on run-once pods to perform tasks such as deploying a pod or performing a build. Run-once pods are pods that have a `RestartPolicy` of `Never` or `OnFailure`.
10+
11+
Cluster administrators can use the {run-once-operator} to force a limit on the time that those run-once pods can be active. After the time limit expires, the cluster will try to actively terminate those pods. The main reason to have such a limit is to prevent tasks such as builds to run for an excessive amount of time.
12+
13+
To apply the run-once duration override from the {run-once-operator} to run-once pods, you must enable it on each applicable namespace.
14+
15+
If both the run-once pod and the {run-once-operator} have their `activeDeadlineSeconds` value set, the lower of the two values is used.

modules/rodoo-enable-override.adoc

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * nodes/pods/run_once_duration_override/run-once-duration-override-install.adoc
4+
5+
:_content-type: PROCEDURE
6+
[id="rodoo-enable-override_{context}"]
7+
= Enabling the run-once duration override on a namespace
8+
9+
To apply the run-once duration override from the {run-once-operator} to run-once pods, you must enable it on each applicable namespace.
10+
11+
.Prerequisites
12+
13+
* The {run-once-operator} is installed.
14+
15+
.Procedure
16+
17+
. Log in to the OpenShift CLI.
18+
19+
. Add the label to enable the run-once duration override to your namespace:
20+
+
21+
[source,terminal]
22+
----
23+
$ oc label namespace <namespace> \ <1>
24+
runoncedurationoverrides.admission.runoncedurationoverride.openshift.io/enabled=true
25+
----
26+
<1> Specify the namespace to enable the run-once duration override on.
27+
28+
After you enable the run-once duration override on this namespace, future run-once pods that are created in this namespace will have their `activeDeadlineSeconds` field set to the override value from the {run-once-operator}. Existing pods in this namespace will also have their `activeDeadlineSeconds` value set when they are updated next.
29+
30+
.Verification
31+
32+
. Create a test run-once pod in the namespace that you enabled the run-once duration override on:
33+
+
34+
[source,yaml]
35+
----
36+
apiVersion: v1
37+
kind: Pod
38+
metadata:
39+
name: example
40+
namespace: <namespace> <1>
41+
spec:
42+
restartPolicy: Never <2>
43+
containers:
44+
- name: busybox
45+
securityContext:
46+
allowPrivilegeEscalation: false
47+
capabilities:
48+
drop: ["ALL"]
49+
runAsNonRoot:
50+
true
51+
seccompProfile:
52+
type: "RuntimeDefault"
53+
image: busybox:1.25
54+
command:
55+
- /bin/sh
56+
- -ec
57+
- |
58+
while sleep 5; do date; done
59+
----
60+
<1> Replace `<namespace>` with the name of your namespace.
61+
<2> The `restartPolicy` must be `Never` or `OnFailure` to be a run-once pod.
62+
63+
. Verify that the pod has its `activeDeadlineSeconds` field set:
64+
+
65+
[source,terminal]
66+
----
67+
$ oc get pods -n <namespace> -o yaml | grep activeDeadlineSeconds
68+
----
69+
+
70+
.Example output
71+
[source,terminal]
72+
----
73+
activeDeadlineSeconds: 3600
74+
----

modules/rodoo-install-operator.adoc

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * nodes/pods/run_once_duration_override/run-once-duration-override-install.adoc
4+
5+
:_content-type: PROCEDURE
6+
[id="rodoo-install-operator_{context}"]
7+
= Installing the {run-once-operator}
8+
9+
You can use the web console to install the {run-once-operator}.
10+
11+
.Prerequisites
12+
13+
* You have access to the cluster with `cluster-admin` privileges.
14+
* You have access to the {product-title} web console.
15+
16+
.Procedure
17+
18+
. Log in to the {product-title} web console.
19+
20+
. Create the required namespace for the {run-once-operator}.
21+
.. Navigate to *Administration* -> *Namespaces* and click *Create Namespace*.
22+
.. Enter `openshift-run-once-duration-override-operator` in the *Name* field and click *Create*.
23+
24+
. Install the {run-once-operator}.
25+
.. Navigate to *Operators* -> *OperatorHub*.
26+
.. Enter *{run-once-operator}* into the filter box.
27+
.. Select the *{run-once-operator}* and click *Install*.
28+
.. On the *Install Operator* page:
29+
... The *Update channel* is set to *stable*, which installs the latest stable release of the {run-once-operator}.
30+
... Select *A specific namespace on the cluster*.
31+
... Choose *openshift-run-once-duration-override-operator* from the dropdown menu under *Installed namespace*.
32+
... Select an *Update approval* strategy.
33+
+
34+
* The *Automatic* strategy allows Operator Lifecycle Manager (OLM) to automatically update the Operator when a new version is available.
35+
* The *Manual* strategy requires a user with appropriate credentials to approve the Operator update.
36+
... Click *Install*.
37+
38+
. Create a `RunOnceDurationOverride` instance.
39+
.. From the *Operators* -> *Installed Operators* page, click *{run-once-operator}*.
40+
.. Select the *Run Once Duration Override* tab and click *Create RunOnceDurationOverride*.
41+
.. Edit the settings as necessary.
42+
+
43+
Under the `runOnceDurationOverride` section, you can update the `spec.activeDeadlineSeconds` value, if required. The predefined value is `3600` seconds, or 1 hour.
44+
45+
.. Click *Create*.
46+
47+
48+
.Verification
49+
50+
. Log in to the OpenShift CLI.
51+
52+
. Verify all pods are created and running properly.
53+
+
54+
[source,terminal]
55+
----
56+
$ oc get pods -n openshift-run-once-duration-override-operator
57+
----
58+
+
59+
.Example output
60+
[source,terminal]
61+
----
62+
NAME READY STATUS RESTARTS AGE
63+
run-once-duration-override-operator-7b88c676f6-lcxgc 1/1 Running 0 7m46s
64+
runoncedurationoverride-62blp 1/1 Running 0 41s
65+
runoncedurationoverride-h8h8b 1/1 Running 0 41s
66+
runoncedurationoverride-tdsqk 1/1 Running 0 41s
67+
----

modules/rodoo-uninstall-operator.adoc

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * nodes/pods/run_once_duration_override/run-once-duration-override-uninstall.adoc
4+
5+
:_content-type: PROCEDURE
6+
[id="rodoo-uninstall-operator_{context}"]
7+
= Uninstalling the {run-once-operator}
8+
9+
You can use the web console to uninstall the {run-once-operator}. Uninstalling the {run-once-operator} does not unset the `activeDeadlineSeconds` field for run-once pods, but it will no longer apply the override value to future run-once pods.
10+
11+
.Prerequisites
12+
13+
* You have access to the cluster with `cluster-admin` privileges.
14+
* You have access to the {product-title} web console.
15+
* You have installed the {run-once-operator}.
16+
17+
.Procedure
18+
19+
. Log in to the {product-title} web console.
20+
21+
. Navigate to *Operators* -> *Installed Operators*.
22+
23+
. Select `openshift-run-once-duration-override-operator` from the *Project* dropdown list.
24+
25+
. Delete the `RunOnceDurationOverride` instance.
26+
.. Click *{run-once-operator}* and select the *Run Once Duration Override* tab.
27+
.. Click the Options menu {kebab} next to the *cluster* entry and select *Delete RunOnceDurationOverride*.
28+
.. In the confirmation dialog, click *Delete*.
29+
30+
. Uninstall the {run-once-operator} Operator.
31+
.. Navigate to *Operators* -> *Installed Operators*.
32+
.. Click the Options menu {kebab} next to the *{run-once-operator}* entry and click *Uninstall Operator*.
33+
.. In the confirmation dialog, click *Uninstall*.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * nodes/pods/run_once_duration_override/run-once-duration-override-uninstall.adoc
4+
5+
:_content-type: PROCEDURE
6+
[id="rodoo-uninstall-resources_{context}"]
7+
= Uninstalling {run-once-operator} resources
8+
9+
Optionally, after uninstalling the {run-once-operator}, you can remove its related resources from your cluster.
10+
11+
.Prerequisites
12+
13+
* You have access to the cluster with `cluster-admin` privileges.
14+
* You have access to the {product-title} web console.
15+
* You have uninstalled the {run-once-operator}.
16+
17+
.Procedure
18+
19+
. Log in to the {product-title} web console.
20+
21+
. Remove CRDs that were created when the {run-once-operator} was installed:
22+
.. Navigate to *Administration* -> *CustomResourceDefinitions*.
23+
.. Enter `RunOnceDurationOverride` in the *Name* field to filter the CRDs.
24+
.. Click the Options menu {kebab} next to the *RunOnceDurationOverride* CRD and select *Delete CustomResourceDefinition*.
25+
.. In the confirmation dialog, click *Delete*.
26+
27+
. Delete the `openshift-run-once-duration-override-operator` namespace.
28+
.. Navigate to *Administration* -> *Namespaces*.
29+
.. Enter `openshift-run-once-duration-override-operator` into the filter box.
30+
.. Click the Options menu {kebab} next to the *openshift-run-once-duration-override-operator* entry and select *Delete Namespace*.
31+
.. In the confirmation dialog, enter `openshift-run-once-duration-override-operator` and click *Delete*.
32+
33+
. Remove the run-once duration override label from the namespaces that it was enabled on.
34+
35+
.. Navigate to *Administration* -> *Namespaces*.
36+
.. Select your namespace.
37+
.. Click *Edit* next to the *Labels* field.
38+
.. Remove the *runoncedurationoverrides.admission.runoncedurationoverride.openshift.io/enabled=true* label and click *Save*.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * nodes/pods/run_once_duration_override/run-once-duration-override-install.adoc
4+
5+
:_content-type: PROCEDURE
6+
[id="rodoo-update-active-deadline-seconds_{context}"]
7+
= Updating the run-once active deadline override value
8+
9+
You can customize the override value that the {run-once-operator} applies to run-once pods. The predefined value is `3600` seconds, or 1 hour.
10+
11+
.Prerequisites
12+
13+
* You have access to the cluster with `cluster-admin` privileges.
14+
* You have installed the {run-once-operator}.
15+
16+
.Procedure
17+
18+
. Log in to the OpenShift CLI.
19+
20+
. Edit the `RunOnceDurationOverride` resource:
21+
+
22+
[source,terminal]
23+
----
24+
$ oc edit runoncedurationoverride cluster
25+
----
26+
27+
. Update the `activeDeadlineSeconds` field:
28+
+
29+
[source,yaml]
30+
----
31+
apiVersion: operator.openshift.io/v1
32+
kind: RunOnceDurationOverride
33+
metadata:
34+
# ...
35+
spec:
36+
runOnceDurationOverride:
37+
spec:
38+
activeDeadlineSeconds: 1800 <1>
39+
# ...
40+
----
41+
<1> Set the `activeDeadlineSeconds` field to the desired value, in seconds.
42+
43+
. Save the file to apply the changes.
44+
45+
Any future run-once pods created in namespaces where the run-once duration override is enabled will have their `activeDeadlineSeconds` field set to this new value. Existing run-once pods in these namespaces will receive this new value when they are updated.

nodes/pods/nodes-pods-configuring.adoc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,3 @@ include::modules/pod-disruption-eviction-policy.adoc[leveloffset=+2]
3737
include::modules/nodes-pods-configuring-pod-critical.adoc[leveloffset=+1]
3838

3939
include::modules/nodes-pods-configuring-reducing.adoc[leveloffset=+1]
40-
41-
// modules/nodes-pods-configuring-run-once.adoc[leveloffset=+1]

0 commit comments

Comments
 (0)