Skip to content

Commit f7bfdbd

Browse files
committed
Support IDMS for disconnected automation
This change adds support for IDMS in addition to ICSP when determining whether the OCP cluster is in a disconnected state. Signed-off-by: Brendan Shephard <bshephar@bne-home.net>
1 parent 5f1307f commit f7bfdbd

8 files changed

Lines changed: 37 additions & 72 deletions

File tree

bindata/rbac/rbac.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,14 @@ rules:
241241
- get
242242
- patch
243243
- update
244+
- apiGroups:
245+
- config.openshift.io
246+
resources:
247+
- imagedigestmirrorsets
248+
verbs:
249+
- get
250+
- list
251+
- watch
244252
- apiGroups:
245253
- config.openshift.io
246254
resources:

config/operator/manager_operator_images.yaml

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -13,45 +13,3 @@ spec:
1313
containers:
1414
- name: operator
1515
env:
16-
- name: RELATED_IMAGE_BARBICAN_OPERATOR_MANAGER_IMAGE_URL
17-
value: quay.io/openstack-k8s-operators/barbican-operator@sha256:eb79dda1a866cacc9d7421ec78799b7275442c4791d97b8c4f34e1a244adda8b
18-
- name: RELATED_IMAGE_CINDER_OPERATOR_MANAGER_IMAGE_URL
19-
value: quay.io/openstack-k8s-operators/cinder-operator@sha256:af0ea6b60d705ac1fbf84b5c9f675ba7545e34295526e6cabd719df0996ecadd
20-
- name: RELATED_IMAGE_DESIGNATE_OPERATOR_MANAGER_IMAGE_URL
21-
value: quay.io/openstack-k8s-operators/designate-operator@sha256:8d2b27869aefa2ad1ffd20b2f5005c42e4094b2935db61e4c05815997da67125
22-
- name: RELATED_IMAGE_GLANCE_OPERATOR_MANAGER_IMAGE_URL
23-
value: quay.io/openstack-k8s-operators/glance-operator@sha256:a25ff180acd90566cff1e5af86fe52dba649476b3f4e1fb7f8b45396cf8651c9
24-
- name: RELATED_IMAGE_HEAT_OPERATOR_MANAGER_IMAGE_URL
25-
value: quay.io/openstack-k8s-operators/heat-operator@sha256:416387ff4062fc5142e4073fc951c153a2179d70b2361c5ae5fcda87220a0717
26-
- name: RELATED_IMAGE_HORIZON_OPERATOR_MANAGER_IMAGE_URL
27-
value: quay.io/openstack-k8s-operators/horizon-operator@sha256:295faa06074ef530e0482896f593336de9fb5a222e5e8ebdf0ebbf157412febc
28-
- name: RELATED_IMAGE_INFRA_OPERATOR_MANAGER_IMAGE_URL
29-
value: quay.io/openstack-k8s-operators/infra-operator@sha256:a91ff27aad73cb3d6c4e4efd0c109359b24234cf67d287fca62ea3579dc0c976
30-
- name: RELATED_IMAGE_IRONIC_OPERATOR_MANAGER_IMAGE_URL
31-
value: quay.io/openstack-k8s-operators/ironic-operator@sha256:5d79cd225aad4dd90857453c05af7f9a0883372d33e3fadc293f963d664eac1d
32-
- name: RELATED_IMAGE_KEYSTONE_OPERATOR_MANAGER_IMAGE_URL
33-
value: quay.io/openstack-k8s-operators/keystone-operator@sha256:67ebbc377d0e3c4bbba350a6f5af69c96eec6504daedd0270626ba0ce2043c0c
34-
- name: RELATED_IMAGE_MANILA_OPERATOR_MANAGER_IMAGE_URL
35-
value: quay.io/openstack-k8s-operators/manila-operator@sha256:597510f495b3969dc78bd584d788e30dc02a251875164f7a1e0428cd2a8622a2
36-
- name: RELATED_IMAGE_MARIADB_OPERATOR_MANAGER_IMAGE_URL
37-
value: quay.io/openstack-k8s-operators/mariadb-operator@sha256:bd9bafbc04f0a671f102f61e3f41f56bc8561e7bddbd7b3c0e71dce6cd002122
38-
- name: RELATED_IMAGE_NEUTRON_OPERATOR_MANAGER_IMAGE_URL
39-
value: quay.io/openstack-k8s-operators/neutron-operator@sha256:93c2078e50130d79bbeccd8aef2329f22bdaa135912b608649a9ce1acdc7ab9f
40-
- name: RELATED_IMAGE_NOVA_OPERATOR_MANAGER_IMAGE_URL
41-
value: quay.io/openstack-k8s-operators/nova-operator@sha256:ef0823f3503ee8b920e2e4d382db11df9af159409afbfbcccf8d007d6ec81698
42-
- name: RELATED_IMAGE_OCTAVIA_OPERATOR_MANAGER_IMAGE_URL
43-
value: quay.io/openstack-k8s-operators/octavia-operator@sha256:f0516edc774e4b5040d6afc6431775bc2ac0fff5341fca0449b1023370457d67
44-
- name: RELATED_IMAGE_OPENSTACK_BAREMETAL_OPERATOR_MANAGER_IMAGE_URL
45-
value: quay.io/openstack-k8s-operators/openstack-baremetal-operator@sha256:2955aa1e2363d28c149ed256d77b5ca0453ecad2bdb36ba19748f8e688cb1312
46-
- name: RELATED_IMAGE_OVN_OPERATOR_MANAGER_IMAGE_URL
47-
value: quay.io/openstack-k8s-operators/ovn-operator@sha256:0b69ca4e3f621d95fc0c27881f4180afa7cc2719066895f47344a6f16fe124e1
48-
- name: RELATED_IMAGE_PLACEMENT_OPERATOR_MANAGER_IMAGE_URL
49-
value: quay.io/openstack-k8s-operators/placement-operator@sha256:1a5af92b7cb62a6be8e215948d30eb47773e42f5e79f1716b22f532bfd03507d
50-
- name: RELATED_IMAGE_RABBITMQ_CLUSTER_OPERATOR_MANAGER_IMAGE_URL
51-
value: quay.io/openstack-k8s-operators/rabbitmq-cluster-operator@sha256:225524223bf2a7f3a4ce95958fc9ca6fdab02745fb70374e8ff5bf1ddaceda4b
52-
- name: RELATED_IMAGE_SWIFT_OPERATOR_MANAGER_IMAGE_URL
53-
value: quay.io/openstack-k8s-operators/swift-operator@sha256:6ae4bfbb80797e43c7325c62632b1eff37f8aac91ef874fecb7ce184474805d9
54-
- name: RELATED_IMAGE_TELEMETRY_OPERATOR_MANAGER_IMAGE_URL
55-
value: quay.io/openstack-k8s-operators/telemetry-operator@sha256:a51b9277b9cf25e2d322cc8f061889adc2108a10e4e15c989a1b9e9ceb89be5d
56-
- name: RELATED_IMAGE_TEST_OPERATOR_MANAGER_IMAGE_URL
57-
value: quay.io/openstack-k8s-operators/test-operator@sha256:f31430b5bb611f00bfa356f3aa98648a78acbcde0f34cefc3eb7cb46cbcd104a

