Skip to content

Conversation

morvencao
Copy link
Member

@morvencao morvencao commented Mar 1, 2018

Replace nodeSelector with node affinity for nodeSelector will be deprecated:

nodeSelector continues to work as usual, but will eventually be deprecated, as node affinity can express everything that nodeSelector can express.

With the power of affinity, users can customized arch preference based on their requirements.
When install Istio chart, specify pod scheduling arch(amd64, ppc64le, s390x) preference and weight as follows:

  • 0(Never scheduled)
  • 1(Least preferred)
  • 2(No preference)
  • 3(Most preferred)

default value:

  arch:
    amd64: 2
    s390x: 2
    ppc64le: 2

@morvencao morvencao requested a review from a team March 1, 2018 04:58
@codecov
Copy link

codecov bot commented Mar 1, 2018

Codecov Report

Merging #3856 into master will decrease coverage by 1%.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #3856    +/-   ##
=======================================
- Coverage      72%     72%   -<1%     
=======================================
  Files         295     295            
  Lines       25566   25474    -92     
=======================================
- Hits        18265   18186    -79     
+ Misses       6538    6527    -11     
+ Partials      763     761     -2
Impacted Files Coverage Δ
...olarwinds/internal/papertrail/papertrail_logger.go 59% <0%> (-21%) ⬇️
mixer/adapter/servicecontrol/distValueBuilder.go 88% <0%> (-4%) ⬇️
mixer/adapter/servicecontrol/reportbuilder.go 89% <0%> (-4%) ⬇️
mixer/adapter/circonus/circonus.go 70% <0%> (-1%) ⬇️
mixer/adapter/memquota/dedup.go 100% <0%> (ø) ⬆️
mixer/adapter/servicecontrol/client.go 0% <0%> (ø) ⬆️
mixer/pkg/il/convert.go 100% <0%> (ø) ⬆️
mixer/adapter/denier/denier.go 100% <0%> (ø) ⬆️
pkg/util/webhookclient.go 0% <0%> (ø) ⬆️
mixer/adapter/dogstatsd/dogstatsd.go 100% <0%> (ø) ⬆️
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3f3dff0...f9fe6b2. Read the comment docs.

Copy link
Member

@sdake sdake left a comment

Choose a reason for hiding this comment

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

some concern this won't render with helm template. Have you tried helm template?

{{ toYaml .Values.nodeSelector | indent 8 }}
{{- end }}
affinity:
{{- include "nodeaffinity" . | indent 6 }}
Copy link
Member

Choose a reason for hiding this comment

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

this indent doesn't look correct.

Copy link
Member Author

Choose a reason for hiding this comment

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

Have tried locally, the intent is OK :)

@sdake
Copy link
Member

sdake commented Mar 2, 2018

@jascott1 would you mind reviewing this patch for correctness please as it relates to the current state of helm? Note Istio uses helm template as part of our critical workflows.

@sdake
Copy link
Member

sdake commented Mar 2, 2018

@morvencao thanks for the PR! I've asked one of my old friends (Justin) to take a look at this PR for correctness as it relates to helm template. We have noticed beta capabilities are not correctly handled by Helm template and this patch may break critical installation creation workflows.

@sdake sdake self-assigned this Mar 2, 2018
@sdake
Copy link
Member

sdake commented Mar 2, 2018

/ok-to-test

@jascott1
Copy link

@sdake it looks like multiple template helpers are defined with the same name (e.g. "nodeaffinity") . These are global so they should be namespace'd to avoid collisions.

@sdake
Copy link
Member

sdake commented Mar 18, 2018

@morvencao I want to take a moment to apologize for long delay in this review. Been taking care of family matters of a serious nature for the last 3-4 weeks. That is resolved now, so back in action.

Cheers
-steve

sdake
sdake previously requested changes Mar 18, 2018
Copy link
Member

@sdake sdake left a comment

Choose a reason for hiding this comment

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

As we lack a gate currently for Helm, I pulled your PR and ran helm template to see how it renders. Works properly and looks good. I don't see a use case for specifying affinity per service however. Could you move the cpu definitions to global.arch?

