Skip to content

[Cloud Bigtable App Profile Beta Migration] Add direct controller #4345

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
May 5, 2025

Conversation

djyau
Copy link
Contributor

@djyau djyau commented Apr 11, 2025

Change description

Fixes #

Tests you have done

  • Run make ready-pr to ensure this PR is ready for review.
  • Perform necessary E2E testing for changed resources.

@djyau djyau force-pushed the controller branch 4 times, most recently from 8facc4b to fb138a6 Compare April 18, 2025 15:08
@djyau djyau force-pushed the controller branch 2 times, most recently from 9e4084f to 34b7ff4 Compare April 22, 2025 20:12
Copy link
Collaborator

@jingyih jingyih left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to test the behavior of the new controller using the existing tests. Let's remove the annotation "cnrm.cloud.google.com/tf2crd=true";"cnrm.cloud.google.com/stability-level=stable" and regenerate the CRD. Then the resource should be reconciled by the new controller.

https://github.com/GoogleCloudPlatform/k8s-config-connector/blob/3bfa3c8c489c280e1d321e6b4f5d5b8c083f21fe/apis/bigtable/v1beta1/appprofile_types.go#L88C113-L88C195

@djyau
Copy link
Contributor Author

djyau commented Apr 23, 2025

We need to test the behavior of the new controller using the existing tests. Let's remove the annotation "cnrm.cloud.google.com/tf2crd=true";"cnrm.cloud.google.com/stability-level=stable" and regenerate the CRD. Then the resource should be reconciled by the new controller.

https://github.com/GoogleCloudPlatform/k8s-config-connector/blob/3bfa3c8c489c280e1d321e6b4f5d5b8c083f21fe/apis/bigtable/v1beta1/appprofile_types.go#L88C113-L88C195

Done - removed the annotations and pushed the resulting generated CRD to the PR

@@ -22,7 +21,6 @@ spec:
- cluster1-${uniqueId}
- cluster2-${uniqueId}
multiClusterRoutingUseAny: true
resourceID: bigtableappprofile-${uniqueId}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maqiuyujoyce For TF-based controller, we are writing "resourceID" back to Spec even though we set "state-into-spec: absent"?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we treat spec.resourceID differently in TF-based/DCL-based controllers, and we always write them back. E.g. https://github.com/GoogleCloudPlatform/k8s-config-connector/blob/master/pkg/krmtotf/tftokrm.go#L229

@jingyih
Copy link
Collaborator

jingyih commented Apr 29, 2025

Can you run "make manifests" to fix the validation error in presubmit?

djyau added 4 commits April 30, 2025 00:01
Remove file to regenerate it

Regenerate controller, make changes to it

Fix Delete and Get

Add Create/Update for existing fields

Dont set Name in Create, since its unused

Make helper function

Tweak comment

Pull latest bigtable goclient version

Make use of updated bigtable goclient API in controller

Clean up controller

Run make ensure

Remove annotations and regenerate CRD

Remove HTTP client options from client creation call
Fix controller update function
…og with GRPC client options

Record real gcp log after cleaning up instances
djyau added 2 commits April 30, 2025 15:19
log: mock gcp with controller logic

Address PR comments

Put name back to golden file

Fix to update mask

Set Name

Make manifests
@@ -309,6 +309,68 @@ OK

GRPC /google.bigtable.admin.v2.BigtableInstanceAdmin/UpdateAppProfile

{
"appProfile": {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why there an extra "UpdateAppProfile" call with this change? The RPC body still contains the old field values. Is this from the mock or the real GCP?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah, that is weird. When I do either "record-gcp" or "compare-mock", neither one removes this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upon closer look, there are 2 updates here for some reason...the first update (line 310) doesn't update the description but does update multiclusterRouting and standardIsolation

Then the second update (line 371) updates the description along with both of those fields that were already updated in the first call.

Copy link
Collaborator

@jingyih jingyih left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/approve

Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jingyih

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-prow google-oss-prow bot merged commit 9033f2e into GoogleCloudPlatform:master May 5, 2025
33 checks passed
jingyih added a commit to jingyih/k8s-config-connector that referenced this pull request May 5, 2025
@jingyih
Copy link
Collaborator

jingyih commented May 5, 2025

For reference, I have also verified that following sample tests passed.

$ GOLDEN_REQUEST_CHECKS=1 GOLDEN_OBJECT_CHECKS=1 E2E_KUBE_TARGET=envtest RUN_E2E=1 E2E_GCP_TARGET=real go test -test.count=1 -timeout 3600s -v ./tests/e2e -run TestAllInSeries/samples/multicluster-bigtable-app-profile

$ GOLDEN_REQUEST_CHECKS=1 GOLDEN_OBJECT_CHECKS=1 E2E_KUBE_TARGET=envtest RUN_E2E=1 E2E_GCP_TARGET=real go test -test.count=1 -timeout 3600s -v ./tests/e2e -run TestAllInSeries/samples/single-cluster-bigtable-app-profile

$ GOLDEN_REQUEST_CHECKS=1 GOLDEN_OBJECT_CHECKS=1 E2E_KUBE_TARGET=envtest RUN_E2E=1 E2E_GCP_TARGET=real go test -test.count=1 -timeout 3600s -v ./tests/e2e -run TestAllInSeries/samples/priority-bigtable-app-profile

jingyih added a commit to jingyih/k8s-config-connector that referenced this pull request May 6, 2025
google-oss-prow bot added a commit that referenced this pull request May 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants