aws / amazon-vpc-cni-k8s

Networking plugin repository for pod networking in Kubernetes using Elastic Network Interfaces on AWS
Apache License 2.0
2.25k stars 734 forks source link

Make the eniconfig name as string in the template. #2990

Open orsenthil opened 1 month ago

orsenthil commented 1 month ago

When an ENIConfig with name is given a number, instead of string,

apiVersion: crd.k8s.amazonaws.com/v1alpha1
kind: ENIConfig
metadata:
    name: 3
    namespace: kube-system
spec:
    securityGroups:
        - sg-xx
        - sg-xx2
    subnet: subnet-xxx

the helm chart apply throws an error stating

unable to ssa object &{Object:map ... } ... name is required

We have to make the eniconfig name as string in the template.

https://github.com/aws/amazon-vpc-cni-k8s/blob/e8faf2f87615a70f8319d6fdf4df8324ffa4cc20/charts/aws-vpc-cni/templates/eniconfig.yaml#L6

yash97 commented 1 month ago

From the values.yaml, It seems like key is expected to be AZ:- https://github.com/aws/amazon-vpc-cni-k8s/blob/e8faf2f87615a70f8319d6fdf4df8324ffa4cc20/charts/aws-vpc-cni/values.yaml#L220. Readme of charts also confirms that - https://github.com/aws/amazon-vpc-cni-k8s/blob/master/charts/aws-vpc-cni/README.md#configuration. But in code I do not see this name being used anywhere.

orsenthil commented 1 month ago

I think, it is the metadata.name spec that is asserting the type here - https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#metadata

In docs, we recommend the AZ name, previously used to have a suffix-with AZ name. Not sure, how the customer generated the ENIConfig; but they ended up creating a number for name,that threw that error.