Skip to content

Enable Istio Sidecar injection for activator#833

Closed
akyyy wants to merge 3 commits into
knative:masterfrom
akyyy:sidecar
Closed

Enable Istio Sidecar injection for activator#833
akyyy wants to merge 3 commits into
knative:masterfrom
akyyy:sidecar

Conversation

@akyyy
Copy link
Copy Markdown
Contributor

@akyyy akyyy commented May 8, 2018

Fixes #838

Proposed Changes

@akyyy akyyy requested a review from josephburnett as a code owner May 8, 2018 17:21
@akyyy akyyy requested a review from a team May 8, 2018 17:21
@google-prow-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: akyyy
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approver: vaikas-google

Assign the PR to them by writing /assign @vaikas-google in a comment when ready.

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details 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

@google-prow-robot google-prow-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label May 8, 2018
Comment thread namespace.yaml
kind: Namespace
metadata:
labels:
istio-injection: enabled
Copy link
Copy Markdown

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).

Copy link
Copy Markdown
Contributor Author

@akyyy akyyy May 8, 2018

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.

@akyyy akyyy requested a review from ian-mi May 8, 2018 17:41
Comment thread 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{})
Copy link
Copy Markdown
Contributor

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)

Copy link
Copy Markdown
Contributor Author

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.

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 {
Copy link
Copy Markdown
Contributor

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?

Copy link
Copy Markdown
Contributor Author

@akyyy akyyy May 8, 2018

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.

Comment thread pkg/activator/activator.go Outdated

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)
Copy link
Copy Markdown
Contributor

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 :)

Copy link
Copy Markdown
Contributor Author

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.

t.Errorf("Error in getRevisionTargetURL %v", err)
}
expectedURL := "http://abc:1234"
expectedURL := "http://test-rev-service.default.svc.cluster.local:1234"
Copy link
Copy Markdown
Contributor

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 = ""
Copy link
Copy Markdown
Contributor Author

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?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor Author

@akyyy akyyy left a 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.

Comment thread pkg/activator/activator.go Outdated

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)
Copy link
Copy Markdown
Contributor Author

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.

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 {
Copy link
Copy Markdown
Contributor Author

@akyyy akyyy May 8, 2018

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.

Comment thread 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{})
Copy link
Copy Markdown
Contributor Author

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 akyyy added the WIP label May 8, 2018
@akyyy akyyy mentioned this pull request May 9, 2018
@akyyy akyyy added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 10, 2018
@google-prow-robot
Copy link
Copy Markdown

@akyyy: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-elafros-elafros-test 8861351 link /test pull-elafros-elafros-test

Full PR test history. Your PR dashboard.

Details

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.

@akyyy
Copy link
Copy Markdown
Contributor Author

akyyy commented May 16, 2018

Nicole took over the issue and she will work on this. Thanks!

@nikkithurmond
Copy link
Copy Markdown
Contributor

I'm continuing this PR in #966

@mattmoor mattmoor added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. and removed WIP labels Jun 2, 2018
@mattmoor
Copy link
Copy Markdown
Member

mattmoor commented Jun 2, 2018

Is this subsumed by #966?

@akyyy
Copy link
Copy Markdown
Contributor Author

akyyy commented Jun 6, 2018

This has been replaced by #966

@akyyy akyyy closed this Jun 6, 2018
markusthoemmes pushed a commit to markusthoemmes/knative-serving that referenced this pull request Jul 1, 2021
* Remove config/domainmapping

* Add 0.23 label
nak3 added a commit to nak3/serving that referenced this pull request Jul 1, 2021
* Remove config/domainmapping

* Add 0.23 label
mgencur pushed a commit to mgencur/serving-1 that referenced this pull request Aug 3, 2021
… (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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants