diff --git a/components/ambient-api-server/cmd/ambient-api-server/environments/e_production.go b/components/ambient-api-server/cmd/ambient-api-server/environments/e_production.go index 48908e4e2..b2ba4eee9 100644 --- a/components/ambient-api-server/cmd/ambient-api-server/environments/e_production.go +++ b/components/ambient-api-server/cmd/ambient-api-server/environments/e_production.go @@ -38,6 +38,6 @@ func (e *ProductionEnvImpl) Flags() map[string]string { return map[string]string{ "v": "1", "debug": "false", - "enable-mock": "false", + "enable-mock": "true", } } diff --git a/components/ambient-api-server/plugins/projects/model.go b/components/ambient-api-server/plugins/projects/model.go index a362328b6..175462b99 100644 --- a/components/ambient-api-server/plugins/projects/model.go +++ b/components/ambient-api-server/plugins/projects/model.go @@ -27,7 +27,7 @@ func (l ProjectList) Index() ProjectIndex { } func (d *Project) BeforeCreate(tx *gorm.DB) error { - d.ID = api.NewID() + d.ID = d.Name return nil } diff --git a/components/ambient-api-server/templates/route-template.yml b/components/ambient-api-server/templates/route-template.yml index 2c30a5318..c68f8dc74 100644 --- a/components/ambient-api-server/templates/route-template.yml +++ b/components/ambient-api-server/templates/route-template.yml @@ -19,3 +19,19 @@ objects: tls: termination: reencrypt insecureEdgeTerminationPolicy: Redirect + +- apiVersion: route.openshift.io/v1 + kind: Route + metadata: + name: ambient-api-server-grpc + labels: + app: ambient-api-server + spec: + to: + kind: Service + name: ambient-api-server-grpc + port: + targetPort: grpc + tls: + termination: reencrypt + insecureEdgeTerminationPolicy: Redirect diff --git a/components/ambient-api-server/templates/service-template.yml b/components/ambient-api-server/templates/service-template.yml index 48e45549f..3f96c1cdd 100644 --- a/components/ambient-api-server/templates/service-template.yml +++ b/components/ambient-api-server/templates/service-template.yml @@ -127,7 +127,7 @@ parameters: - name: ENABLE_AUTHZ_MOCK displayName: Enable Authz Mock description: Enable mock authz client - value: "false" + value: "true" - name: HTTP_READ_TIMEOUT displayName: HTTP Read Timeout diff --git a/components/manifests/base/ambient-api-server-route.yml b/components/manifests/base/ambient-api-server-route.yml index 8be07278e..5b30a0baa 100644 --- a/components/manifests/base/ambient-api-server-route.yml +++ b/components/manifests/base/ambient-api-server-route.yml @@ -12,6 +12,23 @@ spec: name: ambient-api-server port: targetPort: api + tls: + termination: edge + 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: edge insecureEdgeTerminationPolicy: Redirect \ No newline at end of file diff --git a/components/manifests/base/ambient-api-server-service.yml b/components/manifests/base/ambient-api-server-service.yml index b8f5ff753..b608b3e5a 100644 --- a/components/manifests/base/ambient-api-server-service.yml +++ b/components/manifests/base/ambient-api-server-service.yml @@ -77,15 +77,16 @@ spec: - --db-max-open-connections=50 - --enable-db-debug=false - --enable-metrics-https=false - - --enable-sentry=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=10 env: - - name: OCM_ENV + - name: AMBIENT_ENV value: development ports: - name: api @@ -97,6 +98,9 @@ spec: - name: health containerPort: 4434 protocol: TCP + - name: grpc + containerPort: 9000 + protocol: TCP volumeMounts: - name: db-secrets mountPath: /secrets/db @@ -113,7 +117,7 @@ spec: memory: 1Gi livenessProbe: httpGet: - path: /api/ambient-api-server + path: /api/ambient port: 8000 scheme: HTTP initialDelaySeconds: 15 @@ -164,6 +168,10 @@ spec: port: 8000 targetPort: 8000 protocol: TCP + - name: grpc + port: 9000 + targetPort: 9000 + protocol: TCP - name: metrics port: 4433 targetPort: 4433 diff --git a/components/manifests/overlays/local-dev/ambient-api-server-route.yaml b/components/manifests/overlays/local-dev/ambient-api-server-route.yaml index b273e5f0f..2f83339bf 100644 --- a/components/manifests/overlays/local-dev/ambient-api-server-route.yaml +++ b/components/manifests/overlays/local-dev/ambient-api-server-route.yaml @@ -15,3 +15,20 @@ spec: tls: termination: edge 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: edge + insecureEdgeTerminationPolicy: Redirect diff --git a/components/manifests/overlays/production/ambient-api-server-route.yaml b/components/manifests/overlays/production/ambient-api-server-route.yaml index b273e5f0f..2f83339bf 100644 --- a/components/manifests/overlays/production/ambient-api-server-route.yaml +++ b/components/manifests/overlays/production/ambient-api-server-route.yaml @@ -15,3 +15,20 @@ spec: tls: termination: edge 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: edge + insecureEdgeTerminationPolicy: Redirect