diff --git a/apis/container/v1beta1/zz_cluster_types.go b/apis/container/v1beta1/zz_cluster_types.go index 6c1ba2161..381772ae2 100755 --- a/apis/container/v1beta1/zz_cluster_types.go +++ b/apis/container/v1beta1/zz_cluster_types.go @@ -4603,8 +4603,18 @@ type PrivateClusterConfigObservation struct { PrivateEndpoint *string `json:"privateEndpoint,omitempty" tf:"private_endpoint,omitempty"` // Subnetwork in cluster's network where master's endpoint will be provisioned. + // +crossplane:generate:reference:type=github.com/upbound/provider-gcp/apis/compute/v1beta2.Subnetwork + // +crossplane:generate:reference:extractor=github.com/upbound/provider-gcp/config/common.SelfLinkExtractor() PrivateEndpointSubnetwork *string `json:"privateEndpointSubnetwork,omitempty" tf:"private_endpoint_subnetwork,omitempty"` + // Reference to a Subnetwork in compute to populate privateEndpointSubnetwork. + // +kubebuilder:validation:Optional + PrivateEndpointSubnetworkRef *v1.Reference `json:"privateEndpointSubnetworkRef,omitempty" tf:"-"` + + // Selector for a Subnetwork in compute to populate privateEndpointSubnetwork. + // +kubebuilder:validation:Optional + PrivateEndpointSubnetworkSelector *v1.Selector `json:"privateEndpointSubnetworkSelector,omitempty" tf:"-"` + // The external IP address of this cluster's master endpoint. PublicEndpoint *string `json:"publicEndpoint,omitempty" tf:"public_endpoint,omitempty"` } @@ -4641,8 +4651,17 @@ type PrivateClusterConfigParameters struct { MasterIPv4CidrBlock *string `json:"masterIpv4CidrBlock,omitempty" tf:"master_ipv4_cidr_block,omitempty"` // Subnetwork in cluster's network where master's endpoint will be provisioned. - // +kubebuilder:validation:Optional + // +crossplane:generate:reference:type=github.com/upbound/provider-gcp/apis/compute/v1beta2.Subnetwork + // +crossplane:generate:reference:extractor=github.com/upbound/provider-gcp/config/common.SelfLinkExtractor() PrivateEndpointSubnetwork *string `json:"privateEndpointSubnetwork,omitempty" tf:"private_endpoint_subnetwork,omitempty"` + + // Reference to a Subnetwork in compute to populate privateEndpointSubnetwork. + // +kubebuilder:validation:Optional + PrivateEndpointSubnetworkRef *v1.Reference `json:"privateEndpointSubnetworkRef,omitempty" tf:"-"` + + // Selector for a Subnetwork in compute to populate privateEndpointSubnetwork. + // +kubebuilder:validation:Optional + PrivateEndpointSubnetworkSelector *v1.Selector `json:"privateEndpointSubnetworkSelector,omitempty" tf:"-"` } type PrivateRegistryAccessConfigCertificateAuthorityDomainConfigGCPSecretManagerCertificateConfigInitParameters struct { diff --git a/apis/container/v1beta1/zz_generated.deepcopy.go b/apis/container/v1beta1/zz_generated.deepcopy.go index e3ec73b33..fa22fe489 100644 --- a/apis/container/v1beta1/zz_generated.deepcopy.go +++ b/apis/container/v1beta1/zz_generated.deepcopy.go @@ -14499,6 +14499,16 @@ func (in *PrivateClusterConfigObservation) DeepCopyInto(out *PrivateClusterConfi *out = new(string) **out = **in } + if in.PrivateEndpointSubnetworkRef != nil { + in, out := &in.PrivateEndpointSubnetworkRef, &out.PrivateEndpointSubnetworkRef + *out = new(v1.Reference) + (*in).DeepCopyInto(*out) + } + if in.PrivateEndpointSubnetworkSelector != nil { + in, out := &in.PrivateEndpointSubnetworkSelector, &out.PrivateEndpointSubnetworkSelector + *out = new(v1.Selector) + (*in).DeepCopyInto(*out) + } if in.PublicEndpoint != nil { in, out := &in.PublicEndpoint, &out.PublicEndpoint *out = new(string) @@ -14546,6 +14556,16 @@ func (in *PrivateClusterConfigParameters) DeepCopyInto(out *PrivateClusterConfig *out = new(string) **out = **in } + if in.PrivateEndpointSubnetworkRef != nil { + in, out := &in.PrivateEndpointSubnetworkRef, &out.PrivateEndpointSubnetworkRef + *out = new(v1.Reference) + (*in).DeepCopyInto(*out) + } + if in.PrivateEndpointSubnetworkSelector != nil { + in, out := &in.PrivateEndpointSubnetworkSelector, &out.PrivateEndpointSubnetworkSelector + *out = new(v1.Selector) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PrivateClusterConfigParameters. diff --git a/apis/container/v1beta1/zz_generated.resolvers.go b/apis/container/v1beta1/zz_generated.resolvers.go index a8ddfbf68..3691dfcd4 100644 --- a/apis/container/v1beta1/zz_generated.resolvers.go +++ b/apis/container/v1beta1/zz_generated.resolvers.go @@ -67,6 +67,27 @@ func (mg *Cluster) ResolveReferences(ctx context.Context, c client.Reader) error mg.Spec.ForProvider.NodeConfig[i3].ServiceAccount = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.NodeConfig[i3].ServiceAccountRef = rsp.ResolvedReference + } + for i3 := 0; i3 < len(mg.Spec.ForProvider.PrivateClusterConfig); i3++ { + { + m, l, err = apisresolver.GetManagedResource("compute.gcp.upbound.io", "v1beta2", "Subnetwork", "SubnetworkList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.PrivateClusterConfig[i3].PrivateEndpointSubnetwork), + Extract: common.SelfLinkExtractor(), + Reference: mg.Spec.ForProvider.PrivateClusterConfig[i3].PrivateEndpointSubnetworkRef, + Selector: mg.Spec.ForProvider.PrivateClusterConfig[i3].PrivateEndpointSubnetworkSelector, + To: reference.To{List: l, Managed: m}, + }) + } + if err != nil { + return errors.Wrap(err, "mg.Spec.ForProvider.PrivateClusterConfig[i3].PrivateEndpointSubnetwork") + } + mg.Spec.ForProvider.PrivateClusterConfig[i3].PrivateEndpointSubnetwork = reference.ToPtrValue(rsp.ResolvedValue) + mg.Spec.ForProvider.PrivateClusterConfig[i3].PrivateEndpointSubnetworkRef = rsp.ResolvedReference + } { m, l, err = apisresolver.GetManagedResource("compute.gcp.upbound.io", "v1beta1", "Subnetwork", "SubnetworkList") @@ -146,6 +167,28 @@ func (mg *Cluster) ResolveReferences(ctx context.Context, c client.Reader) error mg.Spec.InitProvider.Subnetwork = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.SubnetworkRef = rsp.ResolvedReference + for i3 := 0; i3 < len(mg.Status.AtProvider.PrivateClusterConfig); i3++ { + { + m, l, err = apisresolver.GetManagedResource("compute.gcp.upbound.io", "v1beta2", "Subnetwork", "SubnetworkList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Status.AtProvider.PrivateClusterConfig[i3].PrivateEndpointSubnetwork), + Extract: common.SelfLinkExtractor(), + Reference: mg.Status.AtProvider.PrivateClusterConfig[i3].PrivateEndpointSubnetworkRef, + Selector: mg.Status.AtProvider.PrivateClusterConfig[i3].PrivateEndpointSubnetworkSelector, + To: reference.To{List: l, Managed: m}, + }) + } + if err != nil { + return errors.Wrap(err, "mg.Status.AtProvider.PrivateClusterConfig[i3].PrivateEndpointSubnetwork") + } + mg.Status.AtProvider.PrivateClusterConfig[i3].PrivateEndpointSubnetwork = reference.ToPtrValue(rsp.ResolvedValue) + mg.Status.AtProvider.PrivateClusterConfig[i3].PrivateEndpointSubnetworkRef = rsp.ResolvedReference + + } + return nil } diff --git a/package/crds/container.gcp.upbound.io_clusters.yaml b/package/crds/container.gcp.upbound.io_clusters.yaml index eaa409f13..829f7b735 100644 --- a/package/crds/container.gcp.upbound.io_clusters.yaml +++ b/package/crds/container.gcp.upbound.io_clusters.yaml @@ -1864,6 +1864,82 @@ spec: description: Subnetwork in cluster's network where master's endpoint will be provisioned. type: string + privateEndpointSubnetworkRef: + description: Reference to a Subnetwork in compute to populate + privateEndpointSubnetwork. + properties: + name: + description: Name of the referenced object. + type: string + policy: + description: Policies for referencing. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + required: + - name + type: object + privateEndpointSubnetworkSelector: + description: Selector for a Subnetwork in compute to populate + privateEndpointSubnetwork. + properties: + matchControllerRef: + description: |- + MatchControllerRef ensures an object with the same controller reference + as the selecting object is selected. + type: boolean + matchLabels: + additionalProperties: + type: string + description: MatchLabels ensures an object with matching + labels is selected. + type: object + policy: + description: Policies for selection. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + type: object type: object type: array privateIpv6GoogleAccess: @@ -6712,6 +6788,82 @@ spec: description: Subnetwork in cluster's network where master's endpoint will be provisioned. type: string + privateEndpointSubnetworkRef: + description: Reference to a Subnetwork in compute to populate + privateEndpointSubnetwork. + properties: + name: + description: Name of the referenced object. + type: string + policy: + description: Policies for referencing. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + required: + - name + type: object + privateEndpointSubnetworkSelector: + description: Selector for a Subnetwork in compute to populate + privateEndpointSubnetwork. + properties: + matchControllerRef: + description: |- + MatchControllerRef ensures an object with the same controller reference + as the selecting object is selected. + type: boolean + matchLabels: + additionalProperties: + type: string + description: MatchLabels ensures an object with matching + labels is selected. + type: object + policy: + description: Policies for selection. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + type: object publicEndpoint: description: The external IP address of this cluster's master endpoint.