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

feat: add ementas service with Pulumi #64

Merged
merged 45 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
bf0733c
feat: initial pulumi setup
limwa May 22, 2024
0d7e77e
feat: initial work with pulumi
limwa Jun 24, 2024
99da13e
feat: add script to sync crds
limwa Jun 24, 2024
542146e
feat: new method of getting CRDs
limwa Jun 25, 2024
3cb92d0
feat: add ementas service
limwa Jun 25, 2024
14da41a
chore: remove unused file
limwa Jun 25, 2024
e352932
fix: add resources to be deployed
limwa Jun 25, 2024
1e1a9c3
chore: rework crd sync system
limwa Jun 25, 2024
c316cfb
fix: deploy ementas service
limwa Jun 25, 2024
7293d08
wip: add vpn for improved dev experience
limwa Jun 28, 2024
9bad573
feat: add mongodb resource for creating db users
limwa Jul 1, 2024
8140dd7
feat: finish mongodb controller
limwa Jul 1, 2024
092187e
refactor: add mongodb user management to pulumi
limwa Jul 1, 2024
965d187
fix: set operator to watch all namespaces
limwa Jul 1, 2024
1049297
feat: secret replication working
limwa Jul 5, 2024
f56c76d
refactor: unify mongodb deployment for prod and dev
limwa Jul 5, 2024
3f676bc
chore: remove unused file
limwa Jul 5, 2024
0a68e52
refactor: logic for concatenation of lists
limwa Jul 5, 2024
64afbeb
refactor: use commit signals and pending values
limwa Jul 5, 2024
04103b5
refactor: move mongodb chart to pulumi
limwa Jul 5, 2024
b6f61f5
fix: use longhorn storage class
limwa Jul 5, 2024
f6c87c1
chore: rename charts folder to assets
limwa Jul 5, 2024
18dbfa1
refactor: move things around and separate concerns
limwa Jul 7, 2024
ff6bb57
chore: comment out clustersecret crds
limwa Jul 13, 2024
c22a550
fix: add yq check to sync-crds.sh
limwa Jul 13, 2024
8df46a5
chore: fix typo
limwa Jul 13, 2024
d54cdce
refactor: minor touchups
limwa Jul 15, 2024
0dbf12f
chore: add eslint and prettier
limwa Jul 15, 2024
96c5858
style: format files
limwa Jul 15, 2024
9e7248a
chore: fix some eslint problems
limwa Jul 15, 2024
1865872
chore: add scripts for eslint and prettier
limwa Jul 15, 2024
8f78b91
chore: configure typed linting
limwa Jul 16, 2024
8b3b737
style: format code
limwa Jul 16, 2024
944abeb
ci: add checks for pulumi code
limwa Jul 16, 2024
dfa4a9d
ci: fix path for execution
limwa Jul 16, 2024
fe0d8ae
chore: rework project structure
limwa Jul 17, 2024
2e6bcdf
chore: minor changes to sync-crds
limwa Jul 17, 2024
49b1152
chore: update main package.json
limwa Jul 17, 2024
5259b67
chore: update package names
limwa Jul 17, 2024
4c60d16
ci: reuse preparation steps
limwa Jul 17, 2024
5352042
chore: silence yq warnings
limwa Jul 17, 2024
1995438
chore: recreate stack
limwa Jul 17, 2024
f1aa9f7
Merge branch 'main' into feature/pulumi
limwa Jul 22, 2024
c610b82
chore: comment out ementas service
limwa Aug 8, 2024
320a449
Merge branch 'main' into feature/pulumi
limwa Aug 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 108 additions & 0 deletions schemas/crds.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
{
"$schema": "https://json-schema.org/draft-07/schema",
"$id": "https://niployments.niaefeup.pt/schemas/crds.schema.json",
"title": "CRDs Download Configuration",
"description": "Configuration for the download and extraction of CRDs, used for Pulumi-based resources",
"type": "object",
"required": ["manifests"],
"additionalProperties": false,
"properties": {
"repositories": {
"description": "List of repositories to add to the Helm client",
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"required": ["name", "url"],
"additionalProperties": false,
"properties": {
"name": {
"type": "string"
},
"url": {
"type": "string"
}
}
}
},
"manifests": {
"description": "List of manifests to download and extract CRDs from",
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"oneOf": [
{
"type":"object",
"required": ["type", "chart"],
"additionalProperties": false,
"properties": {
"type": {
"description": "Method for downloading the CRDs",
"type": "string",
"enum": ["helm"]
},
"chart": {
"description": "Name of the Helm chart to download",
"type": "string",
"examples": ["traefik/traefik"]
},
"version": {
"description": "Version of the Helm chart to download",
"type": "string",
"examples": ["28.3.0"]
}
}
},
{
"type":"object",
"required": ["type", "chart"],
"additionalProperties": false,
"properties": {
"type": {
"description": "Method for downloading the CRDs",
"type": "string",
"enum": ["template"]
},
"chart": {
"description": "Name of the Helm chart to download",
"type": "string",
"examples": ["jetstack/cert-manager"]
},
"version": {
"description": "Version of the Helm chart to download",
"type": "string",
"examples": ["v1.14.7"]
},
"options": {
"description": "Options to pass to the Helm template command",
"type": "string"
}
}
},
{
"type":"object",
"required": ["type", "name", "url"],
"additionalProperties": false,
"properties": {
"type": {
"description": "Method for downloading the CRDs",
"type": "string",
"enum": ["curl"]
},
"name": {
"description": "Name of the manifest to download",
"type": "string",
"examples": ["cloudnative-pg/cloudnative-pg"]
},
"url": {
"description": "URL to download the chart from",
"type": "string"
}
}
}
]
}
}
}
}
2 changes: 1 addition & 1 deletion services/cert-manager/deploy-dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ helm repo update

