Commit 18ebb46
committed
feat(telco-kpis): Implement unified lockdowns role with hub capture and parse
Implements a unified lockdowns role for hub/spoke operator lockdown management,
enabling repeatable OpenShift cluster deployments with locked operator versions.
Key Features:
1. Unified Role Structure (lockdowns)
- Mode-based dispatcher (hub/spoke) with action (parse/capture)
- Common utilities: download, validation, symlink generation
- Separate task files for hub and spoke operations
- Jinja2 templates for lockdown JSON generation
2. Hub Lockdown Capture
- Queries cluster for OCP version, Subscriptions, OperatorGroups, CatalogSources
- Detects architecture via skopeo (x86_64/arm64, multi-arch support)
- Maps mirrored catalog names to upstream (cs-redhat-operator-index-* → redhat-operators)
- Enriches FBC operators with mirroring metadata:
* fbc_iib_repo: 'latest'
* ocp_operator_mirror_fbc_image_base: quay.io/redhat-user-workloads/telco-5g-tenant/{catalog}-{version}
- Generates dual-format OCP pull specs (digest + tag)
- Outputs timestamped lockdown JSON with cluster metadata
3. Hub Lockdown Parse
- Downloads lockdown JSON from URI (GitLab, Gitea, file://)
- GitLab symlink resolver handles multi-hop symlink chains:
* lockdown-hub-x86_64.json → lockdown-hub-4.21-x86_64.json → ../4.21/actual.json
* Detects JSON vs symlink text, resolves relative paths
* Max 5 hops protection
- Uses slurp module (not lookup) for SSH compatibility (Ansible controller vs remote host)
- Validates lockdown structure (required fields, nested hierarchy)
- Transforms operators for upstream compatibility:
* Adds 'nsname' field from 'namespace' (upstream role requirement)
- Sets facts: hub_lockdown_operators, hub_ocp_pull_spec, hub_ocp_version
4. Telco-KPIs Wrapper Playbook (deploy-ocp-operators.yml)
- Three-phase workflow:
* Phase 1: Parse lockdown (if hub_lockdown_uri provided) OR use parameters
* Phase 2: Call upstream deploy-ocp-operators.yml with transformed operators
* Phase 3: Capture lockdown (if generate_hub_lockdown requested)
- Integrates with Jenkins install-hub-operators job
- Supports both lockdown mode and parameter mode
5. Lockdown JSON Format
- Nested structure: {hub: {ocp: {...}, operators: [...], metadata: {...}}}
- OCP pull_spec with both digest (immutable) and tag (human-readable)
- Operators include: name, namespace, catalog, channel, subscription_name,
installed_csv, install_plan_approval, og_name, og_spec
- FBC operators include additional: fbc_iib_repo, ocp_operator_mirror_fbc_image_base
- Metadata: cluster_name, capture_timestamp (ISO8601)
6. Testing
- Molecule test suites for hub parse and capture
- 10 test scenarios covering parse, validation, symlinks, comparisons
- Fixtures for direct JSON, 1-hop/2-hop symlinks, invalid JSON
Implementation Details:
- Uses kubernetes.core.k8s_info for cluster queries (no k8s_exec)
- Hardcoded FBC metadata for relaxed repeatability (vs reading CatalogSource state)
- Directory existence checks before template writes
- Variable scoping fixes for lockdown_artifact_dir across playbook phases
Fixes:
- Jenkins builds #75-77, #79, #81, #84, #85 failures with hub lockdown URI
- GitLab symlink resolution (/-/raw/ endpoint returns text, not target)
- Ansible execution context (lookup vs slurp on remote hosts)
- FBC operator mirroring metadata requirements
- Field name mismatches (namespace vs nsname)
Files:
- playbooks/telco-kpis/deploy-ocp-operators.yml (new wrapper)
- playbooks/telco-kpis/roles/lockdowns/ (unified role)
- playbooks/telco-kpis/roles/lockdowns/tasks/{main,hub,spoke,common}
- playbooks/telco-kpis/roles/lockdowns/templates/{hub,spoke,resolve-gitlab-symlinks}
- playbooks/telco-kpis/roles/lockdowns/molecule/hub/default/ (tests)
Integration:
- Jenkins: jobs/Telco-KPIs/install-hub-operators.Jenkinsfile
- GitLab: ran/dev-kpi-pipeline/-/tree/prow-lockdowns/hub/
- Upstream: playbooks/deploy-ocp-operators.yml (imports this wrapper)
Related:
- Legacy branch: ipa-telco-kpis-prow-migration-20260619-before-deploy-ocp-operators-untouched
- Design docs: docs/designs/operator-lockdown-*.md
- README: playbooks/telco-kpis/roles/lockdowns/README.md1 parent b4fcb3c commit 18ebb46
30 files changed
Lines changed: 2510 additions & 1 deletion
File tree
- playbooks
- telco-kpis
- roles
- lockdowns
- defaults
- molecule/hub
- default
- tasks
- common
- hub
- spoke
- templates
- hub
- spoke
- workarounds
- defaults
- meta
- tasks
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
201 | 201 | | |
202 | 202 | | |
203 | 203 | | |
204 | | - | |
| 204 | + | |
205 | 205 | | |
206 | 206 | | |
207 | 207 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
0 commit comments