Converts your k8s YAML to a cdk8s Api Object.

Overview

kube2cdk8s

Converts your k8s YAML to a cdk8s Api Object.

Uses Pulumi's kube2pulumi as a base.

Dependencies

1. pulumi cli
2. pulumi kubernetes provider
$ curl -fsSL https://get.pulumi.com | sh
$ pulumi plugin install resource kubernetes v2.4.2

Usage

$ go test
$ go build
$ printf 'apiVersion: v1
kind: ServiceAccount
metadata:
  name: my-service-account
  namespace: my-namespace' > temp.yaml
$ ./kube2cdk8s typescript -f temp.yaml
new k8s.KubeServiceAccount(this, "my-service-account", {
    metadata: {
        name: "my-service-account",
        namespace: "my-namespace",
    },
});
printf '---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-deployment
  namespace: my-namespace
spec:
  selector:
    matchLabels:
      app: my-deployment
  replicas: 3
  template:
    metadata:
      labels:
        app: my-deployment
    spec:
      containers:
      - name: my-deployment
        image: my-image
        imagePullPolicy: Always
        ports:
        - containerPort: 8080
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-deployment-2
  namespace: my-namespace-2
spec:
  selector:
    matchLabels:
      app: my-deployment-2
  replicas: 4
  template:
    metadata:
      labels:
        app: my-deployment-2
    spec:
      containers:
      - name: my-deployment-2
        image: my-image-2
        imagePullPolicy: Always
        ports:
        - containerPort: 8080' > temp.yaml
$ ./kube2cdk8s typescript -m true -f temp.yaml
new k8s.KubeDeployment(this, "my-deployment", {
    metadata: {
        name: "my-deployment",
        namespace: "my-namespace",
    },
    spec: {
        selector: {
            matchLabels: {
                app: "my-deployment",
            },
        },
        replicas: 3,
        template: {
            metadata: {
                labels: {
                    app: "my-deployment",
                },
            },
            spec: {
                containers: [{
                    name: "my-deployment",
                    image: "my-image",
                    imagePullPolicy: "Always",
                    ports: [{
                        containerPort: 8080,
                    }],
                }],
            },
        },
    },
});

new k8s.KubeDeployment(this, "my-deployment-2", {
    metadata: {
        name: "my-deployment-2",
        namespace: "my-namespace-2",
    },
    spec: {
        selector: {
            matchLabels: {
                app: "my-deployment-2",
            },
        },
        replicas: 4,
        template: {
            metadata: {
                labels: {
                    app: "my-deployment-2",
                },
            },
            spec: {
                containers: [{
                    name: "my-deployment-2",
                    image: "my-image-2",
                    imagePullPolicy: "Always",
                    ports: [{
                        containerPort: 8080,
                    }],
                }],
            },
        },
    },
});
You might also like...
Poc rsa - A simple golang scaffolding to help me to create new api projects or workers with golang on k8s

go-scaffold A simple golang scaffolding to help me to create new api projects or

A shields.io API for your youtube channel to protect your api key
A shields.io API for your youtube channel to protect your api key

Youtube-Channel-Badge A shields.io API for your youtube channel to protect your

Simple online syncing tool for Oracle Object Store

TrollBox ... use your storage with Oracle Object Store Quick Start Make sure you have the Object Storage, bucket and you know the compartment id where

S3pd - CLI utility that downloads multiple s3 objects at a time, with multiple range-requests issued per object

S3 Parallel Downloader CLI utility that downloads multiple s3 objects at a time,

top for k8s
top for k8s

ktop A visualized monitoring dashboard for Kubernetes. kubectl also has top subcommand, but it is not able to: Watch usages regularly for Pod/Node Com

:recycle: Now you can easily rollback to previous deployed images whatever you want on k8s environment

EasyRollback EasyRollback is aim to easy rollback to previous images that deployed on k8s environment Installation You should have go installation fir

go-zero 从零到 k8s 部署

启动: 注意事项: dockerfile 文件配置了 LOCAL_HOST 环境变量 1、项目目录下执行 ./docker.sh 脚本生成 rpc服务docker镜像 ./docker.sh 2、docker-compose-db 创建 mysql redis etcd 容器 执行命令

Kilo is a multi-cloud network overlay built on WireGuard and designed for Kubernetes (k8s + wg = kg)

Kilo Kilo is a multi-cloud network overlay built on WireGuard and designed for Kubernetes. Overview Kilo connects nodes in a cluster by providing an e

A k8s vault webhook is a Kubernetes webhook that can inject secrets into Kubernetes resources by connecting to multiple secret managers
A k8s vault webhook is a Kubernetes webhook that can inject secrets into Kubernetes resources by connecting to multiple secret managers

k8s-vault-webhook is a Kubernetes admission webhook which listen for the events related to Kubernetes resources for injecting secret directly from sec

Releases(v1.3.1)
Owner
smallcase
smallcase
Write controller-runtime based k8s controllers that read/write to git, not k8s

Git Backed Controller The basic idea is to write a k8s controller that runs against git and not k8s apiserver. So the controller is reading and writin

Darren Shepherd 50 Dec 10, 2021
K8s-cinder-csi-plugin - K8s Pod Use Openstack Cinder Volume

k8s-cinder-csi-plugin K8s Pod Use Openstack Cinder Volume openstack volume list

douyali 0 Jul 18, 2022
K8s-ingress-health-bot - A K8s Ingress Health Bot is a lightweight application to check the health of the ingress endpoints for a given kubernetes namespace.

k8s-ingress-health-bot A K8s Ingress Health Bot is a lightweight application to check the health of qualified ingress endpoints for a given kubernetes

Aaron Tam 0 Jan 2, 2022
No YAML deployments to K8s

no-yaml No YAML deployments to K8s with following approaches: Pulumi NAML cdk8s We will deploy the ?? ?? CNCF App Delivery SIG Demo podtato-head and u

Engin Diri 10 Dec 27, 2022
Sample Driver that provides reference implementation for Container Object Storage Interface (COSI) API

cosi-driver-minio Sample Driver that provides reference implementation for Container Object Storage Interface (COSI) API Community, discussion, contri

Kubernetes SIGs 7 Oct 10, 2022
k8s-image-swapper Mirror images into your own registry and swap image references automatically.

k8s-image-swapper Mirror images into your own registry and swap image references automatically. k8s-image-swapper is a mutating webhook for Kubernetes

Enrico Stahn 335 Dec 27, 2022
A k8s operator to reduce CO2 footprint of your clusters

How many of your dev/preview pods stay on during weekends? Or at night? It's a waste of resources! And money! But fear not, kube-green is here to the

null 360 Jan 3, 2023
A handy utility to generate configmap and values.yaml of your application for helmifying them

Helmfig Are you tired of writing values.yaml for configmap of your project when you are helmifying them? Helmfig is a handy tool that can generate the

Snapp Cab Incubators 25 Dec 14, 2022
K8s controller implementing Multi-Cluster Services API based on AWS Cloud Map.

AWS Cloud Map MCS Controller for K8s Introduction AWS Cloud Map multi-cluster service discovery for Kubernetes (K8s) is a controller that implements e

Amazon Web Services 69 Dec 17, 2022
crud is a cobra based CLI utility which helps in scaffolding a simple go based micro-service along with build scripts, api documentation, micro-service documentation and k8s deployment manifests

crud crud is a CLI utility which helps in scaffolding a simple go based micro-service along with build scripts, api documentation, micro-service docum

Piyush Jajoo 0 Nov 29, 2021