Navigation Menu

Skip to content

Commit

Permalink
Add BPF support for Calico CNI
Browse files Browse the repository at this point in the history
  • Loading branch information
Ciprian Hacman committed Oct 19, 2020
1 parent 18ffb49 commit 0d6ba93
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 2 deletions.
44 changes: 43 additions & 1 deletion upup/models/bindata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -11,6 +11,11 @@ metadata:
labels:
role.kubernetes.io/networking: "1"
data:
# Set these to the IP and port of your API server; In BPF mode, we need to connect directly to the
# API server because we take over kube-proxy's role.
kubernetes_service_host: "{{.MasterInternalName}}"
kubernetes_service_port: "443"

# You must set a non-zero value for Typha replicas below.
typha_service_name: "{{- if .Networking.Calico.TyphaReplicas -}}calico-typha{{- else -}}none{{- end -}}"
# Configure the backend to use.
Expand Down Expand Up @@ -3758,6 +3763,17 @@ spec:
name: kubernetes-services-endpoint
optional: true
env:
# Overrides for kubernetes API server host/port. Needed in BPF mode.
- name: KUBERNETES_SERVICE_HOST
valueFrom:
configMapKeyRef:
name: calico-config
key: kubernetes_service_host
- name: KUBERNETES_SERVICE_PORT
valueFrom:
configMapKeyRef:
name: calico-config
key: kubernetes_service_port
- name: KUBERNETES_NODE_NAME
valueFrom:
fieldRef:
Expand Down Expand Up @@ -3785,6 +3801,17 @@ spec:
name: kubernetes-services-endpoint
optional: true
env:
# Overrides for kubernetes API server host/port. Needed in BPF mode.
- name: KUBERNETES_SERVICE_HOST
valueFrom:
configMapKeyRef:
name: calico-config
key: kubernetes_service_host
- name: KUBERNETES_SERVICE_PORT
valueFrom:
configMapKeyRef:
name: calico-config
key: kubernetes_service_port
# Name of the CNI config file to create.
- name: CNI_CONF_NAME
value: "10-calico.conflist"
Expand Down Expand Up @@ -3836,6 +3863,20 @@ spec:
name: kubernetes-services-endpoint
optional: true
env:
# Overrides for kubernetes API server host/port. Needed in BPF mode.
- name: KUBERNETES_SERVICE_HOST
valueFrom:
configMapKeyRef:
name: calico-config
key: kubernetes_service_host
- name: KUBERNETES_SERVICE_PORT
valueFrom:
configMapKeyRef:
name: calico-config
key: kubernetes_service_port
# Actually enable BPF mode.
- name: FELIX_BPFENABLED
value: "true"
# Use Kubernetes API as the backing datastore.
- name: DATASTORE_TYPE
value: "kubernetes"
Expand Down Expand Up @@ -3873,7 +3914,8 @@ spec:
value: "{{- or .Networking.Calico.IPv6AutoDetectionMethod "first-found" }}"
# Enable IPIP
- name: CALICO_IPV4POOL_IPIP
value: "{{- if and (eq .CloudProvider "aws") (.Networking.Calico.CrossSubnet) -}}CrossSubnet{{- else -}} {{- or .Networking.Calico.IPIPMode "Always" -}} {{- end -}}"
value: "Never"
# value: "{{- if and (eq .CloudProvider "aws") (.Networking.Calico.CrossSubnet) -}}CrossSubnet{{- else -}} {{- or .Networking.Calico.IPIPMode "Always" -}} {{- end -}}"
# Enable or Disable VXLAN on the default IP pool.
- name: CALICO_IPV4POOL_VXLAN
value: "Never"
Expand Down
4 changes: 4 additions & 0 deletions upup/pkg/fi/cloudup/new_cluster.go
Expand Up @@ -769,6 +769,10 @@ func setupNetworking(opt *NewClusterOptions, cluster *api.Cluster) error {
cluster.Spec.Networking.Calico = &api.CalicoNetworkingSpec{
MajorVersion: "v3",
}
if cluster.Spec.KubeProxy == nil {
cluster.Spec.KubeProxy = &api.KubeProxyConfig{}
}
cluster.Spec.KubeProxy.Enabled = fi.Bool(false)
case "canal":
cluster.Spec.Networking.Canal = &api.CanalNetworkingSpec{}
case "kube-router":
Expand Down

0 comments on commit 0d6ba93

Please sign in to comment.