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

Fix value template for global ComputeTargetHTTPSProxy #2056

Merged

Conversation

gemmahou
Copy link
Collaborator

@gemmahou gemmahou commented Jun 18, 2024

Change description

Fixes b/345274481

Fix value template for global ComputeTargetHTTPSProxy.
Resource created successfully:

Events:
  Type     Reason              Age              From                                Message
  ----     ------              ----             ----                                -------
  Warning  DependencyNotFound  49s              computetargethttpsproxy-controller  reference ComputeURLMap default/computetargethttpsproxy-dep-certmgr is not found
  Normal   Updating            16s              computetargethttpsproxy-controller  Update in progress
  Normal   UpToDate            4s (x2 over 5s)  computetargethttpsproxy-controller  The resource is up to date

Tests you have done

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

@gemmahou gemmahou added this to the 1.120 milestone Jun 20, 2024
@justinsb
Copy link
Collaborator

Looks good; is this covered by a test?

@maqiuyujoyce
Copy link
Collaborator

/lgtm

Agreed with @justinsb that we should add a test case for it.

@google-oss-prow google-oss-prow bot added lgtm and removed lgtm labels Jun 22, 2024
@gemmahou
Copy link
Collaborator Author

Added dynamic test to cover certificateMapRef field

--- PASS: TestCreateNoChangeUpdateDelete (0.12s)
    --- PASS: TestCreateNoChangeUpdateDelete/compute (0.00s)
        --- PASS: TestCreateNoChangeUpdateDelete/compute/basic-globaltargethttpsproxy (301.47s)
PASS
{"severity":"info","timestamp":"2024-06-24T18:48:56.177Z","msg":"Stopping and waiting for non leader election runnables"}
{"severity":"info","timestamp":"2024-06-24T18:48:56.177Z","msg":"Stopping and waiting for leader election runnables"}
{"severity":"info","timestamp":"2024-06-24T18:48:56.177Z","msg":"Stopping and waiting for caches"}
{"severity":"info","timestamp":"2024-06-24T18:48:56.177Z","msg":"Stopping and waiting for webhooks"}
{"severity":"info","timestamp":"2024-06-24T18:48:56.177Z","logger":"controller-runtime.webhook","msg":"Shutting down webhook server with timeout of 1 minute"}
{"severity":"info","timestamp":"2024-06-24T18:48:56.177Z","msg":"Wait completed, proceeding to shutdown the manager"}
ok      github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/dynamic      311.376s

@@ -20,6 +20,8 @@ spec:
description: "test description"
urlMapRef:
name: computeurlmap-${uniqueId}
certificateMapRef:
Copy link
Collaborator

Choose a reason for hiding this comment

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

According to the field description:

URLs to certificate manager certificate resources that are used to authenticate connections between users and the load balancer.

sslCertificates and certificateManagerCertificates fields can not be defined together.

And according to the latest TF doc: https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_target_https_proxy#certificate_manager_certificates

Certificate manager certificates only apply when the load balancing scheme is set to INTERNAL_MANAGED. For EXTERNAL and EXTERNAL_MANAGED, use certificate_map instead.

Feels like certificateManagerCertificates and certificateMap are mutually exclusive fields, and certificateManagerCertificates/ certificateMap and sslCertificates are mutually exclusive fields as well. I.e. only one out of the three fields can be configured.

Could you verify that certificate map is indeed configured correctly in the underlying GCP resource when ssl certificates are configured?

Once the behavior is confirmed, could you update the field descriptions of those fields to reflect the correct usage of these fields?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The default value for load balancing schemes is EXTERNAL, so I'm able to created a target https proxy with certificateMap: https://screenshot.googleplex.com/7Lm35rNZ6hkmXMZ.png

However, certificateManagerCertificates/certificateMap and sslCertificates are mutually exclusive fields and I noticed that sslCertificates is discarded when both are set. I updated the test and field description.

@yuwenma
Copy link
Collaborator

yuwenma commented Jun 24, 2024

/lgtm

Defer to @maqiuyujoyce comment on verifying the field and updating the doc.

@google-oss-prow google-oss-prow bot added the lgtm label Jun 24, 2024
@gemmahou gemmahou force-pushed the computetargethttpsproxy branch from 8d78e49 to f5b79aa Compare June 25, 2024 00:03
@google-oss-prow google-oss-prow bot removed the lgtm label Jun 25, 2024
@yuwenma
Copy link
Collaborator

yuwenma commented Jun 25, 2024

/lgtm
/approve

Thank you for the change, looks good on my side

/hold In case @maqiuyujoyce want to take another pass. Feel free to unhold

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.

Looks like there are fixes for three fields. Wondering if you can add test cases for the other two fixes.

config/servicemappings/compute.yaml Outdated Show resolved Hide resolved
config/servicemappings/compute.yaml Show resolved Hide resolved
@@ -2496,7 +2499,7 @@ spec:
kind: NetworkSecurityServerTLSPolicy
version: v1beta1
group: networksecurity.cnrm.cloud.google.com
valueTemplate: "projects/{{project}}/locations/{{location}}/serverTlsPolicies/{{value}}"
valueTemplate: "projects/{{project}}/locations/global/serverTlsPolicies/{{value}}"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Similarly, is there a test case covering this fix?

Copy link
Collaborator Author

@gemmahou gemmahou Jun 25, 2024

Choose a reason for hiding this comment

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

I noticed another issue with serverTlsPolicyRef. There's error when resolving project: "error": "Update call failed: error fetching live state: error converting resource config: unable to resolve missing value: project", and I already specified projectRef in the yaml for NetworkSecurityServerTLSPolicy resource.

This field is introduced in #941, and this is a DCL based reference field. I don't think it's necessary to address it here, so I reverted my change back and created a ticket(b/349429138) for this. Lmk if that sounds reasonable.

@gemmahou gemmahou force-pushed the computetargethttpsproxy branch from f5b79aa to 1ef07ff Compare June 25, 2024 19:55
@google-oss-prow google-oss-prow bot removed the lgtm label Jun 25, 2024
@gemmahou gemmahou force-pushed the computetargethttpsproxy branch 3 times, most recently from 2b8f137 to 5b88363 Compare June 25, 2024 20:13
@gemmahou gemmahou force-pushed the computetargethttpsproxy branch from 5b88363 to 752722a Compare June 25, 2024 20:36
@maqiuyujoyce
Copy link
Collaborator

/lgtm
/approve

@google-oss-prow google-oss-prow bot added the lgtm label Jun 26, 2024
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

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

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:
  • OWNERS [maqiuyujoyce,yuwenma]

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 Jun 26, 2024

/hold cancel

@google-oss-prow google-oss-prow bot merged commit 68f10db into GoogleCloudPlatform:master Jun 26, 2024
13 checks passed
@gemmahou gemmahou deleted the computetargethttpsproxy branch June 26, 2024 18:31
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