kubectl apply -f $(dirname $0)/00-namespace.yaml

helm upgrade --install -f $(dirname $0)/values.yaml cert-manager jetstack/cert-manager --namespace cert-manager
helm upgrade --install -f $(dirname $0)/values.yaml cert-manager jetstack/cert-manager --version v1.14.7 --namespace cert-manager

kubectl apply -f $(dirname $0)/01-cluster-issuer-dev.yaml
2 changes: 1 addition & 1 deletion services/databases/mongodb/deploy-mongodb-dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ mongodb_dir='./services/databases/mongodb'
pods=$(cat $mongodb_dir/mongodb-cluster.yaml | awk '{if ($1 == "members:") print $2}')

helm repo add mongodb https://mongodb.github.io/helm-charts
helm install community-operator mongodb/community-operator --namespace mongodb --create-namespace
helm install community-operator mongodb/community-operator --namespace mongodb --create-namespace --set operator.watchNamespace="*"
kubectl apply -f $mongodb_dir/mongodb-cluster.yaml --namespace mongodb
sleep 20 # Wait a little bit for first pod to be created

Expand Down
3 changes: 3 additions & 0 deletions services/pulumi/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/bin/
/node_modules/
/crds/
7 changes: 7 additions & 0 deletions services/pulumi/Pulumi.prod.yaml
limwa marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
encryptionsalt: v1:6vimz/8deKQ=:v1:2jXtXVp4buA9Qw0S:Msz9WV6s+ixqlVstCWD6COpFetFONg==
config:
niployments:ementas-mongodb-uri: mongodb://nimentas:[email protected]:27017,mongodb-op-1.mongodb-op-svc.mongodb.svc.cluster.local:27017,mongodb-op-2.mongodb-op-svc.mongodb.svc.cluster.local:27017/nimentas?replicaSet=mongodb-op&ssl=false
niployments:mongodb/admin-password:
secure: v1:f6NgA0SBJ6F+P7gK:FOskiEA/fOLlODxh97fwz8jB06g=
niployments:mongodb/nimentas-password:
secure: v1:PB1bxtgnlIy6WG0S:7L4PZjiDpx5/IQlr/FPwoohK4QA=
7 changes: 7 additions & 0 deletions services/pulumi/Pulumi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: niployments
runtime: nodejs
description: Pulumi program to manage the niployments cluster
config:
pulumi:tags:
value:
pulumi:template: kubernetes-typescript
46 changes: 46 additions & 0 deletions services/pulumi/crds.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# yaml-language-server: $schema=../../schemas/crds.schema.json
repositories:
- name: jetstack
url: https://charts.jetstack.io
- name: clustersecret
url: https://charts.clustersecret.io/
- name: mongodb
url: https://mongodb.github.io/helm-charts
- name: longhorn
url: https://charts.longhorn.io
- name: traefik
url: https://traefik.github.io/charts

manifests:
# cert-manager
- type: template
chart: jetstack/cert-manager
version: v1.14.7
options: |
--values=../cert-manager/values.yaml
--namespace=cert-manager
# cilium - no CRDs
# cluster-secret
- type: helm
chart: clustersecret/cluster-secret
# databases/mongodb
- type: template
chart: mongodb/community-operator
options: |
--namespace=mongodb
# databases/postgresql
- type: curl
name: cloudnative-pg/cloudnative-pg
url: https://raw.githubusercontent.com/cloudnative-pg/cloudnative-pg/release-1.22/releases/cnpg-1.22.2.yaml
# image-registry (harbor) - no CRDs
# storage/longhorn
- type: template
chart: longhorn/longhorn
version: 1.6.1
options: |
--values=../storage/longhorn/prod-values.yaml
--namespace=longhorn
# traefik
- type: helm
chart: traefik/traefik
version: 28.3.0
4 changes: 4 additions & 0 deletions services/pulumi/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { apps } from "./services/databases/mongodb";
import "./services/ementas";

apps.commit();
19 changes: 19 additions & 0 deletions services/pulumi/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "niployments",
"main": "index.ts",
"devDependencies": {
"@types/node": "^18.19.39",
"typescript": "^5.5.3"
},
"dependencies": {
"@pulumi/kubernetes": "^4.14.0",
"@pulumi/pulumi": "^3.121.0"
},
"imports": {
"#crds": "./crds/nodejs/index.ts",
"#resources/": "./resources/",
"#services/": "./services/",
"#utils/": "./utils/"
},
"packageManager": "[email protected]+sha512.67f5879916a9293e5cf059c23853d571beaf4f753c707f40cb22bed5fb1578c6aad3b6c4107ccb3ba0b35be003eb621a16471ac836c87beb53f9d54bb4612724"
}
Loading
Loading