Skip to content

Commit b63eaa5

Browse files
committed
feat: Use in-cluster registries for CI deployment
1 parent 697488f commit b63eaa5

File tree

5 files changed

+147
-28
lines changed

5 files changed

+147
-28
lines changed

README.md

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,34 @@ The build target will use previously built images if they are available to speed
4848
task clean-image-all
4949
```
5050

51-
6. **Alternative: Remote Registry**
51+
6. **Registry Configuration**
5252

53-
Alternatively, if you set up a registry remotely, define the `REGISTERY` variable. Note that you need to do this for the build step and the push/run step:
53+
The DPU operator now uses in-cluster registries by default with predictable URLs based on your cluster configuration:
54+
55+
- **Host Registry**: `default-route-openshift-image-registry.apps.ocpcluster.redhat.com`
56+
- **DPU Registry**: `default-route-openshift-image-registry.apps.172.16.3.16.nip.io`
57+
58+
You can check the current configuration:
59+
```sh
60+
task show-registry-config
61+
```
62+
63+
To verify the configuration matches your actual clusters (when they're running):
64+
```sh
65+
task verify-registry-routes
66+
```
67+
68+
**Custom Registry Configuration**: If your cluster domains or IPs differ, you can override them:
5469

5570
```sh
56-
REGISTERY=... task ...
71+
# Override cluster domain (affects host registry)
72+
HOST_CLUSTER_DOMAIN=mycluster.example.com task build-image-all
73+
74+
# Override DPU IP (affects DPU registry)
75+
DPU_CLUSTER_IP=10.1.2.3 task build-image-all
76+
77+
# Override registry URLs directly
78+
REGISTRY_HOST=my-host-registry.com REGISTRY_DPU=my-dpu-registry.com task build-image-all
5779
```
5880

5981
7. **Alternative: Deploy only one of the cluster**

hack/cluster-configs/config-dpu.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ clusters:
55
network_api_port: "{{secondary_network_port()}}"
66
kind: "iso"
77
install_iso: "{{iso_server()}}/RHEL-9.6.0-20250416.8-aarch64-dvd1-w-kickstart.iso"
8+
kubeconfig: "/root/kubeconfig.microshift"
89
masters:
910
- name: "{{worker_number(0)}}-acc"
1011
node: "localhost"
@@ -26,5 +27,7 @@ clusters:
2627
organization_id: "{{organization_id()}}"
2728
activation_key: "{{activation_key()}}"
2829
- name: "microshift"
30+
- name: "image_registry"
31+
registry_type: "microshift"
2932
- name: "dpu_operator_dpu"
3033
dpu_operator_path: "../../"

internal/testutils/testcluster.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ func GetDPUNodes(c client.Client) ([]corev1.Node, error) {
110110
func TrafficFlowTestsImage() string {
111111
localContainer := ContainerImage{
112112
Registry: os.Getenv("REGISTRY"),
113-
Name: "ovn-kubernetes/kubernetes-traffic-flow-tests",
113+
Name: "kubernetes-traffic-flow-tests",
114114
Tag: "latest",
115115
}
116116

@@ -125,6 +125,7 @@ func TrafficFlowTestsImage() string {
125125
Expect(err).To(BeNil())
126126
return localContainer.FullRef()
127127
}
128+
128129
return remoteContainer.FullRef()
129130
}
130131

taskfile.yaml

Lines changed: 74 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@ vars:
1414
BINDIR: bin
1515
BINDIR_ABS:
1616
sh: if [[ "{{.BINDIR}}" = /* ]]; then echo "{{.BINDIR}}"; else echo "$(pwd)/{{.BINDIR}}"; fi
17-
REGISTRY:
18-
sh: hostname | sed 's/$/:5000/'
17+
HOST_CLUSTER_DOMAIN: '{{ default "ocpcluster.redhat.com" .HOST_CLUSTER_DOMAIN }}'
18+
DPU_CLUSTER_IP: '{{ default "172.16.3.16" .DPU_CLUSTER_IP }}'
19+
REGISTRY_HOST: '{{ default (printf "default-route-openshift-image-registry.apps.%s/in-cluster-registry" .HOST_CLUSTER_DOMAIN) .REGISTRY_HOST }}'
20+
REGISTRY_DPU: '{{ default (printf "default-route-openshift-image-registry.apps.%s.nip.io/in-cluster-registry" .DPU_CLUSTER_IP) .REGISTRY_DPU }}'
21+
REGISTRY: '{{.REGISTRY_HOST}}'
1922
ENVTEST_K8S_VERSION: 1.27.1
2023
KUSTOMIZE_VERSION: v5.6.0
2124
GINKGO_VERSION:
@@ -48,13 +51,52 @@ tasks:
4851
cmds:
4952
- echo "{{.BINDIR_ABS}}"
5053

54+
show-registry-config:
55+
desc: "Show current registry configuration"
56+
cmds:
57+
- 'echo "Host Registry: {{.REGISTRY_HOST}}"'
58+
- 'echo "DPU Registry: {{.REGISTRY_DPU}}"'
59+
- 'echo "Default Registry: {{.REGISTRY}}"'
60+
61+
verify-registry-routes:
62+
desc: "Verify registry routes match actual cluster routes (requires running clusters)"
63+
cmds:
64+
- |
65+
echo "Verifying registry routes..."
66+
echo "Expected host registry: {{.REGISTRY_HOST}}"
67+
if oc get route default-route -n openshift-image-registry --kubeconfig /root/kubeconfig.ocpcluster &>/dev/null; then
68+
ACTUAL_HOST=$(oc get route default-route -n openshift-image-registry --template='{{`{{ .spec.host }}`}}' --kubeconfig /root/kubeconfig.ocpcluster)
69+
echo "Actual host registry: $ACTUAL_HOST"
70+
if [ "{{.REGISTRY_HOST}}" = "$ACTUAL_HOST" ]; then
71+
echo "Host registry matches"
72+
else
73+
echo "Host registry mismatch - consider setting HOST_CLUSTER_DOMAIN environment variable"
74+
fi
75+
else
76+
echo "Host cluster not available or registry route not found"
77+
fi
78+
79+
echo ""
80+
echo "Expected DPU registry: {{.REGISTRY_DPU}}"
81+
if oc get route default-route -n openshift-image-registry --kubeconfig /root/kubeconfig.microshift &>/dev/null; then
82+
ACTUAL_DPU=$(oc get route default-route -n openshift-image-registry --template='{{`{{ .spec.host }}`}}' --kubeconfig /root/kubeconfig.microshift)
83+
echo "Actual DPU registry: $ACTUAL_DPU"
84+
if [ "{{.REGISTRY_DPU}}" = "$ACTUAL_DPU" ]; then
85+
echo "DPU registry matches"
86+
else
87+
echo "DPU registry mismatch - consider setting DPU_CLUSTER_IP environment variable"
88+
fi
89+
else
90+
echo "DPU cluster not available or registry route not found"
91+
fi
92+
5193
push-image-helper:
5294
internal: true
5395
vars:
5496
SOURCE: '{{.SOURCE}}'
5597
IMAGE: '{{.IMAGE}}'
5698
cmds:
57-
- buildah manifest push --all '{{.SOURCE}}-manifest' 'docker://{{.IMAGE}}'
99+
- buildah manifest push --all --retry 3 --retry-delay 10s '{{.SOURCE}}-manifest' 'docker://{{.IMAGE}}'
58100

59101
undeploy-helper:
60102
internal: true
@@ -95,12 +137,23 @@ tasks:
95137
deps:
96138
- task: kustomize
97139
cmds:
140+
- mkdir -p bin/host bin/dpu
98141
- >
99142
go run ./tools/config/config.go
100-
-registry-url {{.REGISTRY}}
143+
-registry-url {{.REGISTRY_HOST}}
101144
-template-file config/dev/local-images-template.yaml
102-
-output-file bin/local-images.yaml
103-
- cp config/dev/kustomization.yaml bin
145+
-output-file bin/host/local-images.yaml
146+
- >
147+
go run ./tools/config/config.go
148+
-registry-url {{.REGISTRY_DPU}}
149+
-template-file config/dev/local-images-template.yaml
150+
-output-file bin/dpu/local-images.yaml
151+
- cp config/dev/kustomization.yaml bin/host/
152+
- cp config/dev/kustomization.yaml bin/dpu/
153+
- sed -i 's/local-images-template.yaml/local-images.yaml/' bin/host/kustomization.yaml
154+
- sed -i 's/local-images-template.yaml/local-images.yaml/' bin/dpu/kustomization.yaml
155+
- sed -i 's|../config/default|../../config/default|' bin/host/kustomization.yaml
156+
- sed -i 's|../config/default|../../config/default|' bin/dpu/kustomization.yaml
104157

105158
## Download envtest-setup locally if necessary
106159
envtest:
@@ -118,8 +171,8 @@ tasks:
118171
vars:
119172
KUBECONFIG_DPU: "/root/kubeconfig.microshift"
120173
KUBECONFIG_HOST: "/root/kubeconfig.ocpcluster"
121-
- bin/kustomize build bin | KUBECONFIG="/root/kubeconfig.microshift" oc apply -f -
122-
- bin/kustomize build bin | KUBECONFIG="/root/kubeconfig.ocpcluster" oc apply -f -
174+
- bin/kustomize build bin/dpu | KUBECONFIG="/root/kubeconfig.microshift" oc apply -f -
175+
- bin/kustomize build bin/host | KUBECONFIG="/root/kubeconfig.ocpcluster" oc apply -f -
123176
- KUBECONFIG="/root/kubeconfig.microshift" oc -n openshift-dpu-operator wait --for=condition=ready pod --all --timeout=300s
124177
- KUBECONFIG="/root/kubeconfig.ocpcluster" oc -n openshift-dpu-operator wait --for=condition=ready pod --all --timeout=300s
125178

@@ -130,16 +183,21 @@ tasks:
130183
- task: undeploy-1c
131184
vars:
132185
KUBECONFIG_HOST: "/root/kubeconfig.ocpcluster"
133-
- bin/kustomize build bin | KUBECONFIG="/root/kubeconfig.ocpcluster" oc apply -f -
186+
- bin/kustomize build bin/host | KUBECONFIG="/root/kubeconfig.ocpcluster" oc apply -f -
134187
- KUBECONFIG="/root/kubeconfig.ocpcluster" oc -n openshift-dpu-operator wait --for=condition=ready pod --all --timeout=300s
135188

136-
prepare-e2e-test:
189+
ensure-test-images-in-both-registries:
190+
desc: "Ensure test images are available in both registries"
137191
cmds:
138-
- >
139-
if [ "{{.SUBMODULES}}" = "true" ]; then
140-
hack/prepare-submodules.sh
141-
fi
142-
hack/prepare-venv.sh
192+
- |
193+
echo "Ensuring test images are available in both registries..."
194+
skopeo copy --dest-tls-verify=false \
195+
docker://ghcr.io/ovn-kubernetes/kubernetes-traffic-flow-tests:latest \
196+
docker://{{.REGISTRY_HOST}}/kubernetes-traffic-flow-tests:latest
197+
skopeo copy --dest-tls-verify=false \
198+
docker://ghcr.io/ovn-kubernetes/kubernetes-traffic-flow-tests:latest \
199+
docker://{{.REGISTRY_DPU}}/kubernetes-traffic-flow-tests:latest
200+
echo "Test images copied to both registries"
143201
144202
e2e-test:
145203
deps:
@@ -159,6 +217,7 @@ tasks:
159217
- task: ginkgo
160218
- task: envtest
161219
cmds:
220+
- task: ensure-test-images-in-both-registries
162221
- >
163222
FAST_TEST=true
164223
REGISTRY={{.REGISTRY}}

taskfiles/images.yaml

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ tasks:
180180
build-cpagent-service:
181181
internal: true
182182
vars:
183-
IMAGE: '{{.REGISTRY}}/mrvl-cpagent:dev'
183+
IMAGE: '{{.REGISTRY_HOST}}/mrvl-cpagent:dev'
184184
CPIMAGE: "Environment=IMAGE='{{.IMAGE}}'"
185185
CPFILE: 'internal/daemon/vendor-specific-plugins/marvell/cp-agent/cp-agent.service'
186186
cmds:
@@ -377,36 +377,70 @@ tasks:
377377

378378
push-image-all:
379379
deps:
380+
# Push to host registry
380381
- task: push-image-helper
381382
vars:
382383
SOURCE: 'localhost/dpu-operator:dev'
383-
IMAGE: '{{.REGISTRY}}/dpu-operator:dev'
384+
IMAGE: '{{.REGISTRY_HOST}}/dpu-operator:dev'
384385
- task: push-image-helper
385386
vars:
386387
SOURCE: 'localhost/dpu-daemon:dev'
387-
IMAGE: '{{.REGISTRY}}/dpu-daemon:dev'
388+
IMAGE: '{{.REGISTRY_HOST}}/dpu-daemon:dev'
388389
- task: push-image-helper
389390
vars:
390391
SOURCE: 'localhost/mrvl-vsp:dev'
391-
IMAGE: '{{.REGISTRY}}/mrvl-vsp:dev'
392+
IMAGE: '{{.REGISTRY_HOST}}/mrvl-vsp:dev'
392393
- task: push-image-helper
393394
vars:
394395
SOURCE: 'localhost/mrvl-cpagent:dev'
395-
IMAGE: '{{.REGISTRY}}/mrvl-cpagent:dev'
396+
IMAGE: '{{.REGISTRY_HOST}}/mrvl-cpagent:dev'
396397
- task: push-image-helper
397398
vars:
398399
SOURCE: 'localhost/intel-vsp:dev'
399-
IMAGE: '{{.REGISTRY}}/intel-vsp:dev'
400+
IMAGE: '{{.REGISTRY_HOST}}/intel-vsp:dev'
400401
- task: push-image-helper
401402
vars:
402403
SOURCE: 'localhost/intel-vsp-p4:dev'
403-
IMAGE: '{{.REGISTRY}}/intel-vsp-p4:dev'
404+
IMAGE: '{{.REGISTRY_HOST}}/intel-vsp-p4:dev'
404405
- task: push-image-helper
405406
vars:
406407
SOURCE: 'localhost/intel-netsec-vsp:dev'
407-
IMAGE: '{{.REGISTRY}}/intel-netsec-vsp:dev'
408+
IMAGE: '{{.REGISTRY_HOST}}/intel-netsec-vsp:dev'
408409
- task: push-image-helper
409410
vars:
410411
SOURCE: 'localhost/network-resources-injector:dev'
411-
IMAGE: '{{.REGISTRY}}/network-resources-injector:dev'
412+
IMAGE: '{{.REGISTRY_HOST}}/network-resources-injector:dev'
413+
# Push to DPU registry
414+
- task: push-image-helper
415+
vars:
416+
SOURCE: 'localhost/dpu-operator:dev'
417+
IMAGE: '{{.REGISTRY_DPU}}/dpu-operator:dev'
418+
- task: push-image-helper
419+
vars:
420+
SOURCE: 'localhost/dpu-daemon:dev'
421+
IMAGE: '{{.REGISTRY_DPU}}/dpu-daemon:dev'
422+
- task: push-image-helper
423+
vars:
424+
SOURCE: 'localhost/mrvl-vsp:dev'
425+
IMAGE: '{{.REGISTRY_DPU}}/mrvl-vsp:dev'
426+
- task: push-image-helper
427+
vars:
428+
SOURCE: 'localhost/mrvl-cpagent:dev'
429+
IMAGE: '{{.REGISTRY_DPU}}/mrvl-cpagent:dev'
430+
- task: push-image-helper
431+
vars:
432+
SOURCE: 'localhost/intel-vsp:dev'
433+
IMAGE: '{{.REGISTRY_DPU}}/intel-vsp:dev'
434+
- task: push-image-helper
435+
vars:
436+
SOURCE: 'localhost/intel-vsp-p4:dev'
437+
IMAGE: '{{.REGISTRY_DPU}}/intel-vsp-p4:dev'
438+
- task: push-image-helper
439+
vars:
440+
SOURCE: 'localhost/intel-netsec-vsp:dev'
441+
IMAGE: '{{.REGISTRY_DPU}}/intel-netsec-vsp:dev'
442+
- task: push-image-helper
443+
vars:
444+
SOURCE: 'localhost/network-resources-injector:dev'
445+
IMAGE: '{{.REGISTRY_DPU}}/network-resources-injector:dev'
412446

0 commit comments

Comments
 (0)