diff --git a/AGENTS.md b/AGENTS.md index f9dfaa6..efc06e3 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -273,10 +273,16 @@ make build-installer IMG=/:tag **Key points:** -- The `dist/install.yaml` is generated from Kustomize manifests (CRDs, RBAC, Deployment) +- The `dist/install.yaml` is generated from Kustomize manifests (CRDs, RBAC, Deployment, HelmRepository, GitRepository, addon ModuleTemplates) - Commit this file to your repository for easy distribution - Users only need `kubectl` to install (no additional tools required) +**GitRepository version substitution:** + +- `config/modules/gitrepository.yaml` uses the placeholder `__MODULE_OPERATOR_VERSION__` for the Git ref tag +- The `build-installer` target replaces it with the current version (`git describe --tags --always`) via `sed` before writing `dist/install.yaml` +- Modules (CDI, KubeVirt, etc.) are thus sourced from the same version as the operator being built, enabling feature-branch testing without hardcoded tags + **Example:** Users install with a single command: ```bash diff --git a/Makefile b/Makefile index b3427c2..cea544e 100644 --- a/Makefile +++ b/Makefile @@ -158,10 +158,22 @@ docker-buildx: ## Build and push docker image for the manager for cross-platform rm Dockerfile.cross .PHONY: build-installer -build-installer: manifests generate kustomize ## Generate a consolidated YAML with CRDs and deployment. +build-installer: manifests generate kustomize ## Generate dist/install.yaml (CRDs+deploy+HelmRepository+ModuleTemplate+GitRepository+addon ModuleTemplates). mkdir -p dist cd config/manager && "$(KUSTOMIZE)" edit set image controller=${IMG} - "$(KUSTOMIZE)" build config/default > dist/install.yaml + { "$(KUSTOMIZE)" build config/default; echo "---"; "$(KUSTOMIZE)" build config/modules; } | \ + sed 's|__MODULE_OPERATOR_VERSION__|$(VERSION)|g' | \ + sed "s|__CDI_VERSION__|$$(cat config/modules/cdi/VERSION | tr -d '\n')|g" | \ + sed "s|__KUBEVIRT_VERSION__|$$(cat config/modules/kubevirt/VERSION | tr -d '\n')|g" | \ + sed "s|__ROOK_CEPH_VERSION__|$$(cat config/modules/rook-ceph/VERSION | tr -d '\n')|g" | \ + sed "s|__GATEWAY_API_VERSION__|$$(cat config/modules/gateway-api/VERSION | tr -d '\n')|g" | \ + sed "s|__GPU_OPERATOR_VERSION__|$$(cat config/modules/gpu-operator/VERSION | tr -d '\n')|g" | \ + sed "s|__HAMI_VERSION__|$$(cat config/modules/hami/VERSION | tr -d '\n')|g" | \ + sed "s|__ISTIO_VERSION__|$$(cat config/modules/istio/VERSION | tr -d '\n')|g" | \ + sed "s|__PROMETHEUS_VERSION__|$$(cat config/modules/prometheus/VERSION | tr -d '\n')|g" | \ + sed "s|__LLM_D_INFRA_VERSION__|$$(cat config/modules/llm-d-infra/VERSION | tr -d '\n')|g" | \ + sed "s|__GAIE_VERSION__|$$(cat config/modules/gateway-api-inference-extension/VERSION | tr -d '\n')|g" \ + > dist/install.yaml ##@ Deployment diff --git a/config/manager/kustomization.yaml b/config/manager/kustomization.yaml index 5c5f0b8..ad13e96 100644 --- a/config/manager/kustomization.yaml +++ b/config/manager/kustomization.yaml @@ -1,2 +1,8 @@ resources: - manager.yaml +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +images: +- name: controller + newName: controller + newTag: latest diff --git a/config/modules/cdi/VERSION b/config/modules/cdi/VERSION new file mode 100644 index 0000000..902c741 --- /dev/null +++ b/config/modules/cdi/VERSION @@ -0,0 +1 @@ +1.65.0 diff --git a/config/modules/cdi/kustomization.yaml b/config/modules/cdi/kustomization.yaml new file mode 100644 index 0000000..3f0a8ad --- /dev/null +++ b/config/modules/cdi/kustomization.yaml @@ -0,0 +1,8 @@ +# CDI deployment — remote resources for FluxCD Kustomization +# Source: https://github.com/kubevirt/containerized-data-importer +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + - https://github.com/kubevirt/containerized-data-importer/releases/download/v__CDI_VERSION__/cdi-operator.yaml + - https://github.com/kubevirt/containerized-data-importer/releases/download/v__CDI_VERSION__/cdi-cr.yaml diff --git a/config/modules/cdi/moduletemplate.yaml b/config/modules/cdi/moduletemplate.yaml new file mode 100644 index 0000000..9ce46d5 --- /dev/null +++ b/config/modules/cdi/moduletemplate.yaml @@ -0,0 +1,24 @@ +# ModuleTemplate — CDI (Containerized Data Importer) v__CDI_VERSION__ +# Uses FluxCD Kustomization (not Helm). Deploys from remote release YAMLs. +# +# Prerequisite: GitRepository (otterscale-module-operator) must exist in otterscale-system. +# Apply: kubectl apply -k config/modules/cdi/ +apiVersion: module.otterscale.io/v1alpha1 +kind: ModuleTemplate +metadata: + name: cdi +spec: + namespace: cdi + + description: >- + Containerized Data Importer v__CDI_VERSION__ — PVC data import for KubeVirt VM disk images. + Deploys via FluxCD Kustomization from upstream release YAMLs. + + kustomization: + interval: 30m + prune: true + sourceRef: + kind: GitRepository + name: otterscale-module-operator + namespace: otterscale-system + path: config/modules/cdi diff --git a/config/modules/gateway-api-inference-extension/VERSION b/config/modules/gateway-api-inference-extension/VERSION new file mode 100644 index 0000000..3a3cd8c --- /dev/null +++ b/config/modules/gateway-api-inference-extension/VERSION @@ -0,0 +1 @@ +1.3.1 diff --git a/config/modules/gateway-api-inference-extension/kustomization.yaml b/config/modules/gateway-api-inference-extension/kustomization.yaml new file mode 100644 index 0000000..4427dea --- /dev/null +++ b/config/modules/gateway-api-inference-extension/kustomization.yaml @@ -0,0 +1,6 @@ +# Gateway API Inference Extension v__GAIE_VERSION__ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + - https://github.com/kubernetes-sigs/gateway-api-inference-extension/releases/download/v__GAIE_VERSION__/manifests.yaml diff --git a/config/modules/gateway-api-inference-extension/moduletemplate.yaml b/config/modules/gateway-api-inference-extension/moduletemplate.yaml new file mode 100644 index 0000000..326118a --- /dev/null +++ b/config/modules/gateway-api-inference-extension/moduletemplate.yaml @@ -0,0 +1,24 @@ +# ModuleTemplate — Gateway API Inference Extension v__GAIE_VERSION__ +# Uses FluxCD Kustomization. Requires Gateway API CRDs. +apiVersion: module.otterscale.io/v1alpha1 +kind: ModuleTemplate +metadata: + name: gateway-api-inference-extension +spec: + namespace: default + + description: >- + Gateway API Inference Extension v__GAIE_VERSION__ — CRDs and controllers + for AI/ML inference routing via Gateway API. + + kustomization: + interval: 30m + prune: true + dependsOn: + - name: gateway-api + namespace: default + sourceRef: + kind: GitRepository + name: otterscale-module-operator + namespace: otterscale-system + path: config/modules/gateway-api-inference-extension diff --git a/config/modules/gateway-api/VERSION b/config/modules/gateway-api/VERSION new file mode 100644 index 0000000..26ca594 --- /dev/null +++ b/config/modules/gateway-api/VERSION @@ -0,0 +1 @@ +1.5.1 diff --git a/config/modules/gateway-api/kustomization.yaml b/config/modules/gateway-api/kustomization.yaml new file mode 100644 index 0000000..b626c31 --- /dev/null +++ b/config/modules/gateway-api/kustomization.yaml @@ -0,0 +1,6 @@ +# Gateway API v__GATEWAY_API_VERSION__ — Standard channel CRDs +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + - https://github.com/kubernetes-sigs/gateway-api/releases/download/v__GATEWAY_API_VERSION__/standard-install.yaml diff --git a/config/modules/gateway-api/moduletemplate.yaml b/config/modules/gateway-api/moduletemplate.yaml new file mode 100644 index 0000000..4eecac1 --- /dev/null +++ b/config/modules/gateway-api/moduletemplate.yaml @@ -0,0 +1,20 @@ +# ModuleTemplate — Kubernetes Gateway API v__GATEWAY_API_VERSION__ (Standard channel) +# Uses FluxCD Kustomization. CRDs only (GatewayClass, Gateway, HTTPRoute, etc.) +apiVersion: module.otterscale.io/v1alpha1 +kind: ModuleTemplate +metadata: + name: gateway-api +spec: + namespace: default + + description: >- + Kubernetes Gateway API v__GATEWAY_API_VERSION__ — Standard channel CRDs (GatewayClass, Gateway, HTTPRoute, GRPCRoute, ReferenceGrant). + + kustomization: + interval: 30m + prune: true + sourceRef: + kind: GitRepository + name: otterscale-module-operator + namespace: otterscale-system + path: config/modules/gateway-api diff --git a/config/modules/gitrepository.yaml b/config/modules/gitrepository.yaml new file mode 100644 index 0000000..ac535a8 --- /dev/null +++ b/config/modules/gitrepository.yaml @@ -0,0 +1,12 @@ +# Shared GitRepository for addon ModuleTemplates (CDI, KubeVirt, etc.) +# All addon components deploy from this repo's config/modules/*/deploy paths. +apiVersion: source.toolkit.fluxcd.io/v1 +kind: GitRepository +metadata: + name: otterscale-module-operator + namespace: otterscale-system +spec: + interval: 24h + url: https://github.com/otterscale/module-operator + ref: + tag: __MODULE_OPERATOR_VERSION__ diff --git a/config/modules/gpu-operator/VERSION b/config/modules/gpu-operator/VERSION new file mode 100644 index 0000000..12f11ba --- /dev/null +++ b/config/modules/gpu-operator/VERSION @@ -0,0 +1 @@ +25.10.1 diff --git a/config/modules/gpu-operator/helmrepository.yaml b/config/modules/gpu-operator/helmrepository.yaml new file mode 100644 index 0000000..d85176e --- /dev/null +++ b/config/modules/gpu-operator/helmrepository.yaml @@ -0,0 +1,8 @@ +apiVersion: source.toolkit.fluxcd.io/v1 +kind: HelmRepository +metadata: + name: nvidia-gpu-operator + namespace: otterscale-system +spec: + interval: 24h + url: https://nvidia.github.io/gpu-operator diff --git a/config/modules/gpu-operator/moduletemplate.yaml b/config/modules/gpu-operator/moduletemplate.yaml new file mode 100644 index 0000000..01eb8d3 --- /dev/null +++ b/config/modules/gpu-operator/moduletemplate.yaml @@ -0,0 +1,77 @@ +# ModuleTemplate — NVIDIA GPU Operator blueprint +# +# Deploys NVIDIA GPU Operator for driver, DCGM, DCGM Exporter, Node Status Exporter. +# Device plugin and vGPU are disabled (use HAMI for GPU sharing). +# +# Apply: +# kubectl apply -f moduletemplate.yaml +apiVersion: module.otterscale.io/v1alpha1 +kind: ModuleTemplate +metadata: + name: gpu-operator +spec: + namespace: gpu-operator + + description: >- + Deploys NVIDIA GPU Operator (driver 580.x, DCGM, DCGM Exporter, Node Status Exporter). + Device plugin disabled for use with HAMI vGPU. + + helmRelease: + interval: 30m + + chart: + spec: + chart: gpu-operator + version: "__GPU_OPERATOR_VERSION__" + sourceRef: + kind: HelmRepository + name: nvidia-gpu-operator + namespace: otterscale-system + interval: 24h + + install: + remediation: + retries: 3 + + upgrade: + remediation: + retries: 3 + force: false + + timeout: 30m + + values: + cdi: + enabled: false + + driver: + enabled: true + version: "580.105.08" + upgradePolicy: + autoUpgrade: false + + # Offline version + # driver: + # version: "580" + # usePrecompiled: true + + devicePlugin: + enabled: false + + operator: + cleanupCRD: true + upgradeCRD: false + + dcgm: + enabled: true + + dcgmExporter: + enabled: true + serviceMonitor: + enabled: true + + nodeStatusExporter: + enabled: true + + vgpuDeviceManager: + enabled: false diff --git a/config/modules/hami/VERSION b/config/modules/hami/VERSION new file mode 100644 index 0000000..834f262 --- /dev/null +++ b/config/modules/hami/VERSION @@ -0,0 +1 @@ +2.8.0 diff --git a/config/modules/hami/helmrepository.yaml b/config/modules/hami/helmrepository.yaml new file mode 100644 index 0000000..ca66384 --- /dev/null +++ b/config/modules/hami/helmrepository.yaml @@ -0,0 +1,8 @@ +apiVersion: source.toolkit.fluxcd.io/v1 +kind: HelmRepository +metadata: + name: hami + namespace: otterscale-system +spec: + interval: 24h + url: https://project-hami.github.io/HAMi/ diff --git a/config/modules/hami/moduletemplate.yaml b/config/modules/hami/moduletemplate.yaml new file mode 100644 index 0000000..59e83b6 --- /dev/null +++ b/config/modules/hami/moduletemplate.yaml @@ -0,0 +1,75 @@ +# ModuleTemplate — HAMI (Heterogeneous AI Computing Virtualization) blueprint +# +# Deploys HAMI for GPU sharing (vGPU) with NVIDIA GPU Operator. +# Requires GPU Operator to be installed first (driver + nvidia-validations). +# +# Apply: +# kubectl apply -f moduletemplate.yaml +apiVersion: module.otterscale.io/v1alpha1 +kind: ModuleTemplate +metadata: + name: hami +spec: + # HAMI scheduler and device plugin typically run in kube-system + namespace: kube-system + + description: >- + Deploys HAMI for GPU sharing (vGPU) with device split, memory/core scaling. + Integrates with NVIDIA GPU Operator via gpuOperatorToolkitReady. + + helmRelease: + interval: 30m + + dependsOn: + - name: gpu-operator + namespace: gpu-operator + + chart: + spec: + chart: hami + version: "__HAMI_VERSION__" + sourceRef: + kind: HelmRepository + name: hami + namespace: otterscale-system + interval: 24h + + install: + remediation: + retries: 3 + + upgrade: + remediation: + retries: 3 + force: false + + timeout: 30m + + values: + global: + imageTag: "v__HAMI_VERSION__" + annotations: + prometheus.io/scrape: "true" + prometheus.io/port: "31992" + # managedNodeSelectorEnable: false + # managedNodeSelector: + # usage: "nvidia.com/gpu.workload.config" + + scheduler: + service: + type: ClusterIP + + devicePlugin: + enabled: true + gpuOperatorToolkitReady: + enabled: true + hostPath: "/run/nvidia/validations" + deviceSplitCount: 10 + deviceMemoryScaling: 1 + deviceCoreScaling: 1 + service: + type: ClusterIP + runtimeClassName: "nvidia" + nvidiaNodeSelector: + gpu: null + nvidia.com/gpu.workload.config: "vgpu" diff --git a/config/modules/istio/VERSION b/config/modules/istio/VERSION new file mode 100644 index 0000000..83cf0d9 --- /dev/null +++ b/config/modules/istio/VERSION @@ -0,0 +1 @@ +1.29.1 diff --git a/config/modules/istio/helmrepository.yaml b/config/modules/istio/helmrepository.yaml new file mode 100644 index 0000000..456ea4f --- /dev/null +++ b/config/modules/istio/helmrepository.yaml @@ -0,0 +1,8 @@ +apiVersion: source.toolkit.fluxcd.io/v1 +kind: HelmRepository +metadata: + name: istio + namespace: otterscale-system +spec: + interval: 24h + url: https://istio-release.storage.googleapis.com/charts diff --git a/config/modules/istio/moduletemplate-base.yaml b/config/modules/istio/moduletemplate-base.yaml new file mode 100644 index 0000000..0aa1555 --- /dev/null +++ b/config/modules/istio/moduletemplate-base.yaml @@ -0,0 +1,42 @@ +# ModuleTemplate — Istio base (CRDs) +# +# Installs Istio base chart (CRDs). Must be applied before istiod. +# See: https://istio.io/latest/docs/setup/install/helm/ +# +# Apply order: base → istiod +apiVersion: module.otterscale.io/v1alpha1 +kind: ModuleTemplate +metadata: + name: istio-base +spec: + namespace: istio-system + + description: >- + Installs Istio base chart (CRDs). Required before istiod. + + helmRelease: + interval: 30m + + chart: + spec: + chart: base + version: "__ISTIO_VERSION__" + sourceRef: + kind: HelmRepository + name: istio + namespace: otterscale-system + interval: 24h + + install: + remediation: + retries: 3 + + upgrade: + remediation: + retries: 3 + force: false + + timeout: 10m + + values: + defaultRevision: default diff --git a/config/modules/istio/moduletemplate-istiod.yaml b/config/modules/istio/moduletemplate-istiod.yaml new file mode 100644 index 0000000..e2b3e9c --- /dev/null +++ b/config/modules/istio/moduletemplate-istiod.yaml @@ -0,0 +1,47 @@ +# ModuleTemplate — Istiod (Istio control plane) +# +# Installs Istiod control plane. Requires istio-base to be installed first. +# See: https://istio.io/latest/docs/setup/install/helm/ +# +# Apply order: base → istiod +apiVersion: module.otterscale.io/v1alpha1 +kind: ModuleTemplate +metadata: + name: istiod +spec: + namespace: istio-system + + description: >- + Installs Istiod (Istio control plane / discovery server). + + helmRelease: + interval: 30m + + dependsOn: + - name: istio-base + namespace: istio-system + + chart: + spec: + chart: istiod + version: "__ISTIO_VERSION__" + sourceRef: + kind: HelmRepository + name: istio + namespace: otterscale-system + interval: 24h + + install: + remediation: + retries: 3 + + upgrade: + remediation: + retries: 3 + force: false + + timeout: 15m + + values: + env: + ENABLE_GATEWAY_API_INFERENCE_EXTENSION: "true" diff --git a/config/modules/kubevirt/VERSION b/config/modules/kubevirt/VERSION new file mode 100644 index 0000000..27f9cd3 --- /dev/null +++ b/config/modules/kubevirt/VERSION @@ -0,0 +1 @@ +1.8.0 diff --git a/config/modules/kubevirt/kustomization.yaml b/config/modules/kubevirt/kustomization.yaml new file mode 100644 index 0000000..12dd594 --- /dev/null +++ b/config/modules/kubevirt/kustomization.yaml @@ -0,0 +1,8 @@ +# KubeVirt deployment — remote resources for FluxCD Kustomization +# Prerequisite: Deploy CDI first +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + - https://github.com/kubevirt/kubevirt/releases/download/v__KUBEVIRT_VERSION__/kubevirt-operator.yaml + - https://github.com/kubevirt/kubevirt/releases/download/v__KUBEVIRT_VERSION__/kubevirt-cr.yaml diff --git a/config/modules/kubevirt/moduletemplate.yaml b/config/modules/kubevirt/moduletemplate.yaml new file mode 100644 index 0000000..57b8bb3 --- /dev/null +++ b/config/modules/kubevirt/moduletemplate.yaml @@ -0,0 +1,24 @@ +# ModuleTemplate — KubeVirt v__KUBEVIRT_VERSION__ +# Uses FluxCD Kustomization. Deploy CDI first. +apiVersion: module.otterscale.io/v1alpha1 +kind: ModuleTemplate +metadata: + name: kubevirt +spec: + namespace: kubevirt + + description: >- + KubeVirt v__KUBEVIRT_VERSION__ — enables Kubernetes to manage VMs natively. + Requires CDI for VM disk image import. + + kustomization: + interval: 30m + prune: true + dependsOn: + - name: cdi + namespace: cdi + sourceRef: + kind: GitRepository + name: otterscale-module-operator + namespace: otterscale-system + path: config/modules/kubevirt diff --git a/config/modules/kustomization.yaml b/config/modules/kustomization.yaml new file mode 100644 index 0000000..10ee2de --- /dev/null +++ b/config/modules/kustomization.yaml @@ -0,0 +1,33 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +# Sources + ModuleTemplates only (no Module CRs). +# Used by build-installer to generate dist/install.yaml. +# Module CRs are in config/samples/ for users to apply selectively. +resources: + # --- Sources --- + - gitrepository.yaml + + # --- Helm-based ModuleTemplates --- + - gpu-operator/helmrepository.yaml + - gpu-operator/moduletemplate.yaml + + - hami/helmrepository.yaml + - hami/moduletemplate.yaml + + - istio/helmrepository.yaml + - istio/moduletemplate-base.yaml + - istio/moduletemplate-istiod.yaml + + - llm-d-infra/helmrepository.yaml + - llm-d-infra/moduletemplate.yaml + + - prometheus/helmrepository.yaml + - prometheus/moduletemplate.yaml + + # --- Kustomize-based ModuleTemplates --- + - cdi/moduletemplate.yaml + - gateway-api/moduletemplate.yaml + - gateway-api-inference-extension/moduletemplate.yaml + - kubevirt/moduletemplate.yaml + - rook-ceph/moduletemplate.yaml diff --git a/config/modules/llm-d-infra/VERSION b/config/modules/llm-d-infra/VERSION new file mode 100644 index 0000000..0c00f61 --- /dev/null +++ b/config/modules/llm-d-infra/VERSION @@ -0,0 +1 @@ +1.3.10 diff --git a/config/modules/llm-d-infra/helmrepository.yaml b/config/modules/llm-d-infra/helmrepository.yaml new file mode 100644 index 0000000..d924d27 --- /dev/null +++ b/config/modules/llm-d-infra/helmrepository.yaml @@ -0,0 +1,8 @@ +apiVersion: source.toolkit.fluxcd.io/v1 +kind: HelmRepository +metadata: + name: llm-d-infra + namespace: otterscale-system +spec: + interval: 24h + url: https://llm-d-incubation.github.io/llm-d-infra/ diff --git a/config/modules/llm-d-infra/moduletemplate.yaml b/config/modules/llm-d-infra/moduletemplate.yaml new file mode 100644 index 0000000..81b6f34 --- /dev/null +++ b/config/modules/llm-d-infra/moduletemplate.yaml @@ -0,0 +1,64 @@ +# ModuleTemplate — llm-d-infra blueprint +# +# Deploys llm-d infrastructure components: Gateway API configs, Helm charts, +# and operational tooling for llm-d (Kubernetes-native distributed LLM inference). +# +# Prerequisites: +# - Kubernetes 1.28+ +# - Gateway API v1.4.0+ installed +# - Gateway controller (Istio, Kgateway, AgentGateway or GKE) deployed +# +# See: https://github.com/llm-d-incubation/llm-d-infra +# +# Apply: +# kubectl apply -f moduletemplate.yaml +apiVersion: module.otterscale.io/v1alpha1 +kind: ModuleTemplate +metadata: + name: llm-d-infra +spec: + namespace: llm-d + + description: >- + Deploys llm-d infrastructure (Gateway API, service mesh integration) + for high-performance distributed LLM inference framework. + + helmRelease: + interval: 30m + + dependsOn: + - name: gpu-operator + namespace: gpu-operator + - name: istiod + namespace: istio-system + + chart: + spec: + chart: llm-d-infra + version: "__LLM_D_INFRA_VERSION__" + sourceRef: + kind: HelmRepository + name: llm-d-infra + namespace: otterscale-system + interval: 24h + + install: + remediation: + retries: 3 + + upgrade: + remediation: + retries: 3 + force: false + + timeout: 30m + + values: + gateway: + gatewayParameters: + resources: + limits: + cpu: "2" + memory: "1Gi" + service: + type: NodePort diff --git a/config/modules/prometheus/VERSION b/config/modules/prometheus/VERSION new file mode 100644 index 0000000..16913a8 --- /dev/null +++ b/config/modules/prometheus/VERSION @@ -0,0 +1 @@ +82.10.5 diff --git a/config/modules/prometheus/helmrepository.yaml b/config/modules/prometheus/helmrepository.yaml new file mode 100644 index 0000000..08d01e2 --- /dev/null +++ b/config/modules/prometheus/helmrepository.yaml @@ -0,0 +1,8 @@ +apiVersion: source.toolkit.fluxcd.io/v1 +kind: HelmRepository +metadata: + name: prometheus + namespace: otterscale-system +spec: + interval: 24h + url: https://prometheus-community.github.io/helm-charts diff --git a/config/modules/prometheus/moduletemplate.yaml b/config/modules/prometheus/moduletemplate.yaml new file mode 100644 index 0000000..d001b27 --- /dev/null +++ b/config/modules/prometheus/moduletemplate.yaml @@ -0,0 +1,98 @@ +# ModuleTemplate — kube-prometheus-stack blueprint +# +# Defines a reusable template for deploying the Prometheus monitoring stack +# (Prometheus + Alertmanager + Node Exporter, without Grafana) via FluxCD. +# +# IMPORTANT: Replace `storageClassName` with your cluster's actual StorageClass +# name before applying (e.g. standard, gp2, longhorn, etc.). +# +# Apply: +# kubectl apply -f moduletemplate.yaml +apiVersion: module.otterscale.io/v1alpha1 +kind: ModuleTemplate +metadata: + name: prometheus-stack +spec: + # Target namespace where the FluxCD HelmRelease object (and by default the + # Helm release itself) will be created. Can be overridden per-Module via + # Module.spec.namespace. + namespace: monitoring + + description: >- + Deploys kube-prometheus-stack (Prometheus, Alertmanager, Node Exporter) + with persistent storage and remote-write receiver enabled. + Grafana is disabled; metrics retention is set to 365 days / 40 GiB. + + # spec.helmRelease is the FluxCD HelmReleaseSpec (not a full HelmRelease). + # The controller instantiates a HelmRelease from this spec and places it + # in spec.namespace above. + helmRelease: + # Reconciliation interval — how often FluxCD re-checks drift. + interval: 30m + + # Helm chart source: pulls kube-prometheus-stack from the + # prometheus HelmRepository (see helmrepository.yaml). + chart: + spec: + chart: kube-prometheus-stack + # Pin to a specific chart version for reproducibility. + # Remove or set to "*" to always track the latest. + version: "__PROMETHEUS_VERSION__" + sourceRef: + kind: HelmRepository + name: prometheus + namespace: otterscale-system + # How often FluxCD polls the chart index for new versions. + interval: 24h + + # Install strategy: retry up to 3 times on failure. + install: + remediation: + retries: 3 + + # Upgrade strategy: retry up to 3 times; force resource replacement on + # field conflicts. + upgrade: + remediation: + retries: 3 + force: false + + # Maximum time allowed for a single Helm operation before it is + # considered a failure. + timeout: 30m + + # Helm values — equivalent to the `--set` flags in the original + # `helm install` command. + values: + prometheus: + prometheusSpec: + # Accept remote-write requests (useful for forwarding from edge clusters). + enableRemoteWriteReceiver: true + + # Data retention: keep up to 365 days or 40 GiB, whichever limit is hit first. + retention: "365d" + retentionSize: "40GiB" + + # Discover ServiceMonitors from all namespaces, not just those that + # match the Helm release labels. + serviceMonitorSelectorNilUsesHelmValues: false + + # Persistent storage for Prometheus TSDB. + # ⚠️ Replace `storageClassName` with the actual StorageClass on your cluster. + storageSpec: + volumeClaimTemplate: + spec: + # TODO: replace with your cluster's StorageClass (e.g. standard, gp2, longhorn) + accessModes: + - ReadWriteOnce + resources: + requests: + storage: "40Gi" + + # Deploy Node Exporter on every node for host-level metrics. + nodeExporter: + enabled: true + + # Grafana is managed separately; disable the bundled instance. + grafana: + enabled: false diff --git a/config/modules/rook-ceph/VERSION b/config/modules/rook-ceph/VERSION new file mode 100644 index 0000000..836ae4e --- /dev/null +++ b/config/modules/rook-ceph/VERSION @@ -0,0 +1 @@ +1.19.2 diff --git a/config/modules/rook-ceph/kustomization.yaml b/config/modules/rook-ceph/kustomization.yaml new file mode 100644 index 0000000..1f459e6 --- /dev/null +++ b/config/modules/rook-ceph/kustomization.yaml @@ -0,0 +1,8 @@ +# Rook-Ceph Operator v__ROOK_CEPH_VERSION__ — Phase 1: CRDs + Operator (no CephCluster) +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + - https://raw.githubusercontent.com/rook/rook/v__ROOK_CEPH_VERSION__/deploy/examples/crds.yaml + - https://raw.githubusercontent.com/rook/rook/v__ROOK_CEPH_VERSION__/deploy/examples/common.yaml + - https://raw.githubusercontent.com/rook/rook/v__ROOK_CEPH_VERSION__/deploy/examples/operator.yaml diff --git a/config/modules/rook-ceph/moduletemplate.yaml b/config/modules/rook-ceph/moduletemplate.yaml new file mode 100644 index 0000000..3e193a9 --- /dev/null +++ b/config/modules/rook-ceph/moduletemplate.yaml @@ -0,0 +1,20 @@ +# ModuleTemplate — Rook-Ceph Operator v__ROOK_CEPH_VERSION__ (Phase 1: Operator only) +# Uses FluxCD Kustomization. Phase 2: Apply rook-ceph-cluster Module for CephCluster. +apiVersion: module.otterscale.io/v1alpha1 +kind: ModuleTemplate +metadata: + name: rook-ceph +spec: + namespace: rook-ceph + + description: >- + Rook-Ceph Operator v__ROOK_CEPH_VERSION__ — CRDs, Operator Deployment. Create CephCluster separately via rook-ceph-cluster Module. + + kustomization: + interval: 30m + prune: true + sourceRef: + kind: GitRepository + name: otterscale-module-operator + namespace: otterscale-system + path: config/modules/rook-ceph diff --git a/config/samples/module-cdi.yaml b/config/samples/module-cdi.yaml new file mode 100644 index 0000000..499813f --- /dev/null +++ b/config/samples/module-cdi.yaml @@ -0,0 +1,6 @@ +apiVersion: module.otterscale.io/v1alpha1 +kind: Module +metadata: + name: cdi +spec: + templateRef: cdi diff --git a/config/samples/module-gateway-api-inference-extension.yaml b/config/samples/module-gateway-api-inference-extension.yaml new file mode 100644 index 0000000..cd497fd --- /dev/null +++ b/config/samples/module-gateway-api-inference-extension.yaml @@ -0,0 +1,7 @@ +apiVersion: module.otterscale.io/v1alpha1 +kind: Module +metadata: + name: gateway-api-inference-extension +spec: + templateRef: + name: gateway-api-inference-extension diff --git a/config/samples/module-gateway-api.yaml b/config/samples/module-gateway-api.yaml new file mode 100644 index 0000000..e360d85 --- /dev/null +++ b/config/samples/module-gateway-api.yaml @@ -0,0 +1,6 @@ +apiVersion: module.otterscale.io/v1alpha1 +kind: Module +metadata: + name: gateway-api +spec: + templateRef: gateway-api diff --git a/config/samples/module-gpu-operator.yaml b/config/samples/module-gpu-operator.yaml new file mode 100644 index 0000000..cedca04 --- /dev/null +++ b/config/samples/module-gpu-operator.yaml @@ -0,0 +1,6 @@ +apiVersion: module.otterscale.io/v1alpha1 +kind: Module +metadata: + name: gpu-operator +spec: + templateRef: gpu-operator diff --git a/config/samples/module-hami.yaml b/config/samples/module-hami.yaml new file mode 100644 index 0000000..a050802 --- /dev/null +++ b/config/samples/module-hami.yaml @@ -0,0 +1,6 @@ +apiVersion: module.otterscale.io/v1alpha1 +kind: Module +metadata: + name: hami +spec: + templateRef: hami diff --git a/config/samples/module-istio-base.yaml b/config/samples/module-istio-base.yaml new file mode 100644 index 0000000..a86b4bc --- /dev/null +++ b/config/samples/module-istio-base.yaml @@ -0,0 +1,6 @@ +apiVersion: module.otterscale.io/v1alpha1 +kind: Module +metadata: + name: istio-base +spec: + templateRef: istio-base diff --git a/config/samples/module-istio-gateway.yaml b/config/samples/module-istio-gateway.yaml new file mode 100644 index 0000000..d0a1a7b --- /dev/null +++ b/config/samples/module-istio-gateway.yaml @@ -0,0 +1,6 @@ +apiVersion: module.otterscale.io/v1alpha1 +kind: Module +metadata: + name: istio-gateway +spec: + templateRef: istio-gateway diff --git a/config/samples/module-istio-istiod.yaml b/config/samples/module-istio-istiod.yaml new file mode 100644 index 0000000..1972b47 --- /dev/null +++ b/config/samples/module-istio-istiod.yaml @@ -0,0 +1,6 @@ +apiVersion: module.otterscale.io/v1alpha1 +kind: Module +metadata: + name: istiod +spec: + templateRef: istiod diff --git a/config/samples/module-kubevirt.yaml b/config/samples/module-kubevirt.yaml new file mode 100644 index 0000000..a72dceb --- /dev/null +++ b/config/samples/module-kubevirt.yaml @@ -0,0 +1,6 @@ +apiVersion: module.otterscale.io/v1alpha1 +kind: Module +metadata: + name: kubevirt +spec: + templateRef: kubevirt diff --git a/config/samples/module-llm-d-infra.yaml b/config/samples/module-llm-d-infra.yaml new file mode 100644 index 0000000..7f19b5d --- /dev/null +++ b/config/samples/module-llm-d-infra.yaml @@ -0,0 +1,6 @@ +apiVersion: module.otterscale.io/v1alpha1 +kind: Module +metadata: + name: llm-d-infra +spec: + templateRef: llm-d-infra diff --git a/config/samples/module-prometheus.yaml b/config/samples/module-prometheus.yaml new file mode 100644 index 0000000..16164d1 --- /dev/null +++ b/config/samples/module-prometheus.yaml @@ -0,0 +1,6 @@ +apiVersion: module.otterscale.io/v1alpha1 +kind: Module +metadata: + name: prometheus +spec: + templateRef: prometheus-stack diff --git a/config/samples/module-rook-ceph.yaml b/config/samples/module-rook-ceph.yaml new file mode 100644 index 0000000..915b9c0 --- /dev/null +++ b/config/samples/module-rook-ceph.yaml @@ -0,0 +1,6 @@ +apiVersion: module.otterscale.io/v1alpha1 +kind: Module +metadata: + name: rook-ceph +spec: + templateRef: rook-ceph diff --git a/internal/module/helmrelease.go b/internal/module/helmrelease.go index 2accae6..7afab7a 100644 --- a/internal/module/helmrelease.go +++ b/internal/module/helmrelease.go @@ -74,7 +74,7 @@ func ReconcileHelmRelease( }, } - op, err := ctrlutil.CreateOrUpdate(ctx, c, hr, func() error { + op, err := ctrlutil.CreateOrPatch(ctx, c, hr, func() error { if m.Spec.Values != nil { templateSpec.Values = &apiextensionsv1.JSON{Raw: m.Spec.Values.Raw} } diff --git a/internal/module/kustomization.go b/internal/module/kustomization.go index 50e85f8..8557209 100644 --- a/internal/module/kustomization.go +++ b/internal/module/kustomization.go @@ -73,7 +73,7 @@ func ReconcileKustomization( }, } - op, err := ctrlutil.CreateOrUpdate(ctx, c, ks, func() error { + op, err := ctrlutil.CreateOrPatch(ctx, c, ks, func() error { ks.Spec = templateSpec // Ensure labels are set for identification and filtering