Skip to main content

Run your apps on Kubernetes cluster without bored YAMLing

Project description

cdk8s-debore

Run your apps on Kubernetes cluster without bored YAMLing, powered by the cdk8s project 🚀

Overview

cdk8s-debore is a cdk8s library which allows you to define your Kubernetes app with just few lines of code.

# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
DeboredApp(self, "webapp",
    image="your-image:latest",
    auto_scale=True,
    ingress=IngressType.NGINX_INGRESS
)

Then the Kubernetes manifests created by cdk8s synth command will have Kubernetes resources such as Deployment, Service, HorizontalPodAutoscaler, Ingress, as follows.

manifest.k8s.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-app-webapp-deployment-deployment-d67b425c
  namespace: default
spec:
  selector:
    matchLabels:
      app: myappwebapp4BD95A2A
  template:
    metadata:
      labels:
        app: myappwebapp4BD95A2A
    spec:
      containers:
        - image: your-image:latest
          imagePullPolicy: Always
          name: app
          ports:
            - containerPort: 8080
          resources:
            limits:
              cpu: 400m
              memory: 512Mi
            requests:
              cpu: 200m
              memory: 256Mi
---
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
  name: my-app-webapp-deployment-hpa-bd8107fd
  namespace: default
spec:
  maxReplicas: 10
  metrics:
    - resource:
        name: cpu
        target:
          averageUtilization: 85
          type: Utilization
      type: Resource
    - resource:
        name: memory
        target:
          averageUtilization: 75
          type: Utilization
      type: Resource
  minReplicas: 1
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: my-app-webapp-deployment-deployment-d67b425c
---
apiVersion: v1
kind: Service
metadata:
  name: my-app-webapp-exposable-service-d6a35671
  namespace: default
spec:
  ports:
    - port: 8080
      targetPort: 80
  selector:
    app: myappwebapp4BD95A2A
  type: ClusterIP
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/rewrite-target: /
  name: my-app-webapp-exposable-ingress-c350957f
  namespace: default
spec:
  rules:
    - http:
        paths:
          - backend:
              serviceName: my-app-webapp-exposable-service-d6a35671
              servicePort: 80
            path: /my-app-webapp-deployment-deployment-d67b425c

Installation

cdk8s supports TypeScript and Python at this point, so as cdk8s-debore.

We'd recommend to walk through the cdk8s Getting Started guide before using this library, if you're very new to cdk8s world.

TypeScript

Use npm or yarn to install.

$ npm install -s cdk8s-debore

or

$ yarn add cdk8s-debore

Python

$ pip install cdk8s-debore

Contribution

  1. Fork (https://github.com/toricls/cdk8s-debore/fork)

  2. Bootstrap the repo:

    npx projen   # generates package.json and friends
    yarn install # installs dependencies
    
  3. Development scripts:

    Command Description
    yarn compile Compiles typescript => javascript
    yarn watch Watch & compile
    yarn test Run unit test & linter through jest
    yarn test -u Update jest snapshots
    yarn run package Creates a dist with packages for all languages.
    yarn build Compile + test + package
    yarn bump Bump version (with changelog) based on conventional commits
    yarn release Bump + push to master
  4. Create a feature branch

  5. Commit your changes

  6. Rebase your local changes against the master branch

  7. Create a new Pull Request (use conventional commits for the title please)

Licence

Apache License, Version 2.0

Author

Tori

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cdk8s-debore-0.1.1.tar.gz (283.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cdk8s_debore-0.1.1-py3-none-any.whl (281.8 kB view details)

Uploaded Python 3

File details

Details for the file cdk8s-debore-0.1.1.tar.gz.

File metadata

  • Download URL: cdk8s-debore-0.1.1.tar.gz
  • Upload date:
  • Size: 283.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.6

File hashes

Hashes for cdk8s-debore-0.1.1.tar.gz
Algorithm Hash digest
SHA256 bc4063b6ec93ec09c332419c9e377a7d378c832a618e603c69f1e8afef7d38d2
MD5 77e162cb4292c946a359889c385ddb4e
BLAKE2b-256 a9b031747cd9f88789f8983795afcbb61a2b7e47bc5b4458aebb468af673baed

See more details on using hashes here.

File details

Details for the file cdk8s_debore-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: cdk8s_debore-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 281.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.6

File hashes

Hashes for cdk8s_debore-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 29b92566bf3944ee4106a209caad6b9ea336b2faa2cfcab08080640356ea51f0
MD5 ac2bddceccdb498abb93b55e717a86fe
BLAKE2b-256 d682aa5eeb235fe58236ae5086e730d71793cb750b1d57189a0857242d416e4b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page