diff --git a/apis/container/v1beta1/zz_cluster_types.go b/apis/container/v1beta1/zz_cluster_types.go index 381772ae2..6c0700849 100755 --- a/apis/container/v1beta1/zz_cluster_types.go +++ b/apis/container/v1beta1/zz_cluster_types.go @@ -4567,6 +4567,14 @@ type PrivateClusterConfigInitParameters struct { // Subnetwork in cluster's network where master's endpoint will be provisioned. 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 PrivateClusterConfigObservation struct { @@ -4603,18 +4611,8 @@ 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"` } @@ -4651,8 +4649,7 @@ 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. - // +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() + // +kubebuilder:validation:Optional PrivateEndpointSubnetwork *string `json:"privateEndpointSubnetwork,omitempty" tf:"private_endpoint_subnetwork,omitempty"` // Reference to a Subnetwork in compute to populate privateEndpointSubnetwork. diff --git a/apis/container/v1beta1/zz_generated.deepcopy.go b/apis/container/v1beta1/zz_generated.deepcopy.go index fa22fe489..24c0fe069 100644 --- a/apis/container/v1beta1/zz_generated.deepcopy.go +++ b/apis/container/v1beta1/zz_generated.deepcopy.go @@ -14447,6 +14447,16 @@ func (in *PrivateClusterConfigInitParameters) DeepCopyInto(out *PrivateClusterCo *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 PrivateClusterConfigInitParameters. @@ -14499,16 +14509,6 @@ 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) diff --git a/apis/container/v1beta1/zz_generated.resolvers.go b/apis/container/v1beta1/zz_generated.resolvers.go index 3691dfcd4..a8ddfbf68 100644 --- a/apis/container/v1beta1/zz_generated.resolvers.go +++ b/apis/container/v1beta1/zz_generated.resolvers.go @@ -67,27 +67,6 @@ 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") @@ -167,28 +146,6 @@ 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 829f7b735..4a2f16c31 100644 --- a/package/crds/container.gcp.upbound.io_clusters.yaml +++ b/package/crds/container.gcp.upbound.io_clusters.yaml @@ -3947,6 +3947,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: @@ -6788,82 +6864,6 @@ 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.