Skip to content

Commit

Permalink
Make a k8s manifest generator
Browse files Browse the repository at this point in the history
  • Loading branch information
ifd3f committed Mar 9, 2024
1 parent f1196b3 commit c909bc5
Show file tree
Hide file tree
Showing 11 changed files with 4,697 additions and 0 deletions.
1 change: 1 addition & 0 deletions k8s/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
manifests linguist-generated
1 change: 1 addition & 0 deletions k8s/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
1 change: 1 addition & 0 deletions k8s/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
manifests
37 changes: 37 additions & 0 deletions k8s/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { V1DeploymentSpec } from "@kubernetes/client-node";
import { FileWriter } from "./writer";

const exampledeployment = {
apiVersion: "v1",
kind: "Deployment",
metadata: {
name: "example-deployment",
},
spec: {
selector: {},
template: {},
} as V1DeploymentSpec,
};

const files = [
{
filename: "example-deployment.yaml",
content: (_: any) => exampledeployment,
},
];

const writers = [
new FileWriter("manifests/prod", {
env: "prod",
}),
new FileWriter("manifests/staging", {
env: "staging",
}),
new FileWriter("manifests/dev", {
env: "dev",
}),
];

for (const writer of writers) {
writer.writeFiles(files);
}
8 changes: 8 additions & 0 deletions k8s/manifests/dev/example-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# THIS FILE IS AUTO-GENERATED! DO NOT MODIFY DIRECTLY!
apiVersion: "v1"
kind: "Deployment"
metadata:
name: "example-deployment"
spec:
selector: {}
template: {}
8 changes: 8 additions & 0 deletions k8s/manifests/prod/example-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# THIS FILE IS AUTO-GENERATED! DO NOT MODIFY DIRECTLY!
apiVersion: "v1"
kind: "Deployment"
metadata:
name: "example-deployment"
spec:
selector: {}
template: {}
8 changes: 8 additions & 0 deletions k8s/manifests/staging/example-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# THIS FILE IS AUTO-GENERATED! DO NOT MODIFY DIRECTLY!
apiVersion: "v1"
kind: "Deployment"
metadata:
name: "example-deployment"
spec:
selector: {}
template: {}
Loading

0 comments on commit c909bc5

Please sign in to comment.