diff --git a/clusters/atlas/applications/kustomization.yaml b/clusters/atlas/applications/kustomization.yaml index 209790b..a32ec81 100644 --- a/clusters/atlas/applications/kustomization.yaml +++ b/clusters/atlas/applications/kustomization.yaml @@ -9,3 +9,4 @@ resources: - ../../services/monitoring - ../../services/pegasus - ../../services/vault + - ../../services/bstein-dev-home diff --git a/clusters/atlas/flux-system/applications/bstein-dev-home/image-automation.yaml b/clusters/atlas/flux-system/applications/bstein-dev-home/image-automation.yaml new file mode 100644 index 0000000..889aa2d --- /dev/null +++ b/clusters/atlas/flux-system/applications/bstein-dev-home/image-automation.yaml @@ -0,0 +1,26 @@ +# clusters/atlas/flux-system/applications/bstein-dev-home/image-automation.yaml +apiVersion: image.toolkit.fluxcd.io/v1 +kind: ImageUpdateAutomation +metadata: + name: bstein-dev-home + namespace: flux-system +spec: + interval: 1m0s + sourceRef: + kind: GitRepository + name: flux-system + namespace: flux-system + git: + checkout: + ref: + branch: feature/ci-gitops + commit: + author: + email: ops@bstein.dev + name: flux-bot + messageTemplate: "chore(bstein-dev-home): update images to {{range .Updated.Images}}{{.}}{{end}}" + push: + branch: feature/ci-gitops + update: + strategy: Setters + path: services/bstein-dev-home diff --git a/clusters/atlas/flux-system/applications/bstein-dev-home/kustomization.yaml b/clusters/atlas/flux-system/applications/bstein-dev-home/kustomization.yaml new file mode 100644 index 0000000..000eea3 --- /dev/null +++ b/clusters/atlas/flux-system/applications/bstein-dev-home/kustomization.yaml @@ -0,0 +1,15 @@ +# clusters/atlas/flux-system/applications/bstein-dev-home/kustomization.yaml +apiVersion: kustomize.toolkit.fluxcd.io/v1 +kind: Kustomization +metadata: + name: bstein-dev-home + namespace: flux-system +spec: + interval: 10m + path: ./services/bstein-dev-home + prune: true + sourceRef: + kind: GitRepository + name: flux-system + targetNamespace: bstein-dev-home + wait: false diff --git a/clusters/atlas/flux-system/applications/kustomization.yaml b/clusters/atlas/flux-system/applications/kustomization.yaml index 62caed7..5825734 100644 --- a/clusters/atlas/flux-system/applications/kustomization.yaml +++ b/clusters/atlas/flux-system/applications/kustomization.yaml @@ -9,6 +9,8 @@ resources: - monerod/kustomization.yaml - pegasus/kustomization.yaml - pegasus/image-automation.yaml + - bstein-dev-home/kustomization.yaml + - bstein-dev-home/image-automation.yaml - harbor/kustomization.yaml - harbor/image-automation.yaml - jellyfin/kustomization.yaml diff --git a/services/bstein-dev-home/backend-deployment.yaml b/services/bstein-dev-home/backend-deployment.yaml new file mode 100644 index 0000000..1159487 --- /dev/null +++ b/services/bstein-dev-home/backend-deployment.yaml @@ -0,0 +1,48 @@ +# services/bstein-dev-home/backend-deployment.yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: bstein-dev-home-backend + namespace: bstein-dev-home +spec: + replicas: 2 + revisionHistoryLimit: 3 + selector: + matchLabels: + app: bstein-dev-home-backend + template: + metadata: + labels: + app: bstein-dev-home-backend + spec: + nodeSelector: + kubernetes.io/arch: arm64 + node-role.kubernetes.io/worker: "true" + imagePullSecrets: + - name: harbor-bstein-robot + containers: + - name: backend + image: registry.bstein.dev/bstein/bstein-dev-home-backend:latest + imagePullPolicy: Always + ports: + - name: http + containerPort: 8080 + readinessProbe: + httpGet: + path: /api/healthz + port: http + initialDelaySeconds: 2 + periodSeconds: 5 + livenessProbe: + httpGet: + path: /api/healthz + port: http + initialDelaySeconds: 10 + periodSeconds: 10 + resources: + requests: + cpu: 50m + memory: 64Mi + limits: + cpu: 300m + memory: 256Mi diff --git a/services/bstein-dev-home/backend-service.yaml b/services/bstein-dev-home/backend-service.yaml new file mode 100644 index 0000000..75ec16c --- /dev/null +++ b/services/bstein-dev-home/backend-service.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: bstein-dev-home-backend + namespace: bstein-dev-home +spec: + selector: + app: bstein-dev-home-backend + ports: + - name: http + port: 80 + targetPort: 8080 diff --git a/services/bstein-dev-home/frontend-deployment.yaml b/services/bstein-dev-home/frontend-deployment.yaml new file mode 100644 index 0000000..7189bee --- /dev/null +++ b/services/bstein-dev-home/frontend-deployment.yaml @@ -0,0 +1,48 @@ +# services/bstein-dev-home/frontend-deployment.yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: bstein-dev-home-frontend + namespace: bstein-dev-home +spec: + replicas: 2 + revisionHistoryLimit: 3 + selector: + matchLabels: + app: bstein-dev-home-frontend + template: + metadata: + labels: + app: bstein-dev-home-frontend + spec: + nodeSelector: + kubernetes.io/arch: arm64 + node-role.kubernetes.io/worker: "true" + imagePullSecrets: + - name: harbor-bstein-robot + containers: + - name: frontend + image: registry.bstein.dev/bstein/bstein-dev-home-frontend:latest + imagePullPolicy: Always + ports: + - name: http + containerPort: 80 + readinessProbe: + httpGet: + path: / + port: http + initialDelaySeconds: 2 + periodSeconds: 5 + livenessProbe: + httpGet: + path: / + port: http + initialDelaySeconds: 10 + periodSeconds: 10 + resources: + requests: + cpu: 50m + memory: 64Mi + limits: + cpu: 300m + memory: 256Mi diff --git a/services/bstein-dev-home/frontend-service.yaml b/services/bstein-dev-home/frontend-service.yaml new file mode 100644 index 0000000..8540580 --- /dev/null +++ b/services/bstein-dev-home/frontend-service.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: bstein-dev-home-frontend + namespace: bstein-dev-home +spec: + selector: + app: bstein-dev-home-frontend + ports: + - name: http + port: 80 + targetPort: 80 diff --git a/services/bstein-dev-home/image.yaml b/services/bstein-dev-home/image.yaml new file mode 100644 index 0000000..4462ba5 --- /dev/null +++ b/services/bstein-dev-home/image.yaml @@ -0,0 +1,48 @@ +# services/bstein-dev-home/image.yaml +apiVersion: image.toolkit.fluxcd.io/v1beta2 +kind: ImageRepository +metadata: + name: bstein-dev-home-frontend + namespace: bstein-dev-home +spec: + image: registry.bstein.dev/bstein/bstein-dev-home-frontend + interval: 1m0s +--- +apiVersion: image.toolkit.fluxcd.io/v1beta2 +kind: ImagePolicy +metadata: + name: bstein-dev-home-frontend + namespace: bstein-dev-home +spec: + imageRepositoryRef: + name: bstein-dev-home-frontend + filterTags: + pattern: '^v?(?P[0-9]+\\.[0-9]+\\.[0-9]+(?:[-.][0-9A-Za-z]+)?)$' + extract: '$version' + policy: + semver: + range: ">=0.1.0" +--- +apiVersion: image.toolkit.fluxcd.io/v1beta2 +kind: ImageRepository +metadata: + name: bstein-dev-home-backend + namespace: bstein-dev-home +spec: + image: registry.bstein.dev/bstein/bstein-dev-home-backend + interval: 1m0s +--- +apiVersion: image.toolkit.fluxcd.io/v1beta2 +kind: ImagePolicy +metadata: + name: bstein-dev-home-backend + namespace: bstein-dev-home +spec: + imageRepositoryRef: + name: bstein-dev-home-backend + filterTags: + pattern: '^v?(?P[0-9]+\\.[0-9]+\\.[0-9]+(?:[-.][0-9A-Za-z]+)?)$' + extract: '$version' + policy: + semver: + range: ">=0.1.0" diff --git a/services/bstein-dev-home/ingress.yaml b/services/bstein-dev-home/ingress.yaml new file mode 100644 index 0000000..471f1bc --- /dev/null +++ b/services/bstein-dev-home/ingress.yaml @@ -0,0 +1,31 @@ +# services/bstein-dev-home/ingress.yaml +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: bstein-dev-home + namespace: bstein-dev-home + annotations: + kubernetes.io/ingress.class: traefik + traefik.ingress.kubernetes.io/router.entrypoints: websecure + traefik.ingress.kubernetes.io/router.tls: "true" + cert-manager.io/cluster-issuer: letsencrypt +spec: + tls: + - hosts: [ "bstein.dev" ] + secretName: bstein-dev-home-tls + rules: + - host: bstein.dev + http: + paths: + - path: /api + pathType: Prefix + backend: + service: + name: bstein-dev-home-backend + port: { number: 80 } + - path: / + pathType: Prefix + backend: + service: + name: bstein-dev-home-frontend + port: { number: 80 } diff --git a/services/bstein-dev-home/kustomization.yaml b/services/bstein-dev-home/kustomization.yaml new file mode 100644 index 0000000..dd4d6e7 --- /dev/null +++ b/services/bstein-dev-home/kustomization.yaml @@ -0,0 +1,17 @@ +# services/bstein-dev-home/kustomization.yaml +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +namespace: bstein-dev-home +resources: + - namespace.yaml + - image.yaml + - frontend-deployment.yaml + - frontend-service.yaml + - backend-deployment.yaml + - backend-service.yaml + - ingress.yaml +images: + - name: registry.bstein.dev/bstein/bstein-dev-home-frontend + newTag: latest # {"$imagepolicy": "bstein-dev-home:bstein-dev-home-frontend"} + - name: registry.bstein.dev/bstein/bstein-dev-home-backend + newTag: latest # {"$imagepolicy": "bstein-dev-home:bstein-dev-home-backend"} diff --git a/services/bstein-dev-home/namespace.yaml b/services/bstein-dev-home/namespace.yaml new file mode 100644 index 0000000..ae77d71 --- /dev/null +++ b/services/bstein-dev-home/namespace.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: bstein-dev-home diff --git a/services/jenkins/helmrelease.yaml b/services/jenkins/helmrelease.yaml index a9bba37..c94c7fb 100644 --- a/services/jenkins/helmrelease.yaml +++ b/services/jenkins/helmrelease.yaml @@ -287,6 +287,25 @@ spec: } } } + pipelineJob('bstein-dev-home') { + triggers { + scm('H/2 * * * *') + } + definition { + cpsScm { + scm { + git { + remote { + url('https://scm.bstein.dev/bstein/bstein-dev-home.git') + credentials('gitea-pat') + } + branches('*/master') + } + } + scriptPath('Jenkinsfile') + } + } + } persistence: enabled: true storageClass: astreae