@@ -113,7 +113,11 @@ type VPCNetworkSpec struct {
113
113
// +optional
114
114
ResourceGroup * string `json:"resourceGroup,omitempty"`
115
115
116
- // TODO(cjschaef): Complete spec definition (SecurityGroups, VPC)
116
+ // vpc defines the IBM Cloud VPC.
117
+ // +optional
118
+ VPC * VPCResource `json:"vpc,omitempty"`
119
+
120
+ // TODO(cjschaef): Complete spec definition (SecurityGroups, etc.)
117
121
}
118
122
119
123
// VPCSecurityGroupStatus defines a vpc security group resource status with its id and respective rule's ids.
@@ -146,11 +150,22 @@ type VPCLoadBalancerStatus struct {
146
150
type IBMVPCClusterStatus struct {
147
151
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
148
152
// Important: Run "make" to regenerate code after modifying this file
153
+ // dep: rely on Network instead.
149
154
VPC VPC `json:"vpc,omitempty"`
150
155
156
+ // network is the status of the VPC network resources.
157
+ // +optional
158
+ Network * VPCNetworkStatus `json:"network,omitempty"`
159
+
151
160
// Ready is true when the provider resource is ready.
152
161
// +optional
153
- Ready bool `json:"ready"`
162
+ // +kubebuilder:default=false
163
+ Ready bool `json:"ready"`
164
+
165
+ // resourceGroup is the status of the cluster's Resource Group.
166
+ // +optional
167
+ ResourceGroup * ResourceStatus `json:"resourceGroup,omitempty"`
168
+
154
169
Subnet Subnet `json:"subnet,omitempty"`
155
170
VPCEndpoint VPCEndpoint `json:"vpcEndpoint,omitempty"`
156
171
@@ -163,6 +178,45 @@ type IBMVPCClusterStatus struct {
163
178
Conditions capiv1beta1.Conditions `json:"conditions,omitempty"`
164
179
}
165
180
181
+ // VPCNetworkStatus provides details on the status of VPC network resources.
182
+ type VPCNetworkStatus struct {
183
+ // resourceGroup references the Resource Group for Network resources for the cluster.
184
+ // This can be the same or unique from the cluster's Resource Group.
185
+ // +optional
186
+ ResourceGroup * ResourceStatus `json:"resourceGroup,omitempty"`
187
+
188
+ // vpc references the IBM Cloud VPC.
189
+ // +optional
190
+ VPC * VPCResourceStatus `json:"vpc,omitempty"`
191
+ }
192
+
193
+ // VPCResourceStatus identifies a VPC resource by id (and name) and whether it is ready.
194
+ type VPCResourceStatus struct {
195
+ // id defines the IBM Cloud ID of the resource.
196
+ // +required
197
+ ID string `json:"id"`
198
+
199
+ // name defines the name of the resource.
200
+ // +optional
201
+ Name * string `json:"name,omitempty"`
202
+
203
+ // ready defines whether the IBM Cloud VPC resource is ready.
204
+ // +required
205
+ // +kubebuilder:default=false
206
+ Ready bool `json:"ready"`
207
+ }
208
+
209
+ // Set sets the VPCResourceStatus fields.
210
+ func (s * VPCResourceStatus ) Set (resource VPCResourceStatus ) {
211
+ s .ID = resource .ID
212
+ // Set the name if it hasn't been, or the resource.Name won't remove it (nil).
213
+ if s .Name == nil && resource .Name != nil {
214
+ s .Name = resource .Name
215
+ }
216
+ s .Name = resource .Name
217
+ s .Ready = resource .Ready
218
+ }
219
+
166
220
// VPC holds the VPC information.
167
221
type VPC struct {
168
222
ID string `json:"id"`
0 commit comments