Skip to content

Commit e7de9db

Browse files
fix: resolved bug for ocmirrorv2 from 4.19 (#412)
This PR will fix the oc mirror v2 from 4.19 for disconnected setups. ## Validations - [x] Successfully Installed 4.20 cluster using these changes ``` [root@ocpz-disconnected-bastion ~]# oc get clusterversion NAME VERSION AVAILABLE PROGRESSING SINCE STATUS version 4.20.4 True False 23m Error while reconciling 4.20.4: the cluster operator olm is not available ``` Note: This is verified for UPI installations. But not for ABI as of now. It will be verified based on the requirement in the future. --------- Signed-off-by: Kotakonda Sai Deekshith <[email protected]> Co-authored-by: Veerabhadrarao Damisetti <[email protected]>
1 parent b90f359 commit e7de9db

File tree

8 files changed

+206
-82
lines changed

8 files changed

+206
-82
lines changed

docs/run-the-playbooks-for-disconnected.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,15 @@ configurations are mentioned over here.
6868
### Overview
6969
7070
Mirror the ocp platform and other necessary images to the mirror registry. Please run this playbook before you run **6 Create Nodes Playbook** and after
71-
**0 Setup Playbook**.
71+
**5 Setup Bastion**.
7272
7373
### Outcomes
7474
7575
* Download `oc` and `oc-mirror` to the mirror host.
7676
* Template the mirror pull secret to the mirror host.
7777
* Add the ca cert to the mirror host anchors if ca is not trusted.
7878
* Mirror the platform images using `oc adm release mirror` if legacy mirroring is enabled.
79-
* Template the image set to mirror host and then mirror it using `oc-mirror` plogin.
79+
* Template the image set to mirror host and then mirror it using `oc-mirror` plugin.
8080
* Copy the results on the `oc-mirror` to ansible controller to apply to cluster in future steps.
8181
8282
### Notes

docs/set-variables-group-vars.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,27 +253,33 @@
253253
:--- | :--- | :---
254254
**disconnected.enabled** | True or False, to enable disconnected mode | False
255255
**disconnected.registry.url** | String containing url of disconnected registry with or without port and without protocol | registry.tt.testing:5000
256+
**disconnected.registry.ip** | String containing ip of the registry, which will be used for resolving dns | `192.168.151.1`
256257
**disconnected.registry.pull_secret** | String containing pull secret of the disconnected registry to be applied on the *cluster*. Make sure to enclose pull_secret in 'single quotes' and it has appropriate pull access. | '{"auths":{"registry.tt..testing:5000":{"auth":"b3Blb...4yQQ==","email":"[email protected]"}}}'
257-
**disconnected.registry.mirror_pull_ecret** | String containing pull secret to use for mirroring. Contains Red Hat secret and registry pull secret. Make sure to enclose pull_secret in 'single quotes' and must be able to push to mirror registry. | '{"auths":{"cloud.openshift.com":{"auth":"b3Blb...4yQQ==","email":"[email protected]", "registry.tt..testing:5000":[email protected]"}}}'
258+
**disconnected.registry.mirror_pull_secret** | String containing pull secret to use for mirroring. Contains Red Hat secret and registry pull secret. Make sure to enclose pull_secret in 'single quotes' and must be able to push to mirror registry. | '{"auths":{"cloud.openshift.com":{"auth":"b3Blb...4yQQ==","email":"[email protected]", "registry.tt..testing:5000":[email protected]"}}}'
258259
**disconnected.registry.ca_trusted** | True or False to indicate that mirror registry CA is implicitly trusted or needs to be made trusted on mirror host and cluster. | False
259260
**disconnected.registry.ca_cert** | Multiline string containing the mirror registry CA bundle | -----BEGIN CERTIFICATE-----MIIDqDCCApCgAwIBAgIULL+d1HTYsiP+8jeWnqBis3N4BskwDQYJKoZIhvcNAQEF...-----END CERTIFICATE-----
260261
**disconnected.mirroring.host.name** | String containing the hostname of the host, which will be used for mirroring | mirror-host-1
261262
**disconnected.mirroring.host.ip** | String containing ip of the host, which will be used for mirroring | 192.168.10.99
262263
**disconnected.mirroring.host.user** | String containing the username of the host, which will be used for mirroring | mirroruser
263264
**disconnected.mirroring.host.pass** | String containing the password of the host, which will be used for mirroring | mirrorpassword
264265
**disconnected.mirroring.file_server.clients_dir** | Directory path relative to the HTTP/FTP accessible directory on **env.file_server** where client binary tarballs are kept | clients
265-
**disconnected.mirroring.file_server.oc_mirror_tgz** | Name of oc-mirror tarball on **env.file_server** in **disconnected.mirroring.file_server.clients_dir** | oc-mirror.tar.gz
266-
**disconnected.mirroring.legacy.platform** | True or False if the platform should be mirrored using `oc adm release mirror`. | False
266+
**disconnected.mirroring.file_server.oc_mirror_tgz** | Name of oc-mirror tarball on **env.file_server** in **disconnected.mirroring.file_server.clients_dir**. This must be placed in your ftp server after downloading it yourself from https://console.redhat.com/openshift/downloads. | oc-mirror.tar.gz
267+
**disconnected.mirroring.client_download.ocp_download_url** | url to download the oc client | https://mirror.openshift.com/pub/openshift-v4/multi/clients/ocp/4.13.1/amd64/
268+
**disconnected.mirroring.client_download.ocp_client_tgz** | Name of oc-client tarball on **env.file_server**. This should match the binary name available in **disconnected.mirroring.client_download.ocp_download_url** | openshift-client-linux.tar.gz
269+
**disconnected.mirroring.legacy.platform** | True or False if the platform should be mirrored using `oc adm release mirror`. If **True** then platform is mirrored in the old way and install config will be patched with the imagecontentsourcepolicy | False (default)
267270
**disconnected.mirroring.legacy.ocp_quay_release_image_tag** | The tag of the release image *quay.io/openshift-release-dev/ocp-release* to mirror and use | 4.13.1-s390x
268271
**disconnected.mirroring.legacy.ocp_org** | The org part of the repo on the mirror registry where the release image will be pushed | ocp4
269272
**disconnected.mirroring.legacy.ocp_repo** | The repo part of the repo on the mirror registry where the release image will be pushed | openshift4
270273
**disconnected.mirroring.legacy.ocp_tag** | The tag part of the repo on the mirror registry where the release image will be pushed. Full image would be as below.: disconnected.registry.url/disconnected.mirroring.legacy.ocp_org/disconnected...ocp_repo:disconnected..ocp_tag | v4.13.1
271-
**disconnected.mirroring.oc_mirror.release_image_tag** | The ocp release image tag you want to install the cluster with. Used when legacy platform mirroring is disabled and **disconnected.mirroring.oc_mirror.image_set** contains platform entries. | 4.13.1-multi
272274
**disconnected.mirroring.oc_mirror.oc_mirror_args.continue_on_error** | True or False to give `--continue-on-error` flag to `oc-mirror` | False
273275
**disconnected.mirroring.oc_mirror.oc_mirror_args.source_skip_tls** | True or False to give `--source-skip-tls` flag to `oc-mirror` | False
274276
**disconnected.mirroring.oc_mirror.post_mirror.mapping.replace.enabled** | True or False to replace values in `mapping.txt` generated by oc-mirror. This also does a manual repush of the images in `mapping.txt`. | False
275277
**disconnected.mirroring.oc_mirror.post_mirror.mapping.replace.list** | List of **regexp** and **replace** where every string/regular expression gets replaced by corresponding *replace* value. | regexp: interal-url.com replace: external-url.com
278+
**disconnected.mirroring.oc_mirror.release_image_tag** | The ocp release image tag you want to install the cluster with. Used when legacy platform mirroring is disabled and **disconnected.mirroring.oc_mirror.image_set** contains platform entries. | 4.13.1-multi
279+
**disconnected.mirroring.oc_mirror.release_image_registry** | The Release Image registry like Brew Registry which stores the release images as mirror to **registry.redhat.io**. This will be mirror registry for release operator images| `brew.registry.redhat.io`
276280
**disconnected.mirroring.oc_mirror.image_set** | YAML fields containing a standard `oc-mirror` [image set](https://docs.openshift.com/container-platform/latest/installing/disconnected_install/installing-mirroring-disconnected.html#oc-mirror-creating-image-set-config_installing-mirroring-disconnected) with some minor changes to schema. Differences are documented as needed. Used to generate final image set. | see template
281+
**disconnected.mirroring.oc_mirror.image_set.apiVersion** | The API version of the `ImageSetConfiguration` content. | `mirror.openshift.io/v1alpha2`, `mirror.openshift.io/v2alpha1`
282+
**disconnected.mirroring.oc_mirror.image_set.storageConfig.enabled** | True or False to set whether oc-mirror is v1 or v2. As for v2 storageConfig flag is removed completely | `True` or `False`
277283
**disconnected.mirroring.oc_mirror.image_set.storageConfig.registry.enabled** | True or False to use registry storage backend for pushing mirrored content directly to the registry. Currently only this backend is supported.| True
278284
**disconnected.mirroring.oc_mirror.image_set.storageConfig.registry.imageURL.org** | The org part of registry imageURL from standard image set. | mirror
279285
**disconnected.mirroring.oc_mirror.image_set.storageConfig.registry.imageURL.repo** | The repo part of registry imageURL from standard image set. Final imageURL will be as below: disconnected.registry.url/disconnected.mirroring.oc_mirror.image_set.storageConfig .registry.imageURL.org/disconnected...imageURL.repo | oc-mirror-metadata
Lines changed: 46 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,86 @@
11
# Warning: currently, the oc-mirror plugin is officially downloadable to amd64 only.
2+
# Please refer to docs set-variables-group-vars.md for instructions on how to create this configuration file for disconnected.
23
disconnected:
3-
enabled: False
4+
enabled: false
45
registry:
56
url: 'registry url'
6-
pull_secret: '' # this is similar to env.redhat.pull_secret but it will only contain secrets to be applied to the cluster in disconnected mode.
7-
mirror_pull_secret: '' # this should contain a pull secret that contains the combination of env.redhat.pull_secret and pull secret with push access to mirror registry for mirroring
8-
ca_trusted: False
7+
ip: 'registry reachable ip'
8+
pull_secret: ''
9+
mirror_pull_secret: ''
10+
ca_trusted: false
911
ca_cert: |
1012
-----BEGIN CERTIFICATE-----
11-
if ca_trusted is False, then this ca will be added to mirror host anchors as well as to the install config of cluster
13+
if ca_trusted is False, then this ca will be added to mirror host anchors
14+
as well as to the install config of cluster
1215
-----END CERTIFICATE-----
1316
mirroring:
14-
host: # this is the host that can access the internet as well as the registry
17+
# this is the host that can access the internet as well as the registry
18+
host:
1519
name: hosname
1620
ip: x.x.x.x
1721
user: mirroruser # with become access
1822
pass: mirrorpassword
19-
file_server: # in disconnected mode, the client binaries and rhcos will be put on env.file_server and then downloaded to the final destination from there. For now, its only oc-mirror. Rest of artifacts will be downloaded from urls
23+
# In disconnected mode client binaries and RHCOS will be placed on the
24+
# file server (env.file_server) and then downloaded to the final
25+
# destination from there. Currently only oc-mirror is handled this way.
26+
file_server:
2027
clients_dir: 'clients'
21-
oc_mirror_tgz: 'oc-mirror.tar.gz' # name of oc-mirror plugin binary in clients_dir. should be a tar.gz file. You must place this in your ftp server after downloading it yourself from https://console.redhat.com/openshift/downloads for amd64 (or building it yourself if your mirror host is s390x)
22-
client_download: # this will download oc binary to the mirror host for use on the mirror host for mirroring
28+
oc_mirror_tgz: 'oc-mirror.tar.gz'
29+
# this will download oc binary to the mirror host for use on the mirror host for mirroring
30+
client_download:
2331
ocp_download_url: "https://mirror.openshift.com/pub/openshift-v4/multi/clients/ocp/4.13.1/amd64/"
24-
ocp_client_tgz: 'openshift-client-linux.tar.gz' # name of the oc binary. Should be a tar.gz file
32+
ocp_client_tgz: 'openshift-client-linux.tar.gz'
2533
legacy:
26-
platform: False # if true then platform is mirrored in the old way and install config will be patched with the imagecontentsourcepolicy
34+
platform: false
2735
ocp_quay_release_image_tag: '4.13.1-s390x'
2836
ocp_org: 'ocp4'
2937
ocp_repo: 'openshift4'
30-
ocp_tag: 'v4.13.1' # platform images will be pushed to {tegistry_url}/{ocp_org}/{ocp_repo}:{ocp_tag}
38+
ocp_tag: 'v4.13.1' # platform images will be pushed to {registry_url}/{ocp_org}/{ocp_repo}:{ocp_tag}
3139
oc_mirror:
3240
oc_mirror_args:
33-
continue_on_error: False
34-
source_skip_tls: False
41+
continue_on_error: false
42+
source_skip_tls: false
3543
post_mirror:
3644
mapping:
3745
replace:
38-
enabled: False
46+
enabled: false
3947
list:
40-
- regexp: what
41-
replace: with
48+
- regexp: what
49+
replace: with
4250
release_image_tag: '4.13.1-multi'
43-
image_set: # this field is a standard image set from oc-mirror documentation. The only exception is the storageConfig which is altered to allow substitution of disconnected.registry.url
51+
release_image_registry: 'brew.registry.redhat.io'
52+
image_set:
53+
# this field is a standard image set from oc-mirror documentation.
54+
# The only exception is the storageConfig which is altered to allow substitution of disconnected.registry.url
55+
apiVersion: mirror.openshift.io/v2alpha1 # update the version with v2alpha1 for oc-mirror v2 plugin and v1alpha2 for v1 plugin
4456
storageConfig:
57+
enable: false # enable this flag if oc-mirror v1 plugin is used since storageConfig is removed for v2 plugin
4558
registry:
46-
enabled: True # use registry storage backend. Currently only method supproted
59+
enabled: true # use registry storage backend. Currently only method supported
4760
imageURL: # the final value will be {imageURL: disconnected.registry.url/org/repo}
4861
org: mirror
4962
repo: oc-mirror-metadata
5063
skipTLS: false # standard field form oc-mirror schema
51-
mirror: # this field is also atandard from the oc-mirror schema. It will be substituted as is into the final image set.
64+
mirror: # this field is also standard from the oc-mirror schema. It will be substituted as is into the final image set.
5265
platform:
5366
architectures:
54-
- multi # note: while image tags such as `multi-s390x` are also available on quay, we cannot mirror these, so list can only contain pure architecture names such as `s390x` or the multiarch `multi`
67+
- multi
68+
# Note: cannot mirror tags like multi-s390x; list must contain pure
69+
# architecture names (e.g. s390x) or the multiarch token 'multi'.
5570
channels:
56-
- name: stable-4.13
57-
full: false
58-
minVersion: 4.13.1
59-
maxVersion: 4.13.1
71+
- name: stable-4.13
72+
full: false
73+
minVersion: 4.13.1
74+
maxVersion: 4.13.1
6075
operators:
6176
- catalog: registry.redhat.io/redhat/redhat-operator-index:v4.13
6277
full: false
6378
packages:
64-
- name: serverless-operator
65-
channels:
66-
- name: stable
67-
#minVersion: '2.4.1-0'
68-
#maxVersion: '2.4.1-0'
79+
- name: serverless-operator
80+
channels:
81+
- name: stable
82+
# minVersion: '2.4.1-0'
83+
# maxVersion: '2.4.1-0'
6984
additionalImages:
70-
- name: registry.redhat.io/ubi8/ubi:latest
85+
- name: registry.redhat.io/ubi8/ubi:latest
7186
helm: {}

roles/disconnected_check_vars/tasks/main.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
- name: 'Check mandatory variables are defined for disconnected'
44
block:
55
- name: "check mandatory variables for disconnected are set"
6-
assert:
6+
ansible.builtin.assert:
77
that:
88
- disconnected.registry.url is defined and disconnected.registry.url != None
9+
- disconnected.registry.ip is defined and disconnected.registry.ip != None
910
- disconnected.registry.pull_secret is defined and disconnected.registry.pull_secret != None
1011
- disconnected.registry.mirror_pull_secret is defined and disconnected.registry.mirror_pull_secret != None
1112
- disconnected.mirroring.host.name is defined and disconnected.mirroring.host.name != None
@@ -16,4 +17,8 @@
1617
- disconnected.mirroring.file_server.oc_mirror_tgz is defined and disconnected.mirroring.file_server.oc_mirror_tgz != None
1718
- disconnected.mirroring.client_download.ocp_download_url is defined and disconnected.mirroring.client_download.ocp_download_url != None
1819
- disconnected.mirroring.client_download.ocp_client_tgz is defined and disconnected.mirroring.client_download.ocp_client_tgz != None
20+
- disconnected.mirroring.oc_mirror.release_image_registry is defined and disconnected.mirroring.oc_mirror.release_image_registry != None
1921
- disconnected.mirroring.oc_mirror.image_set is defined and disconnected.mirroring.oc_mirror.image_set != None
22+
- disconnected.mirroring.oc_mirror.image_set.apiVersion is defined and disconnected.mirroring.oc_mirror.image_set.apiVersion != None
23+
- disconnected.mirroring.oc_mirror.image_set.storageConfig.registry.enabled is defined
24+
- disconnected.mirroring.oc_mirror.image_set.storageConfig.registry.enabled != None

0 commit comments

Comments
 (0)