-
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
Enable Istio Sidecar injection for activator #833
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: akyyy Assign the PR to them by writing 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 |
@@ -15,4 +15,6 @@ | |||
apiVersion: v1 | |||
kind: Namespace | |||
metadata: | |||
labels: | |||
istio-injection: enabled |
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.
I am wondering if this will enable istio sidecar injection for other pods in namespace ela-system. I guess we only want to inject sidecar for activator and autoscaler (maybe).
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 particular deployment needs a special annotation to get istio sidecar enabled.
annotations:
sidecar.istio.io/inject: "true"
so we should be fine.
pkg/activator/activator.go
Outdated
if err != nil { | ||
if apierrors.IsNotFound(err) { | ||
return nil, nil | ||
} | ||
return nil, err | ||
} | ||
if len(endpoint.Subsets[0].Ports) != 1 { | ||
return nil, fmt.Errorf("need just one port. Found %v ports", len(endpoint.Subsets[0].Ports)) | ||
svc, err = services.Get(controller.GetElaK8SServiceNameForRevision(revision), metav1.GetOptions{}) |
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.
Any reason this is called a second time here? (same call is made on line 97 as well)
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.
oops. That's an error.
pkg/activator/activator.go
Outdated
if len(endpoint.Subsets[0].Ports) != 1 { | ||
return nil, fmt.Errorf("need just one port. Found %v ports", len(endpoint.Subsets[0].Ports)) | ||
svc, err = services.Get(controller.GetElaK8SServiceNameForRevision(revision), metav1.GetOptions{}) | ||
if len(svc.Spec.Ports) != 1 { |
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.
Do we need to restrict this to only one port? What if more ports are added in the future (for example, when we enable mutual TLS, we might need to add a second port for health checks, separate from the serving port) - it will require changes in this code as well. Can this instead look for a specific named port?
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.
I opened an issue for this #837.
pkg/activator/activator.go
Outdated
} | ||
return u, nil | ||
} | ||
|
||
func (a *Activator) proxyRequest(revRequest RevisionRequest, serviceURL *url.URL) { | ||
glog.Infof("Sending a proxy request to %q", serviceURL) | ||
glog.Infof("Sending the request to %q", serviceURL) |
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.
I recommend eventually removing this. This will easily get very verbose. This is the perfect place to integrate to the distributed tracing :)
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.
Deleted this log line. There is an issue to track tracing/metrics for activator #743.
@@ -173,7 +173,7 @@ func TestGetRevisionTargetURL(t *testing.T) { | |||
if err != nil { | |||
t.Errorf("Error in getRevisionTargetURL %v", err) | |||
} | |||
expectedURL := "http://abc:1234" | |||
expectedURL := "http://test-rev-service.default.svc.cluster.local:1234" |
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.
we probably should have a check here that tests that the request host is also empty.
// https://github.com/elafros/elafros/blob/2b3ee4f3c46118b3759aa95d9e6c41747c32d6c5/pkg/controller/route/ela_ingress.go#L38 | ||
// Since host values like "route-example.default.demo-domain.com" do not exist, we need to | ||
// clear it to make istio sidecar happy if it's injected. | ||
revRequest.r.Host = "" |
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.
@mattmoor Is this the best thing to do to overcome 404's?
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.
cc @tcnghia
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.
Nghia syned up with me. He thinks the right fix could be additional route rules or check with istio team. I'll try those first.
pkg/activator/activator.go
Outdated
} | ||
return u, nil | ||
} | ||
|
||
func (a *Activator) proxyRequest(revRequest RevisionRequest, serviceURL *url.URL) { | ||
glog.Infof("Sending a proxy request to %q", serviceURL) | ||
glog.Infof("Sending the request to %q", serviceURL) |
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.
Deleted this log line. There is an issue to track tracing/metrics for activator #743.
pkg/activator/activator.go
Outdated
if len(endpoint.Subsets[0].Ports) != 1 { | ||
return nil, fmt.Errorf("need just one port. Found %v ports", len(endpoint.Subsets[0].Ports)) | ||
svc, err = services.Get(controller.GetElaK8SServiceNameForRevision(revision), metav1.GetOptions{}) | ||
if len(svc.Spec.Ports) != 1 { |
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.
I opened an issue for this #837.
pkg/activator/activator.go
Outdated
if err != nil { | ||
if apierrors.IsNotFound(err) { | ||
return nil, nil | ||
} | ||
return nil, err | ||
} | ||
if len(endpoint.Subsets[0].Ports) != 1 { | ||
return nil, fmt.Errorf("need just one port. Found %v ports", len(endpoint.Subsets[0].Ports)) | ||
svc, err = services.Get(controller.GetElaK8SServiceNameForRevision(revision), metav1.GetOptions{}) |
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.
oops. That's an error.
@akyyy: The following test failed, say
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. |
Nicole took over the issue and she will work on this. Thanks! |
I'm continuing this PR in #966 |
Is this subsumed by #966? |
This has been replaced by #966 |
* Remove config/domainmapping * Add 0.23 label
* Remove config/domainmapping * Add 0.23 label
… (knative#836) * Add root ca for Controller HA test with https (knative#11471) This patch adds `test.AddRootCAtoTransport` for prober in TestControllerHA. * stick serverless-operator branch * Revert "stick serverless-operator branch" This reverts commit d2be74a. * Add v0.23 label to manifests (knative#833) * Remove config/domainmapping * Add 0.23 label * Update label * Add back DomainMapping
Fixes #838
Proposed Changes