config/rbac/role.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,14 @@ rules:
198198
- get
199199
- patch
200200
- update
201+
- apiGroups:
202+
- config.openshift.io
203+
resources:
204+
- imagedigestmirrorsets
205+
verbs:
206+
- get
207+
- list
208+
- watch
201209
- apiGroups:
202210
- config.openshift.io
203211
resources:

controllers/dataplane/openstackdataplanenodeset_controller.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ func (r *OpenStackDataPlaneNodeSetReconciler) GetLogger(ctx context.Context) log
125125

126126
// RBAC for ImageContentSourcePolicy and MachineConfig
127127
// +kubebuilder:rbac:groups="operator.openshift.io",resources=imagecontentsourcepolicies,verbs=get;list;watch
128+
// +kubebuilder:rbac:groups="config.openshift.io",resources=imagedigestmirrorsets,verbs=get;list;watch
128129
// +kubebuilder:rbac:groups="machineconfiguration.openshift.io",resources=machineconfigs,verbs=get;list;watch
129130

130131
// Reconcile is part of the main kubernetes reconciliation loop which aims to

docs/assemblies/proc_deploying-in-disconnected-environments.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ Deploying in disconnected environments can be achieved largely by following the
88
== Technical Implementation
99
The details provided in this section are for informational purposes only. Users should not need to interact with anything additional after completing the above mentioned OLM mirroring process.
1010

