Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 10 additions & 0 deletions osdc/base/kubernetes/base/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Base Kubernetes resources shared across ALL providers (EKS, GKE, etc.).
# Provider-specific resources go in overlays/<provider>/.
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- harbor-namespace.yaml
- nvidia-device-plugin.yaml
- registry-mirror-config.yaml
- git-cache/
16 changes: 6 additions & 10 deletions osdc/base/kubernetes/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
# Base Kubernetes resources applied to EVERY cluster.
# These are cluster-agnostic and required regardless of which modules are enabled.
# Shared (provider-agnostic) resources live in base/.
# Provider-specific resources live in overlays/<provider>/.
#
# Module-specific resources belong in osdc/<module>/kubernetes/ instead.
# This top-level kustomization points to the EKS overlay for backward
# compatibility — deploy-base's `kubectl apply -k base/kubernetes/` works
# unchanged. Future providers (GKE, AKS) use their own overlay directly.
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- storageclass-gp3.yaml
- node-performance-tuning.yaml
- nvidia-device-plugin.yaml
- harbor-namespace.yaml
- git-cache/
- registry-mirror-config.yaml
# NOTE: Namespaces for modules (arc-runners, arc-systems, buildkit, etc.)
# are created by the module's own kubernetes/ directory, not here.
- overlays/eks
8 changes: 8 additions & 0 deletions osdc/base/kubernetes/overlays/eks/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# EKS overlay: shared base + EKS-specific resources.
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- ../../base
- storageclass-gp3.yaml
- node-performance-tuning.yaml
8 changes: 8 additions & 0 deletions osdc/base/kubernetes/overlays/gke/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# GKE overlay: shared base + GKE-specific resources.
# Consumer adds GKE-specific resources (StorageClass, etc.) via patches or
# by overriding this overlay in their own modules/ directory.
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- ../../base
2 changes: 1 addition & 1 deletion osdc/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ kubeconfig cluster:
# BOOTSTRAP
# ============================================================================

# Bootstrap S3 state bucket + DynamoDB lock table for a cluster
# Bootstrap remote state storage for a cluster (S3/GCS, auto-detected)
bootstrap cluster:
@OSDC_ROOT="{{ROOT}}" OSDC_UPSTREAM="{{UPSTREAM}}" CLUSTERS_YAML="{{CLUSTERS_YAML}}" {{SCRIPTS}}/bootstrap-state.sh {{cluster}}

Expand Down
47 changes: 47 additions & 0 deletions osdc/scripts/bootstrap-state-gcp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/env bash
set -euo pipefail
#
# Bootstrap GCS state bucket for a GCP cluster.
#
# Creates:
# - GCS bucket for state storage (versioned, uniform IAM)
#
# GCS provides native state locking — no DynamoDB equivalent needed.
#
# Usage:
# ./scripts/bootstrap-state-gcp.sh <cluster-id>
#
# Idempotent: safe to run multiple times.

SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
# shellcheck source=/dev/null
source "$SCRIPT_DIR/mise-activate.sh"
CONFIG_PY="$SCRIPT_DIR/cluster-config.py"

CLUSTER="${1:?Usage: $0 <cluster-id>}"
PROJECT=$(uv run "$CONFIG_PY" "$CLUSTER" gcp_project)
BUCKET=$(uv run "$CONFIG_PY" "$CLUSTER" state_bucket)
REGION=$(uv run "$CONFIG_PY" "$CLUSTER" region)

echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "Bootstrapping state for: $CLUSTER"
echo " Bucket: $BUCKET (region: $REGION)"
echo " Project: $PROJECT"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"

if gcloud storage buckets describe "gs://${BUCKET}" --project="${PROJECT}" >/dev/null 2>&1; then
echo " Bucket '${BUCKET}' already exists, skipping create."
else
echo " Creating bucket '${BUCKET}'..."
gcloud storage buckets create "gs://${BUCKET}" \
--project="${PROJECT}" \
--location="${REGION}" \
--uniform-bucket-level-access
fi

echo " Enabling versioning..."
gcloud storage buckets update "gs://${BUCKET}" --versioning

echo " Done."
echo ""
echo "State bootstrapping complete."
9 changes: 9 additions & 0 deletions osdc/scripts/bootstrap-state.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ STATE_REGION="us-west-2"

bootstrap_cluster() {
local cluster_id="$1"
local cloud
cloud=$(uv run "$CONFIG_PY" "$cluster_id" cloud aws)

# Non-AWS providers have their own bootstrap script
if [[ "$cloud" != "aws" ]]; then
"$SCRIPT_DIR/bootstrap-state-${cloud}.sh" "$cluster_id"
return
fi

local bucket
bucket=$(uv run "$CONFIG_PY" "$cluster_id" state_bucket)

Expand Down
Loading