-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Support exposing ClusterIngress to two or more shared Gateways. #2666
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tcnghia: 4 warnings.
In response to this:
Proposed Changes
In order for existing users to migrate cleanly off existing
knative-ingressgateway
we need to have a mechanism to allow them to expose their Services to two or more External LoadBalancer and cleanly update the domain to point to new IP address. This change makes that possible.So even though #1969 is fixed we will leave the
knative-ingressgateway
around and will have it removed may be when 0.4 rolls out.Release Note
Reinstate the `knative-ingressgateway` to allow existing users to upgrade cleanly.
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.
/lint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tcnghia: 1 unresolved warning and 0 new warning.
In response to this:
/lint
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.
/test pull-knative-serving-unit-tests |
/test pull-knative-serving-integration-tests |
config/config-istio.yaml
Outdated
# ${gatewayName}:${gatewayService}, where ${gatewayName} is the name of | ||
# the Gateway, and ${gatewayService} is the URL of the service backing | ||
# that gateway. | ||
ingress-gateway: "knative-ingress-gateway:istio-ingressgateway.istio-system.svc.cluster.local;knative-shared-gateway:knative-ingressgateway.istio-system.svc.cluster.local" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's use a wildcard on keys, like this:
serving/config/config-logging.yaml
Lines 48 to 52 in 0e7cbf3
loglevel.controller: "info" | |
loglevel.autoscaler: "info" | |
loglevel.queueproxy: "info" | |
loglevel.webhook: "info" | |
loglevel.activator: "info" |
*-gateway:
in config-istio.yaml
seems like a safe compromise :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since I don't want the Istio Gateway CRD to be named with -gateway suffix all the time, I opted to use a "gateway." prefix instead.
/test pull-knative-serving-upgrade-tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
couple nits / questions
originGateway = "origin.ns.svc.cluster.local" | ||
customGateway = "custom.ns.svc.cluster.local" | ||
originDomainInternal = "origin.ns.svc.cluster.local" | ||
newDomainInternal = "custom.ns.svc.cluster.local" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use these constants above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -31,26 +33,51 @@ const ( | |||
// IngressGatewayKey is the name of the configuration entry | |||
// that specifies ingress gateway url. | |||
IngressGatewayKey = "ingress-gateway" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
urls := map[string]string{} | ||
gatewayNames := []string{} | ||
for k, v := range configMap.Data { | ||
if strings.HasPrefix(k, GatewayKeyPrefix) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: if !... { continue }
to reduce indent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -32,12 +32,10 @@ func TestStoreLoadWithContext(t *testing.T) { | |||
store.OnConfigChanged(istioConfig) | |||
config := FromContext(store.ToContext(context.Background())) | |||
|
|||
t.Run("load istio", func(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why'd you remove the t.Run
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the test name isn't changing inside a for loop, I didn't see any purpose for the t.Run
if !strings.HasPrefix(k, GatewayKeyPrefix) { | ||
continue | ||
} | ||
gatewayName, serviceURL := strings.TrimPrefix(k, GatewayKeyPrefix), v |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
k[len(GatewayKeyPrefix):] gonna be much faster, since you already know the prefix is there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
if errs := validation.IsDNS1123Subdomain(gateway); len(errs) > 0 { | ||
return nil, fmt.Errorf("invalid gateway format: %v", errs) | ||
if len(gatewayNames) == 0 { | ||
return nil, fmt.Errorf("at least one gateway is required") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No formatting --> Error()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
return nil, fmt.Errorf("at least one gateway is required") | ||
} | ||
sort.Strings(gatewayNames) | ||
gateways := []IngressGateway{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make([]IG, 0, len(gatewayNames)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but I agree with @vagababov nits. Thanks @vagababov :)
The following is the coverage report on pkg/.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
/hold
@vagababov If this LGTY then /hold cancel
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mattmoor, tcnghia 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 |
/hold cancel |
Proposed Changes
In order for existing users to migrate cleanly off existing
knative-ingressgateway
we need to have a mechanism to allow them to expose their Services to two or more External LoadBalancer and cleanly update the domain to point to new IP address. This change makes that possible.Hence even though #1969 is fixed we will leave the
knative-ingressgateway
around and will have it removed may be when 0.4 rolls out.Release Note