mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-07 00:48:01 +01:00
85 lines
3.2 KiB
Plaintext
85 lines
3.2 KiB
Plaintext
// Module included in the following assemblies:
|
|
// * updating/updating_a_cluster/updating_disconnected_cluster/disconnected-update-osus.adoc
|
|
|
|
:_mod-docs-content-type: PROCEDURE
|
|
[id="update-service-create-service-cli_{context}"]
|
|
= Creating an OpenShift Update Service application by using the CLI
|
|
|
|
You can use the OpenShift CLI (`oc`) to create an OpenShift Update Service application.
|
|
|
|
.Prerequisites
|
|
|
|
* The OpenShift Update Service Operator has been installed.
|
|
* The OpenShift Update Service graph data container image has been created and pushed to a repository that is accessible to the OpenShift Update Service.
|
|
* The current release and update target releases have been mirrored to a locally accessible registry.
|
|
|
|
.Procedure
|
|
|
|
. Configure the OpenShift Update Service target namespace, for example, `openshift-update-service`:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ NAMESPACE=openshift-update-service
|
|
----
|
|
+
|
|
The namespace must match the `targetNamespaces` value from the operator group.
|
|
|
|
. Configure the name of the OpenShift Update Service application, for example, `service`:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ NAME=service
|
|
----
|
|
|
|
. Configure the local registry and repository for the release images as configured in "Mirroring the {product-title} image repository", for example, `registry.example.com/ocp4/openshift4-release-images`:
|
|
//TODO: Add xref to the preceding step when allowed.
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ RELEASE_IMAGES=registry.example.com/ocp4/openshift4-release-images
|
|
----
|
|
|
|
. Set the local pullspec for the graph data image to the graph data container image created in "Creating the OpenShift Update Service graph data container image", for example, `registry.example.com/openshift/graph-data:latest`:
|
|
//TODO: Add xref to the preceding step when allowed.
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ GRAPH_DATA_IMAGE=registry.example.com/openshift/graph-data:latest
|
|
----
|
|
|
|
. Create an OpenShift Update Service application object:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc -n "${NAMESPACE}" create -f - <<EOF
|
|
apiVersion: updateservice.operator.openshift.io/v1
|
|
kind: UpdateService
|
|
metadata:
|
|
name: ${NAME}
|
|
spec:
|
|
replicas: 2
|
|
releases: ${RELEASE_IMAGES}
|
|
graphDataImage: ${GRAPH_DATA_IMAGE}
|
|
EOF
|
|
----
|
|
|
|
. Verify the OpenShift Update Service application:
|
|
|
|
.. Use the following command to obtain a policy engine route:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ while sleep 1; do POLICY_ENGINE_GRAPH_URI="$(oc -n "${NAMESPACE}" get -o jsonpath='{.status.policyEngineURI}/api/upgrades_info/v1/graph{"\n"}' updateservice "${NAME}")"; SCHEME="${POLICY_ENGINE_GRAPH_URI%%:*}"; if test "${SCHEME}" = http -o "${SCHEME}" = https; then break; fi; done
|
|
----
|
|
+
|
|
You might need to poll until the command succeeds.
|
|
|
|
.. Retrieve a graph from the policy engine. Be sure to specify a valid version for `channel`. For example, if running in {product-title} {product-version}, use `stable-{product-version}`:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ while sleep 10; do HTTP_CODE="$(curl --header Accept:application/json --output /dev/stderr --write-out "%{http_code}" "${POLICY_ENGINE_GRAPH_URI}?channel=stable-4.6")"; if test "${HTTP_CODE}" -eq 200; then break; fi; echo "${HTTP_CODE}"; done
|
|
----
|
|
+
|
|
This polls until the graph request succeeds; however, the resulting graph might be empty depending on which release images you have mirrored.
|