Use cluster name as default subnet tag for Lyft CNI

This commit is contained in:
Ciprian Hacman 2020-02-16 06:15:28 +02:00
parent fd99b3b42f
commit 87bbcd615c
4 changed files with 36 additions and 27 deletions

View File

@ -545,7 +545,7 @@ You can specify which subnets to use for allocating Pod IPs by specifying
networking: networking:
lyftvpc: lyftvpc:
subnetTags: subnetTags:
kubernetes_kubelet: true KubernetesCluster: myclustername.mydns.io
``` ```
In this example, new interfaces will be attached to subnets tagged with `kubernetes_kubelet = true`. In this example, new interfaces will be attached to subnets tagged with `kubernetes_kubelet = true`.

View File

@ -6,6 +6,8 @@
* Terraform users on AWS may need to rename some resources in their state file in order to prepare for Terraform 0.12 support. See Required Actions below. * Terraform users on AWS may need to rename some resources in their state file in order to prepare for Terraform 0.12 support. See Required Actions below.
* Lyft CNI plugin default subnet tags changed from from `Type: pod` to `KubernetesCluster: myclustername.mydns.io`. Subnets intended for use by the plugin will need to be tagged with this new tag and [additional tag filters](https://github.com/lyft/cni-ipvlan-vpc-k8s#other-configuration-flags) may need to be added to the cluster spec in order to achieve the desired set of subnets.
* Support for Kubernetes versions prior to 1.9 has been removed. * Support for Kubernetes versions prior to 1.9 has been removed.
* Kubernetes 1.9 users will need to enable the PodPriority feature gate. See Required Actions below. * Kubernetes 1.9 users will need to enable the PodPriority feature gate. See Required Actions below.

View File

@ -1,26 +1,26 @@
{ {
"cniVersion": "0.3.1",
"name": "cni-ipvlan-vpc-k8s",
"plugins": [
{
"cniVersion": "0.3.1", "cniVersion": "0.3.1",
"name": "cni-ipvlan-vpc-k8s", "type": "cni-ipvlan-vpc-k8s-ipam",
"plugins": [ "interfaceIndex": 1,
{ "skipDeallocation": true,
"cniVersion": "0.3.1", "subnetTags": {{ SubnetTags }},
"type": "cni-ipvlan-vpc-k8s-ipam", "secGroupIds": {{ NodeSecurityGroups }}
"interfaceIndex": 1, },
"skipDeallocation" : true, {
"subnetTags": {{ SubnetTags }}, "cniVersion": "0.3.1",
"secGroupIds": {{ NodeSecurityGroups }} "type": "cni-ipvlan-vpc-k8s-ipvlan",
}, "mode": "l2"
{ },
"cniVersion": "0.3.1", {
"type": "cni-ipvlan-vpc-k8s-ipvlan", "cniVersion": "0.3.1",
"mode": "l2" "type": "cni-ipvlan-vpc-k8s-unnumbered-ptp",
}, "hostInterface": "eth0",
{ "containerInterface": "veth0",
"cniVersion": "0.3.1", "ipMasq": true
"type": "cni-ipvlan-vpc-k8s-unnumbered-ptp", }
"hostInterface": "eth0", ]
"containerInterface": "veth0", }
"ipMasq": true
}
]
}

View File

@ -261,8 +261,15 @@ func (c *NodeUpCommand) Run(out io.Writer) error {
if c.cluster.Spec.Networking.LyftVPC != nil { if c.cluster.Spec.Networking.LyftVPC != nil {
loader.TemplateFunctions["SubnetTags"] = func() (string, error) { loader.TemplateFunctions["SubnetTags"] = func() (string, error) {
tags := map[string]string{ var tags map[string]string
"Type": "pod", if c.cluster.IsKubernetesGTE("1.18") {
tags = map[string]string{
"KubernetesCluster": c.cluster.Name,
}
} else {
tags = map[string]string{
"Type": "pod",
}
} }
if len(c.cluster.Spec.Networking.LyftVPC.SubnetTags) > 0 { if len(c.cluster.Spec.Networking.LyftVPC.SubnetTags) > 0 {
tags = c.cluster.Spec.Networking.LyftVPC.SubnetTags tags = c.cluster.Spec.Networking.LyftVPC.SubnetTags