Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docker/common-services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ services:
teams-api-common:
image: voxel51/fiftyone-teams-api:v2.11.0
environment:
API_EXTERNAL_URL: ${FIFTYONE_API_URI}
CAS_BASE_URL: ${CAS_BASE_URL:-http://teams-cas:3000/cas/api}
FIFTYONE_AUTH_SECRET: ${FIFTYONE_AUTH_SECRET}
FIFTYONE_DATABASE_NAME: ${FIFTYONE_DATABASE_NAME}
Expand Down
2 changes: 1 addition & 1 deletion docker/internal-auth/env.template
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This should be the URL your end-users will connect to
BASE_URL=https://example.fiftyone.ai

# This should be set to the URI your end-users will use to connect to the API
# This should be set to the URI your end-users and external orchestrators will use to connect to the API
# This could be the same as BASE_URL if you are using path-based routing
FIFTYONE_API_URI=https://example-api.fiftyone.ai

Expand Down
2 changes: 1 addition & 1 deletion docker/legacy-auth/env.template
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ AUTH0_SECRET=
# This should be the URL your end-users will connect to
AUTH0_BASE_URL=https://example.fiftyone.ai

# This should be set to the URI your end-users will use to connect to the API
# This should be set to the URI your end-users and external orchestrators will use to connect to the API
# This could be the same as AUTH0_BASE_URL if you are using path-based routing
FIFTYONE_API_URI=https://example-api.fiftyone.ai

Expand Down
2 changes: 1 addition & 1 deletion helm/fiftyone-teams-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ follow
|-----|------|---------|-------------|
| apiSettings.affinity | object | `{}` | Affinity and anti-affinity for `teams-api`. [Reference][affinity]. |
| apiSettings.deploymentAnnotations | object | `{}` | Annotations for the `teams-api` deployment. [Reference][annotations]. |
| apiSettings.dnsName | string | `""` | Controls whether `teams-api` is added to the chart's ingress. When an empty string, a rule for `teams-api` is not added to the chart managed ingress. When not an empty string, becomes the value to the `host` in the ingress' rule and set `ingress.api` too. |
| apiSettings.dnsName | string | `""` | Controls whether `teams-api` is added to the chart's ingress. When an empty string, a rule for `teams-api` is not added to the chart managed ingress. When not an empty string, becomes the value to the `host` in the ingress' rule and set `ingress.api` too. Additionally, the `apiSettings.dnsName` is used by `teams-api` to generate the `API_EXTERNAL_URL` environment variable for configuring external orchestrators. |
| apiSettings.env.FIFTYONE_ENV | string | `"production"` | Controls FiftyOne GraphQL verbosity. When "production", debug mode is disabled and the default logging level is "INFO". When "development", debug mode is enabled and the default logging level is "DEBUG". Can be overridden by setting `apiSettings.env.LOGGING_LEVEL`. |
| apiSettings.env.FIFTYONE_INTERNAL_SERVICE | bool | `true` | Whether the SDK is running in an internal service context. When running in FiftyOne Enterprise, set to `true`. |
| apiSettings.env.FIFTYONE_LOGGING_FORMAT | string | `"text"` | The format to use for log messages. Can be one of `json` or `text`. |
Expand Down
8 changes: 8 additions & 0 deletions helm/fiftyone-teams-app/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,14 @@ Create a merged list of environment variables for fiftyone-teams-api
*/}}
{{- define "fiftyone-teams-api.env-vars-list" -}}
{{- $secretName := .Values.secret.name }}
- name: API_EXTERNAL_URL
{{- if .Values.apiSettings.dnsName }}
value: {{ printf "https://%s" .Values.apiSettings.dnsName | quote}}
{{- else if .Values.teamsAppSettings.dnsName }}
value: {{ printf "https://%s" .Values.teamsAppSettings.dnsName | quote }}
Comment thread
afoley587 marked this conversation as resolved.
{{- else }}
value: ""
{{- end }}
- name: CAS_BASE_URL
value: {{ printf "http://%s:%.0f/cas/api" .Values.casSettings.service.name (float64 .Values.casSettings.service.port) | quote }}
- name: FIFTYONE_AUTH_SECRET
Expand Down
2 changes: 1 addition & 1 deletion helm/fiftyone-teams-app/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"dnsName": {
"default": "",
"description": "Controls whether `teams-api` is added to the chart's ingress.\nWhen an empty string, a rule for `teams-api` is not added to the chart managed ingress.\nWhen not an empty string, becomes the value to the `host` in the ingress' rule and\nset `ingress.api` too.",
"description": "Controls whether `teams-api` is added to the chart's ingress.\nWhen an empty string, a rule for `teams-api` is not added to the chart managed ingress.\nWhen not an empty string, becomes the value to the `host` in the ingress' rule and\nset `ingress.api` too. Additionally, the `apiSettings.dnsName` is used by `teams-api`\nto generate the `API_EXTERNAL_URL` environment variable for configuring external orchestrators.",
"required": [],
"title": "dnsName",
"type": "string"
Expand Down
3 changes: 2 additions & 1 deletion helm/fiftyone-teams-app/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ apiSettings:
# -- Controls whether `teams-api` is added to the chart's ingress.
# When an empty string, a rule for `teams-api` is not added to the chart managed ingress.
# When not an empty string, becomes the value to the `host` in the ingress' rule and
# set `ingress.api` too.
# set `ingress.api` too. Additionally, the `apiSettings.dnsName` is used by `teams-api`
# to generate the `API_EXTERNAL_URL` environment variable for configuring external orchestrators.
dnsName: ""
# -- Annotations for the `teams-api` deployment. [Reference][annotations].
deploymentAnnotations: {}
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/compose/docker-compose-internal-auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ func (s *commonServicesInternalAuthDockerComposeTest) TestServiceEnvironment() {
[]string{internalAuthComposeFile},
s.dotEnvFiles,
[]string{
"API_EXTERNAL_URL=https://example-api.fiftyone.ai",
"CAS_BASE_URL=http://teams-cas:3000/cas/api",
"FIFTYONE_AUTH_SECRET=test-fiftyone-auth-secret",
"FIFTYONE_DATABASE_NAME=fiftyone",
Expand Down Expand Up @@ -340,6 +341,7 @@ func (s *commonServicesInternalAuthDockerComposeTest) TestServiceEnvironment() {
[]string{internalAuthComposePluginsFile},
s.dotEnvFiles,
[]string{
"API_EXTERNAL_URL=https://example-api.fiftyone.ai",
"CAS_BASE_URL=http://teams-cas:3000/cas/api",
"FIFTYONE_AUTH_SECRET=test-fiftyone-auth-secret",
"FIFTYONE_DATABASE_NAME=fiftyone",
Expand Down Expand Up @@ -422,6 +424,7 @@ func (s *commonServicesInternalAuthDockerComposeTest) TestServiceEnvironment() {
[]string{internalAuthComposeDedicatedPluginsFile},
s.dotEnvFiles,
[]string{
"API_EXTERNAL_URL=https://example-api.fiftyone.ai",
"CAS_BASE_URL=http://teams-cas:3000/cas/api",
"FIFTYONE_AUTH_SECRET=test-fiftyone-auth-secret",
"FIFTYONE_DATABASE_NAME=fiftyone",
Expand Down
6 changes: 5 additions & 1 deletion tests/unit/compose/docker-compose-legacy-auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const (
var legacyAuthComposeFile = filepath.Join(dockerLegacyAuthDir, "compose.yaml")
var legacyAuthComposePluginsFile = filepath.Join(dockerLegacyAuthDir, "compose.plugins.yaml")
var legacyAuthComposeDedicatedPluginsFile = filepath.Join(dockerLegacyAuthDir, "compose.dedicated-plugins.yaml")
var legacyAuthComposeDelegatedOperationsFile = filepath.Join(dockerInternalAuthDir, "compose.delegated-operators.yaml")
var legacyAuthComposeDelegatedOperationsFile = filepath.Join(dockerLegacyAuthDir, "compose.delegated-operators.yaml")
Comment thread
kaixi-wang marked this conversation as resolved.
var legacyAuthEnvTemplateFilePath = filepath.Join(dockerLegacyAuthDir, "env.template")

type commonServicesLegacyAuthDockerComposeTest struct {
Expand Down Expand Up @@ -258,6 +258,7 @@ func (s *commonServicesLegacyAuthDockerComposeTest) TestServiceEnvironment() {
[]string{legacyAuthComposeFile},
s.dotEnvFiles,
[]string{
"API_EXTERNAL_URL=https://example-api.fiftyone.ai",
"CAS_BASE_URL=http://teams-cas:3000/cas/api",
"FIFTYONE_AUTH_SECRET=test-fiftyone-auth-secret",
"FIFTYONE_DATABASE_NAME=fiftyone",
Expand Down Expand Up @@ -338,6 +339,7 @@ func (s *commonServicesLegacyAuthDockerComposeTest) TestServiceEnvironment() {
[]string{legacyAuthComposeFile},
s.dotEnvFiles,
[]string{
"API_EXTERNAL_URL=https://example-api.fiftyone.ai",
"CAS_BASE_URL=http://teams-cas:3000/cas/api",
"FIFTYONE_AUTH_SECRET=test-fiftyone-auth-secret",
"FIFTYONE_DATABASE_NAME=fiftyone",
Expand Down Expand Up @@ -419,6 +421,7 @@ func (s *commonServicesLegacyAuthDockerComposeTest) TestServiceEnvironment() {
[]string{legacyAuthComposePluginsFile},
s.dotEnvFiles,
[]string{
"API_EXTERNAL_URL=https://example-api.fiftyone.ai",
"CAS_BASE_URL=http://teams-cas:3000/cas/api",
"FIFTYONE_AUTH_SECRET=test-fiftyone-auth-secret",
"FIFTYONE_DATABASE_NAME=fiftyone",
Expand Down Expand Up @@ -500,6 +503,7 @@ func (s *commonServicesLegacyAuthDockerComposeTest) TestServiceEnvironment() {
[]string{legacyAuthComposeDedicatedPluginsFile},
s.dotEnvFiles,
[]string{
"API_EXTERNAL_URL=https://example-api.fiftyone.ai",
"CAS_BASE_URL=http://teams-cas:3000/cas/api",
"FIFTYONE_AUTH_SECRET=test-fiftyone-auth-secret",
"FIFTYONE_DATABASE_NAME=fiftyone",
Expand Down
108 changes: 108 additions & 0 deletions tests/unit/helm/api-deployment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,10 @@ func (s *deploymentApiTemplateTest) TestContainerEnv() {
nil,
func(envVars []corev1.EnvVar) {
expectedEnvVarJSON := `[
{
"name": "API_EXTERNAL_URL",
"value": ""
},
{
"name": "CAS_BASE_URL",
"value": "http://teams-cas:80/cas/api"
Expand Down Expand Up @@ -518,6 +522,10 @@ func (s *deploymentApiTemplateTest) TestContainerEnv() {
},
func(envVars []corev1.EnvVar) {
expectedEnvVarJSON := `[
{
"name": "API_EXTERNAL_URL",
"value": ""
},
{
"name": "CAS_BASE_URL",
"value": "http://teams-cas:80/cas/api"
Expand Down Expand Up @@ -617,6 +625,10 @@ func (s *deploymentApiTemplateTest) TestContainerEnv() {
},
func(envVars []corev1.EnvVar) {
expectedEnvVarJSON := `[
{
"name": "API_EXTERNAL_URL",
"value": ""
},
{
"name": "CAS_BASE_URL",
"value": "http://teams-cas:80/cas/api"
Expand Down Expand Up @@ -713,6 +725,10 @@ func (s *deploymentApiTemplateTest) TestContainerEnv() {
},
func(envVars []corev1.EnvVar) {
expectedEnvVarJSON := `[
{
"name": "API_EXTERNAL_URL",
"value": ""
},
{
"name": "CAS_BASE_URL",
"value": "http://teams-cas:80/cas/api"
Expand Down Expand Up @@ -797,6 +813,10 @@ func (s *deploymentApiTemplateTest) TestContainerEnv() {
},
func(envVars []corev1.EnvVar) {
expectedEnvVarJSON := `[
{
"name": "API_EXTERNAL_URL",
"value": ""
},
{
"name": "CAS_BASE_URL",
"value": "http://teams-cas-override:8000/cas/api"
Expand Down Expand Up @@ -866,6 +886,94 @@ func (s *deploymentApiTemplateTest) TestContainerEnv() {
"name": "LOGGING_LEVEL",
"value": "INFO"
}
]`
var expectedEnvVars []corev1.EnvVar
err := json.Unmarshal([]byte(expectedEnvVarJSON), &expectedEnvVars)
s.NoError(err)
s.Equal(expectedEnvVars, envVars, "Envs should be equal")
},
},
{
"overrideExternalApiUrl",
map[string]string{
"apiSettings.dnsName": "external-api-url:443",
"teamsAppSettings.dnsName": "external-app-url:443",
},
func(envVars []corev1.EnvVar) {
expectedEnvVarJSON := `[
{
"name": "API_EXTERNAL_URL",
"value": "https://external-api-url:443"
},
{
"name": "CAS_BASE_URL",
"value": "http://teams-cas:80/cas/api"
},
{
"name": "FIFTYONE_AUTH_SECRET",
"valueFrom": {
"secretKeyRef": {
"name": "fiftyone-teams-secrets",
"key": "fiftyoneAuthSecret"
}
}
},
{
"name": "FIFTYONE_DATABASE_NAME",
"valueFrom": {
"secretKeyRef": {
"name": "fiftyone-teams-secrets",
"key": "fiftyoneDatabaseName"
}
}
},
{
"name": "FIFTYONE_DATABASE_URI",
"valueFrom": {
"secretKeyRef": {
"name": "fiftyone-teams-secrets",
"key": "mongodbConnectionString"
}
}
},
{
"name": "FIFTYONE_ENCRYPTION_KEY",
"valueFrom": {
"secretKeyRef": {
"name": "fiftyone-teams-secrets",
"key": "encryptionKey"
}
}
},
{
"name": "MONGO_DEFAULT_DB",
"valueFrom": {
"secretKeyRef": {
"name": "fiftyone-teams-secrets",
"key": "fiftyoneDatabaseName"
}
}
},
{
"name": "FIFTYONE_ENV",
"value": "production"
},
{
"name": "FIFTYONE_INTERNAL_SERVICE",
"value": "true"
},
{
"name": "FIFTYONE_LOGGING_FORMAT",
"value": "text"
},
{
"name": "GRAPHQL_DEFAULT_LIMIT",
"value": "10"
},
{
"name": "LOGGING_LEVEL",
"value": "INFO"
}
]`
var expectedEnvVars []corev1.EnvVar
err := json.Unmarshal([]byte(expectedEnvVarJSON), &expectedEnvVars)
Expand Down
Loading