Skip to content

Commit 4b51e2c

Browse files
committed
Merge remote-tracking branch 'upstream/main'
2 parents 04ba223 + f2104cb commit 4b51e2c

7 files changed

Lines changed: 183 additions & 0 deletions

File tree

.claude/rules/.rules

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../.rules

.rules/helm-dep-charts.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
paths: ["charts/dependencies/**"]
3+
---
4+
## charts/dependencies/ — standalone operator charts (non-OLM)
5+
6+
Each subdirectory is an independent Helm chart extracted from OLM bundles for vanilla Kubernetes (no OLM).
7+
8+
### Chart structure
9+
10+
- `crds/` — CRD YAMLs (raw, not templated).
11+
- `templates/` — Deployments, RBAC, Services, operator CRs. Namespace refs templated via `{{ .Values.operatorNamespace }}`.
12+
- `scripts/update-bundle.sh` — extracts manifests from registry bundle image using `olm-extractor`. Splits into CRDs vs templates, templatizes namespaces, adds imagePullSecrets to ServiceAccounts.
13+
- `test/snapshots/` — snapshot test files.
14+
- `values.yaml` — minimal: `operatorNamespace`, `operandNamespace` (if different), `imagePullSecrets`, `bundle.version`.
15+
16+
### Patterns
17+
18+
- Templates are mostly static YAML with namespace templating only (`{{ .Values.operatorNamespace }}`).
19+
- No complex helpers — each chart is self-contained.
20+
- CRDs go in `crds/` (Helm manages them separately), NOT in `templates/`.
21+
- Operator CR templates (e.g. `certmanager.yaml`, `leaderworkersetoperator.yaml`) are simple static specs.
22+
- ServiceAccounts include `{{- with .Values.imagePullSecrets }}` block.
23+
24+
### Updating a dependency
25+
26+
Run `scripts/update-bundle.sh <version>` — requires `podman login registry.redhat.io`.
27+
After update: review extracted manifests, run snapshot tests.
28+
29+
### Validation
30+
31+
```bash
32+
helm template <chart-name> charts/dependencies/<chart-name>
33+
make chart-snapshots
34+
make chart-test
35+
```

.rules/helm-ocp-chart.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
paths: ["charts/rhai-on-openshift-chart/**"]
3+
---
4+
## rhai-on-openshift-chart (OCP/OLM-based)
5+
6+
Template prefix: `rhoai-dependencies.` for all helpers.
7+
8+
### Dependency templates
9+
10+
Follow `templates/dependencies/cert-manager/operator.yaml` pattern:
11+
- `operator.yaml`: gate with `shouldInstall` + `isOlmMode`, call `rhoai-dependencies.operator.olm`.
12+
- `config.yaml` (optional): gate with `shouldInstall` + `crdExists`, render CR with `$dep.config.spec`.
13+
- Pass all OLM fields: `name`, `namespace`, `channel`, `version`, `targetNamespaces`, `config`, `root`.
14+
15+
### Adding dependency
16+
17+
1. Add to `values.yaml` under `dependencies.yourOperator` (enabled: auto, olm config, optional config/dependencies).
18+
2. Create `templates/dependencies/your-operator/operator.yaml` (and `config.yaml` if CR needed).
19+
3. Update `values.schema.json`.
20+
4. Run `make helm-docs`.
21+
22+
### Adding component
23+
24+
1. Add to `values.yaml` under `components.yourComponent` (dependencies, dsc, optional defaults per operator type).
25+
2. Add to `templates/operator/datasciencecluster.yaml` using `componentDSCConfig`.
26+
3. Add to `docs/examples/values-all-components-managed.yaml`.
27+
4. Update `values.schema.json`.
28+
5. Run `make helm-docs`.
29+
30+
### Adding profile
31+
32+
1. Create `profiles/<name>.yaml` — only override components/services that differ from default (Removed).
33+
2. Add name to `profile` enum in `values.schema.json`.
34+
3. Add snapshot entry in `scripts/snapshot-config.yaml`.
35+
36+
### Key helpers (in `templates/definitions/`)
37+
38+
- `shouldInstall`: tri-state (true/false/auto) → resolves via component/service/transitive deps.
39+
- `isOlmMode`: true when `tags.install-with-helm-dependencies` is false (default).
40+
- `crdExists`: checks CRD presence or `skipCrdCheck` flag. Use in config.yaml templates.
41+
- `componentDSCConfig`: merges user values > operator-type defaults > profile defaults.
42+
- `effectiveComponentManagementState` / `effectiveServiceManagementState`: resolves null states via profiles.
43+
- `operator.olm`: generates Namespace + OperatorGroup + Subscription.
44+
45+
### Validation
46+
47+
```bash
48+
make chart-snapshots CHART_NAME=rhai-on-openshift-chart
49+
make chart-test CHART_NAME=rhai-on-openshift-chart
50+
make helm-docs
51+
helm template ./charts/rhai-on-openshift-chart -f docs/examples/values-all-components-managed.yaml --set skipCrdCheck=true
52+
```

