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

@ -6,7 +6,7 @@
"cniVersion": "0.3.1", "cniVersion": "0.3.1",
"type": "cni-ipvlan-vpc-k8s-ipam", "type": "cni-ipvlan-vpc-k8s-ipam",
"interfaceIndex": 1, "interfaceIndex": 1,
"skipDeallocation" : true, "skipDeallocation": true,
"subnetTags": {{ SubnetTags }}, "subnetTags": {{ SubnetTags }},
"secGroupIds": {{ NodeSecurityGroups }} "secGroupIds": {{ NodeSecurityGroups }}
}, },

View File

@ -261,9 +261,16 @@ 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
if c.cluster.IsKubernetesGTE("1.18") {
tags = map[string]string{
"KubernetesCluster": c.cluster.Name,
}
} else {
tags = map[string]string{
"Type": "pod", "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
} }