Skip to content

Commit

Permalink
Upgraded kms api to v1.20
Browse files Browse the repository at this point in the history
1. updated controller to return false iff get return 404
2. updated mappers
  • Loading branch information
nb-goog committed Oct 11, 2024
1 parent 17e87ec commit 1d5401c
Show file tree
Hide file tree
Showing 17 changed files with 349 additions and 346 deletions.
20 changes: 12 additions & 8 deletions apis/kms/v1alpha1/kmsautokeyconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ package v1alpha1

import (
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/apis/k8s/v1alpha1"
folderref "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/direct/kms/folderref"

//folderref "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/direct/kms/folderref"
refs "github.com/GoogleCloudPlatform/k8s-config-connector/apis/refs/v1beta1"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand All @@ -36,14 +37,14 @@ type KMSAutokeyConfigSpec struct {
// + optional
ResourceID *string `json:"resourceID,omitempty"`

FolderRef *folderref.FolderRef `json:"folderRef"`
// Immutable. The folder that this resource belongs to.
FolderRef *refs.FolderRef `json:"folderRef"`

// +optional
KeyProject *refs.ProjectRef `json:"projectRef,omitempty"`
KeyProject *refs.ProjectRef `json:"keyProject,omitempty"`

// +optional
State *string `json:"state,omitempty"`

State *string `json:"state,omitempty"`
}

// KMSAutokeyConfigStatus defines the config connector machine state of KMSAutokeyConfig
Expand All @@ -54,8 +55,9 @@ type KMSAutokeyConfigStatus struct {

// ObservedGeneration is the generation of the resource that was most recently observed by the Config Connector controller. If this is equal to metadata.generation, then that means that the current reported status reflects the most recent desired state of the resource.
ObservedGeneration *int64 `json:"observedGeneration,omitempty"`
PrjectRef *refs.ProjectRef `json:"projectRef,omitempty"`
State *string `json:"state,omitempty"`
//KeyProject *refs.ProjectRef `json:"projectRef,omitempty"`
//State *string `json:"state,omitempty"`

// A unique specifier for the KMSAutokeyConfig resource in GCP.
ExternalRef *string `json:"externalRef,omitempty"`

Expand All @@ -66,7 +68,9 @@ type KMSAutokeyConfigStatus struct {
// KMSAutokeyConfigSpec defines the desired state of KMSAutokeyConfig
// +kcc:proto=google.cloud.kms.v1.AutokeyConfig
type KMSAutokeyConfigObservedState struct {

// Output only. Current state of this AutokeyConfig.
// +optional
State *string `json:"state,omitempty"`
}

// +genclient
Expand Down
6 changes: 5 additions & 1 deletion apis/kms/v1alpha1/types.generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 37 additions & 2 deletions apis/kms/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,84 @@ spec:
spec:
description: KMSAutokeyConfigSpec defines the desired state of KMSAutokeyConfig
properties:
folderRef:
description: Immutable. The folder that this resource belongs to.
oneOf:
- not:
required:
- external
required:
- name
- not:
anyOf:
- required:
- name
- required:
- namespace
required:
- external
properties:
external:
description: The 'name' field of a folder, when not managed by
Config Connector. This field must be set when 'name' field is
not set.
type: string
name:
description: The 'name' field of a 'Folder' resource. This field
must be set when 'external' field is not set.
type: string
namespace:
description: The 'namespace' field of a 'Folder' resource. If
unset, the namespace is defaulted to the namespace of the referencer
resource.
type: string
type: object
keyProject:
description: The Project that this resource belongs to.
oneOf:
- not:
required:
- external
required:
- name
- kind
- not:
anyOf:
- required:
- name
- required:
- namespace
- required:
- kind
required:
- external
properties:
external:
description: The `projectID` field of a project, when not managed
by Config Connector.
type: string
kind:
description: The kind of the Project resource; optional but must
be `Project` if provided.
type: string
name:
description: The `name` field of a `Project` resource.
type: string
namespace:
description: The `namespace` field of a `Project` resource.
type: string
type: object
resourceID:
description: Immutable. The KMSAutokeyConfig name. If not given, the
metadata.name will be used.
type: string
x-kubernetes-validations:
- message: ResourceID field is immutable
rule: self == oldSelf
state:
type: string
required:
- folderRef
type: object
status:
description: KMSAutokeyConfigStatus defines the config connector machine
Expand Down Expand Up @@ -109,6 +180,10 @@ spec:
observedState:
description: ObservedState is the state of the resource as most recently
observed in GCP.
properties:
state:
description: Output only. Current state of this AutokeyConfig.
type: string
type: object
type: object
type: object
Expand Down
23 changes: 12 additions & 11 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require (
cloud.google.com/go/dataflow v0.10.0
cloud.google.com/go/dataform v0.10.0
cloud.google.com/go/firestore v1.16.0
cloud.google.com/go/iam v1.2.0
cloud.google.com/go/iam v1.2.1
cloud.google.com/go/monitoring v1.21.0
cloud.google.com/go/privilegedaccessmanager v0.2.1
cloud.google.com/go/profiler v0.4.1
Expand Down Expand Up @@ -60,14 +60,14 @@ require (
github.com/zclconf/go-cty v1.13.0
go.opencensus.io v0.24.0
go.uber.org/zap v1.26.0
golang.org/x/oauth2 v0.22.0
golang.org/x/oauth2 v0.23.0
golang.org/x/sync v0.8.0
golang.org/x/time v0.6.0
google.golang.org/api v0.196.0
google.golang.org/api v0.197.0
google.golang.org/genproto v0.0.0-20240903143218-8af14fe29dc1
google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1
google.golang.org/grpc v1.66.0
google.golang.org/grpc v1.66.2
google.golang.org/protobuf v1.34.2
gopkg.in/dnaeon/go-vcr.v3 v3.2.0
gopkg.in/yaml.v2 v2.4.0
Expand All @@ -92,7 +92,8 @@ require (
cloud.google.com/go/auth/oauth2adapt v0.2.4 // indirect
cloud.google.com/go/bigtable v1.31.0 // indirect
cloud.google.com/go/compute/metadata v0.5.0 // indirect
cloud.google.com/go/longrunning v0.6.0 // indirect
cloud.google.com/go/kms v1.20.0 // indirect
cloud.google.com/go/longrunning v0.6.1 // indirect
dario.cat/mergo v1.0.0 // indirect
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
github.com/MakeNowJust/heredoc v1.0.0 // indirect
Expand Down Expand Up @@ -146,7 +147,7 @@ require (
github.com/google/pprof v0.0.0-20240528025155-186aa0362fba // indirect
github.com/google/s2a-go v0.1.8 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.3 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.4 // indirect
github.com/gosimple/unidecode v1.0.1 // indirect
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect
Expand Down Expand Up @@ -226,13 +227,13 @@ require (
go.opentelemetry.io/otel/trace v1.29.0 // indirect
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect
go.uber.org/multierr v1.10.0 // indirect
golang.org/x/crypto v0.26.0 // indirect
golang.org/x/crypto v0.27.0 // indirect
golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect
golang.org/x/mod v0.18.0 // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/sys v0.24.0 // indirect
golang.org/x/term v0.23.0 // indirect
golang.org/x/text v0.17.0 // indirect
golang.org/x/net v0.29.0 // indirect
golang.org/x/sys v0.25.0 // indirect
golang.org/x/term v0.24.0 // indirect
golang.org/x/text v0.18.0 // indirect
golang.org/x/tools v0.22.0 // indirect
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
gomodules.xyz/jsonpatch/v2 v2.3.0 // indirect
Expand Down
13 changes: 13 additions & 0 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1d5401c

Please sign in to comment.