1
0
mirror of https://github.com/rancher/rke.git synced 2025-08-31 14:36:32 +00:00

Add custom flexvolume capabilities to canal and calico

This commit is contained in:
Chris Kim
2020-02-21 10:52:18 -08:00
parent 64f0d7808d
commit 97371fe82d
2 changed files with 19 additions and 8 deletions

View File

@@ -65,6 +65,10 @@ const (
DefaultFlannelBackendVxLanPort = "8472"
DefaultFlannelBackendVxLanVNI = "1"
DefaultCalicoFlexVolPluginDirectory = "/usr/libexec/kubernetes/kubelet-plugins/volume/exec/nodeagent~uds"
DefaultCanalFlexVolPluginDirectory = "/usr/libexec/kubernetes/kubelet-plugins/volume/exec/nodeagent~uds"
KubeAPIArgAdmissionControlConfigFile = "admission-control-config-file"
DefaultKubeAPIArgAdmissionControlConfigFileValue = "/etc/kubernetes/admission.yaml"
@@ -503,7 +507,8 @@ func (c *Cluster) setClusterNetworkDefaults() {
switch c.Network.Plugin {
case CalicoNetworkPlugin:
networkPluginConfigDefaultsMap = map[string]string{
CalicoCloudProvider: DefaultNetworkCloudProvider,
CalicoCloudProvider: DefaultNetworkCloudProvider,
CalicoFlexVolPluginDirectory: DefaultCalicoFlexVolPluginDirectory,
}
case FlannelNetworkPlugin:
networkPluginConfigDefaultsMap = map[string]string{
@@ -516,6 +521,7 @@ func (c *Cluster) setClusterNetworkDefaults() {
CanalFlannelBackendType: DefaultFlannelBackendVxLan,
CanalFlannelBackendPort: DefaultFlannelBackendVxLanPort,
CanalFlannelBackendVxLanNetworkIdentify: DefaultFlannelBackendVxLanVNI,
CanalFlexVolPluginDirectory: DefaultCanalFlexVolPluginDirectory,
}
}
if c.Network.CalicoNetworkProvider != nil {

View File

@@ -52,10 +52,11 @@ const (
// FlannelBackendVxLanNetworkIdentify should be greater than or equal to 4096 if using VxLan mode in the cluster with Windows nodes
FlannelBackendVxLanNetworkIdentify = "flannel_backend_vni"
CalicoNetworkPlugin = "calico"
CalicoNodeLabel = "calico-node"
CalicoControllerLabel = "calico-kube-controllers"
CalicoCloudProvider = "calico_cloud_provider"
CalicoNetworkPlugin = "calico"
CalicoNodeLabel = "calico-node"
CalicoControllerLabel = "calico-kube-controllers"
CalicoCloudProvider = "calico_cloud_provider"
CalicoFlexVolPluginDirectory = "calico_flex_volume_plugin_dir"
CanalNetworkPlugin = "canal"
CanalIface = "canal_iface"
@@ -64,6 +65,7 @@ const (
CanalFlannelBackendPort = "canal_flannel_backend_port"
// CanalFlannelBackendVxLanNetworkIdentify should be greater than or equal to 4096 if using Flannel VxLan mode in the cluster with Windows nodes
CanalFlannelBackendVxLanNetworkIdentify = "canal_flannel_backend_vni"
CanalFlexVolPluginDirectory = "canal_flex_volume_plugin_dir"
WeaveNetworkPlugin = "weave"
WeaveNetworkAppName = "weave-net"
@@ -104,6 +106,7 @@ const (
FlannelInterface = "FlannelInterface"
FlannelBackend = "FlannelBackend"
CanalInterface = "CanalInterface"
FlexVolPluginDir = "FlexVolPluginDir"
WeavePassword = "WeavePassword"
MTU = "MTU"
RBACConfig = "RBACConfig"
@@ -199,6 +202,7 @@ func (c *Cluster) doCalicoDeploy(ctx context.Context, data map[string]interface{
NodeSelector: c.Network.NodeSelector,
MTU: c.Network.MTU,
UpdateStrategy: c.Network.UpdateStrategy,
FlexVolPluginDir: c.Network.Options[CalicoFlexVolPluginDirectory],
}
pluginYaml, err := c.getNetworkPluginManifest(calicoConfig, data)
if err != nil {
@@ -236,9 +240,10 @@ func (c *Cluster) doCanalDeploy(ctx context.Context, data map[string]interface{}
"VNI": flannelVni,
"Port": flannelPort,
},
NodeSelector: c.Network.NodeSelector,
MTU: c.Network.MTU,
UpdateStrategy: c.Network.UpdateStrategy,
NodeSelector: c.Network.NodeSelector,
MTU: c.Network.MTU,
UpdateStrategy: c.Network.UpdateStrategy,
FlexVolPluginDir: c.Network.Options[CanalFlexVolPluginDirectory],
}
pluginYaml, err := c.getNetworkPluginManifest(canalConfig, data)
if err != nil {