Skip to content
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

tests: csau test #3286

Merged
merged 2 commits into from
Dec 16, 2024
Merged

Conversation

ziyue-101
Copy link
Collaborator

@ziyue-101 ziyue-101 commented Dec 3, 2024

Change description

Remove version filed if auto-upgrade is turned on.

Tests you have done

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

@ziyue-101
Copy link
Collaborator Author

/assign @acpana

@acpana acpana changed the title remove version field that doesn't work together with auto-upgrade tests: csau test Dec 6, 2024
@acpana
Copy link
Collaborator

acpana commented Dec 6, 2024

/lgtm
/approve

thanks for splitting the tests!

cc @maqiuyujoyce

@google-oss-prow google-oss-prow bot added the lgtm label Dec 6, 2024
syncWaitSecs: "20"
syncRev: "HEAD"
secretType: "none"
version: "1.18.1"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you make the test case be updating from one management mode (e.g. automatic) to another management mode (e.g. manual)? We want to test the update of this field as well.

@maqiuyujoyce
Copy link
Collaborator

I suggest we don't update from using version to using management (yet) due to this test gap.

@yuwenma
Copy link
Collaborator

yuwenma commented Dec 11, 2024

For the management and version, suggest making sure the direct controller can do the following (we'd like to see this is reflected in the test suites)

  1. If using CSAU, the GCP service returned version is recorded in status.observedState.version (or status.version if it already exists)
  2. If using CSAU, and passing in the version in the HTTP request, does GCP service give errors? Or no-op? or take into account the version as well?
  • if it is error. the current KCC API is good. users know how to fix their config if given both management AUTOMATIC and version.
  • If it is a no-op, the direct controller should add additional logic that if management= AUTOMATIC, unset version before sending the HTTP request.
  • If GCP service take into account the version, KCC can treat it as a no-op.

@maqiuyujoyce
Copy link
Collaborator

If using CSAU, the GCP service returned version is recorded in status.observedState.version (or status.version if it already exists)

Good point.

If using CSAU, and passing in the version in the HTTP request, does GCP service give errors? Or no-op? or take into account the version as well?

Note that KCC pass in the version in the HTTP request because version is also specified in the KRM object. Check #3344 (comment) for more details. So basically this means user specified both management and version.

If it is a no-op, the direct controller should add additional logic that if management= AUTOMATIC, unset version before sending the HTTP request.

If no-op, then it means the live state is considered SoT and the desired intention is ignored. We should find the diff in between the desired state and live state and return an error accordingly if there is a diff.

@yuwenma
Copy link
Collaborator

yuwenma commented Dec 12, 2024

Note that KCC pass in the version in the HTTP request because version is also specified in the KRM object. Check #3344 (comment) for more details. So basically this means user specified both management and version.

Right. Passing in both version and management could be okay, it defers to how the GKEHub service responses. For the 3 possible results I gave, KCC only need additional logic if GKEHub service allows both values and ignore the version.

@ziyue-101
Copy link
Collaborator Author

ziyue-101 commented Dec 12, 2024

Answer: the GCP server returns an error if both version and csau is specified in the spec.

  1. If using CSAU, and passing in the version in the HTTP request, does GCP service give errors? Or no-op? or take into account the version as well?
  • if it is error. the current KCC API is good. users know how to fix their config if given both management AUTOMATIC and version.
  • If it is a no-op, the direct controller should add additional logic that if management= AUTOMATIC, unset version before sending the HTTP request.
  • If GCP service take into account the version, KCC can treat it as a no-op.

@ziyue-101
Copy link
Collaborator Author

I suggest we don't update from using version to using management (yet) due to this test gap.

Thanks for the digging. I don't think this PR should be blocked on the test gap. I can remove the version field in the created.yaml

@ziyue-101
Copy link
Collaborator Author

ziyue-101 commented Dec 12, 2024

@maqiuyujoyce the gap is in test, I wonder what's the behavior for base controller when doing update, does it patch or update? Does he base controller have the same gap?

@ziyue-101
Copy link
Collaborator Author

ziyue-101 commented Dec 12, 2024

Answer

If using CSAU, the GCP service returned version is recorded in status.observedState.version (or status.version if it already exists)

If this is desired, this means the status.version field should be optional because it should only be populated when csau is disabled. This PR only adds test cases, I think we can address the status.version in followups.

Copy link
Collaborator

@maqiuyujoyce maqiuyujoyce 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

/hold
Do you have any other concerns, @yuwenma ?

Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: acpana, maqiuyujoyce

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

@yuwenma
Copy link
Collaborator

yuwenma commented Dec 16, 2024

Answer

If using CSAU, the GCP service returned version is recorded in status.observedState.version (or status.version if it already exists)

If this is desired, this means the status.version field should be optional because it should only be populated when csau is enabled. This PR only adds test cases, I think we can address the status.version in followups.

Do you infer the version is required now and not in status? If so, yes it should be changed from required to optional (this is common when the GCP service adds automatic support for some previously configurable only fields).

@yuwenma
Copy link
Collaborator

yuwenma commented Dec 16, 2024

/hold cancel

Looks good on my side.
Thanks! @ziyue-101

@google-oss-prow google-oss-prow bot merged commit 4901040 into GoogleCloudPlatform:master Dec 16, 2024
17 checks passed
@ziyue-101
Copy link
Collaborator Author

ziyue-101 commented Dec 16, 2024

Answer

If using CSAU, the GCP service returned version is recorded in status.observedState.version (or status.version if it already exists)

If this is desired, this means the status.version field should be optional because it should only be populated when csau is enabled. This PR only adds test cases, I think we can address the status.version in followups.

Do you infer the version is required now and not in status? If so, yes it should be changed from required to optional (this is common when the GCP service adds automatic support for some previously configurable only fields).

My bad, I corrected my previous statement. The version field is prohibited when management field is set as automatic, it is optional If management field is set with other values. The GCP sever has validation logic to deny any request with version field and csau field set together. I think we should delegate the validation to the GCP server and don't emulate GCP server behavior in the direct controller because that could change over time.

@yuwenma
Copy link
Collaborator

yuwenma commented Dec 16, 2024

Answer

If using CSAU, the GCP service returned version is recorded in status.observedState.version (or status.version if it already exists)

If this is desired, this means the status.version field should be optional because it should only be populated when csau is enabled. This PR only adds test cases, I think we can address the status.version in followups.

Do you infer the version is required now and not in status? If so, yes it should be changed from required to optional (this is common when the GCP service adds automatic support for some previously configurable only fields).

My bad, I corrected my previous statement. The version field is prohibited when management field is set as automatic, it is optional If management field is set with other values. The GCP sever has validation logic to deny any request with version field and csau field set together. I think we should delegate the validation to the GCP server and don't emulate GCP server behavior in the direct controller because that could change over time.

Right, that's option 3 I mentioned. If If GCP service take into account the version, KCC can treat it as a no-op, and let users take actions according to the GCP error
Can you add a scenario test to record the real GCP behavior? Step 1. version configured Step 2 version and managed (auto) configured 3. version unset and only managed(auto) configured.

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.

4 participants