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

Added support for calico serviceExternalIPs #6928

Conversation

anjkl
Copy link
Contributor

@anjkl anjkl commented Nov 19, 2020

What type of PR is this?

/kind feature

What this PR does / why we need it:

Add support of advertising Kubernetes service ExternalIPs over BGP using calico CNI

Calico doc|Advertise service external IP addresses

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

Added ability to configure Service ExternalIPs for calico CNI

@k8s-ci-robot k8s-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Nov 19, 2020
@k8s-ci-robot
Copy link
Contributor

Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA.

It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.


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.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Nov 19, 2020
@k8s-ci-robot
Copy link
Contributor

Welcome @anjkl!

It looks like this is your first PR to kubernetes-sigs/kubespray 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/kubespray has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot
Copy link
Contributor

Hi @anjkl. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Nov 19, 2020
@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Nov 19, 2020
@anjkl
Copy link
Contributor Author

anjkl commented Nov 19, 2020

I signed it

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Nov 19, 2020
@@ -154,6 +154,17 @@
- inventory_hostname == groups['kube-master'][0]
- 'calico_conf.stdout == "0"'

- name: Set Service External IPs to empty list
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This section can be deleted or changed the task below:

 - name: Populate Service External IPs 
  set_fact:
    _service_external_ips: "{{ _service_external_ips|default([]) + [ {'cidr': item} ] }}" 

to

 - name: Populate Service External IPs 
  set_fact:
    _service_external_ips: "{{ _service_external_ips + [ {'cidr': item} ] }}" 

Copy link
Contributor

Choose a reason for hiding this comment

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

It is nice to remove this section.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

Copy link
Contributor

@oomichi oomichi left a comment

Choose a reason for hiding this comment

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

/cc @oomichi
/ok-to-test

