Unverified Commit 9c2c0d27 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #65999 from jingax10/release-1.10

Automatic merge from submit-queue. Backport Calico related fixes to release 1.10 **What this PR does / why we need it**: We need to run Calico 3.0+ on GCP and we need to customize MTU when Calico CNI is used on GCP. **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes #65045 #65067 **Special notes for your reviewer**: **Release note**: ```release-note "NONE" ```
parents c838d0ac 54c42713
...@@ -36,6 +36,7 @@ rules: ...@@ -36,6 +36,7 @@ rules:
- get - get
- list - list
- watch - watch
- patch
- apiGroups: [""] - apiGroups: [""]
resources: resources:
- nodes - nodes
...@@ -51,17 +52,28 @@ rules: ...@@ -51,17 +52,28 @@ rules:
- get - get
- list - list
- watch - watch
- apiGroups: ["networking.k8s.io"]
resources:
- networkpolicies
verbs:
- watch
- list
- apiGroups: ["crd.projectcalico.org"] - apiGroups: ["crd.projectcalico.org"]
resources: resources:
- globalfelixconfigs - globalfelixconfigs
- felixconfigurations
- bgppeers
- globalbgpconfigs - globalbgpconfigs
- bgpconfigurations
- ippools - ippools
- globalnetworkpolicies - globalnetworkpolicies
- globalnetworksets
- networkpolicies
- clusterinformations
- hostendpoints
verbs: verbs:
- create - create
- get - get
- list - list
- update - update
- patch
- delete
- watch - watch
...@@ -41,18 +41,22 @@ spec: ...@@ -41,18 +41,22 @@ spec:
value: "none" value: "none"
- name: DATASTORE_TYPE - name: DATASTORE_TYPE
value: "kubernetes" value: "kubernetes"
- name: FELIX_TYPHAK8SSERVICENAME
value: "calico-typha"
- name: FELIX_DEFAULTENDPOINTTOHOSTACTION - name: FELIX_DEFAULTENDPOINTTOHOSTACTION
value: "ACCEPT" value: "ACCEPT"
- name: FELIX_HEALTHENABLED
value: "true"
- name: FELIX_IPV6SUPPORT - name: FELIX_IPV6SUPPORT
value: "false" value: "false"
- name: FELIX_LOGSEVERITYSYS - name: FELIX_LOGSEVERITYSYS
value: "none" value: "none"
- name: FELIX_LOGSEVERITYSCREEN
value: "info"
- name: FELIX_PROMETHEUSMETRICSENABLED - name: FELIX_PROMETHEUSMETRICSENABLED
value: "true" value: "true"
- name: FELIX_HEALTHENABLED - name: FELIX_REPORTINGINTERVALSECS
value: "true" value: "0"
- name: FELIX_TYPHAK8SSERVICENAME
value: "calico-typha"
- name: IP - name: IP
value: "" value: ""
- name: NO_DEFAULT_POOLS - name: NO_DEFAULT_POOLS
...@@ -84,6 +88,12 @@ spec: ...@@ -84,6 +88,12 @@ spec:
- mountPath: /etc/calico - mountPath: /etc/calico
name: etc-calico name: etc-calico
readOnly: true readOnly: true
- mountPath: /var/run/calico
name: var-run-calico
readOnly: false
- mountPath: /var/lib/calico
name: var-lib-calico
readOnly: false
# This container installs the Calico CNI binaries # This container installs the Calico CNI binaries
# and CNI network config file on each node. # and CNI network config file on each node.
- name: install-cni - name: install-cni
...@@ -149,6 +159,12 @@ spec: ...@@ -149,6 +159,12 @@ spec:
- name: cni-net-dir - name: cni-net-dir
hostPath: hostPath:
path: /etc/cni/net.d path: /etc/cni/net.d
- name: var-run-calico
hostPath:
path: /var/run/calico
- name: var-lib-calico
hostPath:
path: /var/lib/calico
tolerations: tolerations:
# Make sure calico/node gets scheduled on all nodes. # Make sure calico/node gets scheduled on all nodes.
- effect: NoSchedule - effect: NoSchedule
......
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: clusterinformations.crd.projectcalico.org
labels:
kubernetes.io/cluster-service: "true"
addonmanager.kubernetes.io/mode: Reconcile
spec:
scope: Cluster
group: crd.projectcalico.org
version: v1
names:
kind: ClusterInformation
plural: clusterinformations
singular: clusterinformation
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: felixconfigurations.crd.projectcalico.org
labels:
kubernetes.io/cluster-service: "true"
addonmanager.kubernetes.io/mode: Reconcile
spec:
scope: Cluster
group: crd.projectcalico.org
version: v1
names:
kind: FelixConfiguration
plural: felixconfigurations
singular: felixconfiguration
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: globalnetworksets.crd.projectcalico.org
labels:
kubernetes.io/cluster-service: "true"
addonmanager.kubernetes.io/mode: Reconcile
spec:
scope: Cluster
group: crd.projectcalico.org
version: v1
names:
kind: GlobalNetworkSet
plural: globalnetworksets
singular: globalnetworkset
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: hostendpoints.crd.projectcalico.org
labels:
kubernetes.io/cluster-service: "true"
addonmanager.kubernetes.io/mode: Reconcile
spec:
scope: Cluster
group: crd.projectcalico.org
version: v1
names:
kind: HostEndpoint
plural: hostendpoints
singular: hostendpoint
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: networkpolicies.crd.projectcalico.org
labels:
kubernetes.io/cluster-service: "true"
addonmanager.kubernetes.io/mode: Reconcile
spec:
scope: Namespaced
group: crd.projectcalico.org
version: v1
names:
kind: NetworkPolicy
plural: networkpolicies
singular: networkpolicy
...@@ -44,6 +44,8 @@ spec: ...@@ -44,6 +44,8 @@ spec:
value: "9093" value: "9093"
- name: TYPHA_DATASTORETYPE - name: TYPHA_DATASTORETYPE
value: "kubernetes" value: "kubernetes"
- name: TYPHA_REPORTINGINTERVALSECS
value: "0"
- name: TYPHA_MAXCONNECTIONSLOWERLIMIT - name: TYPHA_MAXCONNECTIONSLOWERLIMIT
value: "1" value: "1"
- name: TYPHA_HEALTHENABLED - name: TYPHA_HEALTHENABLED
......
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: typha-cpva
labels:
kubernetes.io/cluster-service: "true"
addonmanager.kubernetes.io/mode: Reconcile
rules:
- apiGroups: [""]
resources: ["nodes"]
verbs: ["list"]
- apiGroups: ["apps", "extensions"]
resources: ["deployments"]
verbs: ["patch"]
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: typha-cpva
labels:
kubernetes.io/cluster-service: "true"
addonmanager.kubernetes.io/mode: Reconcile
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: typha-cpva
subjects:
- kind: ServiceAccount
name: typha-cpva
namespace: kube-system
apiVersion: v1
kind: ServiceAccount
metadata:
name: typha-cpva
namespace: kube-system
labels:
kubernetes.io/cluster-service: "true"
addonmanager.kubernetes.io/mode: Reconcile
...@@ -2226,6 +2226,23 @@ EOF ...@@ -2226,6 +2226,23 @@ EOF
fi fi
} }
# A helper function to set up a custom yaml for a k8s addon.
#
# $1: addon category under /etc/kubernetes
# $2: manifest source dir
# $3: manifest file
# $4: custom yaml
function setup-addon-custom-yaml {
local -r manifest_path="/etc/kubernetes/$1/$2/$3"
local -r custom_yaml="$4"
if [ -n "${custom_yaml:-}" ]; then
# Replace with custom manifest.
cat > "${manifest_path}" <<EOF
$custom_yaml
EOF
fi
}
# Prepares the manifests of k8s addons, and starts the addon manager. # Prepares the manifests of k8s addons, and starts the addon manager.
# Vars assumed: # Vars assumed:
# CLUSTER_NAME # CLUSTER_NAME
...@@ -2368,6 +2385,9 @@ EOF ...@@ -2368,6 +2385,9 @@ EOF
if [[ "${NETWORK_POLICY_PROVIDER:-}" == "calico" ]]; then if [[ "${NETWORK_POLICY_PROVIDER:-}" == "calico" ]]; then
setup-addon-manifests "addons" "calico-policy-controller" setup-addon-manifests "addons" "calico-policy-controller"
setup-addon-custom-yaml "addons" "calico-policy-controller" "calico-node-daemonset.yaml" "${CUSTOM_CALICO_NODE_DAEMONSET_YAML:-}"
setup-addon-custom-yaml "addons" "calico-policy-controller" "typha-deployment.yaml" "${CUSTOM_TYPHA_DEPLOYMENT_YAML:-}"
# Configure Calico CNI directory. # Configure Calico CNI directory.
local -r ds_file="${dst_dir}/calico-policy-controller/calico-node-daemonset.yaml" local -r ds_file="${dst_dir}/calico-policy-controller/calico-node-daemonset.yaml"
sed -i -e "s@__CALICO_CNI_DIR__@/home/kubernetes/bin@g" "${ds_file}" sed -i -e "s@__CALICO_CNI_DIR__@/home/kubernetes/bin@g" "${ds_file}"
...@@ -2619,4 +2639,4 @@ if [[ "$#" -eq 1 && "${1}" == "--source-only" ]]; then ...@@ -2619,4 +2639,4 @@ if [[ "$#" -eq 1 && "${1}" == "--source-only" ]]; then
: :
else else
main "${@}" main "${@}"
fi fi
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment