Skip to content

Commit 8700311

Browse files
committed
ci: use prebuilt HaRP image and verify operator Service preservation
Signed-off-by: Oleksander Piskun <oleksandr2088@icloud.com>
1 parent 666fbc6 commit 8700311

4 files changed

Lines changed: 22 additions & 60 deletions

File tree

.github/workflows/tests-deploy-k8s-clusterip.yml

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
# works when HaRP runs outside the cluster (e.g. Docker on the host) because
99
# kube-proxy makes ClusterIPs routable via iptables/ipvs.
1010
#
11-
# NOTE: Requires HaRP with ClusterIP address resolution fix.
12-
# Once merged into HaRP main and released, switch to the prebuilt image.
13-
#
1411
name: Tests - K8s Deploy (ClusterIP)
1512

1613
on:
@@ -128,18 +125,8 @@ jobs:
128125
- name: Pre-pull ExApp image into k3s
129126
run: sudo k3s ctr images pull ghcr.io/nextcloud/app-skeleton-python:latest
130127

131-
# Build HaRP from fix branch (ClusterIP address resolution fix).
132-
# TODO: switch to prebuilt image once HaRP fix/k8s-manual-expose-persistence is released.
133-
- name: Checkout HaRP
134-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
135-
with:
136-
persist-credentials: false
137-
repository: nextcloud/HaRP
138-
ref: fix/k8s-manual-expose-persistence
139-
path: harp-src
140-
141-
- name: Build HaRP image
142-
run: docker build -t harp:test harp-src/
128+
- name: Pull HaRP image
129+
run: docker pull ghcr.io/nextcloud/nextcloud-appapi-harp:latest
143130

144131
- name: Start HaRP with K8s backend
145132
run: |
@@ -153,7 +140,7 @@ jobs:
153140
-e HP_K8S_NAMESPACE="nextcloud-exapps" \
154141
-e HP_K8S_VERIFY_SSL="false" \
155142
--restart unless-stopped \
156-
-d harp:test
143+
-d ghcr.io/nextcloud/nextcloud-appapi-harp:latest
157144
158145
- name: Start nginx proxy
159146
run: |
@@ -190,7 +177,6 @@ jobs:
190177
- name: Run K8s integration tests (ClusterIP)
191178
env:
192179
K8S_EXPOSE_TYPE: clusterip
193-
HARP_HAS_MANAGED_BY_LABEL: "true"
194180
run: python3 apps/${{ env.APP_NAME }}/tests/test_occ_commands_k8s.py
195181

196182
- name: Collect HaRP logs

.github/workflows/tests-deploy-k8s-manual.yml

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
# etc.) themselves. HaRP creates the Deployment but does NOT create a Service.
88
# This workflow tests the deploy lifecycle with operator-managed Services.
99
#
10-
# NOTE: Requires HaRP with manual-expose annotation persistence support.
11-
# Once merged into HaRP main and released, switch to the prebuilt image.
12-
#
1310
name: Tests - K8s Deploy (Manual)
1411

1512
on:
@@ -128,18 +125,8 @@ jobs:
128125
- name: Pre-pull ExApp image into k3s
129126
run: sudo k3s ctr images pull ghcr.io/nextcloud/app-skeleton-python:latest
130127

131-
# Build HaRP from fix branch (manual expose annotation support).
132-
# TODO: switch to prebuilt image once HaRP fix/k8s-manual-expose-persistence is released.
133-
- name: Checkout HaRP
134-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
135-
with:
136-
persist-credentials: false
137-
repository: nextcloud/HaRP
138-
ref: fix/k8s-manual-expose-persistence
139-
path: harp-src
140-
141-
- name: Build HaRP image
142-
run: docker build -t harp:test harp-src/
128+
- name: Pull HaRP image
129+
run: docker pull ghcr.io/nextcloud/nextcloud-appapi-harp:latest
143130

144131
- name: Start HaRP with K8s backend
145132
run: |
@@ -153,7 +140,7 @@ jobs:
153140
-e HP_K8S_NAMESPACE="nextcloud-exapps" \
154141
-e HP_K8S_VERIFY_SSL="false" \
155142
--restart unless-stopped \
156-
-d harp:test
143+
-d ghcr.io/nextcloud/nextcloud-appapi-harp:latest
157144
158145
- name: Start nginx proxy
159146
run: |
@@ -191,7 +178,6 @@ jobs:
191178
env:
192179
K8S_EXPOSE_TYPE: manual
193180
MANUAL_CLUSTER_IP: ${{ env.MANUAL_CLUSTER_IP }}
194-
HARP_HAS_MANAGED_BY_LABEL: "true"
195181
run: python3 apps/${{ env.APP_NAME }}/tests/test_occ_commands_k8s.py
196182

197183
- name: Collect HaRP logs

.github/workflows/tests-deploy-k8s.yml

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -117,18 +117,8 @@ jobs:
117117
- name: Pre-pull ExApp image into k3s
118118
run: sudo k3s ctr images pull ghcr.io/nextcloud/app-skeleton-python:latest
119119

120-
# Build HaRP from fix branch (K8s fixes: ClusterIP resolution, managed-by labels, Succeeded phase).
121-
# TODO: switch to prebuilt image once HaRP fix/k8s-manual-expose-persistence is released.
122-
- name: Checkout HaRP
123-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
124-
with:
125-
persist-credentials: false
126-
repository: nextcloud/HaRP
127-
ref: fix/k8s-manual-expose-persistence
128-
path: harp-src
129-
130-
- name: Build HaRP image
131-
run: docker build -t harp:test harp-src/
120+
- name: Pull HaRP image
121+
run: docker pull ghcr.io/nextcloud/nextcloud-appapi-harp:latest
132122

133123
- name: Start HaRP with K8s backend
134124
run: |
@@ -142,7 +132,7 @@ jobs:
142132
-e HP_K8S_NAMESPACE="nextcloud-exapps" \
143133
-e HP_K8S_VERIFY_SSL="false" \
144134
--restart unless-stopped \
145-
-d harp:test
135+
-d ghcr.io/nextcloud/nextcloud-appapi-harp:latest
146136
147137
- name: Start nginx proxy
148138
run: |
@@ -179,7 +169,6 @@ jobs:
179169
- name: Run K8s integration tests
180170
env:
181171
K8S_EXPOSE_TYPE: nodeport
182-
HARP_HAS_MANAGED_BY_LABEL: "true"
183172
run: python3 apps/${{ env.APP_NAME }}/tests/test_occ_commands_k8s.py
184173

185174
- name: Collect HaRP logs

tests/test_occ_commands_k8s.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@
3333
"loadbalancer": "LoadBalancer",
3434
}
3535

36-
# Whether the HaRP version under test supports managed-by labels on Services.
37-
# ClusterIP and Manual workflows build from the fix branch; NodePort uses prebuilt.
38-
HARP_HAS_MANAGED_BY_LABEL = os.environ.get("HARP_HAS_MANAGED_BY_LABEL", "false") == "true"
39-
4036
# Separate daemon name for validation tests to avoid interfering with the deploy daemon
4137
K8S_VALIDATION_DAEMON = "k8s_validation"
4238

@@ -346,13 +342,12 @@ def test_k8s_single_deploy():
346342
assert actual_type == expected_type, (
347343
f"Service type mismatch: expected {expected_type}, got {actual_type}"
348344
)
349-
if HARP_HAS_MANAGED_BY_LABEL:
350-
managed_by = item["metadata"].get("labels", {}).get(
351-
"app.kubernetes.io/managed-by"
352-
)
353-
assert managed_by == "harp", (
354-
f"Service missing managed-by=harp label, got: {managed_by}"
355-
)
345+
managed_by = item["metadata"].get("labels", {}).get(
346+
"app.kubernetes.io/managed-by"
347+
)
348+
assert managed_by == "harp", (
349+
f"Service missing managed-by=harp label, got: {managed_by}"
350+
)
356351
found = True
357352
break
358353
assert found, (
@@ -417,7 +412,13 @@ def test_k8s_single_unregister_keep_data():
417412
deploy_output = kubectl_output("get deploy -o name", check=False)
418413
assert "app-skeleton-python" not in deploy_output, f"Deployment still exists: {deploy_output}"
419414

420-
if not IS_MANUAL:
415+
if IS_MANUAL:
416+
# Operator-managed Service must be preserved (HaRP only deletes managed-by=harp Services)
417+
svc_output = kubectl_output("get svc -o name", check=False)
418+
assert "app-skeleton-python" in svc_output, (
419+
f"Operator-managed Service was deleted during unregister: {svc_output}"
420+
)
421+
else:
421422
svc_output = kubectl_output("get svc -o name", check=False)
422423
assert "app-skeleton-python" not in svc_output, f"Service still exists: {svc_output}"
423424

0 commit comments

Comments
 (0)