Skip to content

Commit

Permalink
Add list markers to SubnetSpec
Browse files Browse the repository at this point in the history
This is to allow a co-authored slice between CAPI and CAPA in server
side apply.

Hacks
* update type definition for CRD generation purpose
* make id field as a required manually
  • Loading branch information
Winnie Kwon committed Jun 16, 2022
1 parent 851a814 commit 12218f8
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions api/v1beta1/network_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ type NetworkSpec struct {

// Subnets configuration.
// +optional
//// +listType=map
//// +listMapKey=id
//Subnets []SubnetSpec `json:"subnets,omitempty"`
Subnets Subnets `json:"subnets,omitempty"`

// CNI configuration
Expand Down Expand Up @@ -248,6 +251,8 @@ func (s *SubnetSpec) String() string {
}

// Subnets is a slice of Subnet.
// +listType=map
// +listMapKey=id
type Subnets []SubnetSpec

// ToMap returns a map from id to subnet.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2549,7 +2549,12 @@ spec:
resource.
type: object
type: object
required:
- id
type: array
x-kubernetes-list-map-keys:
- id
x-kubernetes-list-type: map
vpc:
description: VPC configuration.
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1808,7 +1808,12 @@ spec:
resource.
type: object
type: object
required:
- id
type: array
x-kubernetes-list-map-keys:
- id
x-kubernetes-list-type: map
vpc:
description: VPC configuration.
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,12 @@ spec:
the resource.
type: object
type: object
required:
- id
type: array
x-kubernetes-list-map-keys:
- id
x-kubernetes-list-type: map
vpc:
description: VPC configuration.
properties:
Expand Down

0 comments on commit 12218f8

Please sign in to comment.