diff --git a/.github/workflows/helm-e2e.yaml b/.github/workflows/helm-e2e.yaml index 00ae2db..2be662d 100644 --- a/.github/workflows/helm-e2e.yaml +++ b/.github/workflows/helm-e2e.yaml @@ -20,15 +20,15 @@ jobs: RELEASE_NAME: openops NAMESPACE: openops steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7.0.1 - name: Set up Helm - uses: azure/setup-helm@v4 + uses: azure/setup-helm@v5.0.1 with: version: v3.14.4 - name: Cache Docker images - uses: actions/cache@v4 + uses: actions/cache@v6.1.0 with: path: /var/lib/docker key: docker-${{ runner.os }}-${{ hashFiles('chart/values.yaml', 'chart/values.ci.yaml') }} @@ -36,7 +36,7 @@ jobs: docker-${{ runner.os }}- - name: Create kind cluster - uses: helm/kind-action@v1.9.0 + uses: helm/kind-action@v1.15.0 with: cluster_name: openops-e2e wait: 180s diff --git a/.github/workflows/helm-validate.yaml b/.github/workflows/helm-validate.yaml index 624b860..bb90573 100644 --- a/.github/workflows/helm-validate.yaml +++ b/.github/workflows/helm-validate.yaml @@ -18,10 +18,10 @@ jobs: contents: read steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v7.0.1 - name: Set up Helm - uses: azure/setup-helm@v4 + uses: azure/setup-helm@v5.0.1 with: version: v3.14.4 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 63a0b74..2ac30ef 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,15 +20,20 @@ jobs: runs-on: ubuntu-latest permissions: contents: write + id-token: write + # The release identity's federated credentials are scoped to this environment rather than to + # a branch, so a release runs from any branch - and the environment is where an approval gate + # for publishing to the public registry belongs. Without it the OIDC subject does not match. + environment: release env: CHART_VERSION: ${{ inputs.draft && format('{0}-draft', inputs.version) || inputs.version }} APP_VERSION: ${{ inputs.version }} steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v7.0.1 - name: Set up Helm - uses: azure/setup-helm@v4 + uses: azure/setup-helm@v5.0.1 with: version: v3.14.4 @@ -54,23 +59,29 @@ jobs: chart_package=$(printf '%s\n' "$pkg_output" | awk '/Successfully packaged chart and saved it to:/ {print $NF}') echo "CHART_PACKAGE=$chart_package" >> "$GITHUB_ENV" - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v4 + - name: Azure login + uses: azure/login@7ddb5af1ef8758cf1353cf3b42f940aee27ba21c # v3.0.2 with: - aws-access-key-id: ${{ secrets.ECR_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.ECR_SECRET_ACCESS_KEY }} - aws-region: ${{ vars.ECR_PUBLIC_REGION }} + client-id: ${{ secrets.AZURE_ACR_RELEASE_CLIENT_ID }} + tenant-id: ${{ secrets.AZURE_TENANT_ID }} + subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} - - name: Push chart to public ECR + - name: Push chart to the public ACR + env: + ACR_PUBLIC_NAME: ${{ vars.ACR_PUBLIC_NAME }} + ACR_PUBLIC_LOGIN_SERVER: ${{ vars.ACR_PUBLIC_LOGIN_SERVER }} run: | set -euo pipefail - aws ecr-public get-login-password --region ${{ vars.ECR_PUBLIC_REGION }} \ - | helm registry login --username AWS --password-stdin public.ecr.aws - helm push "$CHART_PACKAGE" oci://public.ecr.aws/openops/helm - echo "- ✅ Pushed \`oci://public.ecr.aws/openops/helm/openops:${CHART_VERSION}\`" >> $GITHUB_STEP_SUMMARY + # --expose-token rather than plain `az acr login`: that writes Docker's credential + # store, which helm does not read. helm wants its own registry login. + TOKEN=$(az acr login --name "$ACR_PUBLIC_NAME" --expose-token --output tsv --query accessToken) + helm registry login "$ACR_PUBLIC_LOGIN_SERVER" \ + --username 00000000-0000-0000-0000-000000000000 --password-stdin <<<"$TOKEN" + helm push "$CHART_PACKAGE" "oci://$ACR_PUBLIC_LOGIN_SERVER/helm" + echo "- ✅ Pushed \`oci://$ACR_PUBLIC_LOGIN_SERVER/helm/openops:${CHART_VERSION}\`" >> $GITHUB_STEP_SUMMARY - name: Create GitHub release - uses: softprops/action-gh-release@v2 + uses: softprops/action-gh-release@v3.0.3 with: target_commitish: ${{ github.sha }} tag_name: ${{ env.CHART_VERSION }} @@ -91,5 +102,5 @@ jobs: echo "" >> $GITHUB_STEP_SUMMARY echo "Install with:" >> $GITHUB_STEP_SUMMARY echo '```bash' >> $GITHUB_STEP_SUMMARY - echo "helm install openops oci://public.ecr.aws/openops/helm/openops --version $CHART_VERSION" >> $GITHUB_STEP_SUMMARY + echo "helm install openops oci://${{ vars.ACR_PUBLIC_LOGIN_SERVER }}/helm/openops --version $CHART_VERSION" >> $GITHUB_STEP_SUMMARY echo '```' >> $GITHUB_STEP_SUMMARY diff --git a/AGENTS.md b/AGENTS.md index 7e5dee5..e93d736 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -35,21 +35,21 @@ - **Validation helpers**: Runtime validation of required secrets (OPS_ENCRYPTION_KEY, OPS_JWT_SECRET, etc.) with helpful error messages at render time. ## Release workflow -- **`.github/workflows/release.yml`**: Packages the Helm chart and pushes it as an OCI artifact to `public.ecr.aws/openops/helm/openops`. +- **`.github/workflows/release.yml`**: Packages the Helm chart and pushes it as an OCI artifact to `openops.azurecr.io/helm/openops`. - Triggered via `workflow_dispatch` with two inputs: - `version` (required): The release version (e.g., `0.6.15`). Sets both `Chart.yaml` version/appVersion and `global.version` (image tags). - - `draft` (boolean, default `true`): When true, appends `-draft` to the chart version (e.g., `0.6.15-draft`). Draft versions are overwritable on ECR; final versions are immutable. + - `draft` (boolean, default `true`): When true, appends `-draft` to the chart version (e.g., `0.6.15-draft`). The suffix is a naming convention only - ACR does not enforce tag immutability unless it is configured on the registry, so a final version can be overwritten by a later push of the same version. - Also triggered cross-repo by `openops-cloud/openops` release workflow. - Creates a GitHub release (draft or published) with the packaged `.tgz` as an asset. - **Do not bump versions in `Chart.yaml` or `values.yaml` manually**—the release workflow sets them at build time. The repo defaults are `version: 0.0.1-dev` and `appVersion: 0.0.1-dev`. -- Required secrets: `ECR_ACCESS_KEY_ID`, `ECR_SECRET_ACCESS_KEY`; required vars: `ECR_PUBLIC_REGION`. +- Authenticates with GitHub OIDC. Required secrets: `AZURE_ACR_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_SUBSCRIPTION_ID`; required vars: `ACR_PUBLIC_NAME`, `ACR_PUBLIC_LOGIN_SERVER`. ## Versioning strategy - All *release* versions are unified: chart version = appVersion = `global.version` (image tags) = OpenOps release version. The in-repo development defaults (`0.0.1-dev`) are normalized by the release workflow. - Exception: draft releases use `{version}-draft` for the chart version only; `appVersion` and image tags use the clean version. -- The chart is published to `oci://public.ecr.aws/openops/helm/openops`. Users install with: +- The chart is published to `oci://openops.azurecr.io/helm/openops`. Users install with: ``` - helm install openops oci://public.ecr.aws/openops/helm/openops --version + helm install openops oci://openops.azurecr.io/helm/openops --version ``` ## PR lint rules diff --git a/README.md b/README.md index b58f20c..d5b856f 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ This repository contains the Helm chart that deploys the OpenOps application sta ### Install from OCI registry (recommended) ```bash -helm install openops oci://public.ecr.aws/openops/helm/openops \ +helm install openops oci://openops.azurecr.io/helm/openops \ --version \ -n openops --create-namespace \ -f values.overrides.yaml @@ -315,38 +315,23 @@ kubectl create secret tls openops-tls \ ## Dependencies The deployments include health checks and readiness probes so dependent services wait until their prerequisites are available. -## Private ECR access from non-AWS clusters +## Pulling from a private registry -When deploying on AKS or other non-AWS Kubernetes clusters that need to pull images from a private ECR registry, enable the ECR credential refresh CronJob: +Release images need no credentials. `openops.azurecr.io` allows anonymous pull, so a default +install authenticates to nothing. + +If you mirror the images into a registry of your own, create a pull secret by whatever means +that registry expects and reference it: ```yaml global: imagePullSecrets: - - ecr-pull-secret - -ecrCredentialRefresh: - enabled: true - registry: "" - awsRegion: "us-east-2" - awsSecretName: "ecr-credentials" # K8s secret with AWS access keys - imagePullSecretName: "ecr-pull-secret" # Created/refreshed automatically -``` + - my-registry-credentials -**Pre-requisite:** Create the AWS credentials secret (one-time): -```bash -kubectl create secret generic ecr-credentials \ - -n openops \ - --from-literal=AWS_ACCESS_KEY_ID= \ - --from-literal=AWS_SECRET_ACCESS_KEY= +image: + repository: my-registry.example.com/openops ``` -The IAM user needs only `ecr:GetAuthorizationToken`, `ecr:BatchGetImage`, and `ecr:GetDownloadUrlForLayer` permissions. - -**How it works:** -- A Helm post-install/post-upgrade hook creates the pull secret immediately on deploy -- A CronJob refreshes the ECR token every 6 hours (tokens expire after 12h) -- All deployments reference the pull secret via `global.imagePullSecrets` - ## Analytics (Superset) configuration override The analytics component is based on Apache Superset. To override its Python configuration (e.g., for Redis SSL/auth), use `analytics.configOverride`: diff --git a/chart/templates/NOTES.txt b/chart/templates/NOTES.txt index 03312f6..736f396 100644 --- a/chart/templates/NOTES.txt +++ b/chart/templates/NOTES.txt @@ -118,7 +118,7 @@ Useful commands: helm test {{ .Release.Name }} -n {{ .Release.Namespace }} # Upgrade deployment - helm upgrade {{ .Release.Name }} oci://public.ecr.aws/openops/helm/{{ .Chart.Name }} --version {{ .Chart.Version }} -n {{ .Release.Namespace }} -f values.overrides.yaml + helm upgrade {{ .Release.Name }} oci://openops.azurecr.io/helm/{{ .Chart.Name }} --version {{ .Chart.Version }} -n {{ .Release.Namespace }} -f values.overrides.yaml # Uninstall helm uninstall {{ .Release.Name }} -n {{ .Release.Namespace }} diff --git a/chart/templates/cronjob-ecr-credential-refresh.yaml b/chart/templates/cronjob-ecr-credential-refresh.yaml deleted file mode 100644 index da2abf2..0000000 --- a/chart/templates/cronjob-ecr-credential-refresh.yaml +++ /dev/null @@ -1,184 +0,0 @@ -{{- if .Values.ecrCredentialRefresh.enabled }} ---- -apiVersion: v1 -kind: ServiceAccount -metadata: - name: {{ .Values.ecrCredentialRefresh.serviceAccount.name | default "ecr-credential-refresh" }} - namespace: {{ .Release.Namespace }} - {{- with .Values.ecrCredentialRefresh.serviceAccount.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - name: ecr-credential-refresh - namespace: {{ .Release.Namespace }} -rules: - - apiGroups: [""] - resources: ["secrets"] - resourceNames: [{{ .Values.ecrCredentialRefresh.imagePullSecretName | default "ecr-pull-secret" | quote }}] - verbs: ["get", "patch", "delete"] - - apiGroups: [""] - resources: ["secrets"] - verbs: ["create"] ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: ecr-credential-refresh - namespace: {{ .Release.Namespace }} -subjects: - - kind: ServiceAccount - name: {{ .Values.ecrCredentialRefresh.serviceAccount.name | default "ecr-credential-refresh" }} - namespace: {{ .Release.Namespace }} -roleRef: - kind: Role - name: ecr-credential-refresh - apiGroup: rbac.authorization.k8s.io ---- -apiVersion: batch/v1 -kind: CronJob -metadata: - name: ecr-credential-refresh - namespace: {{ .Release.Namespace }} - labels: - app.kubernetes.io/name: ecr-credential-refresh - app.kubernetes.io/instance: {{ .Release.Name }} -spec: - schedule: "0 */6 * * *" - successfulJobsHistoryLimit: 2 - failedJobsHistoryLimit: 3 - concurrencyPolicy: Forbid - jobTemplate: - spec: - backoffLimit: 3 - template: - spec: - serviceAccountName: {{ .Values.ecrCredentialRefresh.serviceAccount.name | default "ecr-credential-refresh" }} - restartPolicy: OnFailure - containers: - - name: ecr-credential-refresh - image: amazon/aws-cli:2.27.18 - env: - - name: AWS_ACCESS_KEY_ID - valueFrom: - secretKeyRef: - name: {{ .Values.ecrCredentialRefresh.awsSecretName | default "ecr-credentials" }} - key: AWS_ACCESS_KEY_ID - - name: AWS_SECRET_ACCESS_KEY - valueFrom: - secretKeyRef: - name: {{ .Values.ecrCredentialRefresh.awsSecretName | default "ecr-credentials" }} - key: AWS_SECRET_ACCESS_KEY - - name: AWS_REGION - value: {{ .Values.ecrCredentialRefresh.awsRegion | quote }} - - name: ECR_REGISTRY - value: {{ required "ecrCredentialRefresh.registry is required when ecrCredentialRefresh is enabled" .Values.ecrCredentialRefresh.registry | quote }} - - name: SECRET_NAME - value: {{ .Values.ecrCredentialRefresh.imagePullSecretName | default "ecr-pull-secret" | quote }} - - name: NAMESPACE - value: {{ .Release.Namespace }} - command: - - /bin/bash - - -c - - | - set -euo pipefail - KUBECTL_VERSION="v1.32.3" - ARCH=$(uname -m | sed 's/x86_64/amd64/' | sed 's/aarch64/arm64/') - if [[ "$ARCH" != "amd64" && "$ARCH" != "arm64" ]]; then - echo "❌ Unsupported architecture: $(uname -m)" >&2; exit 1 - fi - curl -fSLO "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/${ARCH}/kubectl" - curl -fSLO "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/${ARCH}/kubectl.sha256" - echo "$(cat kubectl.sha256) kubectl" | sha256sum -c - - rm kubectl.sha256 - chmod +x kubectl && mv kubectl /usr/local/bin/ - TOKEN=$(aws ecr get-login-password --region "$AWS_REGION") - kubectl create secret docker-registry "$SECRET_NAME" \ - -n "$NAMESPACE" \ - --docker-server="$ECR_REGISTRY" \ - --docker-username=AWS \ - --docker-password="$TOKEN" \ - --dry-run=client -o yaml | kubectl apply -f - - echo "✅ ECR pull secret refreshed successfully" - resources: - requests: - memory: "64Mi" - cpu: "50m" - limits: - memory: "128Mi" - cpu: "100m" ---- -# Initial Job to create the secret immediately on install/upgrade -apiVersion: batch/v1 -kind: Job -metadata: - name: ecr-credential-refresh-init - namespace: {{ .Release.Namespace }} - annotations: - "helm.sh/hook": post-install,post-upgrade - "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded - labels: - app.kubernetes.io/name: ecr-credential-refresh - app.kubernetes.io/instance: {{ .Release.Name }} -spec: - backoffLimit: 3 - template: - spec: - serviceAccountName: {{ .Values.ecrCredentialRefresh.serviceAccount.name | default "ecr-credential-refresh" }} - restartPolicy: OnFailure - containers: - - name: ecr-credential-refresh - image: amazon/aws-cli:2.27.18 - env: - - name: AWS_ACCESS_KEY_ID - valueFrom: - secretKeyRef: - name: {{ .Values.ecrCredentialRefresh.awsSecretName | default "ecr-credentials" }} - key: AWS_ACCESS_KEY_ID - - name: AWS_SECRET_ACCESS_KEY - valueFrom: - secretKeyRef: - name: {{ .Values.ecrCredentialRefresh.awsSecretName | default "ecr-credentials" }} - key: AWS_SECRET_ACCESS_KEY - - name: AWS_REGION - value: {{ .Values.ecrCredentialRefresh.awsRegion | quote }} - - name: ECR_REGISTRY - value: {{ required "ecrCredentialRefresh.registry is required when ecrCredentialRefresh is enabled" .Values.ecrCredentialRefresh.registry | quote }} - - name: SECRET_NAME - value: {{ .Values.ecrCredentialRefresh.imagePullSecretName | default "ecr-pull-secret" | quote }} - - name: NAMESPACE - value: {{ .Release.Namespace }} - command: - - /bin/bash - - -c - - | - set -euo pipefail - KUBECTL_VERSION="v1.32.3" - ARCH=$(uname -m | sed 's/x86_64/amd64/' | sed 's/aarch64/arm64/') - if [[ "$ARCH" != "amd64" && "$ARCH" != "arm64" ]]; then - echo "❌ Unsupported architecture: $(uname -m)" >&2; exit 1 - fi - curl -fSLO "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/${ARCH}/kubectl" - curl -fSLO "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/${ARCH}/kubectl.sha256" - echo "$(cat kubectl.sha256) kubectl" | sha256sum -c - - rm kubectl.sha256 - chmod +x kubectl && mv kubectl /usr/local/bin/ - TOKEN=$(aws ecr get-login-password --region "$AWS_REGION") - kubectl create secret docker-registry "$SECRET_NAME" \ - -n "$NAMESPACE" \ - --docker-server="$ECR_REGISTRY" \ - --docker-username=AWS \ - --docker-password="$TOKEN" \ - --dry-run=client -o yaml | kubectl apply -f - - echo "✅ ECR pull secret created successfully" - resources: - requests: - memory: "64Mi" - cpu: "50m" - limits: - memory: "128Mi" - cpu: "100m" -{{- end }} diff --git a/chart/values.ci.yaml b/chart/values.ci.yaml index 41eef3c..3f82918 100644 --- a/chart/values.ci.yaml +++ b/chart/values.ci.yaml @@ -3,7 +3,7 @@ # Includes test secrets - NOT FOR PRODUCTION global: - # Use latest published images for CI (repo default 0.0.1-dev does not exist in ECR) + # Use latest published images for CI (repo default 0.0.1-dev is never published) version: "latest" # Allow single replica for CI diff --git a/chart/values.schema.json b/chart/values.schema.json index 1d2df46..0a1df5a 100644 --- a/chart/values.schema.json +++ b/chart/values.schema.json @@ -87,7 +87,7 @@ }, "repository": { "type": "string", - "description": "Image repository for tables (defaults to public.ecr.aws/openops)" + "description": "Image repository for tables (defaults to openops.azurecr.io)" }, "tag": { "type": "string", @@ -112,7 +112,7 @@ }, "repository": { "type": "string", - "description": "Image repository for analytics (defaults to public.ecr.aws/openops)" + "description": "Image repository for analytics (defaults to openops.azurecr.io)" }, "tag": { "type": "string", diff --git a/chart/values.yaml b/chart/values.yaml index 8b791b6..a2a70d5 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -81,7 +81,7 @@ global: priorityClassName: "" image: - repository: public.ecr.aws/openops + repository: openops.azurecr.io pullPolicy: IfNotPresent openopsEnv: @@ -149,7 +149,7 @@ openopsEnv: OPS_SUBAGENT_S3_BUCKET: "" OPS_SUBAGENT_S3_REGION: "" OPS_SUBAGENT_S3_ENDPOINT: "" - OPS_SUBAGENT_RUNNER_IMAGE: "535002847982.dkr.ecr.us-east-2.amazonaws.com/openops/subagent-runner:0fdbc6b1" + OPS_SUBAGENT_RUNNER_IMAGE: "" # Secret environment variables # Any var in this section is treated as a secret (stored in K8s Secret, referenced via secretKeyRef). @@ -256,8 +256,8 @@ worker: tables: name: openops-tables image: openops-tables - repository: "public.ecr.aws/openops" # Always use public ECR for tables - tag: "0.2.21" + repository: "openops.azurecr.io" # Always the public registry for tables + tag: "0.2.22" replicas: 1 resources: requests: @@ -319,8 +319,8 @@ tables: analytics: name: openops-analytics image: openops-analytics - repository: "public.ecr.aws/openops" # Always use public ECR for analytics - tag: "0.14.7" + repository: "openops.azurecr.io" # Always the public registry for analytics + tag: "0.14.8" replicas: 1 resources: requests: @@ -654,23 +654,6 @@ externalSecrets: annotations: {} labels: {} -# ECR credential refresh CronJob (for pulling from private ECR outside AWS) -# Creates and refreshes an imagePullSecret every 6 hours using AWS ECR token. -# Required when AKS or non-AWS clusters need to pull from private ECR. -ecrCredentialRefresh: - enabled: false - registry: "" - # AWS region of the ECR registry - awsRegion: "us-east-2" - # Name of the Kubernetes secret containing AWS credentials (keys: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY) - awsSecretName: "ecr-credentials" - # Name of the imagePullSecret that will be created/refreshed - imagePullSecretName: "ecr-pull-secret" - serviceAccount: - name: "ecr-credential-refresh" - annotations: {} - -# Subagent configuration subagents: # Namespace where subagent pods run (defaults to same namespace as app) namespace: "" diff --git a/docs/DEPLOY_TO_AWS_EKS.md b/docs/DEPLOY_TO_AWS_EKS.md index 254ca3c..d3b3ae7 100644 --- a/docs/DEPLOY_TO_AWS_EKS.md +++ b/docs/DEPLOY_TO_AWS_EKS.md @@ -617,7 +617,7 @@ global: enabled: true image: - repository: public.ecr.aws/openops + repository: openops.azurecr.io pullPolicy: IfNotPresent openopsEnv: diff --git a/docs/DEPLOY_TO_AWS_EKS_FARGATE.md b/docs/DEPLOY_TO_AWS_EKS_FARGATE.md index 8867074..a5e06cb 100644 --- a/docs/DEPLOY_TO_AWS_EKS_FARGATE.md +++ b/docs/DEPLOY_TO_AWS_EKS_FARGATE.md @@ -677,7 +677,7 @@ global: whenUnsatisfiable: ScheduleAnyway image: - repository: public.ecr.aws/openops + repository: openops.azurecr.io pullPolicy: IfNotPresent # Environment configuration