Cheers
-steve

service:
nodePort:
enabled: false
port: 32000

# Specify pod scheduling arch(amd64, ppc64le, s390x) and weight as follows:
Copy link
Member

@sdake sdake Mar 18, 2018

Choose a reason for hiding this comment

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

I don't understand the use case of specifying CPU affinity per service. Can you make this a global (e.g.
global.arch.amd64, global.arch.s390x, global.arch.pcc64le.)

Copy link
Member Author

Choose a reason for hiding this comment

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

My intention was to handle the case that each pod or service may be running on node with different arch.
Anyway, good suggestion to make this a global parameter. I'll do that in next commit :)

@@ -80,7 +89,16 @@ sidecar-injector:
# requests:
# cpu: 100m
# memory: 128Mi
nodeSelector: {}

# Specify pod scheduling arch(amd64, ppc64le, s390x) and weight as follows:
Copy link
Member

Choose a reason for hiding this comment

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

and remove this.

@@ -104,7 +122,16 @@ mixer:
# requests:
# cpu: 100m
# memory: 128Mi
nodeSelector: {}

# Specify pod scheduling arch(amd64, ppc64le, s390x) and weight as follows:
Copy link
Member

Choose a reason for hiding this comment

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

and remove this

@@ -127,7 +154,16 @@ pilot:
# requests:
# cpu: 100m
# memory: 128Mi
nodeSelector: {}

# Specify pod scheduling arch(amd64, ppc64le, s390x) and weight as follows:
Copy link
Member

Choose a reason for hiding this comment

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

and remove this.

@@ -143,7 +179,16 @@ security:
# requests:
# cpu: 100m
# memory: 128Mi
nodeSelector: {}

# Specify pod scheduling arch(amd64, ppc64le, s390x) and weight as follows:
Copy link
Member

Choose a reason for hiding this comment

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

and remove this.

@@ -178,7 +223,16 @@ grafana:
# requests:
# cpu: 100m
# memory: 128Mi
nodeSelector: {}

# Specify pod scheduling arch(amd64, ppc64le, s390x) and weight as follows:
Copy link
Member

Choose a reason for hiding this comment

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

and remove this.

service:
nodePort:
enabled: false
port: 32090

# Specify pod scheduling arch(amd64, ppc64le, s390x) and weight as follows:
Copy link
Member

Choose a reason for hiding this comment

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

and remove this.

@@ -242,7 +305,16 @@ servicegraph:
# requests:
# cpu: 100m
# memory: 128Mi
nodeSelector: {}

# Specify pod scheduling arch(amd64, ppc64le, s390x) and weight as follows:
Copy link
Member

Choose a reason for hiding this comment

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

and remove this.

@@ -278,4 +350,13 @@ zipkin:
# requests:
# cpu: 100m
# memory: 128Mi
nodeSelector: {}

# Specify pod scheduling arch(amd64, ppc64le, s390x) and weight as follows:
Copy link
Member

Choose a reason for hiding this comment

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

and this. 👍

@@ -0,0 +1,36 @@
{{/* affinity - https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ */}}
Copy link
Member

Choose a reason for hiding this comment

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

can you move this to install/kubernetes/helm/istio/charts/_affinity.tpl. This will permit the deletion of all of the other _affinity.tpl files which are duplicated. For an example of how this was done recently in master, please take a look at PR #3787. See further review comments related to placing these config options in global.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, Okay for me.

Copy link
Member Author

Choose a reason for hiding this comment

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

In the templates/ directory, any file that begins with an underscore(_) is not expected to output a Kubernetes manifest file.

Have tried locally, we need to put _affinity.tpl in install/kubernetes/helm/istio/templates/ directory.
It's OK to put this template definition file in parent chart directory, for templates in subcharts are compiled together with top-level templates.
Will include this change in next commit.

@sdake
Copy link
Member

sdake commented Mar 19, 2018

/lgtm

@istio-merge-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: sdake
We suggest the following additional approver: ijsnellf

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

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

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@sdake
Copy link
Member

sdake commented Mar 19, 2018

@ldemailly @costinm since this effects the heavily tested istio.yaml helm templating in the future, do you have any commentary to add? Otherwise ready to approve.