.rules/helm-xks-chart.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
paths: ["charts/rhai-on-xks-chart/**"]
3+
---
4+
## rhai-on-xks-chart (non-OCP Kubernetes)
5+
6+
Template prefix: `rhai-on-xks-chart.` for all helpers.
7+
8+
### Structure
9+
10+
- `templates/manager/` — RHAI operator deployment, namespaces, services.
11+
- `templates/rbac/` — ServiceAccount, ClusterRole, ClusterRoleBinding.
12+
- `templates/crds/` — CRDs bundled in chart.
13+
- `templates/hooks/` — post-install Jobs (CRs creation, gateway setup).
14+
- `templates/webhooks/` — MutatingWebhookConfiguration.
15+
- `templates/cloudmanager/{azure,coreweave}/` — cloud-specific resources (RBAC, CRDs, deployment).
16+
- `templates/pull-secret.yaml` — optional image pull secret.
17+
- `templates/validation.yaml` — calls `validateCloudProvider`.
18+
19+
### Cloud provider pattern
20+
21+
Exactly one of `azure.enabled` or `coreweave.enabled` must be true. Validated by `validateCloudProvider` helper.
22+
Cloud-specific templates gated with `{{- if .Values.<provider>.enabled }}`.
23+
24+
### Key helpers (`_helpers.tpl`)
25+
26+
- `validateCloudProvider`: fails if zero or multiple providers enabled.
27+
- `imagePullSecretEnabled`: checks `imagePullSecret.dockerConfigJson`.
28+
- `imagePullSecretName`: defaults to `rhai-pull-secret`.
29+
- `imagePullSecrets`: renders pod spec block.
30+
31+
### Image updates
32+
33+
`make update-image` fetches images from Build-Config repo into `values-<branch>.yaml` override files.
34+
Override files (e.g. `values-rhoai-3.4.yaml`) are copies of `values.yaml` with patched image fields.
35+
36+
### Validation
37+
38+
```bash
39+
make chart-snapshots CHART_NAME=rhai-on-xks-chart
40+
make chart-test CHART_NAME=rhai-on-xks-chart
41+
make helm-docs
42+
```

.rules/kustomize.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
paths: ["components/**", "dependencies/**", "configurations/**"]
3+
---
4+
New operator: component in `components/operators/<name>/`, overlay in `dependencies/operators/<name>/`.
5+
No namespace in kustomization.yaml — set in individual resource files.
6+
Add to parent kustomization: `dependencies/operators/kustomization.yaml` and `configurations/kustomization.yaml`.
7+
Update `scripts/verify-dependencies.sh` for new operators.
8+
Validate: `make validate-all`.

AGENTS.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# odh-gitops
2+
3+
GitOps repo for OpenDataHub/RHOAI dependencies and Helm charts. Kustomize layers + Helm charts for OCP operator deployment.
4+
5+
## Build & Test
6+
7+
```bash
8+
make validate-all # YAML lint + kustomize build + kube-linter
9+
make chart-test # Helm snapshot tests
10+
make chart-snapshots # Regenerate snapshots
11+
make helm-docs # Regenerate api-docs.md (commit result)
12+
helm lint ./charts/<chart> # Lint single chart
13+
helm template ./charts/rhai-on-openshift-chart -f docs/examples/values-all-components-managed.yaml --set skipCrdCheck=true
14+
```
15+
16+
## Conventions
17+
18+
- Commits: conventional format `type(JIRA-ID): description`. All non-chore commits need Jira link.
19+
- YAML indent: 2 spaces. Line length max 180.
20+
- Kustomize: no namespace in `kustomization.yaml`, set in individual resource files.
21+
- Helm dependencies: tri-state `enabled` (auto/true/false). Use `shouldInstall` helper.
22+
- Helm docs: run `make helm-docs` after values.yaml changes, commit generated `api-docs.md`.
23+
24+
## Before writing code
25+
26+
Read existing files in same area to match patterns. Key examples:
27+
28+
- Kustomize dependency: `components/operators/cert-manager/`, `dependencies/operators/kueue-operator/`
29+
- Kustomize config: `configurations/kueue-operator/`
30+
- Helm dependency template: `charts/rhai-on-openshift-chart/templates/dependencies/cert-manager/operator.yaml`
31+
- Helm helpers: `charts/rhai-on-openshift-chart/templates/definitions/_helpers.tpl`
32+
- Helm values schema: `charts/rhai-on-openshift-chart/values.schema.json`
33+
- Snapshot config: `scripts/snapshot-config.yaml`
34+
- Adding new dependency: see `CONTRIBUTING.md`
35+
36+
## Architecture
37+
38+
- `components/operators/` — reusable Kustomize components per operator
39+
- `dependencies/operators/` — composed Kustomize overlays (reference components, add patches)
40+
- `configurations/` — post-CRD operator config (CRs that need OLM-installed CRDs)
41+
- `charts/rhai-on-openshift-chart/` — Helm chart for OCP (OLM-based)
42+
- `charts/rhai-on-xks-chart/` — Helm chart for non-OCP Kubernetes
43+
- `scripts/` — verification, snapshot, and maintenance scripts
44+
- `bin/` — local tool binaries (gitignored content, committed wrappers)

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@AGENTS.md

0 commit comments

Comments
 (0)