一键导入
flux-gitops
Flux CD GitOps scaffolding: multi-environment repos, infrastructure components, image automation, External Secrets integration, Kustomize overlays.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Flux CD GitOps scaffolding: multi-environment repos, infrastructure components, image automation, External Secrets integration, Kustomize overlays.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
This skill should be used when the user is working with Go projects (go.mod, *.go files), asking about "Go patterns", "Go architecture", "services", "repositories", or mentions "Go development", "Go project", "Go handlers", "Go testing".
Helm chart authoring, values.yaml design, GitOps with Flux HelmRelease, External Secrets Operator integration. Use for creating and debugging Helm charts.
| name | flux-gitops |
| description | Flux CD GitOps scaffolding: multi-environment repos, infrastructure components, image automation, External Secrets integration, Kustomize overlays. |
Scaffold and manage Flux CD GitOps repositories with:
Complementary to: helm-chart-developer skill (for Helm chart authoring).
This skill focuses on GitOps project structure and Flux-specific patterns.
Activate for:
gitops/
├── clusters/{env}/ # Flux orchestration layer
│ ├── kustomization.yaml # Aggregates all Flux Kustomizations
│ ├── 00-crds.yaml # CRDs (prune: false, wait: true)
│ ├── 01-controllers.yaml # dependsOn: crds
│ ├── 02-cluster-configs.yaml # dependsOn: controllers
│ ├── 03-services.yaml # dependsOn: cluster-configs
│ ├── 99-apps.yaml # dependsOn: services, cluster-configs
│ └── flux-system/
│
├── infra/
│ ├── base/
│ │ ├── cluster/
│ │ │ ├── controllers/ # cert-manager, ingress-nginx, ESO
│ │ │ └── configs/ # ClusterIssuer, ClusterSecretStore
│ │ └── services/ # redis, postgres (with configs/secrets)
│ ├── crds/ # Vendored CRDs (applied first)
│ │ ├── kustomization.yaml # Aggregates all CRD subdirs
│ │ ├── cert-manager/
│ │ └── external-secrets/
│ └── {env}/
│ ├── cluster/
│ │ ├── controllers/ # values only (ConfigMapGenerator)
│ │ └── configs/ # plain manifests
│ └── services/ # values + configs + secrets
│
├── apps/
│ ├── base/{app}/ # Base HelmRelease
│ └── {env}/{app}/ # values + configs + secrets
│ ├── configs/ # Plain ConfigMaps
│ └── secrets/ # ExternalSecrets
│
└── charts/app/ # Generic application chart
Structure Principle: Base + overlay with explicit layering. Controllers → Configs → Services → Apps.
See references/project-structure.md for detailed layout.
To create a new GitOps project:
Gather requirements via AskUserQuestion:
Create directory structure per references/project-structure.md
Generate cluster orchestration files (numbered Kustomizations)
Copy generic Helm chart from assets/charts/app/
Fetch latest component versions via Context7
Three workflows depending on component type:
infra/crds/{component}/:
kustomization.yaml - Resources referencecrds.yaml - Vendored from upstream (curl from release)infra/base/cluster/controllers/{component}/:
kustomization.yaml - Resources referencehelm.yaml - HelmRepository + HelmRelease (installCRDs: false)infra/{env}/cluster/controllers/{component}/:
kustomization.yaml - refs base + ConfigMapGeneratorvalues.yaml - Environment values (installCRDs: false)infra/crds/kustomization.yaml aggregatorinfra/{env}/cluster/controllers/kustomization.yaml aggregatorinfra/base/cluster/configs/{component}/:
kustomization.yaml - Resources reference{component}.yaml - Plain manifest templateinfra/{env}/cluster/configs/{component}/:
kustomization.yaml - refs base{component}.yaml - Environment-specific manifestinfra/{env}/cluster/configs/kustomization.yaml aggregatorinfra/base/services/{component}/:
kustomization.yaml - Resources referencehelm.yaml - HelmRepository + HelmReleaseinfra/{env}/services/{component}/:
kustomization.yaml - refs base + ConfigMapGenerator + configs + secretsvalues.yaml - With envFrom injectionconfigs/{component}.config.yaml - Plain ConfigMapsecrets/{component}.external.yaml - ExternalSecretinfra/{env}/services/kustomization.yaml aggregatorValidation: Run kubectl kustomize infra/{env}/... to validate before commit.
See references/infra-components.md for supported components.
To add application with image automation:
Gather via AskUserQuestion:
Create apps/base/{app}/:
kustomization.yaml - Resources referencehelm.yaml - HelmRelease referencing charts/appCreate apps/{env}/{app}/:
kustomization.yaml - refs base + ConfigMapGenerator + configs + secretsvalues.yaml - With envFrom injectionpatches.yaml - Image tag with automation markerkustomizeconfig.yaml - ConfigMap name replacementconfigs/{app}.config.yaml - Plain ConfigMap (non-sensitive)secrets/{app}.external.yaml - ExternalSecret (sensitive)Create image automation in apps/{env}/:
image-automation.yaml - ImageRepository + ImagePolicy + ImageUpdateAutomationUpdate apps/{env}/kustomization.yaml aggregator
See references/image-automation.md for registry-specific patterns.
Always use these API versions:
| Resource | API Version |
|---|---|
| HelmRelease | helm.toolkit.fluxcd.io/v2 |
| HelmRepository | source.toolkit.fluxcd.io/v1 |
| Kustomization (Flux) | kustomize.toolkit.fluxcd.io/v1 |
| GitRepository | source.toolkit.fluxcd.io/v1 |
| ImageRepository | image.toolkit.fluxcd.io/v1 |
| ImagePolicy | image.toolkit.fluxcd.io/v1 |
| ImageUpdateAutomation | image.toolkit.fluxcd.io/v1 |
| ExternalSecret | external-secrets.io/v1 |
| ClusterSecretStore | external-secrets.io/v1 |
CRITICAL: Never use deprecated versions (v2beta1, v2beta2). If found, propose migration.
See references/key-patterns.md for detailed YAML patterns:
Five Flux Kustomizations with explicit dependsOn chain:
| File | DependsOn | Path | Critical Settings |
|---|---|---|---|
00-crds.yaml | - | ./infra/crds | prune: false, wait: true |
01-controllers.yaml | crds | ./infra/{env}/cluster/controllers | wait: true, timeout: 10m |
02-cluster-configs.yaml | controllers | ./infra/{env}/cluster/configs | wait: true, timeout: 5m |
03-services.yaml | cluster-configs | ./infra/{env}/services | wait: true, timeout: 10m |
99-apps.yaml | services, cluster-configs | ./apps/{env} | wait: true, timeout: 10m |
Why this order:
Each directory Flux points to MUST have kustomization.yaml:
# infra/{env}/cluster/controllers/kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- cert-manager
- ingress-nginx
- external-secrets
CRITICAL: Vendor CRDs into repository. Do NOT use nested Flux Kustomizations for CRDs.
# Download vendored CRDs (use Context7 to get {VERSION} first!)
curl -sL https://github.com/cert-manager/cert-manager/releases/download/{VERSION}/cert-manager.crds.yaml \
> infra/crds/cert-manager/crds.yaml
For HelmReleases with CRDs, disable CRD installation:
# values.yaml
installCRDs: false
CRITICAL: Never hardcode versions. Always use Context7 to get current versions.
version: "") → Blocks and requires Context7version: "1.2.3") → Asks for verificationBefore creating ANY HelmRelease or vendoring CRDs:
# Step 1: Resolve library ID
Tool: resolve-library-id
Parameter: libraryName="{component}"
# Step 2: Query docs for version
Tool: query-docs
Parameters:
libraryId: "/{org}/{project}"
topic: "helm chart installation version"
# Step 3: Use version from documentation
Tool: resolve-library-id
libraryName: "cert-manager"
# Returns: /jetstack/cert-manager
Tool: query-docs
libraryId: "/jetstack/cert-manager"
topic: "helm installation version"
# Extract version from documentation
NEVER:
ALWAYS:
version: "" as placeholder until Context7 fetchedSee references/version-matrix.md for Context7 library IDs per component.
Before committing GitOps manifests, validate structure with kubectl kustomize:
# Validate infra component
kubectl kustomize infra/dev/cert-manager
# Validate apps
kubectl kustomize apps/dev
# Validate entire environment (from cluster kustomization)
kubectl kustomize clusters/dev
This catches:
Before completing GitOps scaffolding:
kubectl kustomize passes for all directoriesdependsOn set correctly in KustomizationsdisableNameSuffixHash: true| Avoid | Instead |
|---|---|
| Hardcoded secrets in values | ExternalSecret + secretRef |
prune: true for CRDs | prune: false to prevent deletion |
Missing dependsOn | Always set dependencies |
crds: CreateReplace | crds: Skip + vendored CRDs |
installCRDs: true in values | installCRDs: false (CRDs managed separately) |
| Nested Flux Kustomization for CRDs | Vendor CRDs into repo (race condition!) |
Missing wait: true | Always use wait: true + timeout |
| Missing aggregator kustomization.yaml | Every Flux path needs kustomization.yaml |
v2beta1/v2beta2 APIs | Use stable v2/v1 APIs |
| Hash suffix on ConfigMaps | disableNameSuffixHash: true |
{name}-{env} suffix | Skip suffix if env = namespace |
Trigger phrases:
For detailed patterns, consult:
references/project-structure.md - Full directory layoutreferences/image-automation.md - Registry-specific automationreferences/infra-components.md - Infrastructure patternsreferences/version-matrix.md - Current versions + Context7 usageWorking examples in examples/:
Orchestration:
orchestration-kustomizations.yaml - All 5 Flux Kustomizations with dependsOn chainControllers & Configs:
infra-base-helm.yaml - Base HelmRepo + HelmRelease for controllercluster-controller-overlay.yaml - Controller overlay (values only)cluster-config-overlay.yaml - Cluster config overlay (ClusterIssuer)Services & Apps (with configs/secrets):
service-overlay-full.yaml - Service with configs/secretsapp-overlay-full.yaml - App with configs/secretsconfig-configmap.yaml - Plain ConfigMap patternvalues-with-envfrom.yaml - values.yaml with envFrom injectionCRDs & Image Automation:
crds-kustomization.yaml - Vendored CRDs aggregatorimage-automation-ecr.yaml - ECR automationimage-automation-ghcr.yaml - GHCR automationexternal-secret.yaml - ESO patternGeneric chart template in assets/charts/app/ - copy to target project.
helm-chart-developer - Helm chart authoring and ESO integrationconventional-commit - Commit message formatting