Skip to content

Commit

Permalink
Merge pull request #1059 from maqiuyujoyce/202312-observed-state-in-crds
Browse files Browse the repository at this point in the history
Support the partial observed state in ContainerCluster, ContainerNodePool and RedisInstance
  • Loading branch information
google-oss-prow[bot] authored Dec 19, 2023
2 parents 05c47a6 + af2d237 commit 761f1d8
Show file tree
Hide file tree
Showing 17 changed files with 352 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1808,6 +1808,24 @@ spec:
current reported status reflects the most recent desired state of
the resource.
type: integer
observedState:
description: The observed state of the underlying GCP resource.
properties:
masterAuth:
description: DEPRECATED. Basic authentication was removed for
GKE cluster versions >= 1.19. The authentication information
for accessing the Kubernetes master. Some values in this block
are only returned by the API if your service account has permission
to get credentials for your GKE cluster. If you see an unexpected
diff unsetting your client cert, ensure you have the container.clusters.getCredentials
permission.
properties:
clientCertificate:
description: Base64 encoded public certificate used by clients
to authenticate to the cluster endpoint.
type: string
type: object
type: object
operation:
type: string
selfLink:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,12 @@ spec:
current reported status reflects the most recent desired state of
the resource.
type: integer
observedState:
description: The observed state of the underlying GCP resource.
properties:
version:
type: string
type: object
operation:
type: string
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,14 @@ spec:
current reported status reflects the most recent desired state of
the resource.
type: integer
observedState:
description: The observed state of the underlying GCP resource.
properties:
authString:
description: Output only. AUTH String set on the instance. This
field will only be populated if auth_enabled is true.
type: string
type: object
persistenceIamIdentity:
description: |-
Output only. Cloud IAM identity used by import / export operations
Expand Down
4 changes: 4 additions & 0 deletions config/servicemappings/container.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ spec:
- remove_default_node_pool
mutableButUnreadableFields:
- min_master_version
observedFields:
- master_auth.client_certificate
containers:
- type: project
tfField: project
Expand Down Expand Up @@ -128,6 +130,8 @@ spec:
name: name
resourceID:
targetField: name
observedFields:
- version
resourceReferences:
- key: clusterRef
tfField: cluster
Expand Down
2 changes: 2 additions & 0 deletions config/servicemappings/redis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ spec:
labels: labels
resourceID:
targetField: name
observedFields:
- auth_string
resourceReferences:
- tfField: authorized_network
description: |-
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ require (
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/mod v0.9.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/term v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/tools v0.7.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum

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

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

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

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

10 changes: 10 additions & 0 deletions pkg/clients/generated/apis/redis/v1beta1/redisinstance_types.go

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

26 changes: 26 additions & 0 deletions pkg/clients/generated/apis/redis/v1beta1/zz_generated.deepcopy.go

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

4 changes: 3 additions & 1 deletion pkg/krmtotf/tftokrm.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,9 @@ func addFieldIfExists(path []string, tfSchemas map[string]*tfschema.Schema, sour
}
result := make(map[string]interface{})
addFieldIfExists(path[1:], subSchema, fieldStateMap, result)
parent[field] = result
if len(result) > 0 {
parent[field] = result
}
return
default:
// TODO(b/312581557): Handle array types.
Expand Down
Loading

0 comments on commit 761f1d8

Please sign in to comment.