Skip to content

Commit bac7280

Browse files
xnotoclaude
andauthored
feat!: migrate to argocd-operator on k3s; drop OpenShift-isms (Phase A) (#5)
## Summary Phase A of the k3s migration: re-targets `kustomize-cluster` from OpenShift Local (CRC) onto vanilla k3s, consumed by `argocd-operator` (community, upstream of OpenShift GitOps — same `argoproj.io/v1beta1 ArgoCD` CRD, so the existing `repo:` block with KSOPS/Dex/RBAC works unchanged). This is the *minimum* set of changes for ArgoCD to bootstrap successfully on k3s. Phase B (replace OLM Subscriptions for cert-manager/awx/grafana with upstream Helm) and Phase C (clean up `openshift-monitoring` Prometheus scrape refs, `system:openshift:scc` references in workloads) follow as separate PRs. Bundles the previously-staged repo-local opencode config (the prior commit on this branch). ### Renames - namespace `openshift-gitops` → `argocd` (~22 files) - ArgoCD CR `name: openshift-gitops` → `name: argocd` - SA `openshift-gitops-argocd-application-controller` → `argocd-argocd-application-controller` - directory `workloads/openshift-gitops/` → `workloads/argocd/` - service ref `argocd-server.openshift-gitops.svc.cluster.local` → `argocd-server.argocd.svc.cluster.local` - TunnelBinding subject `openshift-gitops-server` → `argocd-server` - PostSync hooks: `oc` → `kubectl`, OpenShift CLI ImageStream → `bitnami/kubectl:latest` - ci-token-sync image: `image-registry.openshift-image-registry.svc:5000/public-registry/gh-cli` → `ghcr.io/makeitworkcloud/gh-cli` ### Deletions (OpenShift-only constructs) - `bootstrap/console-branding/` — OpenShift web console branding - `bootstrap/secrets/openshift-oauth/` — cluster-wide OpenShift OAuth provider config; ArgoCD's own Dex GitHub SSO remains the SSO path - `bootstrap/public-registry.yaml` — OpenShift internal-registry-backed namespace - `operators/cert-manager/{ingress-patch,openshift-ingress-config}.yaml` — patched OpenShift's IngressController + componentRoutes - `operators/cert-manager/wildcard-certificate.yaml` — the wildcard `*.apps.makeitwork.cloud` LE cert was a CRC ingress workaround. With public traffic flowing through Cloudflare Tunnels (already in this repo via `cloudflare-operator` + `TunnelBinding`), TLS terminates at Cloudflare's edge and an in-cluster wildcard cert is dead code. - `workloads/arc/imagestream.yaml` — OpenShift ImageStream ### Bootstrap chain ``` tfroot-libvirt k3s cloud-init runcmd: 1. Install k3s 2. Create ns argocd + sops-age-keys Secret (in argocd ns) 3. kubectl apply -k argocd-operator (community) 4. kubectl apply -k kustomize-cluster//bootstrap?ref=main → applies argocd-config.yaml (operator reconciles → argocd-server with KSOPS init) → applies bootstrap-secrets-app, gitops-operators, gitops-workloads (sit dormant until argocd-server is up) 5. argocd-server starts → picks up Applications → self-manages from here ``` The argocd-operator install + sops-age-keys Secret + bootstrap apply is in the **companion tfroot-libvirt PR #2**. The `sops_age_key` value needs to be added to `tfroot-libvirt/secrets/secrets.yaml` (sops-encrypted; same age recipient as the rest). ## Test plan - [x] `kustomize build bootstrap/` passes locally - [x] `kustomize build workloads/apps/` passes locally - [x] All pre-commit hooks (yaml lint, KubeLinter, EOF/whitespace) pass - [x] CI `Pre-commit Tests` job passes (now `ubuntu-latest`) - [x] Apply locally (after tfroot-libvirt is also applied) — verify ArgoCD comes up, repo-server has KSOPS init-container, root sync starts - [x] Expected red items in ArgoCD UI after sync: cert-manager / awx / grafana OLM Subscriptions (Phase B will replace), grafana scrape refs to `openshift-monitoring` (Phase C) ## Migration notes for operators - The OLM-installed operators (cert-manager, awx, grafana) **will fail to sync** on k3s because there's no OLM. Their `operator.yaml` Subscription resources land in etcd but go nowhere. Expected; see Phase B. - The wildcard cert is gone. Anything that previously consumed `wildcard-apps-makeitwork-cloud-tls` Secret (none currently in repo) will need re-plumbing through Cloudflare. --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 84e92e5 commit bac7280

44 files changed

Lines changed: 108 additions & 401 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ permissions:
1515
jobs:
1616
test:
1717
name: Pre-commit Tests
18-
runs-on: arc
18+
# ubuntu-latest while arc-dind runners are unavailable during the libvirt
19+
# migration. Revert to `arc` once the new k3s cluster has ARC runners up.
20+
runs-on: ubuntu-latest
1921
steps:
2022
- name: Checkout repository
2123
uses: actions/checkout@v4
@@ -30,23 +32,18 @@ jobs:
3032

3133
sync:
3234
name: Sync ArgoCD
35+
# In-cluster `arc` runner uses its SA token to talk to the API directly;
36+
# this job stays on `arc` because it needs cluster access. It will not run
37+
# until ARC dind runners are deployed by kustomize-cluster post-bootstrap.
3338
runs-on: arc
3439
needs: [test]
3540
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
3641

3742
steps:
38-
- name: Install OpenShift CLI
39-
uses: redhat-actions/oc-installer@v1
40-
41-
- name: Login to OpenShift
42-
uses: redhat-actions/oc-login@v1
43-
with:
44-
openshift_server_url: ${{ secrets.OPENSHIFT_SERVER_URL }}
45-
openshift_token: ${{ secrets.OPENSHIFT_TOKEN }}
46-
insecure_skip_tls_verify: true
47-
48-
- name: Sync ArgoCD application
43+
- name: Sync ArgoCD bootstrap Applications
4944
run: |
50-
oc -n openshift-gitops patch application kustomize-cluster \
51-
--type=merge \
52-
-p '{"operation":{"initiatedBy":{"username":"github-actions"},"sync":{"revision":"${{ github.sha }}"}}}'
45+
for app in bootstrap-secrets gitops-operators gitops-workloads; do
46+
kubectl -n argocd patch application "$app" \
47+
--type=merge \
48+
-p '{"operation":{"initiatedBy":{"username":"github-actions"},"sync":{"revision":"${{ github.sha }}"}}}'
49+
done

bootstrap/argocd-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
2-
# OpenShift GitOps ArgoCD configuration
2+
# ArgoCD instance managed by argocd-operator (community).
33
# - KSOPS for SOPS-encrypted secrets using AGE keys
44
# - GitHub OAuth authentication via Dex
55
# - RBAC with GitHub org/team mapping
66
apiVersion: argoproj.io/v1beta1
77
kind: ArgoCD
88
metadata:
9-
name: openshift-gitops
10-
namespace: openshift-gitops
9+
name: argocd
10+
namespace: argocd
1111
annotations:
1212
argocd.argoproj.io/sync-wave: "0"
1313
spec:

bootstrap/bootstrap-secrets-app.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ apiVersion: argoproj.io/v1alpha1
55
kind: Application
66
metadata:
77
name: bootstrap-secrets
8-
namespace: openshift-gitops
8+
namespace: argocd
99
annotations:
1010
argocd.argoproj.io/sync-wave: "1"
1111
spec:

bootstrap/ci-service-account.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ apiVersion: v1
55
kind: ServiceAccount
66
metadata:
77
name: ci-deployer
8-
namespace: openshift-gitops
8+
namespace: argocd
99
annotations:
1010
argocd.argoproj.io/sync-wave: "0"
1111
---
1212
# Long-lived API token for CI/CD
13-
# Extract with: oc get secret ci-deployer-token -n openshift-gitops -o jsonpath='{.data.token}' | base64 -d
13+
# Extract with: kubectl get secret ci-deployer-token -n argocd -o jsonpath='{.data.token}' | base64 -d
1414
apiVersion: v1
1515
kind: Secret
1616
metadata:
1717
name: ci-deployer-token
18-
namespace: openshift-gitops
18+
namespace: argocd
1919
annotations:
2020
argocd.argoproj.io/sync-wave: "0"
2121
kubernetes.io/service-account.name: ci-deployer
@@ -35,4 +35,4 @@ roleRef:
3535
subjects:
3636
- kind: ServiceAccount
3737
name: ci-deployer
38-
namespace: openshift-gitops
38+
namespace: argocd

bootstrap/ci-token-sync-job.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ apiVersion: batch/v1
55
kind: Job
66
metadata:
77
name: ci-token-sync
8-
namespace: openshift-gitops
8+
namespace: argocd
99
annotations:
1010
argocd.argoproj.io/hook: PostSync
1111
argocd.argoproj.io/hook-delete-policy: BeforeHookCreation
@@ -25,7 +25,7 @@ spec:
2525
type: RuntimeDefault
2626
containers:
2727
- name: sync
28-
image: image-registry.openshift-image-registry.svc:5000/public-registry/gh-cli:latest
28+
image: ghcr.io/makeitworkcloud/gh-cli:latest
2929
securityContext:
3030
allowPrivilegeEscalation: false
3131
readOnlyRootFilesystem: true

bootstrap/console-branding/console-favicon-configmap.yaml

Lines changed: 0 additions & 8 deletions
This file was deleted.

bootstrap/console-branding/console-logo-configmap.yaml

Lines changed: 0 additions & 35 deletions
This file was deleted.

bootstrap/console-branding/console-operator.yaml

Lines changed: 0 additions & 39 deletions
This file was deleted.

bootstrap/console-branding/kustomization.yaml

Lines changed: 0 additions & 8 deletions
This file was deleted.

bootstrap/console-branding/remove-banner.yaml

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)