Skip to content

Commit d6c754b

Browse files
committed
Add blog post
1 parent 169d379 commit d6c754b

File tree

1 file changed

+184
-0
lines changed

1 file changed

+184
-0
lines changed
Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
---
2+
date: 2024-10-12
3+
title: Validated Patterns in a disconnected Network
4+
summary: Install a Validated Pattern on a disconnected network
5+
author: Michele Baldessari
6+
blog_tags:
7+
- patterns
8+
- how-to
9+
- disconnected
10+
---
11+
:toc:
12+
13+
== Preamble
14+
15+
This document provides a comprehensive guide on how to deploy a Validated
16+
Pattern, specifically the Multicloud GitOps solution on OpenShift 4.16, onto an
17+
OpenShift cluster that has been set up in a disconnected network environment. A
18+
disconnected network, in this context, refers to an infrastructure that is
19+
isolated from external internet access, which adds additional complexity to the
20+
deployment process.
21+
22+
By following this guide, you will learn the necessary steps, best practices,
23+
and specific configurations required to successfully deploy Multicloud GitOps
24+
in such an environment. We will cover the prerequisite setup, key components
25+
involved, and how to manage the constraints posed by the lack of direct
26+
connectivity to external repositories and services. This ensures that even in a
27+
restricted, air-gapped network, the deployment of this validated pattern can be
28+
performed smoothly and securely.
29+
30+
31+
== Requirements
32+
33+
* One or more openshift clusters deployed in a disconnected network
34+
* An OCI-compliant registry that is accessible from the disconnected network
35+
(referred to as `registry.internal.disconnected.net` in this article)
36+
* A Git Repository that is accessible from the disconnected network
37+
* (Optional) A VM in the disconnected network where we run our commands
38+
39+
We won’t cover here how to deploy openshift in a disconnected network, as there
40+
is more detailed documentation that can be found
41+
https://docs.redhat.com/en/documentation/openshift_container_platform/4.17/html-single/disconnected_environments/index#about-installing-oc-mirror-v2[here]
42+
43+
== Mirroring
44+
45+
The first step needed to deploy a pattern is mirroring all the needed images.
46+
In most cases this is a very pattern-dependent process, so the exact list of
47+
needed images will depend on the pattern, on the openshift version and on the
48+
needed operators.
49+
50+
In this example we use the tool `oc mirror --v2` (note: it is currently in tech
51+
preview, but the experience is superior compared to the previous release). Here
52+
is an example of such a configuration file `imageset-config.yaml`:
53+
54+
[source,yaml]
55+
----
56+
kind: ImageSetConfiguration
57+
apiVersion: mirror.openshift.io/v2alpha1
58+
mirror:
59+
platform:
60+
graph: true
61+
channels:
62+
- name: stable-4.16
63+
type: ocp
64+
operators:
65+
- catalog: registry.redhat.io/redhat/redhat-operator-index:v4.16
66+
packages:
67+
- name: lvms-operator
68+
- name: advanced-cluster-management
69+
channels:
70+
- name: release-2.11
71+
- name: multicluster-engine
72+
channels:
73+
- name: stable-2.6
74+
- name: openshift-gitops-operator
75+
channels:
76+
- name: gitops-1.13
77+
- catalog: registry.redhat.io/redhat/community-operator-index:v4.16
78+
packages:
79+
- name: patterns-operator
80+
additionalImages:
81+
- name: registry.redhat.io/ubi9/ubi-minimal:latest
82+
- name: registry.connect.redhat.com/hashicorp/vault:1.17.6-ubi
83+
- name: registry.access.redhat.com/ubi8/httpd-24:1-226
84+
- name: ghcr.io/external-secrets/external-secrets:v0.10.2-ubi
85+
- name: registry.redhat.io/ansible-automation-platform-24/ee-supported-rhel9:latest
86+
# VP charts
87+
- name: quay.io/hybridcloudpatterns/acm:0.1.3
88+
- name: quay.io/hybridcloudpatterns/clustergroup:0.9.5
89+
- name: quay.io/hybridcloudpatterns/gitea:0.0.2
90+
- name: quay.io/hybridcloudpatterns/golang-external-secrets:0.1.3
91+
- name: quay.io/hybridcloudpatterns/hashicorp-vault:0.1.3
92+
- name: quay.io/hybridcloudpatterns/utility-container:latest
93+
- name: quay.io/hybridcloudpatterns/imperative-container:v1
94+
- name: quay.io/hybridcloudpatterns/pattern-install:0.0.3
95+
- name: docker.io/gitea/gitea:1.21.11-rootless
96+
----
97+
98+
We can use this `imageset-config.yaml` file to mirror the needed images on our
99+
registry. We assume we have a folder (`/var/cache/oc-mirror`) where the tool can
100+
locally cache the downloaded images before pushing them to the internal
101+
registry. We copied the imageset-config.yaml in that folder:
102+
103+
[source,sh]
104+
----
105+
oc mirror --config=/var/cache/oc-mirror/imageset-config.yaml \
106+
--workspace file:///var/cache/oc-mirror/workspace \
107+
docker://registry.internal.disconnected.net --v2
108+
----
109+
110+
Once this command completes the `registry.internal.disconnected` OCI registry
111+
will contain the mirrored images. The oc mirror command will generate a few
112+
yaml files that can be found under `/var/cache/oc-mirror/workspace/working-dir/cluster-resources`.
113+
114+
We need to apply them to our cluster:
115+
116+
[source,sh]
117+
----
118+
cd /var/cache/oc-mirror/workspace/working-dir/cluster-resources
119+
oc apply -f cs-community-operator-index-v4-16.yaml \
120+
cs-redhat-operator-index-v4-16.yaml idms-oc-mirror.yaml \
121+
itms-oc-mirror.yaml
122+
----
123+
124+
Once these are applied the cluster will be able to fetch the images from the
125+
internal disconnected registry.
126+
127+
== Git repository changes
128+
129+
Note that we assume here that the git folder you are working on has the
130+
`origin` remote pointing to the disconnected git server where you will be
131+
cloning the pattern from. To verify to which git server a remote is pointing to
132+
you can run the `git remote -v` command.
133+
134+
We will need to tweak a couple of things so that the pattern is aware of which
135+
catalog sources in openshift contain the different images. Those names were
136+
defined in the previous mirroring step in the yaml files under
137+
`/var/cache/oc-mirror/workspace/working-dir/cluster-resources`.
138+
139+
`values-global.yaml`:
140+
[source,yaml]
141+
----
142+
main:
143+
multiSourceConfig:
144+
enabled: true
145+
clusterGroupChartVersion: "0.9.*"
146+
helmRepoUrl: registry.internal.disconnected.net/hybridcloudpatterns
147+
patternsOperator:
148+
source: cs-community-operator-index-v4-16
149+
gitops:
150+
operatorSource: cs-redhat-operator-index-v4-16
151+
----
152+
153+
`values-hub.yaml`:
154+
[source,yaml]
155+
----
156+
acm:
157+
mce_operator:
158+
source: cs-redhat-operator-index-v4-16
159+
160+
clusterGroup:
161+
subscriptions:
162+
acm:
163+
name: advanced-cluster-management
164+
namespace: open-cluster-management
165+
channel: release-2.11
166+
source: cs-redhat-operator-index-v4-16
167+
----
168+
169+
== Deploy the pattern
170+
171+
At this point we can clone Multicloud Gitops on to a VM that lives in the
172+
disconnected network and deploy the pattern. The only thing we need to do first
173+
is to point the installation script to the mirrored helm chart inside the
174+
disconnected registry.
175+
176+
[source,sh]
177+
----
178+
# Points to the mirrored VP install chart
179+
export PATTERN_DISCONNECTED_HOME=registry.internal.disconnected.net/hybridcloudpatterns
180+
./pattern.sh make install
181+
----
182+
183+
After a while the cluster will converge to its desired final state and the
184+
MultiCloud Gitops pattern will be installed successfully.

0 commit comments

Comments
 (0)