11-
The `openstack-operator` contains a list of related images that will ensure all required images for the deployment are mirrored following the above OpenShift process. Once images are mirrored, the `ImageContentSourcePolicy` custom resource (CR) is created. This process results in a `MachineConfig` called `99-master-genereted-registries` being updated in the cluster. The `99-master-generated-registries` `MachineConfig` contains a `registries.conf` file that is applied to all of the OpenShift nodes in the cluster.
11+
The `openstack-operator` contains a list of related images that will ensure all required images for the deployment are mirrored following the above OpenShift process. Once images are mirrored, either an `ImageContentSourcePolicy` custom resource (CR), or a `ImageDigestMirrorSet` CR is created. This process results in a `MachineConfig` called `99-master-genereted-registries` being updated in the cluster. The `99-master-generated-registries` `MachineConfig` contains a `registries.conf` file that is applied to all of the OpenShift nodes in the cluster.
1212

13-
In order for dataplane nodes to integrate cleanly with this process, openstack-operator checks for the existence of an `ImageContentSourcePolicy`. If one is found, it will read the `registries.conf` file from the `99-master-generated-registries` `MachineConfig`. The openstack-operator will then set two variables in the Ansible inventory for the nodes.
13+
In order for dataplane nodes to integrate cleanly with this process, openstack-operator checks for the existence of an `ImageContentSourcePolicy` or an `ImageDigestMirrorSet`. If one is found, it will read the `registries.conf` file from the `99-master-generated-registries` `MachineConfig`. The openstack-operator will then set two variables in the Ansible inventory for the nodes.
1414

1515
[,yaml]
1616
----
Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,2 @@
11
# NOTE: this file is automatically generated by hack/sync-bindata.sh!
22

