diff --git a/AGENTS.md b/AGENTS.md index fca2cfa..0de0980 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -125,7 +125,6 @@ Two local charts under `helm/`: **Required Helm plugins** (not standard): ```bash -helm plugin install https://github.com/aslafy-z/helm-git helm plugin install https://github.com/databus23/helm-diff --verify=false ``` @@ -148,7 +147,7 @@ Helmfile uses Go template syntax (`.gotmpl` extension) throughout. ## Sibling repos -Helm charts for `hyperfleet-api`, `hyperfleet-sentinel`, and `hyperfleet-adapter` live in their respective sibling repos and are pulled at deploy time via `helm-git`. The `CHART_ORG` and `API_CHART_REF` variables control which org/ref is used. +Helm charts for `hyperfleet-api`, `hyperfleet-sentinel`, and `hyperfleet-adapter` are published to Quay as OCI artifacts and pulled via standard `oci://` repositories. The `API_CHART_VERSION`, `SENTINEL_CHART_VERSION`, and `ADAPTER_CHART_VERSION` variables control which versions are deployed. For kind image builds, `PROJECTS_DIR` must point to the parent directory containing those repos (default: `~/openshift-hyperfleet`). diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 477d0fa..7f6aacf 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,7 +10,7 @@ git clone https://github.com/openshift-hyperfleet/hyperfleet-infra.git cd hyperfleet-infra # 2. Install prerequisites -# - helm + helm-git plugin + helmfile +# - helm + helmfile # - kubectl # - terraform 1.13.1 via asdf (GCP only) # - Google Cloud SDK + gke-gcloud-auth-plugin (GCP only) @@ -37,7 +37,6 @@ Notes: - Personal tfvars/tfbackend are gitignored — never commit them - For kind deployments, Terraform setup is not required - `NAMESPACE` controls which Kubernetes namespace is used; set it to run parallel deployments on the same cluster -- `helm-git` plugin is required for helm to pull charts from sibling repos - `diff` plugin is required for helmfile to show the change on upgrade ## Environment Configuration Files @@ -264,7 +263,6 @@ Full standard: https://github.com/openshift-hyperfleet/architecture/blob/main/hy ## Release Process No semantic versioning. Infrastructure changes deploy from `main` after review and approval via `OWNERS` (Prow enforced). - -- Helm charts live in component repos (`hyperfleet-api`, `hyperfleet-sentinel`, `hyperfleet-adapter`) and are pulled via helm-git at deploy time +- Helm charts live in component repos (`hyperfleet-api`, `hyperfleet-sentinel`, `hyperfleet-adapter`) and are published to Quay as OCI artifacts - Terraform modules are versioned through git tags - Image tags default to `latest` (GCP) or `local` (kind); override with `API_IMAGE_TAG`, `SENTINEL_IMAGE_TAG`, `ADAPTER_IMAGE_TAG` diff --git a/README.md b/README.md index 42a00bd..c6c9f5b 100644 --- a/README.md +++ b/README.md @@ -27,12 +27,11 @@ Two message broker backends are supported: ### All environments -- `helm` + [`helm-git` plugin](https://github.com/aslafy-z/helm-git) + [`helm-diff` plugin](https://github.com/databus23/helm-diff) +- `helm` + [`helm-diff` plugin](https://github.com/databus23/helm-diff) - `helmfile` - `kubectl` with a configured context ```bash -helm plugin install https://github.com/aslafy-z/helm-git helm plugin install https://github.com/databus23/helm-diff --verify=false ``` @@ -176,10 +175,9 @@ Set `TRACING_ENABLED=true` and `OBSERVABILITY_ENABLED=true`. | `SENTINEL_IMAGE_TAG` | `dev` | `local` | | | `ADAPTER_IMAGE_TAG` | `dev` | `local` | | | `IMAGE_PULL_POLICY` | `Always` | `IfNotPresent` | | -| `CHART_ORG` | `openshift-hyperfleet` | `openshift-hyperfleet` | GitHub org for helm-git chart repos | -| `API_CHART_REF` | `main` | `main` | Git ref for API chart | -| `SENTINEL_CHART_REF` | `main` | `main` | Git ref for Sentinel chart | -| `ADAPTER_CHART_REF` | `main` | `main` | Git ref for Adapter chart | +| `API_CHART_VERSION` | `` (empty) | `` (empty) | OCI chart version; empty=latest, or pin to version like `0.3.1` | +| `SENTINEL_CHART_VERSION` | `` (empty) | `` (empty) | OCI chart version; empty=latest, or pin to version like `0.3.1` | +| `ADAPTER_CHART_VERSION` | `` (empty) | `` (empty) | OCI chart version; empty=latest, or pin to version like `0.3.1` | | `TF_ENV` | `dev` | N/A | Selects `envs/gke/.tfvars` | | `RABBITMQ_URL` | N/A | `amqp://guest:guest@rabbitmq:5672` | | | `MAESTRO_CONSUMER` | `cluster1` | `cluster1` | | diff --git a/docs/bump-chart-versions.md b/docs/bump-chart-versions.md new file mode 100644 index 0000000..8a38ef4 --- /dev/null +++ b/docs/bump-chart-versions.md @@ -0,0 +1,191 @@ +# Bumping Chart Versions + +This guide explains how to update HyperFleet component chart versions for deployments. + +## Overview + +HyperFleet component charts (API, Sentinel, Adapter) are published as OCI artifacts to Quay on every merge to main in their respective repos. This infrastructure repo consumes those charts from: + +``` +oci://quay.io/redhat-services-prod/hyperfleet-tenant/hyperfleet/ +``` + +## Chart Version Variables + +Three environment variables control which chart versions are deployed: + +| Variable | Default | Component | +|----------|---------|-----------| +| `API_CHART_VERSION` | `` (empty) | hyperfleet-api-chart | +| `SENTINEL_CHART_VERSION` | `` (empty) | hyperfleet-sentinel-chart | +| `ADAPTER_CHART_VERSION` | `` (empty) | hyperfleet-adapter-chart | + + +These are defined in `helmfile/helmfile.yaml.gotmpl` and can be overridden via environment variables or `env.gcp`/`env.kind`. + +**Default Behavior (empty/unset)**: By default, the version is empty, which tells Helm to pull the latest semantic version available in the OCI registry. This maintains the same "always up-to-date" behavior as the previous helm-git setup with `ref=main`. Helm automatically selects the highest SemVer tag. + +**Pinning to a Specific Version**: For production deployments or when you need to test a specific chart version, set the variable to a SemVer version like `0.3.1`. +## Listing Available Versions + +### Via Quay UI + +Browse to: +- https://quay.io/repository/redhat-services-prod/hyperfleet-tenant/hyperfleet/hyperfleet-api-chart?tab=tags +- https://quay.io/repository/redhat-services-prod/hyperfleet-tenant/hyperfleet/hyperfleet-sentinel-chart?tab=tags +- https://quay.io/repository/redhat-services-prod/hyperfleet-tenant/hyperfleet/hyperfleet-adapter-chart?tab=tags + +### Via CLI + +```bash +# List all tags for a chart +skopeo list-tags docker://quay.io/redhat-services-prod/hyperfleet-tenant/hyperfleet/hyperfleet-api-chart + +# List recent tags (last 10) +skopeo list-tags docker://quay.io/redhat-services-prod/hyperfleet-tenant/hyperfleet/hyperfleet-api-chart | jq -r '.Tags[]' | sort -V | tail -10 +``` + +## Bumping Versions + +### Option 1: Override via CLI (temporary, one-time) + +```bash +# Upgrade all three charts to 0.3.2 +API_CHART_VERSION=0.3.2 \ +SENTINEL_CHART_VERSION=0.3.2 \ +ADAPTER_CHART_VERSION=0.3.2 \ +make install-hyperfleet +``` + +### Option 2: Update env.gcp or env.kind (persistent for local dev) + +Edit `env.gcp` or `env.kind`: + +```bash +# Add or update these lines +export API_CHART_VERSION=0.3.2 +export SENTINEL_CHART_VERSION=0.3.2 +export ADAPTER_CHART_VERSION=0.3.2 +``` + +Then deploy normally: + +```bash +make install-hyperfleet +``` + +### Option 3: Update helmfile defaults (permanent, affects all users) + +Edit `helmfile/helmfile.yaml.gotmpl`: + +```yaml +values: + - charts: + api: + version: {{ env "API_CHART_VERSION" | default "0.3.2" }} + sentinel: + version: {{ env "SENTINEL_CHART_VERSION" | default "0.3.2" }} + adapter: + version: {{ env "ADAPTER_CHART_VERSION" | default "0.3.2" }} +``` + +Commit and create a PR. After merge, all users get the new defaults. + +## Upgrade Strategy + +### Coordinated Release (recommended) + +When all three component repos publish the same version: + +```bash +# Single version bump for all charts +export CHART_VERSION=0.3.2 +API_CHART_VERSION=$CHART_VERSION \ +SENTINEL_CHART_VERSION=$CHART_VERSION \ +ADAPTER_CHART_VERSION=$CHART_VERSION \ +make install-hyperfleet +``` + +### Independent Versioning + +When components have different versions (e.g., hotfix for API only): + +```bash +# Bump only API chart +API_CHART_VERSION=0.3.2 make install-api + +# Or bump all with different versions +API_CHART_VERSION=0.3.2 \ +SENTINEL_CHART_VERSION=0.3.1 \ +ADAPTER_CHART_VERSION=0.3.1 \ +make install-hyperfleet +``` + +## Verification + +After deploying with new chart versions: + +```bash +# Check deployed chart versions +helm list -n hyperfleet + +# Inspect a specific release +helm get values hyperfleet-api -n hyperfleet + +# Verify chart metadata +helm get metadata hyperfleet-api -n hyperfleet +``` + +## Troubleshooting + +### Chart version not found + +``` +Error: failed to download "hyperfleet-charts/hyperfleet-api-chart" at version "0.3.2" +``` + +**Cause:** The requested chart version doesn't exist on Quay. + +**Fix:** Verify the version exists using `skopeo list-tags` or the Quay UI. Check that the component repo's pipeline successfully published the chart. + +### Permission denied pulling chart + +``` +Error: GET "https://quay.io/v2/...": response status code 401: unauthorized +``` + +**Cause:** Quay repository is private or you're not authenticated. + +**Fix:** Charts should be public. If private, authenticate: + +```bash +helm registry login quay.io -u +``` + +### Helm says "improper constraint" + +``` +Error: improper constraint: 0.1.515_aff8821 +``` + +**Cause:** Invalid version format. Helm expects SemVer (0.3.1), not commit-suffixed tags (0.1.515_aff8821). + +**Fix:** Use the SemVer tag (0.3.1), not build metadata tags. + +## Rollback + +To rollback to a previous chart version: + +```bash +# Rollback API to 0.3.0 +API_CHART_VERSION=0.3.0 make install-api + +# Or rollback via helm directly +helm rollback hyperfleet-api -n hyperfleet +``` + +## Related + +- Chart publishing pipeline: See `.tekton/` in component repos (hyperfleet-api, hyperfleet-sentinel, hyperfleet-adapter) +- Chart source: `charts/` directory in each component repo +- Epic: HYPERFLEET-831 (Helm OCI Distribution) diff --git a/helmfile/helmfile.yaml.gotmpl b/helmfile/helmfile.yaml.gotmpl index 018cfe4..0637483 100644 --- a/helmfile/helmfile.yaml.gotmpl +++ b/helmfile/helmfile.yaml.gotmpl @@ -11,14 +11,13 @@ helmDefaults: # Base values for all environments values: - namespace: {{ requiredEnv "NAMESPACE" }} - - chartOrg: {{ env "CHART_ORG" | default "openshift-hyperfleet" }} - charts: api: - chartRef: {{ env "API_CHART_REF" | default "main" }} + version: {{ env "API_CHART_VERSION" | default "" }} sentinel: - chartRef: {{ env "SENTINEL_CHART_REF" | default "main" }} + version: {{ env "SENTINEL_CHART_VERSION" | default "" }} adapter: - chartRef: {{ env "ADAPTER_CHART_REF" | default "main" }} + version: {{ env "ADAPTER_CHART_VERSION" | default "" }} # Environment configurations - e2e, e2e-kind, kind, gcp environments: @@ -56,13 +55,6 @@ commonLabels: --- -repositories: - - name: hyperfleet-api - url: git+https://github.com/{{ .Values.chartOrg }}/hyperfleet-api@charts?ref={{ .Values.charts.api.chartRef }}&sparse=0 - - name: hyperfleet-sentinel - url: git+https://github.com/{{ .Values.chartOrg }}/hyperfleet-sentinel@charts?ref={{ .Values.charts.sentinel.chartRef }}&sparse=0 - - name: hyperfleet-adapter - url: git+https://github.com/{{ .Values.chartOrg }}/hyperfleet-adapter@charts?ref={{ .Values.charts.adapter.chartRef }}&sparse=0 releases: {{ if eq .Values.brokerType "rabbitmq" }} @@ -76,7 +68,10 @@ releases: # HyperFleet API - name: hyperfleet-api namespace: {{ .Values.namespace }} - chart: hyperfleet-api/hyperfleet-api + chart: oci://quay.io/redhat-services-prod/hyperfleet-tenant/hyperfleet/hyperfleet-api-chart +{{ if .Values.charts.api.version }} + version: {{ .Values.charts.api.version }} +{{ end }} labels: component: api values: @@ -85,7 +80,10 @@ releases: {{ range .Values.sentinels }} - name: {{ .name }} namespace: {{ $.Values.namespace }} - chart: hyperfleet-sentinel/hyperfleet-sentinel + chart: oci://quay.io/redhat-services-prod/hyperfleet-tenant/hyperfleet/hyperfleet-sentinel-chart +{{ if $.Values.charts.sentinel.version }} + version: {{ $.Values.charts.sentinel.version }} +{{ end }} needs: - hyperfleet-api labels: @@ -104,7 +102,10 @@ releases: {{ range .Values.adapters }} - name: {{ .name }} namespace: {{ $.Values.namespace }} - chart: hyperfleet-adapter/hyperfleet-adapter + chart: oci://quay.io/redhat-services-prod/hyperfleet-tenant/hyperfleet/hyperfleet-adapter-chart +{{ if $.Values.charts.adapter.version }} + version: {{ $.Values.charts.adapter.version }} +{{ end }} labels: component: adapter values: