Skip to content

Commit a410929

Browse files
feat: remove v1/otomi/values endpoint and tools sidecar dependencies (#997)
Co-authored-by: svcAPLBot <174728082+svcAPLBot@users.noreply.github.com>
1 parent 3576b5e commit a410929

11 files changed

Lines changed: 2 additions & 138 deletions

File tree

bin/dc.sh

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ sub_help () {
1212
echo
1313
echo "Commands:"
1414
echo " help This help message"
15-
echo " up Start standalone docker-compose version of web without dependent services $info"
16-
echo " up-all Start docker-compose version of web with dependent services $info"
17-
echo " up-deps Start docker-compose version of only dependent services $info"
15+
echo " up Start docker-compose version of web $info"
1816
echo " down Stop and clean docker-compose containers"
1917
}
2018

@@ -23,18 +21,8 @@ sub_up () {
2321
docker-compose -f docker-compose.yml up ${1}
2422
}
2523

26-
sub_up-all () {
27-
local files='-f docker-compose.yml -f docker-compose-deps.yml'
28-
29-
docker-compose $files up ${1}
30-
}
31-
32-
sub_up-deps () {
33-
docker-compose -f docker-compose-deps.yml up ${1}
34-
}
35-
3624
sub_down () {
37-
docker-compose -f docker-compose.yml -f docker-compose-deps.yml down --remove-orphans -v
25+
docker-compose -f docker-compose.yml down --remove-orphans -v
3826
}
3927

4028
case $command in

docker-compose-deps.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

docker-compose.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ services:
1818
- /tmp:/tmp:rw
1919
working_dir: /app
2020
environment:
21-
TOOLS_HOST: tools
2221
HOME: /app
2322
env_file:
2423
- .env

src/api.authz.test.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -184,23 +184,6 @@ describe('API authz tests', () => {
184184
await agent.post('/v1/teams').send(data).set('Authorization', `Bearer ${platformAdminToken}`).expect(200)
185185
})
186186

187-
test('platform admin can get all values', async () => {
188-
jest.spyOn(otomiStack, 'getValues').mockResolvedValue({})
189-
await agent.get('/v1/otomi/values').set('Authorization', `Bearer ${platformAdminToken}`).expect(200)
190-
})
191-
192-
test('team member cannot get all values', async () => {
193-
await agent.get('/v1/otomi/values').set('Authorization', `Bearer ${teamMemberToken}`).expect(403)
194-
})
195-
196-
test('authenticated user cannot get all values', async () => {
197-
await agent.get('/v1/otomi/values').set('Authorization', `Bearer ${userToken}`).expect(403)
198-
})
199-
200-
test('unauthenticated user cannot get all values', async () => {
201-
await agent.get('/v1/otomi/values').expect(401)
202-
})
203-
204187
test('platform admin can see values from an app', async () => {
205188
const values = { shown: true } as App['values']
206189
jest.spyOn(otomiStack, 'getApp').mockImplementation(() => ({ id: 'adminapp', values }))

src/api/v1/otomi/values.ts

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/constants.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
import { TOOLS_HOST, cleanEnv } from './validators'
2-
3-
const env = cleanEnv({
4-
TOOLS_HOST,
5-
})
6-
7-
export const BASEURL = `http://${env.TOOLS_HOST}:17771`
8-
91
export const APL_SECRETS_NAMESPACE = 'apl-secrets'
102
export const APL_USERS_NAMESPACE = 'apl-users'
113
export const PLATFORM_SECRETS_NAME = 'otomi-secrets'

src/git.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import axios, { AxiosResponse } from 'axios'
21
import Debug from 'debug'
32
import diff from 'deep-diff'
43
import { rmSync } from 'fs'
@@ -16,10 +15,8 @@ import {
1615
GIT_PUSH_RETRIES,
1716
GIT_REPO_URL,
1817
GIT_USER,
19-
TOOLS_HOST,
2018
} from 'src/validators'
2119
import { parse as parseYaml, stringify as stringifyYaml } from 'yaml'
22-
import { BASEURL } from './constants'
2320
import { GitPullError } from './error'
2421
import { Core } from './otomi-models'
2522
import { getSanitizedErrorMessage, removeBlankAttributes, sanitizeGitPassword } from './utils'
@@ -33,12 +30,8 @@ const env = cleanEnv({
3330
GIT_REPO_URL,
3431
GIT_USER,
3532
GIT_PUSH_RETRIES,
36-
TOOLS_HOST,
3733
})
3834

39-
const baseUrl = BASEURL
40-
const valuesUrl = `${baseUrl}/otomi/values`
41-
4235
const getProtocol = (url): string => (url && url.includes('://') ? url.split('://')[0] : 'http')
4336

4437
const getUrl = (url): string => (!url || url.includes('://') ? url : `${getProtocol(url)}://${url}`)
@@ -92,12 +85,6 @@ export class Git {
9285
return getProtocol(this.url)
9386
}
9487

95-
async requestValues(params): Promise<AxiosResponse> {
96-
debug(`Tools: requesting "otomi/values" ${this.path}`)
97-
const res = await axios.get(valuesUrl, { params: { envDir: this.path, ...params } })
98-
return res
99-
}
100-
10188
async addConfig(): Promise<void> {
10289
debug(`Adding git config`)
10390
await this.git.addConfig('user.name', this.user)

src/openapi/api.yaml

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -14,37 +14,6 @@ externalDocs:
1414

1515
# -------------------------------------------- Paths
1616
paths:
17-
/v1/otomi/values:
18-
get:
19-
operationId: getValues
20-
x-eov-operation-handler: v1/otomi/values
21-
description: Get otomi values
22-
x-aclSchema: OtomiCliValues
23-
parameters:
24-
- name: filesOnly
25-
in: query
26-
description: IDs of settings to return
27-
schema:
28-
type: string
29-
enum: ['true', 'false']
30-
- name: excludeSecrets
31-
in: query
32-
schema:
33-
type: string
34-
enum: ['true', 'false']
35-
- name: withWorkloadValues
36-
in: query
37-
schema:
38-
type: string
39-
enum: ['true', 'false']
40-
responses:
41-
'200':
42-
description: Successfully obtained otomi values
43-
content:
44-
application/yaml:
45-
schema:
46-
$ref: '#/components/schemas/OtomiCliValues'
47-
4817
/v1/teams:
4918
get:
5019
operationId: getTeams
@@ -3562,8 +3531,6 @@ components:
35623531
$ref: 'error.yaml#/OpenApiValidationError'
35633532
OtomiStackError:
35643533
$ref: 'error.yaml#/OtomiStackError'
3565-
OtomiCliValues:
3566-
$ref: 'otomi/cli.yaml#/OtomiCliValues'
35673534
Policy:
35683535
$ref: 'policies.yaml#/Policy'
35693536
Policies:

src/openapi/otomi/cli.yaml

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/otomi-stack.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ import {
111111
OBJ_STORAGE_APPS,
112112
OBJECT_STORAGE_UI_EXCLUSIONS,
113113
PREINSTALLED_EXCLUDED_APPS,
114-
TOOLS_HOST,
115114
VERSIONS,
116115
} from 'src/validators'
117116
import { v4 as uuidv4 } from 'uuid'
@@ -186,7 +185,6 @@ const env = cleanEnv({
186185
GIT_REPO_URL,
187186
GIT_USER,
188187
HELM_CHART_CATALOG,
189-
TOOLS_HOST,
190188
VERSIONS,
191189
PREINSTALLED_EXCLUDED_APPS,
192190
HIDDEN_APPS,
@@ -274,10 +272,6 @@ export default class OtomiStack {
274272
return getAppList()
275273
}
276274

277-
async getValues(query): Promise<Record<string, any>> {
278-
return (await this.git.requestValues(query)).data
279-
}
280-
281275
getRepoPath() {
282276
if (env.isTest || this.sessionId === undefined) return env.GIT_LOCAL_PATH
283277
return `${rootPath}/${this.sessionId}`

0 commit comments

Comments
 (0)