3-
export RELATED_IMAGE_BARBICAN_OPERATOR_MANAGER_IMAGE_URL=quay.io/openstack-k8s-operators/barbican-operator@sha256:eb79dda1a866cacc9d7421ec78799b7275442c4791d97b8c4f34e1a244adda8b
4-
export RELATED_IMAGE_CINDER_OPERATOR_MANAGER_IMAGE_URL=quay.io/openstack-k8s-operators/cinder-operator@sha256:af0ea6b60d705ac1fbf84b5c9f675ba7545e34295526e6cabd719df0996ecadd
5-
export RELATED_IMAGE_DESIGNATE_OPERATOR_MANAGER_IMAGE_URL=quay.io/openstack-k8s-operators/designate-operator@sha256:8d2b27869aefa2ad1ffd20b2f5005c42e4094b2935db61e4c05815997da67125
6-
export RELATED_IMAGE_GLANCE_OPERATOR_MANAGER_IMAGE_URL=quay.io/openstack-k8s-operators/glance-operator@sha256:a25ff180acd90566cff1e5af86fe52dba649476b3f4e1fb7f8b45396cf8651c9
7-
export RELATED_IMAGE_HEAT_OPERATOR_MANAGER_IMAGE_URL=quay.io/openstack-k8s-operators/heat-operator@sha256:416387ff4062fc5142e4073fc951c153a2179d70b2361c5ae5fcda87220a0717
8-
export RELATED_IMAGE_HORIZON_OPERATOR_MANAGER_IMAGE_URL=quay.io/openstack-k8s-operators/horizon-operator@sha256:295faa06074ef530e0482896f593336de9fb5a222e5e8ebdf0ebbf157412febc
9-
export RELATED_IMAGE_INFRA_OPERATOR_MANAGER_IMAGE_URL=quay.io/openstack-k8s-operators/infra-operator@sha256:a91ff27aad73cb3d6c4e4efd0c109359b24234cf67d287fca62ea3579dc0c976
10-
export RELATED_IMAGE_IRONIC_OPERATOR_MANAGER_IMAGE_URL=quay.io/openstack-k8s-operators/ironic-operator@sha256:5d79cd225aad4dd90857453c05af7f9a0883372d33e3fadc293f963d664eac1d
11-
export RELATED_IMAGE_KEYSTONE_OPERATOR_MANAGER_IMAGE_URL=quay.io/openstack-k8s-operators/keystone-operator@sha256:67ebbc377d0e3c4bbba350a6f5af69c96eec6504daedd0270626ba0ce2043c0c
12-
export RELATED_IMAGE_MANILA_OPERATOR_MANAGER_IMAGE_URL=quay.io/openstack-k8s-operators/manila-operator@sha256:597510f495b3969dc78bd584d788e30dc02a251875164f7a1e0428cd2a8622a2
13-
export RELATED_IMAGE_MARIADB_OPERATOR_MANAGER_IMAGE_URL=quay.io/openstack-k8s-operators/mariadb-operator@sha256:bd9bafbc04f0a671f102f61e3f41f56bc8561e7bddbd7b3c0e71dce6cd002122
14-
export RELATED_IMAGE_NEUTRON_OPERATOR_MANAGER_IMAGE_URL=quay.io/openstack-k8s-operators/neutron-operator@sha256:93c2078e50130d79bbeccd8aef2329f22bdaa135912b608649a9ce1acdc7ab9f
15-
export RELATED_IMAGE_NOVA_OPERATOR_MANAGER_IMAGE_URL=quay.io/openstack-k8s-operators/nova-operator@sha256:ef0823f3503ee8b920e2e4d382db11df9af159409afbfbcccf8d007d6ec81698
16-
export RELATED_IMAGE_OCTAVIA_OPERATOR_MANAGER_IMAGE_URL=quay.io/openstack-k8s-operators/octavia-operator@sha256:f0516edc774e4b5040d6afc6431775bc2ac0fff5341fca0449b1023370457d67
17-
export RELATED_IMAGE_OPENSTACK_BAREMETAL_OPERATOR_MANAGER_IMAGE_URL=quay.io/openstack-k8s-operators/openstack-baremetal-operator@sha256:2955aa1e2363d28c149ed256d77b5ca0453ecad2bdb36ba19748f8e688cb1312
18-
export RELATED_IMAGE_OVN_OPERATOR_MANAGER_IMAGE_URL=quay.io/openstack-k8s-operators/ovn-operator@sha256:0b69ca4e3f621d95fc0c27881f4180afa7cc2719066895f47344a6f16fe124e1
19-
export RELATED_IMAGE_PLACEMENT_OPERATOR_MANAGER_IMAGE_URL=quay.io/openstack-k8s-operators/placement-operator@sha256:1a5af92b7cb62a6be8e215948d30eb47773e42f5e79f1716b22f532bfd03507d
20-
export RELATED_IMAGE_RABBITMQ_CLUSTER_OPERATOR_MANAGER_IMAGE_URL=quay.io/openstack-k8s-operators/rabbitmq-cluster-operator@sha256:225524223bf2a7f3a4ce95958fc9ca6fdab02745fb70374e8ff5bf1ddaceda4b
21-
export RELATED_IMAGE_SWIFT_OPERATOR_MANAGER_IMAGE_URL=quay.io/openstack-k8s-operators/swift-operator@sha256:6ae4bfbb80797e43c7325c62632b1eff37f8aac91ef874fecb7ce184474805d9
22-
export RELATED_IMAGE_TELEMETRY_OPERATOR_MANAGER_IMAGE_URL=quay.io/openstack-k8s-operators/telemetry-operator@sha256:a51b9277b9cf25e2d322cc8f061889adc2108a10e4e15c989a1b9e9ceb89be5d
23-
export RELATED_IMAGE_TEST_OPERATOR_MANAGER_IMAGE_URL=quay.io/openstack-k8s-operators/test-operator@sha256:f31430b5bb611f00bfa356f3aa98648a78acbcde0f34cefc3eb7cb46cbcd104a

