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

Enable Istio Sidecar injection for activator #833

Closed
wants to merge 3 commits into from
Closed

Enable Istio Sidecar injection for activator #833

wants to merge 3 commits into from

Conversation

akyyy
Copy link
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

[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

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
@@ -15,4 +15,6 @@
apiVersion: v1
kind: Namespace
metadata:
labels:
istio-injection: enabled

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
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
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{})
Copy link
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
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
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
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.

}
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)
Copy link
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
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.

@@ -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"
Copy link
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
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
Member

Choose a reason for hiding this comment

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

Copy link
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.

}
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)
Copy link
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
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.

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{})
Copy link
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

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

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
Contributor Author

akyyy commented May 16, 2018

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

@nikkithurmond
Copy link
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
Member

mattmoor commented Jun 2, 2018

Is this subsumed by #966?

@akyyy
Copy link
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