Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Restore installing image puller on openshift using cli #2722

Merged
merged 7 commits into from
Apr 25, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ therefore improving the workspace start time.

* xref:installing-image-puller-on-openshift-by-using-the-web-console.adoc[]

* xref:installing-image-puller-on-openshift-using-cli.adoc[]

* xref:configuring-image-puller-to-pre-pull-default-che-images.adoc[]

* xref:configuring-image-puller-to-pre-pull-custom-images.adoc[]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
:_content-type: PROCEDURE
:description: Installing {image-puller-name-short} on OpenShift using CLI
:keywords: administration-guide, image-puller, openshift, openshift-templates, CLI
:navtitle: Installing {image-puller-name-short} on OpenShift using CLI
//:page-aliases: .:installing-image-puller-on-openshift-using-openshift-templates.adoc,installing-image-puller-on-openshift-using-openshift-templates.adoc
deerskindoll marked this conversation as resolved.
Show resolved Hide resolved

[id="installing-image-puller-on-openshift-using-the-cli"]
= Installing {image-puller-name-short} on OpenShift by using the CLI

You can install the {image-puller-name} on OpenShift by using OpenShift `oc` management tool.

.Prerequisites

* An active `oc` session with administrative permissions to the OpenShift cluster. See link:https://docs.openshift.com/container-platform/{ocp4-ver}/cli_reference/openshift_cli/getting-started-cli.html[Getting started with the OpenShift CLI].

.Procedure

. Gather a list of relevant container images to pull by navigating to the links:
* `pass:c,a,q[{prod-url}]/plugin-registry/v3/external_images.txt`
* `pass:c,a,q[{prod-url}]/devfile-registry/devfiles/external_images.txt`

. Define the memory requests and limits parameters to ensure pulled containers and the platform have enough memory to run.
+
When defining the minimal value for `CACHING_MEMORY_REQUEST` or `CACHING_MEMORY_LIMIT`, consider the necessary amount of memory required to run each of the container images to pull.
+
When defining the maximal value for `CACHING_MEMORY_REQUEST` or `CACHING_MEMORY_LIMIT`, consider the total memory allocated to the DaemonSet Pods in the cluster:
+
----
(memory limit) * (number of images) * (number of nodes in the cluster)
----
+
====
Pulling 5 images on 20 nodes, with a container memory limit of `20Mi` requires `2000Mi` of memory.
====

. Clone the {image-puller-name-short} repository and get in the directory containing the OpenShift templates:
+
[subs="+attributes,+quotes"]
----
$ git clone https://github.com/che-incubator/{image-puller-repository-name}
$ cd {image-puller-repository-name}/deploy/openshift
----

. Configure the `app.yaml`, `configmap.yaml` and `serviceaccount.yaml` OpenShift templates using following parameters:
+
.{image-puller-name-short} OpenShift templates parameters in `app.yaml`
[options="header"]
|===
|Value |Usage |Default

|`DEPLOYMENT_NAME`
|The value of `DEPLOYMENT_NAME` in the ConfigMap
|`{image-puller-deployment-name}`

|`IMAGE`
|Image used for the `{image-puller-deployment-name}` deployment
|`{image-puller-image-name}`

|`IMAGE_TAG`
|The image tag to pull
|`latest`

|`SERVICEACCOUNT_NAME`
|The name of the ServiceAccount created and used by the deployment
|`kubernetes-image-puller`

|===
+
.{image-puller-name-short} OpenShift templates parameters in `configmap.yaml`
[options="header"]
|===
|Value |Usage |Default

|`CACHING_CPU_LIMIT`
|The value of `CACHING_CPU_LIMIT` in the ConfigMap
|`.2`

|`CACHING_CPU_REQUEST`
|The value of `CACHING_CPU_REQUEST` in the ConfigMap
|`.05`

|`CACHING_INTERVAL_HOURS`
|The value of `CACHING_INTERVAL_HOURS` in the ConfigMap
|``"1"``

|`CACHING_MEMORY_LIMIT`
|The value of `CACHING_MEMORY_LIMIT` in the ConfigMap
|`"20Mi"`

|`CACHING_MEMORY_REQUEST`
|The value of `CACHING_MEMORY_REQUEST` in the ConfigMap
|`"10Mi"`

|`DAEMONSET_NAME`
|The value of `DAEMONSET_NAME` in the ConfigMap
|`{image-puller-deployment-name}`

|`DEPLOYMENT_NAME`
|The value of `DEPLOYMENT_NAME` in the ConfigMap
|`{image-puller-deployment-name}`

|`IMAGES`
|The value of `IMAGES` in the ConfigMap
|`{}`

|`NAMESPACE`
|The value of `NAMESPACE` in the ConfigMap
|`{image-puller-namespace}`

|`NODE_SELECTOR`
|The value of `NODE_SELECTOR` in the ConfigMap
|`"{}"`
|===
+
.{image-puller-name-short} OpenShift templates parameters in `serviceaccount.yaml`
[options="header"]
|===
|Value |Usage |Default

|`SERVICEACCOUNT_NAME`
|The name of the ServiceAccount created and used by the deployment
|`kubernetes-image-puller`

|===



. Create an OpenShift project to host the {image-puller-name-short}:
+
[subs="+attributes,+quotes"]
----
$ oc new-project __<{image-puller-namespace}>__
----

. Process and apply the templates to install the puller:
+
[subs="+attributes,+quotes"]
----
$ oc process -f serviceaccount.yaml | oc apply -f -
$ oc process -f configmap.yaml | oc apply -f -
$ oc process -f app.yaml | oc apply -f -
----


.Verification steps

. Verify the existence of a __<{image-puller-deployment-name}>__ deployment and a __<{image-puller-deployment-name}>__ DaemonSet. The DaemonSet needs to have a Pod for each node in the cluster:
+
[source%nowrap,dummy,subs="+quotes,+attributes"]
----
$ oc get deployment,daemonset,pod --namespace __<{image-puller-namespace}>__
----

. Verify the values of the __<{image-puller-deployment-name}>__ `ConfigMap`.
+
[source%nowrap,dummy,subs="+quotes,+attributes"]
----
$ oc get configmap __<{image-puller-deployment-name}>__ --output yaml
----
Loading