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

OCPBUGS-15100: Create valid DNS names for Gateway API on GCP #949

Merged
merged 1 commit into from Jun 26, 2023

Conversation

candita
Copy link
Contributor

@candita candita commented Jun 16, 2023

Before this change, in ensureDNSRecordsForGateway we didn't add a trailing dot to the domain before creating the dnsrecord, causing the DNS name to fail to be published on a GCP platform.

Add a trailing dot if one doesn't exist, add test to check that only one dot is added, and change expectations of other tests to check for a trailing dot in the domain name.

@openshift-ci-robot openshift-ci-robot added jira/severity-critical Referenced Jira bug's severity is critical for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Jun 16, 2023
@openshift-ci-robot
Copy link
Contributor

@candita: This pull request references Jira Issue OCPBUGS-15100, which is invalid:

  • expected the bug to target the "4.14.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

In response to this:

Before this change, in ensureDNSRecordsForGateway we didn't add a trailing dot to the domain before creating the dnsrecord, causing the DNS name to fail to be published on a GCP platform.

Add a trailing dot if one doesn't exist, add test to check that only one dot is added, and change expectations of other tests to check for a trailing dot in the domain name.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@candita
Copy link
Contributor Author

candita commented Jun 16, 2023

/jira refresh

@openshift-ci-robot openshift-ci-robot added jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. and removed jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Jun 16, 2023
@openshift-ci-robot
Copy link
Contributor

@candita: This pull request references Jira Issue OCPBUGS-15100, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.14.0) matches configured target version for branch (4.14.0)
  • bug is in the state New, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @lihongan

In response to this:

/jira refresh

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@candita
Copy link
Contributor Author

candita commented Jun 16, 2023

/test e2e-hypershift

@candita
Copy link
Contributor Author

candita commented Jun 16, 2023

level=error msg=failed to fetch Master Machines: failed to load asset "Install Config": failed to create install config: platform.azure.region: Invalid value: "centralus": region "centralus" is not valid or not available for this account
environment: line 63: ret: unbound variable

/test e2e-azure-operator

Copy link
Contributor

@Miciah Miciah left a comment

Choose a reason for hiding this comment

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

The code change looks good. Can you make sure the commit has a proper commit message?

@@ -222,6 +223,10 @@ func (r *reconciler) ensureDNSRecordsForGateway(ctx context.Context, gateway *ga
var errs []error
for _, domain := range domains {
name := operatorcontroller.GatewayDNSRecordName(gateway, domain)
// If domain doesn't have a trailing dot, add it
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// If domain doesn't have a trailing dot, add it
// If domain doesn't have a trailing dot, add it.

I would have added the trailing dot in desiredDNSRecord, but maybe this makes more sense.

@candita
Copy link
Contributor Author

candita commented Jun 21, 2023

/assign @Miciah
if you dont' mind, since you were already looking?

@Miciah
Copy link
Contributor

Miciah commented Jun 22, 2023

/assign

@candita
Copy link
Contributor Author

candita commented Jun 22, 2023

The code change looks good. Can you make sure the commit has a proper commit message?

Done

@candita
Copy link
Contributor Author

candita commented Jun 22, 2023

/retest-required

@candita
Copy link
Contributor Author

candita commented Jun 22, 2023

OCPBUGS-12479 exists for the azure-ovn test issue:

level=error msg=failed to fetch Master Machines: failed to load asset "Install Config": failed to create install config: platform.azure.region: Invalid value: "centralus": region "centralus" is not valid or not available for this account

@candita
Copy link
Contributor Author

candita commented Jun 23, 2023

{Failed === RUN TestNodePool/NodePool_Tests_Group/TestNodepoolMachineconfigGetsRolledout/EnsureNoCrashingPods
util.go:457: Container hosted-cluster-config-operator in pod hosted-cluster-config-operator-55bdff74b4-dnxtm has a restartCount > 0 (1)
--- FAIL: TestNodePool/NodePool_Tests_Group/TestNodepoolMachineconfigGetsRolledout/EnsureNoCrashingPods (0.08s)
}

/test e2e-hypershift

@candita
Copy link
Contributor Author

candita commented Jun 23, 2023

/test e2e-azure-ovn

@Miciah
Copy link
Contributor

Miciah commented Jun 23, 2023

The code change looks good. Can you make sure the commit has a proper commit message?

Done

I still only see one line in the commit message of the most recent commit that you pushed for this PR:

% git --no-pager show -s 9341a7f19d912ba1a84b6044a222638a682d75f9
commit 9341a7f19d912ba1a84b6044a222638a682d75f9
Author: candita <cholman@redhat.com>
Date:   2023-06-16 14:19:53 -0400

    OCPBUGS-15100: Fix invalid DNS name formatting for GCP
% 

Did you mean to add more? The description of this PR is pretty descriptive, so I figured you would use that as the commit message (with minor reformatting, and with "for Gateway API" in the commit message's body as you have it in the PR's title).

Before this change, in ensureDNSRecordsForGateway we didn't add a trailing dot to the domain
before creating the dnsrecord, causing the DNS name to fail to be published on a GCP platform.

Add a trailing dot if one doesn't exist, add test to check that only one dot is added, and
change expectations of other tests to check for a trailing dot in the domain name.
@candita
Copy link
Contributor Author

candita commented Jun 23, 2023

The code change looks good. Can you make sure the commit has a proper commit message?

Done

I still only see one line in the commit message of the most recent commit that you pushed for this PR:

% git --no-pager show -s 9341a7f19d912ba1a84b6044a222638a682d75f9
commit 9341a7f19d912ba1a84b6044a222638a682d75f9
Author: candita <cholman@redhat.com>
Date:   2023-06-16 14:19:53 -0400

    OCPBUGS-15100: Fix invalid DNS name formatting for GCP
% 

Did you mean to add more? The description of this PR is pretty descriptive, so I figured you would use that as the commit message (with minor reformatting, and with "for Gateway API" in the commit message's body as you have it in the PR's title).

I never add long commit messages like you do. I can start doing it but may need some reminders.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 23, 2023

@candita: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-aws-ovn-single-node b58456a link false /test e2e-aws-ovn-single-node

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@Miciah
Copy link
Contributor

Miciah commented Jun 26, 2023

I never add long commit messages like you do. I can start doing it but may need some reminders.

Thanks! I might go overboard sometimes, so I haven't been insisting on the level of detail that I usually provide, and what you have now is sufficient. However, commit messages (not PR descriptions) are what go into the Git history, which folks rely on to understand the reason and context for a change, for example when fixing a bug or when trying to determine which feature a change was a part of, and so having clear and reasonably detailed commit messages is critical.

For single-commit PRs, GitHub uses the commit message as the initial PR description. I've been assuming that folks have been putting the same information in their commit messages that they put into their PR descriptions, and I often don't look at the individual commits, but I'll start being more careful when reviewing PRs. * grin *.

/approve
/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jun 26, 2023
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 26, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Miciah

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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 26, 2023
@openshift-ci-robot
Copy link
Contributor

/retest-required

Remaining retests: 0 against base HEAD 3c362e2 and 2 for PR HEAD b58456a in total

@openshift-merge-robot openshift-merge-robot merged commit ecb3786 into openshift:master Jun 26, 2023
13 of 14 checks passed
@openshift-ci-robot
Copy link
Contributor

@candita: Jira Issue OCPBUGS-15100: All pull requests linked via external trackers have merged:

Jira Issue OCPBUGS-15100 has been moved to the MODIFIED state.

In response to this:

Before this change, in ensureDNSRecordsForGateway we didn't add a trailing dot to the domain before creating the dnsrecord, causing the DNS name to fail to be published on a GCP platform.

Add a trailing dot if one doesn't exist, add test to check that only one dot is added, and change expectations of other tests to check for a trailing dot in the domain name.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@candita
Copy link
Contributor Author

candita commented Jun 26, 2023

/cherry-pick release-4.13

@openshift-cherrypick-robot

@candita: new pull request created: #953

In response to this:

/cherry-pick release-4.13

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Comment on lines +226 to +229
// If domain doesn't have a trailing dot, add it
if !strings.HasSuffix(domain, ".") {
domain = domain + "."
}
Copy link
Contributor

Choose a reason for hiding this comment

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

You need to account for the trailing dot in deleteStaleDNSRecordsForGateway too, or else it immediately deletes the DNSRecord CR that ensureDNSRecordsForGateway created. Better yet, add the trailing dot in getGatewayHostnames:

diff --git a/pkg/operator/controller/gateway-service-dns/controller.go b/pkg/operator/controller/gateway-service-dns/controller.go
index 1084d65c..919b8d32 100644
--- a/pkg/operator/controller/gateway-service-dns/controller.go
+++ b/pkg/operator/controller/gateway-service-dns/controller.go
@@ -199,7 +199,12 @@ func getGatewayHostnames(gateway *gatewayapiv1beta1.Gateway) sets.String {
 		if listener.Hostname == nil || len(*listener.Hostname) == 0 {
 			continue
 		}
-		domains.Insert(string(*listener.Hostname))
+		domain := string(*listener.Hostname)
+		// If domain doesn't have a trailing dot, add it.
+		if !strings.HasSuffix(domain, ".") {
+			domain = domain + "."
+		}
+		domains.Insert(domain)
 	}
 	return domains
 }
@@ -223,10 +228,6 @@ func (r *reconciler) ensureDNSRecordsForGateway(ctx context.Context, gateway *ga
 	var errs []error
 	for _, domain := range domains {
 		name := operatorcontroller.GatewayDNSRecordName(gateway, domain)
-		// If domain doesn't have a trailing dot, add it
-		if !strings.HasSuffix(domain, ".") {
-			domain = domain + "."
-		}
 		_, _, err := dnsrecord.EnsureDNSRecord(r.client, name, labels, ownerRef, domain, service)
 		errs = append(errs, err)
 	}

This also has the advantage that "foo.com" without a trailing "." and and "foo.com." with a trailing "." will get the same hash.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in #956

@candita candita changed the title OCPBUGS-15100: Create valid DNS names for Gateway API on GCP OCPBUGS-15434: Create valid DNS names for Gateway API on GCP Jun 29, 2023
@openshift-ci-robot
Copy link
Contributor

@candita: Jira Issue OCPBUGS-15434: All pull requests linked via external trackers have merged:

Jira Issue OCPBUGS-15434 has been moved to the MODIFIED state.

In response to this:

Before this change, in ensureDNSRecordsForGateway we didn't add a trailing dot to the domain before creating the dnsrecord, causing the DNS name to fail to be published on a GCP platform.

Add a trailing dot if one doesn't exist, add test to check that only one dot is added, and change expectations of other tests to check for a trailing dot in the domain name.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@candita candita changed the title OCPBUGS-15434: Create valid DNS names for Gateway API on GCP OCPBUGS-15100: Create valid DNS names for Gateway API on GCP Jun 29, 2023
@openshift-ci-robot
Copy link
Contributor

@candita: Jira Issue OCPBUGS-15100 is in an unrecognized state (ON_QA) and will not be moved to the MODIFIED state.

In response to this:

Before this change, in ensureDNSRecordsForGateway we didn't add a trailing dot to the domain before creating the dnsrecord, causing the DNS name to fail to be published on a GCP platform.

Add a trailing dot if one doesn't exist, add test to check that only one dot is added, and change expectations of other tests to check for a trailing dot in the domain name.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/severity-critical Referenced Jira bug's severity is critical for the branch this PR is targeting. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants