Skip to content

Commit

Permalink
Better flannel configuration
Browse files Browse the repository at this point in the history
Force flannel to use internal network when available

Signed-off-by: Artiom Diomin <[email protected]>
  • Loading branch information
kron4eg committed Jul 22, 2019
1 parent 55d54db commit 98e7dd7
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 34 deletions.
60 changes: 31 additions & 29 deletions pkg/templates/canal/canal.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,40 +39,42 @@ const (
// automatically populated
cniNetworkConfig = `
{
"name": "k8s-pod-network",
"cniVersion": "0.3.0",
"plugins": [
{
"type": "calico",
"log_level": "info",
"datastore_type": "kubernetes",
"nodename": "__KUBERNETES_NODE_NAME__",
"ipam": {
"type": "host-local",
"subnet": "usePodCidr"
},
"policy": {
"type": "k8s"
},
"kubernetes": {
"kubeconfig": "__KUBECONFIG_FILEPATH__"
}
},
{
"type": "portmap",
"snat": true,
"capabilities": {"portMappings": true}
}
]
"name": "k8s-pod-network",
"cniVersion": "0.3.0",
"plugins": [
{
"type": "calico",
"log_level": "info",
"datastore_type": "kubernetes",
"nodename": "__KUBERNETES_NODE_NAME__",
"ipam": {
"type": "host-local",
"subnet": "usePodCidr"
},
"policy": {
"type": "k8s"
},
"kubernetes": {
"kubeconfig": "__KUBECONFIG_FILEPATH__"
}
},
{
"type": "portmap",
"snat": true,
"capabilities": {
"portMappings": true
}
}
]
}
`
// Flannel network configuration (mounted into the flannel container)
flannelNetworkConfig = `
{
"Network": "{{ .POD_SUBNET }}",
"Backend": {
"Type": "vxlan"
}
"Network": "{{ .POD_SUBNET }}",
"Backend": {
"Type": "vxlan"
}
}
`
)
Expand Down
7 changes: 2 additions & 5 deletions pkg/templates/canal/daemonset.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,11 +290,8 @@ func daemonSet() *appsv1.DaemonSet {
{
Name: "FLANNELD_IFACE",
ValueFrom: &corev1.EnvVarSource{
ConfigMapKeyRef: &corev1.ConfigMapKeySelector{
Key: "canal_iface",
LocalObjectReference: corev1.LocalObjectReference{
Name: "canal-config",
},
FieldRef: &corev1.ObjectFieldSelector{
FieldPath: "status.hostIP",
},
},
},
Expand Down

0 comments on commit 98e7dd7

Please sign in to comment.