Compare commits

..

8 Commits

Author SHA1 Message Date
danijel.simeunovic 7b05910eaa fixes 2026-06-12 17:17:51 +02:00
danijel.simeunovic 4fd694ec67 rename overlay 2026-06-12 17:01:34 +02:00
danijel.simeunovic 0fc1be3a8a forte prod 2026-06-12 16:44:44 +02:00
danijel.simeunovic 9297398d56 gitea update
/ test (push) Successful in 8s
2026-06-11 13:03:59 +02:00
danijel.simeunovic b0804e1e6a scan
/ test (push) Successful in 11s
2026-06-11 10:34:11 +02:00
danijel.simeunovic 8216399155 trufflehog
/ test (push) Failing after 33s
2026-06-11 10:14:25 +02:00
danijel.simeunovic a70f078bbb drop drop 2026-06-05 19:38:30 +02:00
danijel.simeunovic a24e61d538 disable slack notifications for forte-drop
Signed-off-by: Danijel Simeunovic <danijel.simeunovic@fortedigital.com>
2026-06-05 13:41:42 +00:00
24 changed files with 353 additions and 176 deletions
+20
View File
@@ -0,0 +1,20 @@
on:
push:
branches:
- main
pull_request:
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install TruffleHog
run: |
curl -sSfL https://raw.githubusercontent.com/trufflesecurity/trufflehog/main/scripts/install.sh \
| sh -s -- -b /usr/local/bin
- name: Secret Scanning
run: trufflehog git file://. --fail --no-update --results=verified,unknown
-103
View File
@@ -1,64 +1,3 @@
# =============================================================================
# UpCloud Workload Cluster
# =============================================================================
# A lean UCS cluster for running application workloads. No managed data
# services — those live on the platform cluster. ArgoCD (on the platform
# cluster) deploys apps to this cluster via the app-of-apps pattern.
#
# Platform components deployed by deploy-workload.sh:
# nginx-ingress, cert-manager, external-dns, external-secrets, alloy
#
# Usage:
# tofu init && tofu plan && tofu apply
# ./sync-tofu-outputs.sh --env upcloud-workload
# ./deploy-workload.sh --env upcloud-workload
# =============================================================================
variable "prefix" {
description = "Prefix for resource names"
type = string
default = "clst-workload"
}
variable "zone" {
description = "UpCloud zone"
type = string
default = "no-svg1"
}
variable "node_plan" {
description = "UpCloud server plan for worker nodes"
type = string
default = "2xCPU-4GB"
}
variable "node_count" {
description = "Number of worker nodes"
type = number
default = 2
}
variable "network_cidr" {
description = "CIDR block for the private network"
type = string
default = "10.110.0.0/24"
}
variable "control_plane_ip_filter" {
description = "CIDRs allowed to access the K8s API"
type = list(string)
default = ["0.0.0.0/0"]
}
variable "tags" {
description = "Labels to apply to resources"
type = map(string)
default = {
Environment = "workload"
ManagedBy = "tofu"
}
}
module "cluster" { module "cluster" {
source = "../modules/cluster" source = "../modules/cluster"
@@ -76,45 +15,3 @@ module "cluster" {
ManagedBy = "tofu" ManagedBy = "tofu"
} }
} }
# ─── Networking ───────────────────────────────────────────────────────
resource "upcloud_router" "kubernetes" {
name = "${var.prefix}-workload-router"
}
resource "upcloud_gateway" "kubernetes" {
name = "${var.prefix}-workload-gateway"
zone = var.zone
features = ["nat"]
router {
id = upcloud_router.kubernetes.id
}
}
resource "upcloud_network" "kubernetes" {
name = "${var.prefix}-workload-network"
zone = var.zone
router = upcloud_router.kubernetes.id
ip_network {
address = var.network_cidr
dhcp = true
dhcp_default_route = true
family = "IPv4"
gateway = cidrhost(var.network_cidr, 1)
}
depends_on = [upcloud_gateway.kubernetes]
}
# ─── Kubernetes Cluster ───────────────────────────────────────────────
resource "upcloud_kubernetes_cluster" "main-prod" {
name = "${var.prefix}-workload"
zone = var.zone
network = upcloud_network.kubernetes.id
control_plane_ip_filter = var.control_plane_ip_filter
private_node_groups = true
}
+49 -6
View File
@@ -5,9 +5,56 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
TOFU_ROOT="$(dirname "$SCRIPT_DIR")" TOFU_ROOT="$(dirname "$SCRIPT_DIR")"
PROJECT_ROOT="$(dirname "$TOFU_ROOT")" PROJECT_ROOT="$(dirname "$TOFU_ROOT")"
CLUSTER="${1:?Usage: $0 <cluster> (e.g., aks-dev, eks-prod)}" usage() {
cat <<EOF
Usage: $0 <cluster> --envtype <dev|prod|workload>
Fetch (or reuse) a kubeconfig for the given cluster.
Platform is read from the cluster prefix (<platform>-...).
Env type must be supplied explicitly — it is no longer inferred
from the cluster name, so names like 'upc-forte-group' work.
Examples:
$0 aks-dev --envtype dev
$0 upc-forte-group --envtype prod
$0 eks-workload --envtype workload
EOF
exit "${1:-0}"
}
CLUSTER=""
ENVTYPE=""
while [[ $# -gt 0 ]]; do
case "$1" in
--envtype) ENVTYPE="${2:-}"; shift 2 ;;
--envtype=*) ENVTYPE="${1#*=}"; shift ;;
-h|--help) usage 0 ;;
-*) echo "Unknown option: $1"; usage 1 ;;
*)
if [[ -z "$CLUSTER" ]]; then
CLUSTER="$1"; shift
else
echo "Error: unexpected argument '$1'"; usage 1
fi
;;
esac
done
[[ -z "$CLUSTER" ]] && { echo "Error: <cluster> argument required"; usage 1; }
[[ -z "$ENVTYPE" ]] && { echo "Error: --envtype <dev|prod|workload> required"; usage 1; }
case "$ENVTYPE" in
dev|prod|workload) ;;
*) echo "Error: invalid --envtype '$ENVTYPE'. Expected: dev, prod, workload"; exit 1 ;;
esac
PLATFORM="${CLUSTER%%-*}" PLATFORM="${CLUSTER%%-*}"
ENV="${CLUSTER#*-}" ENV="$ENVTYPE"
case "$PLATFORM" in
aks|eks|gke|upc) ;;
*) echo "Error: unknown platform '$PLATFORM'. Expected: aks, eks, gke, upc"; exit 1 ;;
esac
KUBECONFIG_FILE="$PROJECT_ROOT/private/$CLUSTER/kubeconfig" KUBECONFIG_FILE="$PROJECT_ROOT/private/$CLUSTER/kubeconfig"
@@ -53,10 +100,6 @@ else
CLUSTER_ID=$(tofu output -raw cluster_id 2>/dev/null || echo "${UPCLOUD_CLUSTER_ID:-}") CLUSTER_ID=$(tofu output -raw cluster_id 2>/dev/null || echo "${UPCLOUD_CLUSTER_ID:-}")
upctl kubernetes config "$CLUSTER_ID" > "$KUBECONFIG_FILE" upctl kubernetes config "$CLUSTER_ID" > "$KUBECONFIG_FILE"
;; ;;
*)
echo "Error: unknown platform '$PLATFORM'"
exit 1
;;
esac esac
chmod 600 "$KUBECONFIG_FILE" chmod 600 "$KUBECONFIG_FILE"
+28 -11
View File
@@ -8,25 +8,33 @@ PROJECT_ROOT="$(dirname "$TOFU_ROOT")"
# ─── Usage ──────────────────────────────────────────────────────────── # ─── Usage ────────────────────────────────────────────────────────────
usage() { usage() {
cat <<EOF cat <<EOF
Usage: $0 <cluster> [options] Usage: $0 <cluster> --envtype <dev|prod|workload> [options]
Provision a Kubernetes cluster using OpenTofu. Provision a Kubernetes cluster using OpenTofu.
Mirrors bootstrap.sh convention: cluster = <platform>-<env> Cluster name is opaque — platform is read from its prefix
(<platform>-...), env is taken from --envtype.
Clusters: aks-dev | aks-prod | eks-dev | eks-prod Platforms (inferred from cluster prefix):
gke-dev | gke-prod | upc-dev | upc-prod aks | eks | gke | upc
<platform>-workload (for workload clusters)
Env types (required via --envtype):
dev Platform cluster, development
prod Platform cluster, production
workload Lean cluster for application workloads (no managed data
services — those run on the platform cluster)
Options: Options:
--envtype <type> dev | prod | workload (required)
--plan Plan only, don't apply --plan Plan only, don't apply
--destroy Destroy the cluster (use teardown-cluster.sh instead) --destroy Destroy the cluster (use teardown-cluster.sh instead)
--auto Skip confirmation prompts --auto Skip confirmation prompts
-h, --help Show this help -h, --help Show this help
Examples: Examples:
$0 aks-dev $0 aks-dev --envtype dev
$0 eks-prod --plan $0 eks-prod --envtype prod --plan
$0 upc-dev --auto $0 upc-forte-group --envtype prod --auto
$0 upc-workload --envtype workload
Prerequisites: Prerequisites:
- tofu, kubectl, helm installed - tofu, kubectl, helm installed
@@ -41,6 +49,7 @@ EOF
# ─── Parse arguments ────────────────────────────────────────────────── # ─── Parse arguments ──────────────────────────────────────────────────
CLUSTER="" CLUSTER=""
ENVTYPE=""
PLAN_ONLY=false PLAN_ONLY=false
DESTROY=false DESTROY=false
AUTO_APPROVE=false AUTO_APPROVE=false
@@ -50,6 +59,8 @@ while [[ $# -gt 0 ]]; do
--plan) PLAN_ONLY=true; shift ;; --plan) PLAN_ONLY=true; shift ;;
--destroy) DESTROY=true; shift ;; --destroy) DESTROY=true; shift ;;
--auto) AUTO_APPROVE=true; shift ;; --auto) AUTO_APPROVE=true; shift ;;
--envtype) ENVTYPE="${2:-}"; shift 2 ;;
--envtype=*) ENVTYPE="${1#*=}"; shift ;;
-h|--help) usage 0 ;; -h|--help) usage 0 ;;
-*) echo "Unknown option: $1"; usage 1 ;; -*) echo "Unknown option: $1"; usage 1 ;;
*) *)
@@ -65,10 +76,16 @@ while [[ $# -gt 0 ]]; do
done done
[[ -z "$CLUSTER" ]] && { echo "Error: <cluster> argument required"; usage 1; } [[ -z "$CLUSTER" ]] && { echo "Error: <cluster> argument required"; usage 1; }
[[ -z "$ENVTYPE" ]] && { echo "Error: --envtype <dev|prod|workload> required"; usage 1; }
# ─── Map cluster → platform + env ──────────────────────────────────── case "$ENVTYPE" in
PLATFORM="${CLUSTER%%-*}" # aks-dev → aks dev|prod|workload) ;;
ENV="${CLUSTER#*-}" # aks-dev → dev *) echo "Error: invalid --envtype '$ENVTYPE'. Expected: dev, prod, workload"; exit 1 ;;
esac
# ─── Resolve platform + env ───────────────────────────────────────────
PLATFORM="${CLUSTER%%-*}" # cluster prefix → platform (e.g. upc-forte-group → upc)
ENV="$ENVTYPE" # env comes from --envtype, not the cluster name
case "$PLATFORM" in case "$PLATFORM" in
aks|eks|gke|upc) ;; aks|eks|gke|upc) ;;
+32
View File
@@ -0,0 +1,32 @@
apiVersion: v1
kind: Namespace
metadata:
name: monitoring
annotations:
argocd.argoproj.io/sync-wave: "-1"
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: infrastructure-apps
namespace: argocd
labels:
app.kubernetes.io/name: infrastructure-apps
app.kubernetes.io/part-of: platform
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
project: default
source:
repoURL: ssh://git@git.forteapps.net:2222/Forte/launchpad.git
targetRevision: HEAD
path: infra/overlays/upc-forte-group
destination:
server: https://kubernetes.default.svc
namespace: default
syncPolicy:
automated:
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true
@@ -5,9 +5,9 @@ metadata:
namespace: argocd namespace: argocd
annotations: annotations:
argocd.argoproj.io/sync-wave: "1" argocd.argoproj.io/sync-wave: "1"
notifications.argoproj.io/subscribe.on-sync-succeeded.slack: "" # notifications.argoproj.io/subscribe.on-sync-succeeded.slack: ""
notifications.argoproj.io/subscribe.on-sync-failed.slack: "" # notifications.argoproj.io/subscribe.on-sync-failed.slack: ""
notifications.argoproj.io/subscribe.on-degraded.slack: "" # notifications.argoproj.io/subscribe.on-degraded.slack: ""
labels: labels:
app.kubernetes.io/name: forte-drop app.kubernetes.io/name: forte-drop
app.kubernetes.io/part-of: apps app.kubernetes.io/part-of: apps
@@ -0,0 +1,33 @@
apiVersion: v1
kind: Secret
metadata:
name: keycloak-client-forte-drop
namespace: forte-drop
labels:
keycloak.forteapps.net/client-config: "true"
annotations:
keycloak.forteapps.net/source-namespace: "forte-drop"
stringData:
client.json: |
{
"clientId": "forte-drop",
"name": "Forte Drop (web)",
"enabled": true,
"protocol": "openid-connect",
"clientAuthenticatorType": "client-secret",
"standardFlowEnabled": true,
"directAccessGrantsEnabled": false,
"serviceAccountsEnabled": false,
"publicClient": false,
"redirectUris": ["https://drop.forteapps.net/auth/callback"],
"webOrigins": ["https://drop.forteapps.net"],
"defaultClientScopes": ["openid","email","profile"],
"secret": {
"namespace": "forte-drop",
"name": "forte-drop-oidc-credentials",
"keys": {
"clientId": "client-id",
"clientSecret": "client-secret"
}
}
}
@@ -2,5 +2,6 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization kind: Kustomization
resources: resources:
- forte-drop.yaml - forte-drop.yaml
- keycloak-client-forte-drop.yaml
- forte-drop-pdb.yaml - forte-drop-pdb.yaml
- forte-drop-secrets-sealed.yaml - forte-drop-secrets-sealed.yaml
+12 -6
View File
@@ -1,13 +1,19 @@
apiVersion: kustomize.config.k8s.io/v1beta1 apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization kind: Kustomization
resources: resources:
- ../../base - ../../base/musicman
- ../../base/dot-ai-stack
- ../../base/argo-mcp
- forte-drop-postgresql - forte-drop-postgresql
- forte-drop - forte-drop
- forte-drop-mcp - forte-drop-mcp
# No patches needed — base apps already default to "upc-dev" value paths patches:
# (upc-dev is the default/base cluster). # dot-ai-stack: swap upc-dev → upc-forte-group
# forte-drop (postgres + web + mcp) and dbunk-demo are upc-dev-only apps — their - target:
# values hardcode upc-dev hosts (drop.forteapps.net etc.) and must not sync to kind: Application
# upc-prod, so they live here in the overlay rather than in apps/base/. name: dot-ai-stack
patch: |
- op: replace
path: /spec/sources/0/helm/valueFiles/1
value: $values/infra/values/upc-dev/dot-ai-stack-values.yaml
@@ -1,8 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1 apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization kind: Kustomization
resources: resources:
- dot-ai-stack - ../../base/mcp10x
- mcp10x - ../../base/ts-mcp
- musicman
- ts-mcp
- argo-mcp
-10
View File
@@ -2,13 +2,3 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization kind: Kustomization
resources: resources:
- ../../base - ../../base
patches:
# dot-ai-stack: swap upc-dev → upc-prod
- target:
kind: Application
name: dot-ai-stack
patch: |
- op: replace
path: /spec/sources/0/helm/valueFiles/1
value: $values/infra/values/upc-prod/dot-ai-stack-values.yaml
+1 -1
View File
@@ -3,7 +3,7 @@
# in case of $'\r': command not found error, run command below first # in case of $'\r': command not found error, run command below first
# sed -i 's/\r$//' ./bootstrap.sh # sed -i 's/\r$//' ./bootstrap.sh
CLUSTER="${1:?Usage: ./bootstrap.sh <cluster> (upc-dev|upc-prod|aks-dev|aks-prod|eks-dev|eks-prod|gke-dev|gke-prod)}" CLUSTER="${1:?Usage: ./bootstrap.sh <cluster> # e.g. upc-dev, upc-prod, upc-forte-group, aks-dev, eks-prod, gke-dev — must match clusters/<cluster>.yaml}"
echo "running $0 for cluster: ${CLUSTER}..." echo "running $0 for cluster: ${CLUSTER}..."
+12
View File
@@ -0,0 +1,12 @@
# Cluster config reference — values must match the corresponding overlay files.
# Read by bootstrap.sh at install time; NOT auto-propagated to ArgoCD value files.
clusterName: prod-fd-no-svg1 # → infra/values/upc-forte-group/argocd-values.yaml (notifications.context.clusterName)
domain: fortedigital.com # → infra/values/base/gitea-values.yaml, renovate-values.yaml, keycloak-values.yaml (subdomains)
argocdDomain: argocd.127.0.0.1.nip.io # → infra/values/upc-forte-group/argocd-values.yaml (global.domain)
grafanaDomain: grafana.fortedigital.com # → infra/values/upc-forte-group/grafana-values.yaml (ingress.hosts)
keycloakDomain: id.fortedigital.com # → infra/values/upc-forte-group/keycloak-values.yaml (ingress.hostname)
dotaiDomain: kubemcp.fortedigital.com # → infra/values/upc-forte-group/dot-ai-stack-values.yaml (dot-ai.ingress.host)
dotaiUiDomain: kubemcpui.fortedigital.com # → infra/values/upc-forte-group/dot-ai-stack-values.yaml (dot-ai-ui.ingress.host)
letsencryptEmail: danijel.simeunovic@fortedigital.com # → cluster-resources/letsencrypt-issuer.yaml (spec.acme.email)
trustedIPs: "172.16.1.0/24" # → infra/values/upc-forte-group/traefik-values.yaml (ports.*.trustedIPs)
cloudProvider: upcloud # → determines overlay directory and cloud-specific LB/storage annotations
+1 -1
View File
@@ -17,7 +17,7 @@ spec:
sources: sources:
- repoURL: https://dl.gitea.com/charts - repoURL: https://dl.gitea.com/charts
chart: gitea chart: gitea
targetRevision: "12.5.0" targetRevision: "12.6.0"
helm: helm:
releaseName: gitea releaseName: gitea
valueFiles: valueFiles:
@@ -28,12 +28,3 @@ resources:
# No patches needed — base already has "upc-dev" paths # No patches needed — base already has "upc-dev" paths
# upc-dev is the default/base cluster # upc-dev is the default/base cluster
patches:
- target:
kind: Application
name: databunker
patch: |
- op: add
path: /spec/sources/0/helm/valueFiles/-
value: $values/infra/values/upc-dev/databunker-values.yaml
@@ -0,0 +1,61 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../base/cert-manager-application
- ../../base/cluster-resources-application
- ../../base/enterprise-apps
- ../../base/fluent-bit
- ../../base/gitea
- ../../base/gitea-actions
- ../../base/grafana
- ../../base/grafana-dashboards
- ../../base/homepage
- ../../base/karpor
- ../../base/keycloak
- ../../base/kyverno
- ../../base/kyverno-policies
- ../../base/loki
- ../../base/opencost
- ../../base/prometheus
- ../../base/renovate
- ../../base/sealedsecrets
- ../../base/tempo
- ../../base/traefik-application
- ../../base/vault
patches:
# Traefik: swap upc-dev → upc-forte-group
- target:
kind: Application
name: traefik
patch: |
- op: replace
path: /spec/sources/0/helm/valueFiles/1
value: $values/infra/values/upc-forte-group/traefik-values.yaml
# Grafana: swap upc-dev → upc-forte-group
- target:
kind: Application
name: grafana
patch: |
- op: replace
path: /spec/sources/0/helm/valueFiles/1
value: $values/infra/values/upc-forte-group/grafana-values.yaml
# OpenCost: swap upc-dev → upc-forte-group
- target:
kind: Application
name: opencost
patch: |
- op: replace
path: /spec/sources/0/helm/valueFiles/1
value: $values/infra/values/upc-forte-group/opencost-values.yaml
# Gitea: swap upc-dev → upc-forte-group
- target:
kind: Application
name: gitea
patch: |
- op: replace
path: /spec/sources/0/helm/valueFiles/1
value: $values/infra/values/upc-forte-group/gitea-values.yaml
@@ -59,10 +59,6 @@ config:
href: https://benken.hackathon.forteapps.net href: https://benken.hackathon.forteapps.net
description: Teknisk kompetanse fra offentlige anbud description: Teknisk kompetanse fra offentlige anbud
icon: forte icon: forte
- Forte Drop:
href: https://drop.forteapps.net
description: Self-hosted HTML-drops + MCP for Claude
icon: forte
- Forte Feedback: - Forte Feedback:
href: https://feedback.forteapps.net href: https://feedback.forteapps.net
description: Fortes internal feedback app description: Fortes internal feedback app
@@ -0,0 +1,5 @@
global:
domain: argocd.fortedigital.com
notifications:
context:
clusterName: "prod-fd-no-svg1"
@@ -0,0 +1,50 @@
# UpCloud storage class for Gitea and its embedded PostgreSQL
persistence:
storageClass: upcloud-block-storage-maxiops
postgresql:
primary:
persistence:
storageClass: upcloud-block-storage-maxiops
gitea:
# -- Gitea app.ini configuration
config:
APP_NAME: "Forte Git"
server:
DOMAIN: source.forteapps.net
ROOT_URL: https://source.forteapps.net
SSH_DOMAIN: source.forteapps.net
# -- Ingress via Traefik with Let's Encrypt TLS
ingress:
enabled: true
className: traefik
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
gethomepage.dev/enabled: "true"
gethomepage.dev/name: "Gitea"
gethomepage.dev/description: "Git hosting & CI/CD"
gethomepage.dev/group: "DevOps"
gethomepage.dev/icon: "gitea"
gethomepage.dev/href: "https://source.forteapps.net"
gethomepage.dev/widget.type: "gitea"
gethomepage.dev/widget.url: "https://source.forteapps.net"
gethomepage.dev/widget.key: "{{HOMEPAGE_VAR_GITEA_TOKEN}}"
hosts:
- host: source.forteapps.net
paths:
- path: /
pathType: Prefix
tls:
- secretName: gitea-tls
hosts:
- source.forteapps.net
# -- Git repository storage
persistence:
enabled: true
size: 20Gi
accessModes:
- ReadWriteOnce
@@ -0,0 +1,3 @@
ingress:
hosts:
- grafana.fortedigital.com
@@ -0,0 +1,2 @@
ingress:
hostname: id.forteapps.com
@@ -0,0 +1,15 @@
# UpCloud custom pricing (no native OpenCost integration)
opencost:
exporter:
customPricing:
enabled: true
provider: custom
costModel:
description: "UpCloud 4-node cluster pricing"
CPU: "5.86"
RAM: "1.46"
GPU: "0"
storage: "0.34"
zoneNetworkEgress: "0"
regionNetworkEgress: "0"
internetNetworkEgress: "0"
@@ -0,0 +1,13 @@
service:
annotations: {}
ports:
web:
proxyProtocol:
trustedIPs: "10.0.0.0/16"
forwardedHeaders:
trustedIPs: "10.0.0.0/16"
websecure:
proxyProtocol:
trustedIPs: "10.0.0.0/16"
forwardedHeaders:
trustedIPs: "10.0.0.0/16"
@@ -1,8 +0,0 @@
dot-ai:
ingress:
host: kubemcp.fortedigital.com
webUI:
baseUrl: http://kubemcpui.fortedigital.com
dot-ai-ui:
ingress:
host: kubemcpui.fortedigital.com