Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable cdk8s to programmatically generate kubernetes yaml #288

Closed
dodtsair opened this issue Aug 15, 2020 · 3 comments
Closed

Enable cdk8s to programmatically generate kubernetes yaml #288

dodtsair opened this issue Aug 15, 2020 · 3 comments
Assignees
Labels
feature-request New/Enhanced functionality wanted

Comments

@dodtsair
Copy link

Description of the feature or enhancement:

Cdk8s should have APIs enabling the generation of kubernetes yaml. Calling this API on the current chart would produce the yaml for that chart, much like calling synth from the command line. Where the command line synth's the chart into a file, the API call would synth the chart into memory for use with other tools.

Use Case:

CDK EKS has the ability to addResource into an EKS cluster. That API call takes a string as it argument. To do this with cdk8s I would have to run cdk8s from the command line, then UI filesystem APIs to find the produced file, load that file into memory and then call addResource.

If cdk8s had the ability to generate kubernetes yaml via API call into memory. It could be treated as a CDK construct or extension of the CDK. Consuming information from other CDK constructs and producing information for other CDK constructs.


This is a 🚀 Feature Request
Whats this line above mean?

@dodtsair dodtsair added feature-request New/Enhanced functionality wanted needs-triage Priority and effort undetermined yet labels Aug 15, 2020
@J11522
Copy link

J11522 commented Aug 18, 2020

Have a look at the following issues:
#48
aws/aws-cdk#9670

Is that what you are trying to achieve?

Depending on your setup, the solution proposed in #48 (comment) works like a charm. Mind the different versions of the constructs library being used.
This can be solved by creating a separate app scope if possible, but in some use cases you could run in the issue described here:
aws/aws-cdk#9670

@dodtsair
Copy link
Author

@J11522 yeah, 9670 is basically the same thing. I would close this in favor of 9670

I have had other conversations that 9670 also covers to some degree. For example if I want to use efs filesystem in my cluster I would need the efs filesystem id that was created by the CDK which I could then use in cdk8s as volumeHandle to generate the necessary manifest as documented here: https://docs.aws.amazon.com/eks/latest/userguide/efs-csi.html

apiVersion: v1
kind: PersistentVolume
metadata:
  name: efs-pv
spec:
  capacity:
    storage: 5Gi
  volumeMode: Filesystem
  accessModes:
    - ReadWriteMany
  persistentVolumeReclaimPolicy: Retain
  storageClassName: efs-sc
  csi:
    driver: efs.csi.aws.com
    volumeHandle: fs-582a03f3

One of my original thoughts was to have the cdk8s build a yaml file, convert it to json and mark that file as the main file for that project. Then use npm to require that project into my cdk project. I believe this would work, I'll try it later. But this doesn't allow me to take data from the cdk into cdk8s for the manifest that cdk will ultimately apply to the cluster.

@iliapolo
Copy link
Member

@dodtsair I'm closing this because the behavior requested here is available through chart.toJson.

As far as integrating with EKS, please follow aws/aws-cdk#9670 for more details and progress.

Thanks

@iliapolo iliapolo removed the needs-triage Priority and effort undetermined yet label Aug 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New/Enhanced functionality wanted
Projects
None yet
Development

No branches or pull requests

3 participants