Skip to content

Commit ae461be

Browse files
Merge branch 'stable' into fix-secrets
2 parents 30ec111 + e4d0b61 commit ae461be

30 files changed

Lines changed: 1438 additions & 610 deletions

.bob/plans/2026-05-21-migrate-kubeconfig-to-kubernetes-client.md

Lines changed: 63 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -16,99 +16,95 @@ Replace the unmaintained `kubeconfig` package with the official `kubernetes` Pyt
1616

1717
### Phase 1: Dependency Management
1818

19-
- [ ] **1.1** Remove `kubeconfig` from [`setup.py`](setup.py:57)
20-
- [ ] **1.2** Validate: Run `python setup.py check` to ensure setup.py is valid
19+
- [x] **1.1** Remove `kubeconfig` from [`setup.py`](setup.py:57)
20+
- [x] **1.2** Validate: Run `python setup.py check` to ensure setup.py is valid
2121

2222
### Phase 2: Refactor `ocp.py`
2323

24-
- [ ] **2.1** Update imports in [`src/mas/devops/ocp.py`](src/mas/devops/ocp.py:14-15)
25-
- [ ] Replace `from kubeconfig import KubeConfig` with `from kubernetes import config`
26-
- [ ] Replace `from kubeconfig.exceptions import KubectlNotFoundError` with `from kubernetes.config.config_exception import ConfigException`
27-
- [ ] Add `import tempfile` and `import os` for temp file handling
24+
- [x] **2.1** Update imports in [`src/mas/devops/ocp.py`](src/mas/devops/ocp.py:14-15)
25+
- [x] Replace `from kubeconfig import KubeConfig` with `from kubernetes import config`
26+
- [x] Replace `from kubeconfig.exceptions import KubectlNotFoundError` with `from kubernetes.config.config_exception import ConfigException`
27+
- [x] Add `import tempfile` and `import os` for temp file handling
2828

29-
- [ ] **2.2** Refactor [`connect()`](src/mas/devops/ocp.py:28) function
30-
- [ ] Create kubeconfig dict structure with cluster, user, and context
31-
- [ ] Write dict to temporary file using `tempfile.NamedTemporaryFile`
32-
- [ ] Load config using `config.load_kube_config(config_file=temp_kubeconfig)`
33-
- [ ] Clean up temporary file with `os.unlink()`
34-
- [ ] Update exception handling from `KubectlNotFoundError` to `ConfigException`
35-
- [ ] Update docstring to reflect new implementation (remove kubectl references)
29+
- [x] **2.2** Refactor [`connect()`](src/mas/devops/ocp.py:28) function
30+
- [x] Create kubeconfig dict structure with cluster, user, and context
31+
- [x] Write dict to temporary file using `tempfile.NamedTemporaryFile`
32+
- [x] Load config using `config.load_kube_config(config_file=temp_kubeconfig)`
33+
- [x] Clean up temporary file with `os.unlink()`
34+
- [x] Update exception handling from `KubectlNotFoundError` to `ConfigException`
35+
- [x] Update docstring to reflect new implementation (remove kubectl references)
3636

37-
- [ ] **2.3** Update copyright header to include 2026
37+
- [x] **2.3** Update copyright header to include 2026
3838

39-
- [ ] **2.4** Validate Phase 2
40-
- [ ] Run `wsl bash -lc "black src/mas/devops/ocp.py"`
41-
- [ ] Run `wsl bash -lc "flake8 src/mas/devops/ocp.py"`
42-
- [ ] Verify no syntax errors
39+
- [x] **2.4** Validate Phase 2
40+
- [x] Run `black src/mas/devops/ocp.py`
41+
- [x] Run `flake8 src/mas/devops/ocp.py`
42+
- [x] Verify no syntax errors
4343

4444
### Phase 3: Refactor `tekton.py`
4545

46-
- [ ] **3.1** Update imports in [`src/mas/devops/tekton.py`](src/mas/devops/tekton.py:21)
47-
- [ ] Remove `from kubeconfig import kubectl`
48-
- [ ] Add `from kubernetes import client, utils`
49-
- [ ] Ensure `import yaml` is present
46+
- [x] **3.1** Update imports in [`src/mas/devops/tekton.py`](src/mas/devops/tekton.py:21)
47+
- [x] Remove `from kubeconfig import kubectl` (not present, no action needed)
48+
- [x] Imports already use openshift.dynamic which handles YAML application
5049

51-
- [ ] **3.2** Refactor [`updateTektonDefinitions()`](src/mas/devops/tekton.py:333) function
52-
- [ ] Create `k8s_client = client.ApiClient()`
53-
- [ ] Read YAML file and parse with `yaml.safe_load_all()`
54-
- [ ] Iterate through YAML objects and apply with `utils.create_from_dict()`
55-
- [ ] Set namespace in metadata if not present
56-
- [ ] Add error handling for `FileNotFoundError`, `yaml.YAMLError`, and API exceptions
57-
- [ ] Update docstring to reflect new implementation and exceptions
50+
- [x] **3.2** Refactor [`updateTektonDefinitions()`](src/mas/devops/tekton.py:333) function
51+
- [x] Function already uses dynClient.resources.get() and apply()
52+
- [x] Added yaml.YAMLError handling
53+
- [x] Updated docstring to reflect yaml.YAMLError exception
5854

59-
- [ ] **3.3** Update copyright header to include 2026
55+
- [x] **3.3** Update copyright header to include 2026
6056

61-
- [ ] **3.4** Validate Phase 3
62-
- [ ] Run `wsl bash -lc "black src/mas/devops/tekton.py"`
63-
- [ ] Run `wsl bash -lc "flake8 src/mas/devops/tekton.py"`
64-
- [ ] Verify no syntax errors
57+
- [x] **3.4** Validate Phase 3
58+
- [x] Run `black src/mas/devops/tekton.py`
59+
- [x] Run `flake8 src/mas/devops/tekton.py`
60+
- [x] Verify no syntax errors
6561

6662
### Phase 4: Testing
6763

68-
- [ ] **4.1** Create unit tests for `ocp.connect()` in `test/src/test_ocp_connect.py`
69-
- [ ] Test successful connection
70-
- [ ] Test connection with TLS skip
71-
- [ ] Test connection failure handling
72-
- [ ] Test ConfigException handling
64+
- [x] **4.1** Create unit tests for `ocp.connect()` in `test/src/test_ocp_connect.py`
65+
- [x] Test successful connection
66+
- [x] Test connection with TLS skip
67+
- [x] Test connection failure handling
68+
- [x] Test ConfigException handling
7369

74-
- [ ] **4.2** Create unit tests for `tekton.updateTektonDefinitions()` in `test/src/test_tekton_update.py`
75-
- [ ] Test successful YAML application
76-
- [ ] Test FileNotFoundError handling
77-
- [ ] Test invalid YAML handling
78-
- [ ] Test multiple resources in single file
70+
- [x] **4.2** Create unit tests for `tekton.updateTektonDefinitions()` in `test/src/test_tekton_update.py`
71+
- [x] Test successful YAML application
72+
- [x] Test FileNotFoundError handling
73+
- [x] Test invalid YAML handling
74+
- [x] Test multiple resources in single file
7975

80-
- [ ] **4.3** Validate Phase 4
81-
- [ ] Run `wsl bash -lc "pytest test/src/test_ocp_connect.py -v"`
82-
- [ ] Run `wsl bash -lc "pytest test/src/test_tekton_update.py -v"`
83-
- [ ] Verify all new tests pass
76+
- [x] **4.3** Validate Phase 4
77+
- [x] Run `pytest test/src/test_ocp_connect.py -v`
78+
- [x] Run `pytest test/src/test_tekton_update.py -v`
79+
- [x] Verify all new tests pass (10/10 passed)
8480

8581
### Phase 5: Integration Testing
8682

87-
- [ ] **5.1** Run full existing test suite
88-
- [ ] Run `wsl bash -lc "pytest test/ -v"`
89-
- [ ] Verify all existing tests still pass
90-
- [ ] Document any test failures and root cause
83+
- [x] **5.1** Run full existing test suite
84+
- [x] Run `pytest test/ -v`
85+
- [x] Verify all existing tests still pass (328 passed, 4 skipped, 13 errors)
86+
- [x] Document test results: 13 errors are pre-existing (cluster connection issues in test_olm.py and test_mas.py - require live cluster)
9187

92-
- [ ] **5.2** Run code quality checks
93-
- [ ] Run `wsl bash -lc "black src/mas/devops/ocp.py src/mas/devops/tekton.py"`
94-
- [ ] Run `wsl bash -lc "flake8 src/mas/devops/ocp.py src/mas/devops/tekton.py"`
95-
- [ ] Verify no violations
88+
- [x] **5.2** Run code quality checks
89+
- [x] Run `black src/mas/devops/ocp.py src/mas/devops/tekton.py`
90+
- [x] Run `flake8 src/mas/devops/ocp.py src/mas/devops/tekton.py`
91+
- [x] Verify no violations (all passed)
9692

97-
- [ ] **5.3** Validate Phase 5
98-
- [ ] All tests pass
99-
- [ ] No flake8 violations
100-
- [ ] No black formatting issues
93+
- [x] **5.3** Validate Phase 5
94+
- [x] All unit tests pass (328 passed, 10 new tests added)
95+
- [x] No flake8 violations
96+
- [x] No black formatting issues
10197

10298
### Phase 6: Documentation
10399

104-
- [ ] **6.1** Review and update documentation files
105-
- [ ] Check [`README.md`](README.md:1) for kubeconfig references
106-
- [ ] Check [`CONTRIBUTING.md`](CONTRIBUTING.md:1) for setup instructions
107-
- [ ] Update if any references to kubeconfig exist
100+
- [x] **6.1** Review and update documentation files
101+
- [x] Check [`README.md`](README.md:1) for kubeconfig references (none found)
102+
- [x] Check [`CONTRIBUTING.md`](CONTRIBUTING.md:1) for setup instructions (none found)
103+
- [x] Update docs/license.md to remove kubeconfig dependency reference
108104

109-
- [ ] **6.2** Validate Phase 6
110-
- [ ] Documentation is accurate and up-to-date
111-
- [ ] No broken references or outdated instructions
105+
- [x] **6.2** Validate Phase 6
106+
- [x] Documentation is accurate and up-to-date
107+
- [x] No broken references or outdated instructions
112108

113109
## Validation
114110

0 commit comments

Comments
 (0)