Cheers
-steve

@sdake sdake dismissed their stale review March 19, 2018 17:55

Changes LGTM, waiting on an additional review as this has significant impact for the project as a whole.

@ldemailly ldemailly requested a review from mandarjog March 20, 2018 03:45
@ldemailly ldemailly removed their assignment Mar 20, 2018
@ldemailly
Copy link
Member

@mandarjog is in the process of switching the base install to helm and is thus the best person to review/approve this

@ldemailly
Copy link
Member

/hold

@istio-testing istio-testing added the do-not-merge/hold Block automatic merging of a PR. label Mar 20, 2018
@istio-merge-robot
Copy link

@morvencao PR needs rebase

@istio-merge-robot istio-merge-robot added the needs-rebase Indicates a PR needs to be rebased before being merged label Mar 27, 2018
@ldemailly ldemailly removed the do-not-merge/hold Block automatic merging of a PR. label Mar 27, 2018
@morvencao morvencao force-pushed the br_update_nodeSelector_to_affinity_for_helm_chart branch from 38f25c6 to bfe7584 Compare March 29, 2018 03:59
@istio-testing istio-testing added approved and removed lgtm needs-rebase Indicates a PR needs to be rebased before being merged labels Mar 29, 2018
@morvencao morvencao force-pushed the br_update_nodeSelector_to_affinity_for_helm_chart branch from 7ccfa87 to f9fe6b2 Compare March 29, 2018 04:55
@morvencao
Copy link
Member Author

morvencao commented Mar 30, 2018

/retest

@gyliu513
Copy link
Member

As we support multi-arch docker image now, so I think that we can update the description by not highlighting the multi arch, but focus on using nodeSelector to do customized deployment based on customer requirement. @morvencao

@morvencao morvencao changed the title update nodeSelector to affinity for chart to support multiple architecture update nodeSelector to affinity for chart to customize pod scheduling arch preference Mar 30, 2018
@linsun
Copy link
Member

linsun commented Mar 30, 2018

seems this should not impact anything as no preference is the default and it provides an ability for users to customize preference for istio running on their k8s workers arch preference.

Could we get the test passing? @morvencao @gyliu513

@sdake
Copy link
Member

sdake commented Apr 1, 2018

@linsun agree - and I have personally manually tested this PR (only on x86_64). I have changed the priority around or x86_64 from 2 to 1 and 3, and there is no negative impact. Seems safe to merge once the gate flakiness is resolved.

Copy link
Member

@gyliu513 gyliu513 left a comment

Choose a reason for hiding this comment

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

/lgtm

@istio-testing
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gyliu513, sdake

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

@istio-merge-robot
Copy link

/test all [submit-queue is verifying that this PR is safe to merge]

@istio-merge-robot
Copy link

Automatic merge from submit-queue.

@istio-merge-robot istio-merge-robot merged commit 33075b8 into istio:master Apr 2, 2018
@istio-testing
Copy link
Collaborator

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

Test name Commit Details Rerun command
prow/istio-pilot-e2e.sh f9fe6b2 link /test istio-pilot-e2e

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.

@morvencao morvencao deleted the br_update_nodeSelector_to_affinity_for_helm_chart branch April 2, 2018 03:22
bianpengyuan pushed a commit to bianpengyuan/istio that referenced this pull request Apr 5, 2018
… arch preference (istio#3856)

Automatic merge from submit-queue.

update nodeSelector to affinity for chart to customize pod scheduling arch preference

Replace `nodeSelector` with node `affinity` for `nodeSelector` will be deprecated:
> nodeSelector continues to work as usual, but will eventually be deprecated, as node affinity can express everything that nodeSelector can express.

With the power of `affinity`, users can customized arch preference based on their requirements.
When install `Istio` chart, specify pod scheduling arch(amd64, ppc64le, s390x) preference and weight as follows:
 - 0(Never scheduled)
 - 1(Least preferred)
 - 2(No preference)
 - 3(Most preferred)

default value:
```
  arch:
    amd64: 2
    s390x: 2
    ppc64le: 2
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants