Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/smallcase/kube2cdk8s
Converts your k8s YAML to a cdk8s Api Object.
https://github.com/smallcase/kube2cdk8s
cdk8s kubernetes
Last synced: about 2 months ago
JSON representation
Converts your k8s YAML to a cdk8s Api Object.
- Host: GitHub
- URL: https://github.com/smallcase/kube2cdk8s
- Owner: smallcase
- License: apache-2.0
- Created: 2021-09-07T18:14:07.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-10-14T13:09:03.000Z (about 2 years ago)
- Last Synced: 2024-06-19T16:32:37.038Z (6 months ago)
- Topics: cdk8s, kubernetes
- Language: Go
- Homepage:
- Size: 5.78 MB
- Stars: 19
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# 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 v3.0.0
```## 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,
}],
}],
},
},
},
});
```