Commit 5f1c1df
authored
new: Add support for LKE Control Plane ACLs (#406)
## 📝 Description
This pull request adds support for configuring and viewing the ACL configuration for an LKE cluster's control plane.
**NOTE: This PR does NOT include the PUT LKE cluster changes because the acl configuration is not returned in the GET LKE cluster response.**
#### New Endpoint Methods
* `control_plane_acl` - GET `/lke/clusters/{cluster_id}/control_plane_acl`
* `control_plane_acl_update(...)` - PUT `/lke/clusters/{cluster_id}/control_plane_acl`
* `control_plane_acl_delete()` - POST `/lke/clusters/{cluster_id}/control_plane_acl`
#### Updated Endpoint Methods
* `LKEGroup.cluster_create(...)` - Add control_plane field to method arguments
#### Misc Changes
* Added data classes for LKE cluster control plane and all substructures
* Added logic to JSONObject to remove `Optional` values from the generated dict if None
* Added a new `always_include` class var used to designate optional values that should always be included in the generated Dict
* Updated test fixture framework to support underscores in path
## ✔️ How to Test
The following test steps assume you have pulled down this PR locally and run `make install`.
### Unit Testing
```
make testunit
```
### Integration Testing
```
make TEST_COMMAND=models/lke/test_lke.py testint
```
### Manual Testing
In a Python SDK sandbox environment (e.g. dx-devenv), run the following:
```python
import os
from linode_api4 import (
LinodeClient,
LKEClusterControlPlaneOptions,
LKEClusterControlPlaneACLOptions,
LKEClusterControlPlaneACLAddressesOptions,
)
client = LinodeClient(token=os.getenv("LINODE_TOKEN"))
cluster = client.lke.cluster_create(
"us-mia",
"test-cluster",
client.lke.node_pool("g6-standard-1", 1),
"1.29",
control_plane=LKEClusterControlPlaneOptions(
acl=LKEClusterControlPlaneACLOptions(
enabled=True,
addresses=LKEClusterControlPlaneACLAddressesOptions(
ipv4=["10.0.0.1/32"], ipv6=["1234::5678"]
),
)
),
)
print("Original ACL:", cluster.control_plane_acl)
cluster.control_plane_acl_update(
LKEClusterControlPlaneACLOptions(
addresses=LKEClusterControlPlaneACLAddressesOptions(ipv4=["10.0.0.2/32"])
)
)
print("Updated ACL:", cluster.control_plane_acl)
cluster.control_plane_acl_delete()
print("Deleted ACL:", cluster.control_plane_acl)
```
2. Ensure the script runs successfully and the output matches the following:
```
Original ACL: LKEClusterControlPlaneACL(enabled=True, addresses=LKEClusterControlPlaneACLAddresses(ipv4=['10.0.0.1/32'], ipv6=['1234::5678/128']))
Updated ACL: LKEClusterControlPlaneACL(enabled=True, addresses=LKEClusterControlPlaneACLAddresses(ipv4=['10.0.0.2/32'], ipv6=None))
Deleted ACL: LKEClusterControlPlaneACL(enabled=False, addresses=None)
```1 parent e4ffa17 commit 5f1c1df
File tree
9 files changed
+473
-11
lines changed- linode_api4
- groups
- objects
- test
- fixtures
- integration/models/lke
- unit
- objects
9 files changed
+473
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
1 | 3 | | |
2 | 4 | | |
3 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
4 | 13 | | |
5 | 14 | | |
6 | 15 | | |
| |||
47 | 56 | | |
48 | 57 | | |
49 | 58 | | |
50 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
51 | 70 | | |
52 | 71 | | |
53 | 72 | | |
| |||
80 | 99 | | |
81 | 100 | | |
82 | 101 | | |
| 102 | + | |
| 103 | + | |
83 | 104 | | |
84 | 105 | | |
85 | 106 | | |
| |||
112 | 133 | | |
113 | 134 | | |
114 | 135 | | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
115 | 141 | | |
116 | 142 | | |
117 | 143 | | |
118 | | - | |
| 144 | + | |
119 | 145 | | |
120 | 146 | | |
121 | 147 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
1 | 3 | | |
2 | 4 | | |
3 | 5 | | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
7 | 9 | | |
| 10 | + | |
8 | 11 | | |
9 | 12 | | |
10 | 13 | | |
| |||
26 | 29 | | |
27 | 30 | | |
28 | 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 | + | |
29 | 87 | | |
30 | 88 | | |
31 | 89 | | |
| |||
129 | 187 | | |
130 | 188 | | |
131 | 189 | | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
132 | 205 | | |
133 | 206 | | |
134 | 207 | | |
| |||
186 | 259 | | |
187 | 260 | | |
188 | 261 | | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
189 | 282 | | |
190 | 283 | | |
191 | 284 | | |
| |||
335 | 428 | | |
336 | 429 | | |
337 | 430 | | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
| 10 | + | |
| 11 | + | |
9 | 12 | | |
10 | 13 | | |
11 | 14 | | |
| |||
54 | 57 | | |
55 | 58 | | |
56 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
57 | 67 | | |
58 | 68 | | |
59 | 69 | | |
60 | 70 | | |
61 | 71 | | |
62 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
63 | 87 | | |
64 | 88 | | |
65 | 89 | | |
66 | 90 | | |
67 | 91 | | |
68 | 92 | | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
69 | 96 | | |
70 | 97 | | |
| 98 | + | |
71 | 99 | | |
72 | 100 | | |
73 | 101 | | |
74 | | - | |
| 102 | + | |
75 | 103 | | |
76 | 104 | | |
77 | 105 | | |
78 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
79 | 111 | | |
80 | 112 | | |
81 | 113 | | |
| |||
86 | 118 | | |
87 | 119 | | |
88 | 120 | | |
89 | | - | |
| 121 | + | |
90 | 122 | | |
91 | 123 | | |
92 | 124 | | |
93 | 125 | | |
| 126 | + | |
| 127 | + | |
94 | 128 | | |
95 | 129 | | |
96 | 130 | | |
| |||
117 | 151 | | |
118 | 152 | | |
119 | 153 | | |
120 | | - | |
| 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 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
121 | 203 | | |
122 | 204 | | |
123 | 205 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
| 103 | + | |
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
| 119 | + | |
120 | 120 | | |
0 commit comments