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

CFE-849: Add new DNSNameResolver CRD #1524

Merged
merged 21 commits into from
Oct 17, 2023

Conversation

arkadeepsen
Copy link
Contributor

Added the new CRD as per the enhancement proposal openshift/enhancements#1335

@openshift-ci-robot
Copy link

openshift-ci-robot commented Jul 12, 2023

@arkadeepsen: This pull request references CFE-849 which is a valid jira issue.

In response to this:

Added the new CRD as per the enhancement proposal openshift/enhancements#1335

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.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jul 12, 2023
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 12, 2023

Hello @arkadeepsen! Some important instructions when contributing to openshift/api:
API design plays an important part in the user experience of OpenShift and as such API PRs are subject to a high level of scrutiny to ensure they follow our best practices. If you haven't already done so, please review the OpenShift API Conventions and ensure that your proposed changes are compliant. Following these conventions will help expedite the api review process for your PR.

@openshift-ci openshift-ci bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 12, 2023
@openshift-ci openshift-ci bot requested review from deads2k and knobunc July 12, 2023 15:48
@arkadeepsen arkadeepsen force-pushed the egressfirewalldnsname branch 2 times, most recently from 83838c3 to 2d7a3cb Compare July 13, 2023 06:00
@arkadeepsen
Copy link
Contributor Author

@JoelSpeed PTAL

Name: FeatureGateEgressFirewallDNSName,
},
OwningJiraComponent: "dns",
ResponsiblePerson: "miciah",
Copy link
Contributor

Choose a reason for hiding this comment

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

@Miciah Just checking you're cool with being the owner listed on 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.

I had initially added @Miciah's name as the apigroup was chosen as dns.openshift.io. Though. as of now it is decided to go with network.openshift.io as the apigroup.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, this is fine.

Copy link
Contributor

Choose a reason for hiding this comment

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

I would slim this down to just the ones that you need, so that would just end up being

schemapatch:
  requiredFeatureSets:
  - ""
  - "Default"
  - "TechPreviewNoUpgrade"
  - "CustomNoUpgrade"

Copy link
Contributor

Choose a reason for hiding this comment

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

You should have a CustomNoUpgrade version of this CRD as well else you risk breaking CustomNoUpgrade use cases

kind: CustomResourceDefinition
metadata:
annotations:
api-approved.openshift.io: https://github.com/openshift/api/pull/xxx
Copy link
Contributor

Choose a reason for hiding this comment

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

1524 needs to be subbed in here

// +k8s:defaulter-gen=TypeMeta
// +k8s:openapi-gen=true

// +groupName=dns.openshift.io
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you remind me, what group is the EgressFirewall in? Was the group name discussed on the enhancement somewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was decided in a meeting with @Miciah , @danwinship and @npinaeva that the group will be network.openshift.io and the name of the CRD will be DNSNameResolver. I will post the changes. openshift/enhancements#1335 (comment)

// dnsName is the resolved DNS name matching the name field of EgressFirewallDNSNameSpec.
// +kubebuilder:validation:Pattern=^(\*\.)?([A-Za-z0-9-]+\.)*[A-Za-z0-9-]+\.$
DNSName string `json:"dnsName"`
// The IP addresses associated with the DNS name used in a EgressFirewall rule.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should start with the name of the field and explain what it is

// The IP addresses associated with the DNS name used in a EgressFirewall rule.
// +listType=set
IPs []string `json:"ips"`
// Minimum time-to-live value among all the IP addresses.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should start with the name of the field

// +listType=set
IPs []string `json:"ips"`
// Minimum time-to-live value among all the IP addresses.
TTL int64 `json:"ttl"`
Copy link
Contributor

Choose a reason for hiding this comment

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

I currently have no idea what unit this is, any reason not to use a duration string?

// Minimum time-to-live value among all the IP addresses.
TTL int64 `json:"ttl"`
// Timestamp when the last DNS lookup was successfully completed.
LastLookupTime metav1.Time `json:"lastLookupTime"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this required? Will need to be a pointer as the json marshal for the zero value is not what you want, ever

Comment on lines 59 to 60
// retryCounter keeps the count of how many times the DNS lookup failed for the dnsName field.
RetryCounter int `json:"retryCounter"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe resolutionFailures? Retry counter to me suggests it might be hard to comprehend, what does it mean when zero? When would it increment to 1?

Need to expand the godoc here as well, to explain what this is counting and what happens if it reaches a certain threshold

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will add the details

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 14, 2023
@openshift-ci openshift-ci bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 14, 2023
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 14, 2023
@arkadeepsen
Copy link
Contributor Author

/retitle Add new DNSNameResolver CRD

@openshift-ci openshift-ci bot changed the title CFE-849: Added new EgressFirewallDNSName CRD Add new DNSNameResolver CRD Jul 14, 2023
@openshift-ci-robot
Copy link

@arkadeepsen: No Jira issue is referenced in the title of this pull request.
To reference a jira issue, add 'XYZ-NNN:' to the title of this pull request and request another refresh with /jira refresh.

In response to this:

Added the new CRD as per the enhancement proposal openshift/enhancements#1335

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.

@openshift-ci-robot openshift-ci-robot removed the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jul 14, 2023
@arkadeepsen
Copy link
Contributor Author

arkadeepsen commented Jul 14, 2023

/retitle CFE-849: Add new DNSNameResolver CRD

@openshift-ci openshift-ci bot changed the title Add new DNSNameResolver CRD CFE-849: Add new DNSNameResolver CRD Jul 14, 2023
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jul 14, 2023
@openshift-ci-robot
Copy link

openshift-ci-robot commented Jul 14, 2023

@arkadeepsen: This pull request references CFE-849 which is a valid jira issue.

In response to this:

Added the new CRD as per the enhancement proposal openshift/enhancements#1335

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.

@arkadeepsen
Copy link
Contributor Author

@JoelSpeed I have incorporated your suggestions. I have also changed the name of the CRD to DNSNameResolver and the group to network.openshift.io. PTAL.

// resolvedNames contains a list of matching DNS names and their corresponding IP addresses
// along with TTL and last DNS lookup time.
// +optional
ResolvedNames []DNSNameResolverStatusItem `json:"resolvedNames,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

if we decide to patch status, we may need more options for this field like listType and patchStrategy?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added

… name. Fix wordings of tests and godoc. Add space before godoc of each field.
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Sep 26, 2023
…ensure each label is a maximum of 63 characters. Update godoc for conditions to add details about Degraded condition.

type DNSNameResolverResolvedAddress struct {
// ip is an IP address associated with the dnsName. The validity of the IP address expires after
// lastLookupTime + ttlSeconds. To refresh the information a DNS lookup will be performed on the
Copy link
Contributor

@candita candita Sep 27, 2023

Choose a reason for hiding this comment

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

nit:

Suggested change
// lastLookupTime + ttlSeconds. To refresh the information a DNS lookup will be performed on the
// lastLookupTime + ttlSeconds. To refresh the information, a DNS lookup will be performed upon the

// ip is an IP address associated with the dnsName. The validity of the IP address expires after
// lastLookupTime + ttlSeconds. To refresh the information a DNS lookup will be performed on the
// expiration of the IP address's validity. If the information is not refreshed then it will be
// removed with a grace period after the expiration of the IP address's validity.
Copy link
Contributor

@candita candita Sep 27, 2023

Choose a reason for hiding this comment

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

Can you add the duration of the grace period? Even if we aren't sure yet how long that is, you can state that it may change in the future.

Suggested change
// removed with a grace period after the expiration of the IP address's validity.
// removed after observing a grace period of __ seconds, and after the expiration of the IP address's validity.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was discussed previously, with @npinaeva and @JoelSpeed. We had decided to remove the specifics about the grace period from here: #1524 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

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

@arkadeepsen - if you can get this into the docs without putting it into the godocs, that's fine. Seems like an extra amount of work to both provide docs through the godocs, and also write something up separately.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The information about the grace period will be added in the TP docs for the feature.

}

// DNSName is used for validation of a DNS name.
// +kubebuilder:validation:Pattern=`^(\*\.)?([a-z0-9]([-a-z0-9]{0,61}[a-z0-9])?\.){2,}$`
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm wondering if we could break down this validation at all into CEL and then use that to enforce the different rules and apply better error messages. Will have a think about 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.

@JoelSpeed The dnsName field is used inside the resolvedNames field. We will probably hit the cost exceeds budget issue with CEL validations that we faced while trying to add the same for the ip field: #1524 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm also a little worried that this might cause issues for DNS names that are accepted by the library-go validation for Route but not accepted here. In a Route, we had to allow for a one-label host name: https://github.com/openshift/library-go/blob/master/pkg/route/routeapihelpers/routeapihelpers.go#L63

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This should not be a problem, as while creating the CR the OVN-K master will correctly convert a DNS name into this format. Even the EgressFirewall DNS name accepts DNS names without trailing periods, however while creating the corresponding DNSNameResolver CR, OVN-K master will add the trailing period. The more strict regex is added as we want to eliminate the chances of creating more than one CR for the same DNS name.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ahh yes, we can't do this because resolvedAddresses is an unbounded list. I don't think given previous conversation that we can bound resolvedAddresses, so nothing to do here

@candita
Copy link
Contributor

candita commented Oct 6, 2023

A few remaining comments that @JoelSpeed can decide, but otherwise:
/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Oct 6, 2023
@openshift-ci-robot
Copy link

openshift-ci-robot commented Oct 6, 2023

@arkadeepsen: This pull request references CFE-849 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.15.0" version, but no target version was set.

In response to this:

Added the new CRD as per the enhancement proposal openshift/enhancements#1335

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.

@arkadeepsen
Copy link
Contributor Author

@JoelSpeed PLMK if I need to change anything in the PR. If not, it would be great if you can approve the PR.

@JoelSpeed
Copy link
Contributor

/lgtm

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

/retest-required

@openshift-ci-robot
Copy link

/retest-required

Remaining retests: 0 against base HEAD 096c446 and 2 for PR HEAD cff650a in total

@arkadeepsen
Copy link
Contributor Author

/retest-required

@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Oct 17, 2023
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Oct 17, 2023

@arkadeepsen: all tests passed!

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.

@JoelSpeed
Copy link
Contributor

/lgtm

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

openshift-ci bot commented Oct 17, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: arkadeepsen, candita, JoelSpeed, rfredette

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

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/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants