-
Notifications
You must be signed in to change notification settings - Fork 98
User scope update #1432
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
User scope update #1432
Changes from all commits
6031ec7
606ce90
6c55b40
f0c83d1
27ca356
ecc111f
423fe26
5a526ef
05d3dad
2cf0e26
c608bd0
813c4e6
9d1e6c0
4c0ee4b
85b6476
9b27e17
76e9181
5fb4711
12d027e
e252262
b673993
07c771f
3b12dbc
cd29d3e
19cae2a
eea6dbf
d8ca236
aca8627
da9e091
59db0de
f7c264f
fc506ef
88d2738
ab195e8
bc7a893
81be018
8409458
4a337c6
f946eb2
58123c5
3731512
81d36eb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,8 @@ kind: ServiceAccount | |
| metadata: | ||
| name: frontend | ||
| namespace: ambient-code | ||
| annotations: | ||
| serviceaccounts.openshift.io/oauth-redirectreference.frontend: '{"kind":"OAuthRedirectReference","apiVersion":"v1","reference":{"kind":"Route","name":"frontend"}}' | ||
|
Comment on lines
+6
to
+7
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Description: List frontend Route definitions and OAuth redirect references.
# Expected: The OAuthRedirectReference route name matches an actual Route metadata.name.
rg -n -C3 'kind:\s*Route|name:\s*frontend|name:\s*frontend-route|oauth-redirectreference' components/manifestsRepository: ambient-code/platform Length of output: 44268 Update OAuth redirect reference to match actual Route name in app-interface and production overlays. The Proposed fix- serviceaccounts.openshift.io/oauth-redirectreference.frontend: '{"kind":"OAuthRedirectReference","apiVersion":"v1","reference":{"kind":"Route","name":"frontend"}}'
+ serviceaccounts.openshift.io/oauth-redirectreference.frontend: '{"kind":"OAuthRedirectReference","apiVersion":"v1","reference":{"kind":"Route","name":"frontend-route"}}'🤖 Prompt for AI Agents |
||
| --- | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: ClusterRole | ||
|
|
@@ -28,3 +30,16 @@ subjects: | |
| - kind: ServiceAccount | ||
| name: frontend | ||
| namespace: ambient-code | ||
| --- | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: ClusterRoleBinding | ||
| metadata: | ||
| name: ambient-frontend-oauth-delegator | ||
| roleRef: | ||
| apiGroup: rbac.authorization.k8s.io | ||
| kind: ClusterRole | ||
| name: system:auth-delegator | ||
| subjects: | ||
| - kind: ServiceAccount | ||
| name: frontend | ||
| namespace: ambient-code | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,17 +11,17 @@ | |
| - name: POSTGRESQL_USER | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: ambient-api-server-db | ||
| name: ambient-code-rds | ||
| key: db.user | ||
| - name: POSTGRESQL_PASSWORD | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: ambient-api-server-db | ||
| name: ambient-code-rds | ||
| key: db.password | ||
| - name: POSTGRESQL_DATABASE | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: ambient-api-server-db | ||
| name: ambient-code-rds | ||
|
Comment on lines
+14
to
+24
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
# Verify overlays that include the in-cluster DB component alongside external-RDS settings.
# Expected: production should not include the local DB component when external RDS is active.
rg -n -C4 'components/ambient-api-server-db|components/postgresql-rhel|ambient-code-rds|--db-sslmode=require' --iglob '*.yaml'Repository: ambient-code/platform Length of output: 24426 Gate the local Postgres Deployment or use separate bootstrap credentials in production. Production includes both the in-cluster Postgres pod ( 🤖 Prompt for AI Agents |
||
| key: db.name | ||
| - op: replace | ||
| path: /spec/template/spec/containers/0/volumeMounts | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| # Patch for production frontend deployment | ||
| # - Adds OAuth proxy sidecar for authentication | ||
| # - Adds OAuth proxy sidecar for authentication using OpenShift OAuth | ||
| # - Uses service account token for cookie secret (no vault secret needed) | ||
| # - Overrides resource limits to prevent OOMKills (sawtooth memory pattern) | ||
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
|
|
@@ -20,19 +21,18 @@ spec: | |
| cpu: 1000m | ||
| # OAuth proxy sidecar | ||
| - name: oauth-proxy | ||
| image: quay.io/openshift/origin-oauth-proxy:4.14 | ||
| image: registry.redhat.io/openshift4/ose-oauth-proxy-rhel9:v4.18.0-202506230505.p0.gcbd44ad.assembly.stream.el9 | ||
| imagePullPolicy: IfNotPresent | ||
| args: | ||
| - --http-address=:8443 | ||
| - --https-address= | ||
| - --https-address=:8443 | ||
| - --provider=openshift | ||
| - --openshift-service-account=frontend | ||
| - --upstream=http://localhost:3000 | ||
| - --client-id=ambient-frontend | ||
| - --client-secret-file=/etc/oauth/config/client-secret | ||
| - --cookie-secret-file=/etc/oauth/config/cookie_secret | ||
| - --cookie-expire=23h0m0s | ||
| - --pass-access-token | ||
| - --scope=user:full | ||
| - --openshift-delegate-urls={"/":{"resource":"projects","verb":"list"}} | ||
| - --openshift-delegate-urls={"/api":{"resource":"namespaces","verb":"get","name":"ambient-code","namespace":"ambient-code"},"/federate":{"resource":"namespaces","verb":"get","name":"ambient-code","namespace":"ambient-code"}} | ||
| - --tls-cert=/etc/tls/private/tls.crt | ||
| - --tls-key=/etc/tls/private/tls.key | ||
| - --cookie-secret-file=/var/run/secrets/kubernetes.io/serviceaccount/token | ||
| - --upstream-timeout=5m | ||
|
Comment on lines
26
to
+35
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Description: Verify final oauth-proxy patches include token forwarding, full scope, and a shared cookie secret.
# Expected: Every oauth-proxy args replacement includes --pass-access-token, --scope=user:full, and cookie-secret-file points to a mounted shared Secret.
rg -n -C5 -- '--pass-access-token|--scope=user:full|--cookie-secret-file|oauth-cookie|serviceaccount/token|disable_cookies' components/manifestsRepository: ambient-code/platform Length of output: 10233 Fix oauth-proxy token forwarding, scope, and session configuration. This patch replaces the oauth-proxy Proposed fix- - --cookie-secret-file=/var/run/secrets/kubernetes.io/serviceaccount/token
+ - --cookie-secret-file=/etc/oauth-cookie/cookie_secret
+ - --pass-access-token
+ - --scope=user:full
- --upstream-timeout=5m
- --skip-auth-regex=^/metrics
@@
volumeMounts:
- mountPath: /etc/tls/private
name: frontend-proxy-tls
+ - mountPath: /etc/oauth-cookie
+ name: oauth-cookie-secret
volumes:
- name: frontend-proxy-tls
secret:
secretName: frontend-proxy-tls
+ - name: oauth-cookie-secret
+ secret:
+ secretName: stage-cookie-secretAlso applies to: 67-73 🤖 Prompt for AI Agents |
||
| - --skip-auth-regex=^/metrics | ||
| ports: | ||
| - containerPort: 8443 | ||
|
|
@@ -41,38 +41,33 @@ spec: | |
| httpGet: | ||
| path: /oauth/healthz | ||
| port: dashboard-ui | ||
| scheme: HTTP | ||
| initialDelaySeconds: 30 | ||
| scheme: HTTPS | ||
| initialDelaySeconds: 10 | ||
| timeoutSeconds: 1 | ||
| periodSeconds: 5 | ||
| periodSeconds: 10 | ||
| successThreshold: 1 | ||
| failureThreshold: 3 | ||
| readinessProbe: | ||
| httpGet: | ||
| path: /oauth/healthz | ||
| port: dashboard-ui | ||
| scheme: HTTP | ||
| initialDelaySeconds: 5 | ||
| scheme: HTTPS | ||
| initialDelaySeconds: 10 | ||
| timeoutSeconds: 1 | ||
| periodSeconds: 5 | ||
| periodSeconds: 10 | ||
| successThreshold: 1 | ||
| failureThreshold: 3 | ||
| resources: | ||
| requests: | ||
| memory: 256Mi | ||
| cpu: 50m | ||
| memory: 50Mi | ||
| cpu: 10m | ||
| limits: | ||
| memory: 512Mi | ||
| memory: 200Mi | ||
| cpu: 200m | ||
| volumeMounts: | ||
| - mountPath: /etc/oauth/config | ||
| name: oauth-config | ||
| - mountPath: /etc/tls/private | ||
| name: proxy-tls | ||
| name: frontend-proxy-tls | ||
| volumes: | ||
| - name: oauth-config | ||
| secret: | ||
| secretName: frontend-oauth-config | ||
| - name: proxy-tls | ||
| - name: frontend-proxy-tls | ||
| secret: | ||
| secretName: dashboard-proxy-tls | ||
| secretName: frontend-proxy-tls | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,10 +1,12 @@ | ||||||||||||||||||||||||||||||||||||
| # Patch to add OAuth port to frontend service | ||||||||||||||||||||||||||||||||||||
| # - Adds HTTPS port for OAuth proxy sidecar | ||||||||||||||||||||||||||||||||||||
| # - Uses service.alpha annotation for auto-generated TLS cert | ||||||||||||||||||||||||||||||||||||
| apiVersion: v1 | ||||||||||||||||||||||||||||||||||||
| kind: Service | ||||||||||||||||||||||||||||||||||||
| metadata: | ||||||||||||||||||||||||||||||||||||
| name: frontend-service | ||||||||||||||||||||||||||||||||||||
| annotations: | ||||||||||||||||||||||||||||||||||||
| service.beta.openshift.io/serving-cert-secret-name: dashboard-proxy-tls | ||||||||||||||||||||||||||||||||||||
| service.alpha.openshift.io/serving-cert-secret-name: frontend-proxy-tls | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+2
to
+9
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
# Expect serving-cert annotations to use service.beta.openshift.io.
rg -n -C2 'service\.(alpha|beta)\.openshift\.io/serving-cert-secret-name' components/manifestsRepository: ambient-code/platform Length of output: 4636 Use the OpenShift service-ca
Proposed fix-# - Uses service.alpha annotation for auto-generated TLS cert
+# - Uses service.beta annotation for auto-generated TLS cert
apiVersion: v1
kind: Service
metadata:
name: frontend-service
annotations:
- service.alpha.openshift.io/serving-cert-secret-name: frontend-proxy-tls
+ service.beta.openshift.io/serving-cert-secret-name: frontend-proxy-tls📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||
| spec: | ||||||||||||||||||||||||||||||||||||
| ports: | ||||||||||||||||||||||||||||||||||||
| - port: 8443 | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| --- | ||
| apiVersion: v1 | ||
| kind: Secret | ||
| metadata: | ||
| name: ambient-code-rds | ||
| labels: | ||
| app: ambient-api-server | ||
| component: database | ||
| annotations: | ||
| # External RDS connection managed via Vault secrets from app-interface Phase 2 | ||
| # These values will be injected by vault-secret-manager from Vault path: | ||
| # app-interface/data/ambient-code-platform/stage/rds-credentials | ||
| qontract.recycle: "true" | ||
| type: Opaque | ||
| stringData: | ||
| # Placeholders - actual values injected from Vault at runtime | ||
| db.host: "VAULT_INJECTED" | ||
| db.port: "5432" | ||
| db.name: "ambient_code" | ||
| db.user: "VAULT_INJECTED" | ||
| db.password: "VAULT_INJECTED" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # App-interface: set environment to stage | ||
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| metadata: | ||
| name: ambient-api-server | ||
| spec: | ||
| template: | ||
| spec: | ||
| containers: | ||
| - name: api-server | ||
| env: | ||
| - name: AMBIENT_ENV | ||
| value: stage |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| --- | ||
| apiVersion: route.openshift.io/v1 | ||
| kind: Route | ||
| metadata: | ||
| name: ambient-api-server | ||
| labels: | ||
| app: ambient-api-server | ||
| component: api | ||
| spec: | ||
| to: | ||
| kind: Service | ||
| name: ambient-api-server | ||
| port: | ||
| targetPort: api | ||
| tls: | ||
| termination: reencrypt | ||
| insecureEdgeTerminationPolicy: Redirect | ||
| --- | ||
| apiVersion: route.openshift.io/v1 | ||
| kind: Route | ||
| metadata: | ||
| name: ambient-api-server-grpc | ||
| labels: | ||
| app: ambient-api-server | ||
| component: grpc | ||
| spec: | ||
| to: | ||
| kind: Service | ||
| name: ambient-api-server | ||
| port: | ||
| targetPort: grpc | ||
| tls: | ||
| termination: reencrypt | ||
| insecureEdgeTerminationPolicy: Redirect |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| # OpenShift service-ca: auto-provision and rotate TLS certs for ambient-api-server | ||
| apiVersion: v1 | ||
| kind: Service | ||
| metadata: | ||
| name: ambient-api-server | ||
| annotations: | ||
| service.beta.openshift.io/serving-cert-secret-name: ambient-api-server-tls |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| # App-interface (stage): enable SSL for external RDS connection | ||
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| metadata: | ||
| name: ambient-api-server | ||
| spec: | ||
| template: | ||
| spec: | ||
| # Migration init container: add SSL mode | ||
| initContainers: | ||
| - name: migration | ||
| command: | ||
| - /usr/local/bin/ambient-api-server | ||
| - migrate | ||
| - --db-host-file=/secrets/db/db.host | ||
| - --db-port-file=/secrets/db/db.port | ||
| - --db-user-file=/secrets/db/db.user | ||
| - --db-password-file=/secrets/db/db.password | ||
| - --db-name-file=/secrets/db/db.name | ||
| - --db-sslmode=require | ||
| - --alsologtostderr | ||
| - -v=4 | ||
| # API server container: add SSL mode | ||
| containers: | ||
| - name: api-server | ||
| command: | ||
| - /usr/local/bin/ambient-api-server | ||
| - serve | ||
| - --db-host-file=/secrets/db/db.host | ||
| - --db-port-file=/secrets/db/db.port | ||
| - --db-user-file=/secrets/db/db.user | ||
| - --db-password-file=/secrets/db/db.password | ||
| - --db-name-file=/secrets/db/db.name | ||
| - --enable-jwt=true | ||
| - --enable-authz=false | ||
| - --jwk-cert-file=/configs/authentication/jwks.json | ||
| - --enable-https=false | ||
| - --api-server-bindaddress=:8000 | ||
| - --metrics-server-bindaddress=:4433 | ||
| - --health-check-server-bindaddress=:4434 | ||
| - --db-sslmode=require | ||
| - --db-max-open-connections=50 | ||
| - --enable-db-debug=false | ||
| - --enable-metrics-https=false | ||
| - --http-read-timeout=5s | ||
| - --http-write-timeout=30s | ||
| - --cors-allowed-origins=* | ||
| - --cors-allowed-headers=X-Ambient-Project | ||
| - --enable-grpc=true | ||
| - --grpc-server-bindaddress=:9000 | ||
| - --alsologtostderr | ||
| - -v=4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: ambient-code/platform
Length of output: 50377
🏁 Script executed:
Repository: ambient-code/platform
Length of output: 1066
🏁 Script executed:
sed -n '140,150p' components/manifests/overlays/mpp-openshift/ambient-api-server.yamlRepository: ambient-code/platform
Length of output: 355
🏁 Script executed:
sed -n '50,70p' components/manifests/overlays/mpp-openshift/ambient-api-server-db.yamlRepository: ambient-code/platform
Length of output: 776
Update all Secret references in mpp-openshift overlay before renaming.
The Secret rename to
ambient-code-rdsaffects multiple consumers incomponents/manifests/overlays/mpp-openshift/:ambient-api-server.yaml:secretName: ambient-api-server-db(volume mount)ambient-api-server-db.yaml:name: ambient-api-server-db(secretKeyRef for db.user, db.password, db.name)All must be updated to
ambient-code-rdsor pods will fail at startup.Required fixes
ambient-api-server.yamlline 146:- name: db-secrets secret: - secretName: ambient-api-server-db + secretName: ambient-code-rdsambient-api-server-db.yamllines 57, 62, 67:env: - name: POSTGRESQL_USER valueFrom: secretKeyRef: key: db.user - name: ambient-api-server-db + name: ambient-code-rds - name: POSTGRESQL_PASSWORD valueFrom: secretKeyRef: key: db.password - name: ambient-api-server-db + name: ambient-code-rds - name: POSTGRESQL_DATABASE valueFrom: secretKeyRef: key: db.name - name: ambient-api-server-db + name: ambient-code-rds🤖 Prompt for AI Agents