diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bd057e93..0e99b2fc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -77,6 +77,8 @@ jobs: uses: golangci/golangci-lint-action@v3 with: version: ${{ env.GOLANGCI_VERSION }} + skip-pkg-cache: true + skip-build-cache: true check-diff: runs-on: ubuntu-22.04 diff --git a/.golangci.yml b/.golangci.yml index 494a9077..bf4c47c0 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,12 +1,16 @@ -run: - deadline: 10m +# SPDX-FileCopyrightText: 2024 The Crossplane Authors +# +# SPDX-License-Identifier: CC0-1.0 - skip-files: - - "zz_\\..+\\.go$" +run: + timeout: 60m + show-stats: true + concurrency: 3 output: # colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number" format: colored-line-number + print-linter-name: true linters-settings: errcheck: @@ -27,9 +31,9 @@ linters-settings: # report about shadowed variables check-shadowing: false - golint: - # minimal confidence for issues, default is 0.8 - min-confidence: 0.8 + revive: + # confidence for issues, default is 0.8 + confidence: 0.8 gofmt: # simplify code: gofmt with `-s` option, true by default @@ -38,7 +42,7 @@ linters-settings: goimports: # put imports beginning with prefix after 3rd-party packages; # it's a comma-separated list of prefixes - local-prefixes: github.com/upbound/upjet-provider-template + local-prefixes: github.com/upbound/provider-vault gocyclo: # minimal code complexity to report, 30 by default (but we recommend 10-20) @@ -113,7 +117,7 @@ linters: - goimports - gofmt # We enable this as well as goimports for its simplify mode. - prealloc - - golint + - revive - unconvert - misspell - nakedret diff --git a/Makefile b/Makefile index 33c70e4b..fcd1c962 100644 --- a/Makefile +++ b/Makefile @@ -47,7 +47,7 @@ GO_SUBDIRS += cmd internal apis # Setup Kubernetes tools KIND_VERSION = v0.18.0 -UP_VERSION = v0.18.0 +UP_VERSION = v0.29.0 UP_CHANNEL = stable UPTEST_VERSION = v0.2.1 RELDIR = "examples/release" diff --git a/apis/vault/v1alpha1/zz_generated.deepcopy.go b/apis/vault/v1alpha1/zz_generated.deepcopy.go index 82ee91e9..91793da1 100644 --- a/apis/vault/v1alpha1/zz_generated.deepcopy.go +++ b/apis/vault/v1alpha1/zz_generated.deepcopy.go @@ -705,245 +705,6 @@ func (in *MountStatus) DeepCopy() *MountStatus { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Namespace) DeepCopyInto(out *Namespace) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Namespace. -func (in *Namespace) DeepCopy() *Namespace { - if in == nil { - return nil - } - out := new(Namespace) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Namespace) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NamespaceInitParameters) DeepCopyInto(out *NamespaceInitParameters) { - *out = *in - if in.CustomMetadata != nil { - in, out := &in.CustomMetadata, &out.CustomMetadata - *out = make(map[string]*string, len(*in)) - for key, val := range *in { - var outVal *string - if val == nil { - (*out)[key] = nil - } else { - in, out := &val, &outVal - *out = new(string) - **out = **in - } - (*out)[key] = outVal - } - } - if in.Namespace != nil { - in, out := &in.Namespace, &out.Namespace - *out = new(string) - **out = **in - } - if in.Path != nil { - in, out := &in.Path, &out.Path - *out = new(string) - **out = **in - } - if in.PathFq != nil { - in, out := &in.PathFq, &out.PathFq - *out = new(string) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamespaceInitParameters. -func (in *NamespaceInitParameters) DeepCopy() *NamespaceInitParameters { - if in == nil { - return nil - } - out := new(NamespaceInitParameters) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NamespaceList) DeepCopyInto(out *NamespaceList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Namespace, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamespaceList. -func (in *NamespaceList) DeepCopy() *NamespaceList { - if in == nil { - return nil - } - out := new(NamespaceList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *NamespaceList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NamespaceObservation) DeepCopyInto(out *NamespaceObservation) { - *out = *in - if in.CustomMetadata != nil { - in, out := &in.CustomMetadata, &out.CustomMetadata - *out = make(map[string]*string, len(*in)) - for key, val := range *in { - var outVal *string - if val == nil { - (*out)[key] = nil - } else { - in, out := &val, &outVal - *out = new(string) - **out = **in - } - (*out)[key] = outVal - } - } - if in.ID != nil { - in, out := &in.ID, &out.ID - *out = new(string) - **out = **in - } - if in.Namespace != nil { - in, out := &in.Namespace, &out.Namespace - *out = new(string) - **out = **in - } - if in.NamespaceID != nil { - in, out := &in.NamespaceID, &out.NamespaceID - *out = new(string) - **out = **in - } - if in.Path != nil { - in, out := &in.Path, &out.Path - *out = new(string) - **out = **in - } - if in.PathFq != nil { - in, out := &in.PathFq, &out.PathFq - *out = new(string) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamespaceObservation. -func (in *NamespaceObservation) DeepCopy() *NamespaceObservation { - if in == nil { - return nil - } - out := new(NamespaceObservation) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NamespaceParameters) DeepCopyInto(out *NamespaceParameters) { - *out = *in - if in.CustomMetadata != nil { - in, out := &in.CustomMetadata, &out.CustomMetadata - *out = make(map[string]*string, len(*in)) - for key, val := range *in { - var outVal *string - if val == nil { - (*out)[key] = nil - } else { - in, out := &val, &outVal - *out = new(string) - **out = **in - } - (*out)[key] = outVal - } - } - if in.Namespace != nil { - in, out := &in.Namespace, &out.Namespace - *out = new(string) - **out = **in - } - if in.Path != nil { - in, out := &in.Path, &out.Path - *out = new(string) - **out = **in - } - if in.PathFq != nil { - in, out := &in.PathFq, &out.PathFq - *out = new(string) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamespaceParameters. -func (in *NamespaceParameters) DeepCopy() *NamespaceParameters { - if in == nil { - return nil - } - out := new(NamespaceParameters) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NamespaceSpec) DeepCopyInto(out *NamespaceSpec) { - *out = *in - in.ResourceSpec.DeepCopyInto(&out.ResourceSpec) - in.ForProvider.DeepCopyInto(&out.ForProvider) - in.InitProvider.DeepCopyInto(&out.InitProvider) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamespaceSpec. -func (in *NamespaceSpec) DeepCopy() *NamespaceSpec { - if in == nil { - return nil - } - out := new(NamespaceSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NamespaceStatus) DeepCopyInto(out *NamespaceStatus) { - *out = *in - in.ResourceStatus.DeepCopyInto(&out.ResourceStatus) - in.AtProvider.DeepCopyInto(&out.AtProvider) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamespaceStatus. -func (in *NamespaceStatus) DeepCopy() *NamespaceStatus { - if in == nil { - return nil - } - out := new(NamespaceStatus) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Policy) DeepCopyInto(out *Policy) { *out = *in @@ -1559,3 +1320,242 @@ func (in *TokenStatus) DeepCopy() *TokenStatus { in.DeepCopyInto(out) return out } + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VaultNamespace) DeepCopyInto(out *VaultNamespace) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VaultNamespace. +func (in *VaultNamespace) DeepCopy() *VaultNamespace { + if in == nil { + return nil + } + out := new(VaultNamespace) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *VaultNamespace) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VaultNamespaceInitParameters) DeepCopyInto(out *VaultNamespaceInitParameters) { + *out = *in + if in.CustomMetadata != nil { + in, out := &in.CustomMetadata, &out.CustomMetadata + *out = make(map[string]*string, len(*in)) + for key, val := range *in { + var outVal *string + if val == nil { + (*out)[key] = nil + } else { + in, out := &val, &outVal + *out = new(string) + **out = **in + } + (*out)[key] = outVal + } + } + if in.Namespace != nil { + in, out := &in.Namespace, &out.Namespace + *out = new(string) + **out = **in + } + if in.Path != nil { + in, out := &in.Path, &out.Path + *out = new(string) + **out = **in + } + if in.PathFq != nil { + in, out := &in.PathFq, &out.PathFq + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VaultNamespaceInitParameters. +func (in *VaultNamespaceInitParameters) DeepCopy() *VaultNamespaceInitParameters { + if in == nil { + return nil + } + out := new(VaultNamespaceInitParameters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VaultNamespaceList) DeepCopyInto(out *VaultNamespaceList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]VaultNamespace, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VaultNamespaceList. +func (in *VaultNamespaceList) DeepCopy() *VaultNamespaceList { + if in == nil { + return nil + } + out := new(VaultNamespaceList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *VaultNamespaceList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VaultNamespaceObservation) DeepCopyInto(out *VaultNamespaceObservation) { + *out = *in + if in.CustomMetadata != nil { + in, out := &in.CustomMetadata, &out.CustomMetadata + *out = make(map[string]*string, len(*in)) + for key, val := range *in { + var outVal *string + if val == nil { + (*out)[key] = nil + } else { + in, out := &val, &outVal + *out = new(string) + **out = **in + } + (*out)[key] = outVal + } + } + if in.ID != nil { + in, out := &in.ID, &out.ID + *out = new(string) + **out = **in + } + if in.Namespace != nil { + in, out := &in.Namespace, &out.Namespace + *out = new(string) + **out = **in + } + if in.NamespaceID != nil { + in, out := &in.NamespaceID, &out.NamespaceID + *out = new(string) + **out = **in + } + if in.Path != nil { + in, out := &in.Path, &out.Path + *out = new(string) + **out = **in + } + if in.PathFq != nil { + in, out := &in.PathFq, &out.PathFq + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VaultNamespaceObservation. +func (in *VaultNamespaceObservation) DeepCopy() *VaultNamespaceObservation { + if in == nil { + return nil + } + out := new(VaultNamespaceObservation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VaultNamespaceParameters) DeepCopyInto(out *VaultNamespaceParameters) { + *out = *in + if in.CustomMetadata != nil { + in, out := &in.CustomMetadata, &out.CustomMetadata + *out = make(map[string]*string, len(*in)) + for key, val := range *in { + var outVal *string + if val == nil { + (*out)[key] = nil + } else { + in, out := &val, &outVal + *out = new(string) + **out = **in + } + (*out)[key] = outVal + } + } + if in.Namespace != nil { + in, out := &in.Namespace, &out.Namespace + *out = new(string) + **out = **in + } + if in.Path != nil { + in, out := &in.Path, &out.Path + *out = new(string) + **out = **in + } + if in.PathFq != nil { + in, out := &in.PathFq, &out.PathFq + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VaultNamespaceParameters. +func (in *VaultNamespaceParameters) DeepCopy() *VaultNamespaceParameters { + if in == nil { + return nil + } + out := new(VaultNamespaceParameters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VaultNamespaceSpec) DeepCopyInto(out *VaultNamespaceSpec) { + *out = *in + in.ResourceSpec.DeepCopyInto(&out.ResourceSpec) + in.ForProvider.DeepCopyInto(&out.ForProvider) + in.InitProvider.DeepCopyInto(&out.InitProvider) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VaultNamespaceSpec. +func (in *VaultNamespaceSpec) DeepCopy() *VaultNamespaceSpec { + if in == nil { + return nil + } + out := new(VaultNamespaceSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VaultNamespaceStatus) DeepCopyInto(out *VaultNamespaceStatus) { + *out = *in + in.ResourceStatus.DeepCopyInto(&out.ResourceStatus) + in.AtProvider.DeepCopyInto(&out.AtProvider) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VaultNamespaceStatus. +func (in *VaultNamespaceStatus) DeepCopy() *VaultNamespaceStatus { + if in == nil { + return nil + } + out := new(VaultNamespaceStatus) + in.DeepCopyInto(out) + return out +} diff --git a/apis/vault/v1alpha1/zz_generated.managed.go b/apis/vault/v1alpha1/zz_generated.managed.go index 5f156001..7d631508 100644 --- a/apis/vault/v1alpha1/zz_generated.managed.go +++ b/apis/vault/v1alpha1/zz_generated.managed.go @@ -159,82 +159,6 @@ func (mg *Mount) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) { mg.Spec.WriteConnectionSecretToReference = r } -// GetCondition of this Namespace. -func (mg *Namespace) GetCondition(ct xpv1.ConditionType) xpv1.Condition { - return mg.Status.GetCondition(ct) -} - -// GetDeletionPolicy of this Namespace. -func (mg *Namespace) GetDeletionPolicy() xpv1.DeletionPolicy { - return mg.Spec.DeletionPolicy -} - -// GetManagementPolicies of this Namespace. -func (mg *Namespace) GetManagementPolicies() xpv1.ManagementPolicies { - return mg.Spec.ManagementPolicies -} - -// GetProviderConfigReference of this Namespace. -func (mg *Namespace) GetProviderConfigReference() *xpv1.Reference { - return mg.Spec.ProviderConfigReference -} - -/* -GetProviderReference of this Namespace. -Deprecated: Use GetProviderConfigReference. -*/ -func (mg *Namespace) GetProviderReference() *xpv1.Reference { - return mg.Spec.ProviderReference -} - -// GetPublishConnectionDetailsTo of this Namespace. -func (mg *Namespace) GetPublishConnectionDetailsTo() *xpv1.PublishConnectionDetailsTo { - return mg.Spec.PublishConnectionDetailsTo -} - -// GetWriteConnectionSecretToReference of this Namespace. -func (mg *Namespace) GetWriteConnectionSecretToReference() *xpv1.SecretReference { - return mg.Spec.WriteConnectionSecretToReference -} - -// SetConditions of this Namespace. -func (mg *Namespace) SetConditions(c ...xpv1.Condition) { - mg.Status.SetConditions(c...) -} - -// SetDeletionPolicy of this Namespace. -func (mg *Namespace) SetDeletionPolicy(r xpv1.DeletionPolicy) { - mg.Spec.DeletionPolicy = r -} - -// SetManagementPolicies of this Namespace. -func (mg *Namespace) SetManagementPolicies(r xpv1.ManagementPolicies) { - mg.Spec.ManagementPolicies = r -} - -// SetProviderConfigReference of this Namespace. -func (mg *Namespace) SetProviderConfigReference(r *xpv1.Reference) { - mg.Spec.ProviderConfigReference = r -} - -/* -SetProviderReference of this Namespace. -Deprecated: Use SetProviderConfigReference. -*/ -func (mg *Namespace) SetProviderReference(r *xpv1.Reference) { - mg.Spec.ProviderReference = r -} - -// SetPublishConnectionDetailsTo of this Namespace. -func (mg *Namespace) SetPublishConnectionDetailsTo(r *xpv1.PublishConnectionDetailsTo) { - mg.Spec.PublishConnectionDetailsTo = r -} - -// SetWriteConnectionSecretToReference of this Namespace. -func (mg *Namespace) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) { - mg.Spec.WriteConnectionSecretToReference = r -} - // GetCondition of this Policy. func (mg *Policy) GetCondition(ct xpv1.ConditionType) xpv1.Condition { return mg.Status.GetCondition(ct) @@ -386,3 +310,79 @@ func (mg *Token) SetPublishConnectionDetailsTo(r *xpv1.PublishConnectionDetailsT func (mg *Token) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) { mg.Spec.WriteConnectionSecretToReference = r } + +// GetCondition of this VaultNamespace. +func (mg *VaultNamespace) GetCondition(ct xpv1.ConditionType) xpv1.Condition { + return mg.Status.GetCondition(ct) +} + +// GetDeletionPolicy of this VaultNamespace. +func (mg *VaultNamespace) GetDeletionPolicy() xpv1.DeletionPolicy { + return mg.Spec.DeletionPolicy +} + +// GetManagementPolicies of this VaultNamespace. +func (mg *VaultNamespace) GetManagementPolicies() xpv1.ManagementPolicies { + return mg.Spec.ManagementPolicies +} + +// GetProviderConfigReference of this VaultNamespace. +func (mg *VaultNamespace) GetProviderConfigReference() *xpv1.Reference { + return mg.Spec.ProviderConfigReference +} + +/* +GetProviderReference of this VaultNamespace. +Deprecated: Use GetProviderConfigReference. +*/ +func (mg *VaultNamespace) GetProviderReference() *xpv1.Reference { + return mg.Spec.ProviderReference +} + +// GetPublishConnectionDetailsTo of this VaultNamespace. +func (mg *VaultNamespace) GetPublishConnectionDetailsTo() *xpv1.PublishConnectionDetailsTo { + return mg.Spec.PublishConnectionDetailsTo +} + +// GetWriteConnectionSecretToReference of this VaultNamespace. +func (mg *VaultNamespace) GetWriteConnectionSecretToReference() *xpv1.SecretReference { + return mg.Spec.WriteConnectionSecretToReference +} + +// SetConditions of this VaultNamespace. +func (mg *VaultNamespace) SetConditions(c ...xpv1.Condition) { + mg.Status.SetConditions(c...) +} + +// SetDeletionPolicy of this VaultNamespace. +func (mg *VaultNamespace) SetDeletionPolicy(r xpv1.DeletionPolicy) { + mg.Spec.DeletionPolicy = r +} + +// SetManagementPolicies of this VaultNamespace. +func (mg *VaultNamespace) SetManagementPolicies(r xpv1.ManagementPolicies) { + mg.Spec.ManagementPolicies = r +} + +// SetProviderConfigReference of this VaultNamespace. +func (mg *VaultNamespace) SetProviderConfigReference(r *xpv1.Reference) { + mg.Spec.ProviderConfigReference = r +} + +/* +SetProviderReference of this VaultNamespace. +Deprecated: Use SetProviderConfigReference. +*/ +func (mg *VaultNamespace) SetProviderReference(r *xpv1.Reference) { + mg.Spec.ProviderReference = r +} + +// SetPublishConnectionDetailsTo of this VaultNamespace. +func (mg *VaultNamespace) SetPublishConnectionDetailsTo(r *xpv1.PublishConnectionDetailsTo) { + mg.Spec.PublishConnectionDetailsTo = r +} + +// SetWriteConnectionSecretToReference of this VaultNamespace. +func (mg *VaultNamespace) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) { + mg.Spec.WriteConnectionSecretToReference = r +} diff --git a/apis/vault/v1alpha1/zz_generated.managedlist.go b/apis/vault/v1alpha1/zz_generated.managedlist.go index 41ede9ea..749c25cb 100644 --- a/apis/vault/v1alpha1/zz_generated.managedlist.go +++ b/apis/vault/v1alpha1/zz_generated.managedlist.go @@ -25,8 +25,8 @@ func (l *MountList) GetItems() []resource.Managed { return items } -// GetItems of this NamespaceList. -func (l *NamespaceList) GetItems() []resource.Managed { +// GetItems of this PolicyList. +func (l *PolicyList) GetItems() []resource.Managed { items := make([]resource.Managed, len(l.Items)) for i := range l.Items { items[i] = &l.Items[i] @@ -34,8 +34,8 @@ func (l *NamespaceList) GetItems() []resource.Managed { return items } -// GetItems of this PolicyList. -func (l *PolicyList) GetItems() []resource.Managed { +// GetItems of this TokenList. +func (l *TokenList) GetItems() []resource.Managed { items := make([]resource.Managed, len(l.Items)) for i := range l.Items { items[i] = &l.Items[i] @@ -43,8 +43,8 @@ func (l *PolicyList) GetItems() []resource.Managed { return items } -// GetItems of this TokenList. -func (l *TokenList) GetItems() []resource.Managed { +// GetItems of this VaultNamespaceList. +func (l *VaultNamespaceList) GetItems() []resource.Managed { items := make([]resource.Managed, len(l.Items)) for i := range l.Items { items[i] = &l.Items[i] diff --git a/apis/vault/v1alpha1/zz_generated_terraformed.go b/apis/vault/v1alpha1/zz_generated_terraformed.go index dd502b3d..9aa038b2 100755 --- a/apis/vault/v1alpha1/zz_generated_terraformed.go +++ b/apis/vault/v1alpha1/zz_generated_terraformed.go @@ -181,18 +181,18 @@ func (tr *Mount) GetTerraformSchemaVersion() int { return 0 } -// GetTerraformResourceType returns Terraform resource type for this Namespace -func (mg *Namespace) GetTerraformResourceType() string { +// GetTerraformResourceType returns Terraform resource type for this VaultNamespace +func (mg *VaultNamespace) GetTerraformResourceType() string { return "vault_namespace" } -// GetConnectionDetailsMapping for this Namespace -func (tr *Namespace) GetConnectionDetailsMapping() map[string]string { +// GetConnectionDetailsMapping for this VaultNamespace +func (tr *VaultNamespace) GetConnectionDetailsMapping() map[string]string { return nil } -// GetObservation of this Namespace -func (tr *Namespace) GetObservation() (map[string]any, error) { +// GetObservation of this VaultNamespace +func (tr *VaultNamespace) GetObservation() (map[string]any, error) { o, err := json.TFParser.Marshal(tr.Status.AtProvider) if err != nil { return nil, err @@ -201,8 +201,8 @@ func (tr *Namespace) GetObservation() (map[string]any, error) { return base, json.TFParser.Unmarshal(o, &base) } -// SetObservation for this Namespace -func (tr *Namespace) SetObservation(obs map[string]any) error { +// SetObservation for this VaultNamespace +func (tr *VaultNamespace) SetObservation(obs map[string]any) error { p, err := json.TFParser.Marshal(obs) if err != nil { return err @@ -210,16 +210,16 @@ func (tr *Namespace) SetObservation(obs map[string]any) error { return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) } -// GetID returns ID of underlying Terraform resource of this Namespace -func (tr *Namespace) GetID() string { +// GetID returns ID of underlying Terraform resource of this VaultNamespace +func (tr *VaultNamespace) GetID() string { if tr.Status.AtProvider.ID == nil { return "" } return *tr.Status.AtProvider.ID } -// GetParameters of this Namespace -func (tr *Namespace) GetParameters() (map[string]any, error) { +// GetParameters of this VaultNamespace +func (tr *VaultNamespace) GetParameters() (map[string]any, error) { p, err := json.TFParser.Marshal(tr.Spec.ForProvider) if err != nil { return nil, err @@ -228,8 +228,8 @@ func (tr *Namespace) GetParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } -// SetParameters for this Namespace -func (tr *Namespace) SetParameters(params map[string]any) error { +// SetParameters for this VaultNamespace +func (tr *VaultNamespace) SetParameters(params map[string]any) error { p, err := json.TFParser.Marshal(params) if err != nil { return err @@ -237,8 +237,8 @@ func (tr *Namespace) SetParameters(params map[string]any) error { return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) } -// GetInitParameters of this Namespace -func (tr *Namespace) GetInitParameters() (map[string]any, error) { +// GetInitParameters of this VaultNamespace +func (tr *VaultNamespace) GetInitParameters() (map[string]any, error) { p, err := json.TFParser.Marshal(tr.Spec.InitProvider) if err != nil { return nil, err @@ -247,10 +247,10 @@ func (tr *Namespace) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } -// LateInitialize this Namespace using its observed tfState. +// LateInitialize this VaultNamespace using its observed tfState. // returns True if there are any spec changes for the resource. -func (tr *Namespace) LateInitialize(attrs []byte) (bool, error) { - params := &NamespaceParameters{} +func (tr *VaultNamespace) LateInitialize(attrs []byte) (bool, error) { + params := &VaultNamespaceParameters{} if err := json.TFParser.Unmarshal(attrs, params); err != nil { return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") } @@ -261,7 +261,7 @@ func (tr *Namespace) LateInitialize(attrs []byte) (bool, error) { } // GetTerraformSchemaVersion returns the associated Terraform schema version -func (tr *Namespace) GetTerraformSchemaVersion() int { +func (tr *VaultNamespace) GetTerraformSchemaVersion() int { return 0 } diff --git a/apis/vault/v1alpha1/zz_namespace_types.go b/apis/vault/v1alpha1/zz_vaultnamespace_types.go similarity index 81% rename from apis/vault/v1alpha1/zz_namespace_types.go rename to apis/vault/v1alpha1/zz_vaultnamespace_types.go index 1aabaf4e..22c79640 100755 --- a/apis/vault/v1alpha1/zz_namespace_types.go +++ b/apis/vault/v1alpha1/zz_vaultnamespace_types.go @@ -13,7 +13,7 @@ import ( v1 "github.com/crossplane/crossplane-runtime/apis/common/v1" ) -type NamespaceInitParameters struct { +type VaultNamespaceInitParameters struct { // Custom metadata describing this namespace. Value type // is map[string]string. Requires Vault version 1.12+. @@ -37,7 +37,7 @@ type NamespaceInitParameters struct { PathFq *string `json:"pathFq,omitempty" tf:"path_fq,omitempty"` } -type NamespaceObservation struct { +type VaultNamespaceObservation struct { // Custom metadata describing this namespace. Value type // is map[string]string. Requires Vault version 1.12+. @@ -68,7 +68,7 @@ type NamespaceObservation struct { PathFq *string `json:"pathFq,omitempty" tf:"path_fq,omitempty"` } -type NamespaceParameters struct { +type VaultNamespaceParameters struct { // Custom metadata describing this namespace. Value type // is map[string]string. Requires Vault version 1.12+. @@ -96,10 +96,10 @@ type NamespaceParameters struct { PathFq *string `json:"pathFq,omitempty" tf:"path_fq,omitempty"` } -// NamespaceSpec defines the desired state of Namespace -type NamespaceSpec struct { +// VaultNamespaceSpec defines the desired state of VaultNamespace +type VaultNamespaceSpec struct { v1.ResourceSpec `json:",inline"` - ForProvider NamespaceParameters `json:"forProvider"` + ForProvider VaultNamespaceParameters `json:"forProvider"` // THIS IS AN ALPHA FIELD. Do not use it in production. It is not honored // unless the relevant Crossplane feature flag is enabled, and may be // changed or removed without notice. @@ -111,49 +111,49 @@ type NamespaceSpec struct { // required on creation, but we do not desire to update them after creation, // for example because of an external controller is managing them, like an // autoscaler. - InitProvider NamespaceInitParameters `json:"initProvider,omitempty"` + InitProvider VaultNamespaceInitParameters `json:"initProvider,omitempty"` } -// NamespaceStatus defines the observed state of Namespace. -type NamespaceStatus struct { +// VaultNamespaceStatus defines the observed state of VaultNamespace. +type VaultNamespaceStatus struct { v1.ResourceStatus `json:",inline"` - AtProvider NamespaceObservation `json:"atProvider,omitempty"` + AtProvider VaultNamespaceObservation `json:"atProvider,omitempty"` } // +kubebuilder:object:root=true -// Namespace is the Schema for the Namespaces API. Writes namespaces for Vault +// VaultNamespace is the Schema for the VaultNamespaces API. Writes namespaces for Vault // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" // +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,vault} -type Namespace struct { +type VaultNamespace struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` // +kubebuilder:validation:XValidation:rule="!('*' in self.managementPolicies || 'Create' in self.managementPolicies || 'Update' in self.managementPolicies) || has(self.forProvider.path) || has(self.initProvider.path)",message="path is a required parameter" - Spec NamespaceSpec `json:"spec"` - Status NamespaceStatus `json:"status,omitempty"` + Spec VaultNamespaceSpec `json:"spec"` + Status VaultNamespaceStatus `json:"status,omitempty"` } // +kubebuilder:object:root=true -// NamespaceList contains a list of Namespaces -type NamespaceList struct { +// VaultNamespaceList contains a list of VaultNamespaces +type VaultNamespaceList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` - Items []Namespace `json:"items"` + Items []VaultNamespace `json:"items"` } // Repository type metadata. var ( - Namespace_Kind = "Namespace" - Namespace_GroupKind = schema.GroupKind{Group: CRDGroup, Kind: Namespace_Kind}.String() - Namespace_KindAPIVersion = Namespace_Kind + "." + CRDGroupVersion.String() - Namespace_GroupVersionKind = CRDGroupVersion.WithKind(Namespace_Kind) + VaultNamespace_Kind = "VaultNamespace" + VaultNamespace_GroupKind = schema.GroupKind{Group: CRDGroup, Kind: VaultNamespace_Kind}.String() + VaultNamespace_KindAPIVersion = VaultNamespace_Kind + "." + CRDGroupVersion.String() + VaultNamespace_GroupVersionKind = CRDGroupVersion.WithKind(VaultNamespace_Kind) ) func init() { - SchemeBuilder.Register(&Namespace{}, &NamespaceList{}) + SchemeBuilder.Register(&VaultNamespace{}, &VaultNamespaceList{}) } diff --git a/config/provider.go b/config/provider.go index f4347a24..b381062a 100644 --- a/config/provider.go +++ b/config/provider.go @@ -9,6 +9,8 @@ import ( _ "embed" ujconfig "github.com/upbound/upjet/pkg/config" + + "github.com/upbound/provider-vault/config/vault" ) const ( @@ -33,6 +35,7 @@ func GetProvider() *ujconfig.Provider { for _, configure := range []func(provider *ujconfig.Provider){ // add custom config functions + vault.Configure, } { configure(pc) } diff --git a/config/vault/config.go b/config/vault/config.go new file mode 100644 index 00000000..9a5f1512 --- /dev/null +++ b/config/vault/config.go @@ -0,0 +1,11 @@ +package vault + +import "github.com/upbound/upjet/pkg/config" + +// ConfigureNamespace configures the namespace resource. +func Configure(p *config.Provider) { + p.AddResourceConfigurator("vault_namespace", func(r *config.Resource) { + r.Kind = "VaultNamespace" + r.ShortGroup = "vault" + }) +} diff --git a/examples-generated/vault/namespace.yaml b/examples-generated/vault/vaultnamespace.yaml similarity index 66% rename from examples-generated/vault/namespace.yaml rename to examples-generated/vault/vaultnamespace.yaml index 6b10e98f..8f8c5f81 100644 --- a/examples-generated/vault/namespace.yaml +++ b/examples-generated/vault/vaultnamespace.yaml @@ -1,8 +1,8 @@ apiVersion: vault.vault.upbound.io/v1alpha1 -kind: Namespace +kind: VaultNamespace metadata: annotations: - meta.upbound.io/example-id: vault/v1alpha1/namespace + meta.upbound.io/example-id: vault/v1alpha1/vaultnamespace labels: testing.upbound.io/example-name: ns1 name: ns1 diff --git a/examples/providerconfig/secret.yaml.tmpl b/examples/providerconfig/secret.yaml.tmpl index 5cd6dae5..6a182d03 100644 --- a/examples/providerconfig/secret.yaml.tmpl +++ b/examples/providerconfig/secret.yaml.tmpl @@ -16,7 +16,7 @@ stringData: # "auth_login": { # "path": "auth/approle/login", # "parameters": { - # "role_id": "" + # "role_id": "", # "secret_id": "" # } # } diff --git a/go.mod b/go.mod index 31fc27da..5efdf78c 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/upbound/provider-vault -go 1.19 +go 1.20 require ( github.com/crossplane/crossplane-runtime v0.20.0 diff --git a/internal/controller/vault/namespace/zz_controller.go b/internal/controller/vault/vaultnamespace/zz_controller.go similarity index 86% rename from internal/controller/vault/namespace/zz_controller.go rename to internal/controller/vault/vaultnamespace/zz_controller.go index e26d93b9..9cb90daf 100755 --- a/internal/controller/vault/namespace/zz_controller.go +++ b/internal/controller/vault/vaultnamespace/zz_controller.go @@ -4,7 +4,7 @@ Copyright 2022 Upbound Inc. // Code generated by upjet. DO NOT EDIT. -package namespace +package vaultnamespace import ( "time" @@ -22,15 +22,15 @@ import ( features "github.com/upbound/provider-vault/internal/features" ) -// Setup adds a controller that reconciles Namespace managed resources. +// Setup adds a controller that reconciles VaultNamespace managed resources. func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { - name := managed.ControllerName(v1alpha1.Namespace_GroupVersionKind.String()) + name := managed.ControllerName(v1alpha1.VaultNamespace_GroupVersionKind.String()) var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1alpha1.Namespace_GroupVersionKind), tjcontroller.WithEventHandler(o.EventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1alpha1.VaultNamespace_GroupVersionKind), tjcontroller.WithEventHandler(o.EventHandler)) opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["vault_namespace"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(o.EventHandler), tjcontroller.WithCallbackProvider(ac), @@ -46,12 +46,12 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { if o.Features.Enabled(features.EnableAlphaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies()) } - r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1alpha1.Namespace_GroupVersionKind), opts...) + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1alpha1.VaultNamespace_GroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). Named(name). WithOptions(o.ForControllerRuntime()). WithEventFilter(xpresource.DesiredStateChanged()). - Watches(&v1alpha1.Namespace{}, o.EventHandler). + Watches(&v1alpha1.VaultNamespace{}, o.EventHandler). Complete(ratelimiter.NewReconciler(name, r, o.GlobalRateLimiter)) } diff --git a/internal/controller/zz_setup.go b/internal/controller/zz_setup.go index b3ec4635..c9aba4d9 100755 --- a/internal/controller/zz_setup.go +++ b/internal/controller/zz_setup.go @@ -131,9 +131,9 @@ import ( secretbackendkey "github.com/upbound/provider-vault/internal/controller/transit/secretbackendkey" audit "github.com/upbound/provider-vault/internal/controller/vault/audit" mount "github.com/upbound/provider-vault/internal/controller/vault/mount" - namespace "github.com/upbound/provider-vault/internal/controller/vault/namespace" policyvault "github.com/upbound/provider-vault/internal/controller/vault/policy" token "github.com/upbound/provider-vault/internal/controller/vault/token" + vaultnamespace "github.com/upbound/provider-vault/internal/controller/vault/vaultnamespace" ) // Setup creates all controllers with the supplied logger and adds them to @@ -262,9 +262,9 @@ func Setup(mgr ctrl.Manager, o controller.Options) error { secretbackendkey.Setup, audit.Setup, mount.Setup, - namespace.Setup, policyvault.Setup, token.Setup, + vaultnamespace.Setup, } { if err := setup(mgr, o); err != nil { return err diff --git a/package/crds/vault.vault.upbound.io_namespaces.yaml b/package/crds/vault.vault.upbound.io_vaultnamespaces.yaml similarity index 97% rename from package/crds/vault.vault.upbound.io_namespaces.yaml rename to package/crds/vault.vault.upbound.io_vaultnamespaces.yaml index 890e24bb..0df119ee 100644 --- a/package/crds/vault.vault.upbound.io_namespaces.yaml +++ b/package/crds/vault.vault.upbound.io_vaultnamespaces.yaml @@ -4,7 +4,7 @@ kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.12.1 - name: namespaces.vault.vault.upbound.io + name: vaultnamespaces.vault.vault.upbound.io spec: group: vault.vault.upbound.io names: @@ -12,10 +12,10 @@ spec: - crossplane - managed - vault - kind: Namespace - listKind: NamespaceList - plural: namespaces - singular: namespace + kind: VaultNamespace + listKind: VaultNamespaceList + plural: vaultnamespaces + singular: vaultnamespace scope: Cluster versions: - additionalPrinterColumns: @@ -34,8 +34,8 @@ spec: name: v1alpha1 schema: openAPIV3Schema: - description: Namespace is the Schema for the Namespaces API. Writes namespaces - for Vault + description: VaultNamespace is the Schema for the VaultNamespaces API. Writes + namespaces for Vault properties: apiVersion: description: 'APIVersion defines the versioned schema of this representation @@ -50,7 +50,7 @@ spec: metadata: type: object spec: - description: NamespaceSpec defines the desired state of Namespace + description: VaultNamespaceSpec defines the desired state of VaultNamespace properties: deletionPolicy: default: Delete @@ -333,7 +333,7 @@ spec: || ''Update'' in self.managementPolicies) || has(self.forProvider.path) || has(self.initProvider.path)' status: - description: NamespaceStatus defines the observed state of Namespace. + description: VaultNamespaceStatus defines the observed state of VaultNamespace. properties: atProvider: properties: