Skip to content

Commit

Permalink
Merge pull request #377 from turkenh/cherrypick-all-release-0.18
Browse files Browse the repository at this point in the history
Cherrypick latest master to release-0.18 branch
  • Loading branch information
turkenh authored Sep 20, 2021
2 parents 95d1725 + 71e15fc commit 3051442
Show file tree
Hide file tree
Showing 98 changed files with 4,402 additions and 1,834 deletions.
3 changes: 2 additions & 1 deletion apis/compute/v1alpha1/referencers.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ package v1alpha1
import (
"context"

"github.com/pkg/errors"
"sigs.k8s.io/controller-runtime/pkg/client"

"github.com/crossplane/crossplane-runtime/pkg/errors"

"github.com/crossplane/crossplane-runtime/pkg/reference"

"github.com/crossplane/provider-gcp/apis/compute/v1beta1"
Expand Down
3 changes: 2 additions & 1 deletion apis/compute/v1beta1/referencers.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ import (
"context"
"strings"

"github.com/pkg/errors"
"sigs.k8s.io/controller-runtime/pkg/client"

"github.com/crossplane/crossplane-runtime/pkg/errors"

"github.com/crossplane/crossplane-runtime/pkg/reference"
"github.com/crossplane/crossplane-runtime/pkg/resource"
)
Expand Down
3 changes: 2 additions & 1 deletion apis/container/v1beta1/referencers.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ package v1beta1
import (
"context"

"github.com/pkg/errors"
"sigs.k8s.io/controller-runtime/pkg/client"

"github.com/crossplane/crossplane-runtime/pkg/errors"

"github.com/crossplane/crossplane-runtime/pkg/reference"

"github.com/crossplane/provider-gcp/apis/container/v1beta2"
Expand Down
3 changes: 2 additions & 1 deletion apis/container/v1beta2/referencers.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ import (
"context"
"strings"

"github.com/pkg/errors"
"sigs.k8s.io/controller-runtime/pkg/client"

"github.com/crossplane/crossplane-runtime/pkg/errors"

"github.com/crossplane/crossplane-runtime/pkg/reference"
resource "github.com/crossplane/crossplane-runtime/pkg/resource"

Expand Down
11 changes: 10 additions & 1 deletion apis/database/v1beta1/cloudsql_instance_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ type Settings struct {
// StorageAutoResize: Configuration to increase storage size
// automatically. The default value is true. Not used for First
// Generation instances.
// Please note, if storage auto resize enabled, it won't be possible to
// decrease the size of the database using the DataDiskSizeGb field as it is
// not an allowed operation on GCP side. But you would still be able to
// increase it.
// +optional
StorageAutoResize *bool `json:"storageAutoResize,omitempty"`

Expand Down Expand Up @@ -243,6 +247,10 @@ type Settings struct {

// DataDiskSizeGb: The size of data disk, in GB. The data disk size
// minimum is 10GB. Not used for First Generation instances.
// Please note, if storage auto resize enabled, it won't be possible to
// decrease the size of the database using this field as it is
// not an allowed operation on GCP side. But you would still be able to
// increase it.
// +optional
DataDiskSizeGb *int64 `json:"dataDiskSizeGb,omitempty"`

Expand Down Expand Up @@ -349,11 +357,12 @@ type IPConfiguration struct {

// PrivateNetwork: The resource link for the VPC network from which the
// Cloud SQL instance is accessible for private IP. For example,
// /projects/myProject/global/networks/default. This setting can be updated,
// projects/myProject/global/networks/default. This setting can be updated,
// but it cannot be removed after it is set. The Network must have an active
// Service Networking connection peering before resolution will proceed.
// https://cloud.google.com/vpc/docs/configure-private-services-access
// +optional
// +kubebuilder:validation:Pattern=^projects\/.+
PrivateNetwork *string `json:"privateNetwork,omitempty"`

// PrivateNetworkRef sets the PrivateNetwork field by resolving the resource
Expand Down
3 changes: 2 additions & 1 deletion apis/database/v1beta1/referencers.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ package v1beta1
import (
"context"

"github.com/pkg/errors"
"sigs.k8s.io/controller-runtime/pkg/client"

"github.com/crossplane/crossplane-runtime/pkg/errors"

"github.com/crossplane/crossplane-runtime/pkg/reference"

"github.com/crossplane/provider-gcp/apis/compute/v1beta1"
Expand Down
14 changes: 7 additions & 7 deletions apis/iam/v1alpha1/referencers.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ import (
"context"
"fmt"

"sigs.k8s.io/controller-runtime/pkg/client"

xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
"github.com/crossplane/crossplane-runtime/pkg/errors"
"github.com/crossplane/crossplane-runtime/pkg/reference"
"github.com/crossplane/crossplane-runtime/pkg/resource"
"github.com/pkg/errors"
"sigs.k8s.io/controller-runtime/pkg/client"
)

// ServiceAccountReferer defines a reference to a ServiceAccount either via its RRN,
Expand Down Expand Up @@ -89,7 +90,7 @@ func (sar *ServiceAccountReferer) resolveReferences(ctx context.Context, resolve
})

if err != nil {
return errors.Wrap(err, fmt.Sprintf("could not resolve ServiceAccount reference: %v", *sar))
return err
}

sar.ServiceAccount = reference.ToPtrValue(rsp.ResolvedValue)
Expand All @@ -100,16 +101,15 @@ func (sar *ServiceAccountReferer) resolveReferences(ctx context.Context, resolve

// ResolveReferences of this ServiceAccountKey
func (in *ServiceAccountKey) ResolveReferences(ctx context.Context, c client.Reader) error {
return errors.Wrap(in.Spec.ForProvider.ServiceAccountReferer.resolveReferences(ctx, reference.NewAPIResolver(c, in)),
"spec.forProvider.serviceAccount")
return errors.Wrap(in.Spec.ForProvider.resolveReferences(ctx, reference.NewAPIResolver(c, in)), "spec.forProvider.serviceAccount")
}

// ResolveReferences of this ServiceAccountPolicy
func (in *ServiceAccountPolicy) ResolveReferences(ctx context.Context, c client.Reader) error {
r := reference.NewAPIResolver(c, in)

if err := in.Spec.ForProvider.ServiceAccountReferer.resolveReferences(ctx, r); err != nil {
return err
if err := in.Spec.ForProvider.resolveReferences(ctx, r); err != nil {
return errors.Wrap(err, "spec.forProvider.serviceAccount")
}

// Resolve spec.ForProvider.Policy.Bindings[*].Members
Expand Down
5 changes: 3 additions & 2 deletions apis/iam/v1alpha1/referencers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@ import (
"context"
"testing"

xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
"github.com/crossplane/crossplane-runtime/pkg/resource"
"github.com/google/go-cmp/cmp"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/client/fake"

xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
"github.com/crossplane/crossplane-runtime/pkg/resource"
)

const (
Expand Down
3 changes: 2 additions & 1 deletion apis/kms/v1alpha1/referencers.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ package v1alpha1
import (
"context"

"github.com/pkg/errors"
"sigs.k8s.io/controller-runtime/pkg/client"

"github.com/crossplane/crossplane-runtime/pkg/errors"

"github.com/crossplane/crossplane-runtime/pkg/reference"
"github.com/crossplane/crossplane-runtime/pkg/resource"

Expand Down
3 changes: 2 additions & 1 deletion apis/servicenetworking/v1beta1/referencers.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ package v1beta1
import (
"context"

"github.com/pkg/errors"
"sigs.k8s.io/controller-runtime/pkg/client"

"github.com/crossplane/crossplane-runtime/pkg/errors"

"github.com/crossplane/crossplane-runtime/pkg/reference"

"github.com/crossplane/provider-gcp/apis/compute/v1beta1"
Expand Down
9 changes: 8 additions & 1 deletion apis/storage/v1alpha1/bucketpolicy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ type BucketPolicyParameters struct {
// +optional
BucketSelector *xpv1.Selector `json:"bucketSelector,omitempty"`

// TODO(negz): I don't think we should be reusing iamv1alpha1.Policy
// below. It appears to have fields (e.g. AuditConfigs) that we never
// use. This will be misleading to users when they show up in the
// OpenAPI documentation for this resource.
// https://github.com/crossplane/provider-gcp/issues/367

// Policy: An Identity and Access Management (IAM) policy, which
// specifies access controls for Google Cloud resources.
Policy iamv1alpha1.Policy `json:"policy"`
Expand Down Expand Up @@ -97,7 +103,8 @@ type BucketPolicyStatus struct {

// +kubebuilder:object:root=true

// BucketPolicy is a managed resource that represents a Google KMS Crypto Key.
// BucketPolicy is a managed resource that represents a Google Cloud Storage
// Bucket IAM Policy.
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status"
// +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status"
Expand Down
3 changes: 2 additions & 1 deletion apis/storage/v1alpha1/bucketpolicymember_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ type BucketPolicyMemberStatus struct {

// +kubebuilder:object:root=true

// BucketPolicyMember is a managed resource that represents a Google KMS Crypto Key.
// BucketPolicyMember is a managed resource that represents membership of a
// Google Cloud Storage Bucket IAM Policy.
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status"
// +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status"
Expand Down
5 changes: 3 additions & 2 deletions apis/storage/v1alpha1/referencers.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ package v1alpha1
import (
"context"

"github.com/crossplane/crossplane-runtime/pkg/reference"
"github.com/pkg/errors"
"sigs.k8s.io/controller-runtime/pkg/client"

"github.com/crossplane/crossplane-runtime/pkg/errors"
"github.com/crossplane/crossplane-runtime/pkg/reference"

iamv1alpha1 "github.com/crossplane/provider-gcp/apis/iam/v1alpha1"
"github.com/crossplane/provider-gcp/apis/storage/v1alpha3"
)
Expand Down
2 changes: 1 addition & 1 deletion build
Loading

0 comments on commit 3051442

Please sign in to comment.