pkg/dataplane/util/image_registry.go

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ import (
77
"fmt"
88
"strings"
99

10+
ocpidms "github.com/openshift/api/config/v1"
1011
mc "github.com/openshift/api/machineconfiguration/v1"
11-
ocpimage "github.com/openshift/api/operator/v1alpha1"
12+
ocpicsp "github.com/openshift/api/operator/v1alpha1"
1213
"github.com/openstack-k8s-operators/lib-common/modules/common/helper"
1314
"sigs.k8s.io/controller-runtime/pkg/client"
1415

@@ -35,22 +36,29 @@ type machineConfigIgnition struct {
3536
} `json:"storage"`
3637
}
3738

38-
// IsDisconnectedOCP - Will retrieve a ImageContentSourcePolicyList. If the list is not
39+
// IsDisconnectedOCP - Will retrieve a CR's related to disconnected OCP deployments. If the list is not
3940
// empty, we can infer that the OCP cluster is a disconnected deployment.
4041
func IsDisconnectedOCP(ctx context.Context, helper *helper.Helper) (bool, error) {
41-
icspList := ocpimage.ImageContentSourcePolicyList{}
42+
icspList := ocpicsp.ImageContentSourcePolicyList{}
43+
idmsList := ocpidms.ImageDigestMirrorSetList{}
4244

4345
listOpts := []client.ListOption{}
44-
err := helper.GetClient().List(ctx, &icspList, listOpts...)
46+
47+
var err error
48+
err = helper.GetClient().List(ctx, &icspList, listOpts...)
49+
if err != nil {
50+
return false, err
51+
}
52+
err = helper.GetClient().List(ctx, &idmsList, listOpts...)
4553
if err != nil {
4654
return false, err
4755
}
4856

49-
if len(icspList.Items) != 0 {
50-
return true, nil
57+
if len(icspList.Items) != 0 || len(idmsList.Items) != 0 {
58+
return true, err
5159
}
5260

53-
return false, nil
61+
return false, err
5462
}
5563

5664
// GetMCRegistryConf - will unmarshal the MachineConfig ignition file the machineConfigIgnition object.

tests/functional/dataplane/suite_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ var _ = BeforeSuite(func() {
106106
Expect(err).ShouldNot(HaveOccurred())
107107
imageContentSourcePolicyCRDs, err := test.GetCRDDirFromModule("github.com/openshift/api", gomod, "operator/v1alpha1/zz_generated.crd-manifests/")
108108
Expect(err).ShouldNot(HaveOccurred())
109+
imageDigestMirrorSetCRDs, err := test.GetCRDDirFromModule("github.com/openshift/api", gomod, "config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_imagedigestmirrorsets.crd.yaml")
110+
Expect(err).ShouldNot(HaveOccurred())
109111
machineConfigCRDs, err := test.GetCRDDirFromModule("github.com/openshift/api", gomod, "machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineconfigs.crd.yaml")
110112
Expect(err).ShouldNot(HaveOccurred())
111113

@@ -118,6 +120,7 @@ var _ = BeforeSuite(func() {
118120
certmgrv1CRDs,
119121
openstackCRDs,
120122
imageContentSourcePolicyCRDs,
123+
imageDigestMirrorSetCRDs,
121124
machineConfigCRDs,
122125
},
123126
WebhookInstallOptions: envtest.WebhookInstallOptions{

0 commit comments

Comments
 (0)