docs/calico.md Outdated
@@ -93,6 +93,15 @@ This can be enabled by setting the following variable as follow in group_vars (k
calico_advertise_cluster_ips: true
```

Since calico 3.10, Calico supports advertising Kubernetes service ExternalIPs over BGP in addition to cluster IPs advertising.
This can be enabled by setting the following variable as follow in group_vars (k8s-cluster/k8s-net-calico.yml)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: as follow seems duplicated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed

@@ -154,6 +154,17 @@
- inventory_hostname == groups['kube-master'][0]
- 'calico_conf.stdout == "0"'

- name: Set Service External IPs to empty list
Copy link
Contributor

Choose a reason for hiding this comment

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

It is nice to remove this section.

@@ -174,6 +185,7 @@
"spec": {
"logSeverityScreen": "Info",
"nodeToNodeMeshEnabled": {{ nodeToNodeMeshEnabled|default('true') }} ,
"serviceExternalIPs": {{ _service_external_ips }},
Copy link
Contributor

Choose a reason for hiding this comment

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

According to https://docs.projectcalico.org/networking/advertise-service-ips this way seems good for me.
One question: Is it fine to specify empty list for calico if calico_advertise_service_external_ips is the default []?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that's fine. An empty list is an acceptable value for the serviceExternalIPs key.

For example, applied non-empty list of serviceExternalIPs:

~ cat bgp-conf-0.yaml
kind: BGPConfigurationList
apiVersion: projectcalico.org/v3
items:
- apiVersion: projectcalico.org/v3
  kind: BGPConfiguration
  metadata:
    name: default
  spec:
    asNumber: 65207
    nodeToNodeMeshEnabled: false
    serviceExternalIPs:
    - cidr: 10.108.13.0/24
~ calicoctl.sh apply -f bgp-conf-0.yaml
Successfully applied 1 'BGPConfiguration' resource(s)
~ calicoctl.sh get bgpconfig default -o yaml
apiVersion: projectcalico.org/v3
kind: BGPConfiguration
metadata:
  creationTimestamp: "2020-11-17T04:02:42Z"
  name: default
  resourceVersion: "1598124"
  uid: c205703f-cbeb-4b1e-94a6-468178ca63e3
spec:
  asNumber: 65207
  nodeToNodeMeshEnabled: false
  serviceExternalIPs:
  - cidr: 10.108.13.0/24

An empty list is also OK. In this case, it just sets the default behavior for serviceExternalIPs:

~ cat bgp-conf-1.yaml
kind: BGPConfigurationList
apiVersion: projectcalico.org/v3
items:
- apiVersion: projectcalico.org/v3
  kind: BGPConfiguration
  metadata:
    name: default
  spec:
    asNumber: 65207
    nodeToNodeMeshEnabled: false
    serviceExternalIPs: []
~ calicoctl.sh apply -f bgp-conf-1.yaml
Successfully applied 1 'BGPConfiguration' resource(s)
~ calicoctl.sh get bgpconfig default -o yaml
apiVersion: projectcalico.org/v3
kind: BGPConfiguration
metadata:
  creationTimestamp: "2020-11-17T04:02:42Z"
  name: default
  resourceVersion: "1598897"
  uid: c205703f-cbeb-4b1e-94a6-468178ca63e3
spec:
  asNumber: 65207
  nodeToNodeMeshEnabled: false

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for your explanation. I got it.

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 19, 2020
@anjkl anjkl force-pushed the feature/support-calico-serviceExternalIPs branch from 6397785 to 3f98236 Compare November 20, 2020 09:58
@oomichi
Copy link
Contributor

oomichi commented Nov 21, 2020

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 21, 2020
@floryut
Copy link
Member

floryut commented Nov 23, 2020

@anjkl now that #6910 is merged, could you please rebase master ? Thank you!

@anjkl anjkl force-pushed the feature/support-calico-serviceExternalIPs branch from 3f98236 to 0d72f30 Compare November 23, 2020 09:04
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 23, 2020
@anjkl
Copy link
Contributor Author

anjkl commented Nov 23, 2020

@anjkl now that #6910 is merged, could you please rebase master ? Thank you!

The branch has been rebased. Thanks.

@oomichi
Copy link
Contributor

oomichi commented Nov 23, 2020

/retest
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 23, 2020
@anjkl
Copy link
Contributor Author

anjkl commented Nov 24, 2020

Tests were failed. But it doesn't look like the issue related to my change.

time="2020-11-24T17:23:10Z" level=fatal msg="pulling image: rpc error: code = Unknown desc = failed to pull and unpack image \"docker.io/library/nginx:1.19\": failed to copy: httpReaderSeeker: failed open: unexpected status code https://registry-1.docker.io/v2/library/nginx/manifests/sha256:c3a1592d2b6d275bef4087573355827b200b00ffc2d9849890a4f3aa2128c4ae: 429 Too Many Requests - Server message: toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limit"

Do I need to do anything?

@floryut
Copy link
Member

floryut commented Nov 24, 2020

Tests were failed. But it doesn't look like the issue related to my change.

time="2020-11-24T17:23:10Z" level=fatal msg="pulling image: rpc error: code = Unknown desc = failed to pull and unpack image \"docker.io/library/nginx:1.19\": failed to copy: httpReaderSeeker: failed open: unexpected status code https://registry-1.docker.io/v2/library/nginx/manifests/sha256:c3a1592d2b6d275bef4087573355827b200b00ffc2d9849890a4f3aa2128c4ae: 429 Too Many Requests - Server message: toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limit"

Do I need to do anything?

I'm on it, no worries, dockerhub changed some things lately and we have yet to adapt

Copy link
Member

@floryut floryut left a comment

Choose a reason for hiding this comment

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

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: anjkl, floryut

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 25, 2020
@k8s-ci-robot k8s-ci-robot merged commit 8a153ed into kubernetes-sigs:master Nov 25, 2020
@anjkl anjkl deleted the feature/support-calico-serviceExternalIPs branch November 25, 2020 14:05
@floryut floryut mentioned this pull request Dec 19, 2020
LuckySB pushed a commit to southbridgeio/kubespray that referenced this pull request Jan 16, 2021
MathildeLeroi pushed a commit to MathildeLeroi/kubespray that referenced this pull request Feb 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants