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

ingress: Add transition-ingress-from-beta-to-stable enhancement #697

Conversation

Miciah
Copy link
Contributor

@Miciah Miciah commented Mar 17, 2021

This enhancement updates the ingress-to-route controller to use the stable networking.k8s.io/v1 version of the Ingress API. Although the API server already supports the v1 API version without this enhancement, the ingress-to-route controller requires changes to transition from using the v1beta1 client to using the v1 client and to support new v1 features. These new features include the spec.pathType and spec.ingressClassType fields as well as the associated IngressClass API. This enhancement does not extend the Route API to accommodate new features in the Ingress API; these are only supported to the extent that they are compatible with the Route API.


Implementation PRs:

Mitigations for the purpose of these alerts):

* An alert for Routes that were created from Ingresses that OpenShift is no longer managing.
* An alert for Ingresses older than 1 day that do not specify `spec.ingressClassName`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Would the IngressClass controller publish a metric detailing how many Ingresses older than 1 day that do not specify spec.ingressClassName exist in the cluster? Im wondering if maybe it would make more sense to report how many Ingresses exist without spec.ingressClassName via a metric, and write the alerting rule to fire after the new metric returns a non-zero value for 24 hours.

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 don't know what the use case for leaving spec.ingressClassName is, but I'm assuming one exists, or else the field would be required for new ingresses. My thinking was that the use case probably involved a developer creating an incomplete ingress and then updating it to make it complete, in which case a high-tenancy cluster with a lot of churn could continuously have some incomplete ingress at any point in time over a 1-day period, so it makes more sense to alert when a specific ingress has been incomplete for >1 day. This thinking could be entirely wrong though, and I don't really know why spec.ingressClassName is optional.

OpenShift no longer manages. This metric is used in one of the alerting rules
described below.

Two alerting rules are added to cluster-monitoring-operator (see Risks and
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Would the ingress operator add these alert rules to a cluster via it's manifests, as opposed to the alert living in the CMO?

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 administrator has the option of creating a custom IngressClass and
annotating it with `ingressclass.kubernetes.io/is-default-class=true`.

Finally, it is possible that a user could have created an Ingress, _did_ specify
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
Finally, it is possible that a user could have created an Ingress, _did_ specify
Finally, it is possible that a user could have created an Ingress that _did_ specify

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is what you mean?

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 mean it as "could have created [...], [and] did specify [...], and nevertheless intended [...]". I can try to rewrite it to be clearer.

@Miciah Miciah force-pushed the ingress-add-transition-ingress-from-beta-to-stable-enhancement branch from 0b69b17 to 16b28fc Compare March 30, 2021 18:24
These new features include the `spec.pathType` and `spec.ingressClassType`
fields as well as the associated IngressClass API. This enhancement does *not*
extend the Route API to accommodate new features in the Ingress API; these are
only supported to the extent that they are compatible with the Route API.
Copy link
Contributor

@candita candita Mar 31, 2021

Choose a reason for hiding this comment

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

Does "these" in L48 refer to the "new features in the Ingress API" ? If so, it would be useful to have a table of those that are compatible with the existing Route API and those that are not. This would help describe goal 1 below better.

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 does. I'll add a table. Thanks for the suggestion!


### Goals

1. Enable users to use new Ingress v1 API features where feasible.
Copy link
Contributor

Choose a reason for hiding this comment

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

Which features are actually expected to be feasible? If we are not able to enumerate those features, it is best to explicitly point out the ones we tested and will support.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For new features, it's pretty much just spec.ingressClassName. I'll remove this list item because it is vague and doesn't add anything.

Additionally, the ingress-to-route controller is extended to check the value of
`spec.rules[*].http.paths[*].pathType` on Ingresses. If an Ingress rule
specifies the value "Exact" for this field, the ingress-to-route controller
ignores the rule.
Copy link
Contributor

Choose a reason for hiding this comment

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

To me it seems counterintuitive that "Exact" means to ignore the rule. Is this just one of the infeasible features?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, it is infeasible because the Route API does not have a corresponding way to express "match this exact path" (as opposed to "match this prefix").

IngressClass already has that annotation. Note that the operator does not add
the annotation when reconciling already created IngressClass objects as the
administrator may intentionally have configured the cluster to have no default
IngressClass.
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps there should be no automatic "is-default-class" annotation if we want to allow the cluster to have no default. If the admin may intentionally want no default, it doesn't make sense for them to have to go and remove it after we add it.

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 don't have a clear understanding of why an administrator wouldn't want a default ingressclass; I just didn't want to preclude the possibility, so I added this description of how to configure it. Having no default ingressclass means that creating an ingress without specifying an ingressclass does not expose the ingress, which is a change in behavior from before this enhancement. Having the default ingresscontroller's ingressclass be the default one eliminates a configuration step for administrators who want it to be default, which I expect is the most common and least confusing configuration for administrators and users.


As follow-up work, we are considering modifying the ingress operator to list all
Ingresses and Routes in the cluster and publish a metric for Routes that were
created for Ingresses that OpenShift no longer manages. This metric could used
Copy link
Contributor

Choose a reason for hiding this comment

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

"could used" -> "could be used"


An alternative to exposing Ingresses that *do* specify `spec.ingressClassName`
would be not to expose them (i.e., delete existing associated Routes). This
alternative would pose an unknown but likely moderate risk to high of breaking
Copy link
Contributor

Choose a reason for hiding this comment

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

"moderate risk to high" -> "moderate to high risk" ?

@Miciah Miciah force-pushed the ingress-add-transition-ingress-from-beta-to-stable-enhancement branch from 16b28fc to 8cb2414 Compare March 31, 2021 23:59
@knobunc
Copy link
Contributor

knobunc commented Apr 5, 2021

/approve

@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: knobunc

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-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 5, 2021
@sgreene570
Copy link
Contributor

Looks good.

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 5, 2021
@openshift-merge-robot openshift-merge-robot merged commit d2eb0eb into openshift:master Apr 5, 2021
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. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants