ITADN

v1beta2 contract: add V1Beta2Status structs and condition accessors to remaining types

#1697Opendamdo 创建于 2026-06-29
kind/feature
D
damdocommented
Parent: https://github.com/kubernetes-sigs/cluster-api-provider-gcp/issues/1607 Add a `V1Beta2` field to the status of every remaining CAPG type that has `status.conditions` (old-style). The JSON tag **must** be `"v1beta2"` — this is a hardcoded path in CAPI core's `UnstructuredGetAll()` at `util/conditions/getter.go:128`, not a naming convention. ## Pattern ```go type GCPManagedClusterV1Beta2Status struct { // +optional // +listType=map // +listMapKey=type // +kubebuilder:validation:MaxItems=32 Conditions []metav1.Condition `json:"conditions,omitempty"` } ``` Plus `GetV1Beta2Conditions()`/`SetV1Beta2Conditions()` accessor methods. ## Resources | Resource | File | |---|---| | GCPManagedCluster | `exp/api/v1beta1/gcpmanagedcluster_types.go` | | GCPManagedControlPlane | `exp/api/v1beta1/gcpmanagedcontrolplane_types.go` | | GCPManagedMachinePool | `exp/api/v1beta1/gcpmanagedmachinepool_types.go` | | GKEConfig | `exp/bootstrap/gke/api/v1beta1/gkeconfig_types.go` | **Note:** GCPMachinePool (`exp/api/v1beta1/gcpmachinepool_types.go`) already uses `[]metav1.Condition` as its condition type but at top-level `status.conditions`, NOT in a `V1Beta2` substruct. It needs to be restructured: - Keep `status.conditions` as `[]metav1.Condition` (it's already the right type) - Add `status.v1beta2.conditions` pointing to the same data, OR add the `V1Beta2` wrapper and keep top-level as deprecated The patch helper auto-detection at `util/patch/utils.go:144` looks for a `V1Beta2` struct field — without it, the new patch helper won't find the v1beta2 conditions. Run `make generate manifests` after to regenerate CRDs. **Reference:** CAPI DevCluster at `test/infrastructure/docker/api/v1beta2/devcluster_types.go:207`
1 条评论