aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.61k stars 3.91k forks source link

(aws-eks): Apply folder k8s resources to existing cluster #11764

Open shrivastavshubham34 opened 3 years ago

shrivastavshubham34 commented 3 years ago

It would be neat if we could add a folder filled with k8s resources to eks cluster.

kubectl apply -k "github.com/aws/eks-charts/stable/aws-load-balancer-controller//crds?ref=master"

Use Case

I'm trying to add an ALB ingress controller to the EKS cluster. But right now cannot do that through CDK. I need to add custom resource definitions present online. Source: AWS_EKS_INGRESS_GUIDE

kubectl apply -k "github.com/aws/eks-charts/stable/aws-load-balancer-controller//crds?ref=master"

Proposed Solution

I'm not sure how to proceed with this. Adding constructor props to select folder mode to KubernetesManifest class and similarly adding a prop to addManifest() function of @aws-cdk/aws-eks.Cluster class


This is a :rocket: Feature Request

iliapolo commented 3 years ago

@shrivastavshubham34 Just to make sure I understand, you are looking to apply a remote directory located in a GitHub repo correct? Not a local one that is present on your machine.

shrivastavshubham34 commented 3 years ago

Either way is fine.

shrivastavshubham34 commented 3 years ago

Hi, do we have an ETA? If not I can switch to EKSCTL for the time being

iliapolo commented 3 years ago

@shrivastavshubham34 This is not currently planned so I cannot provide an ETA. Would you be interested in submitting a PR?

andcea commented 2 years ago

KubernetesManifests are executed via a CustomResource defined here. That uses kubectl-handler and more specifically kubectl apply.

It seems it always expects a json manifest_text, which it then writes to a file and uses kubectl -f file to execute.
That means kubectl -k commands are not currently supported so we cannot install CRDs like instructed in some AWS docs e.g. https://github.com/aws/eks-charts/tree/master/stable/aws-load-balancer-controller https://github.com/aws/eks-charts/tree/master/stable/appmesh-controller

zululee commented 2 years ago

Surprised its not implemented in kubectl-handler by default, whats the constraint?

pahud commented 1 year ago

I believe it's still possible to be implemented with kubectl-handler.