Skip to content
This repository has been archived by the owner on Mar 4, 2024. It is now read-only.

Commit

Permalink
EVEREST-107 Rename TargetNamespaces to AllowedNamespaces (#460)
Browse files Browse the repository at this point in the history
  • Loading branch information
recharte authored Feb 20, 2024
1 parent 3ad4c2a commit 69f606d
Show file tree
Hide file tree
Showing 13 changed files with 441 additions and 445 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ jobs:
--operator.postgresql \
--operator.xtradb-cluster \
--skip-wizard \
--namespace everest
--namespaces everest
# API_TOKEN is used later by "make test"
echo "API_TOKEN=$(./bin/everest token reset --json | jq .token -r)" >> $GITHUB_ENV
Expand Down
16 changes: 8 additions & 8 deletions api-tests/tests/backup-storages.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ test('add/list/get/delete s3 backup storage success', async ({request}) => {
region: 'us-east-2',
accessKey: 'sdfs',
secretKey: 'sdfsdfsd',
targetNamespaces: [testsNs]
allowedNamespaces: [testsNs]
}

const response = await request.post(`/v1/backup-storages`, {
Expand Down Expand Up @@ -65,7 +65,7 @@ test('add/list/get/delete s3 backup storage success', async ({request}) => {
bucketName: 'percona-test-backup-storage1',
accessKey: 'otherAccessKey',
secretKey: 'otherSecret',
targetNamespaces: [testsNs]
allowedNamespaces: [testsNs]
}
const updated = await request.patch(`/v1/backup-storages/${name}`, {
data: updatePayload,
Expand Down Expand Up @@ -100,7 +100,7 @@ test('add/list/get/delete azure backup storage success', async ({request}) => {
bucketName: 'percona-test-backup-storage',
accessKey: 'sdfs',
secretKey: 'sdfsdfsd',
targetNamespaces: [testsNs]
allowedNamespaces: [testsNs]
}

const response = await request.post(`/v1/backup-storages`, {
Expand Down Expand Up @@ -186,7 +186,7 @@ test('create backup storage failures', async ({request}) => {
region: 'us-east-2',
accessKey: 'ssdssd',
secretKey: 'ssdssdssdssd',
targetNamespaces: [testsNs]
allowedNamespaces: [testsNs]
},
errorText: '\'name\' is not RFC 1035 compatible',
},
Expand All @@ -199,7 +199,7 @@ test('create backup storage failures', async ({request}) => {
region: 'us-east-2',
accessKey: 'ssdssd',
secretKey: 'ssdssdssdssd',
targetNamespaces: [testsNs]
allowedNamespaces: [testsNs]
},
errorText: '\'url\' is an invalid URL',
},
Expand All @@ -210,7 +210,7 @@ test('create backup storage failures', async ({request}) => {
bucketName: 'invalid',
accessKey: 'ssdssd',
secretKey: 'ssdssdssdssd',
targetNamespaces: [testsNs]
allowedNamespaces: [testsNs]
},
errorText: 'Region is required',
},
Expand All @@ -222,7 +222,7 @@ test('create backup storage failures', async ({request}) => {
bucketName: 'invalid',
accessKey: 'ssdssd',
secretKey: 'ssdssdssdssd',
targetNamespaces: [testsNs]
allowedNamespaces: [testsNs]
},
errorText: '"/type": value is not one of the allowed values',
},
Expand All @@ -246,7 +246,7 @@ test('update backup storage failures', async ({request}) => {
region: 'us-east-2',
accessKey: 'sdfsdfs',
secretKey: 'lkdfslsldfka',
targetNamespaces: [testsNs]
allowedNamespaces: [testsNs]
}
const response = await request.post(`/v1/backup-storages`, {
data: createPayload,
Expand Down
2 changes: 1 addition & 1 deletion api-tests/tests/database-cluster.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ test.beforeAll(async ({ request }) => {
type: 'pmm',
name: monitoringConfigName1,
url: 'http://monitoring',
targetNamespaces: [testsNs],
allowedNamespaces: [testsNs],
pmm: {
apiKey: '123',
},
Expand Down
2 changes: 1 addition & 1 deletion api-tests/tests/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export const createBackupStorage = async (request, name) => {
region: 'us-east-2',
accessKey: 'sdfs',
secretKey: 'sdfsdfsd',
targetNamespaces: [testsNs],
allowedNamespaces: [testsNs],
}

const response = await request.post(`/v1/backup-storages`, { data: storagePayload })
Expand Down
12 changes: 6 additions & 6 deletions api-tests/tests/monitoring-instances.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ test('create monitoring instance with api key', async ({ request }) => {
type: 'pmm',
name: `${testPrefix}-key`,
url: 'http://monitoring',
targetNamespaces: [testsNs],
allowedNamespaces: [testsNs],
pmm: {
apiKey: '123',
},
Expand All @@ -60,7 +60,7 @@ test('create monitoring instance with user/password', async ({ request }) => {
type: 'pmm',
name: `${testPrefix}-pass`,
url: 'http://127.0.0.1:8888',
targetNamespaces: [testsNs],
allowedNamespaces: [testsNs],
pmm: {
user: 'admin',
password: 'admin',
Expand All @@ -82,7 +82,7 @@ test('create monitoring instance missing pmm', async ({ request }) => {
type: 'pmm',
name: 'monitoring-fail',
url: 'http://monitoring-instance',
targetNamespaces: [testsNs],
allowedNamespaces: [testsNs],
}

const response = await request.post('/v1/monitoring-instances', { data })
Expand All @@ -95,7 +95,7 @@ test('create monitoring instance missing pmm credentials', async ({ request }) =
type: 'pmm',
name: 'monitoring-fail',
url: 'http://monitoring-instance',
targetNamespaces: [testsNs],
allowedNamespaces: [testsNs],
pmm: {},
}

Expand Down Expand Up @@ -244,7 +244,7 @@ test('update monitoring instances failures', async ({ request }) => {
type: 'pmm',
name: `${testPrefix}-fail`,
url: 'http://monitoring',
targetNamespaces: [testsNs],
allowedNamespaces: [testsNs],
pmm: {
apiKey: '123',
},
Expand Down Expand Up @@ -301,7 +301,7 @@ async function createInstances(request: APIRequestContext, namePrefix: string, c
type: 'pmm',
name: '',
url: 'http://monitoring-instance',
targetNamespaces: [testsNs],
allowedNamespaces: [testsNs],
pmm: {
apiKey: '123',
},
Expand Down
62 changes: 31 additions & 31 deletions api/backup_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ func (e *EverestServer) ListBackupStorages(ctx echo.Context) error {
for _, bs := range backupList.Items {
s := bs
result = append(result, BackupStorage{
Type: BackupStorageType(bs.Spec.Type),
Name: s.Name,
Description: &s.Spec.Description,
BucketName: s.Spec.Bucket,
Region: s.Spec.Region,
Url: &s.Spec.EndpointURL,
TargetNamespaces: s.Spec.TargetNamespaces,
Type: BackupStorageType(bs.Spec.Type),
Name: s.Name,
Description: &s.Spec.Description,
BucketName: s.Spec.Bucket,
Region: s.Spec.Region,
Url: &s.Spec.EndpointURL,
AllowedNamespaces: s.Spec.AllowedNamespaces,
})
}

Expand Down Expand Up @@ -120,7 +120,7 @@ func (e *EverestServer) CreateBackupStorage(ctx echo.Context) error { //nolint:f
Bucket: params.BucketName,
Region: params.Region,
CredentialsSecretName: params.Name,
TargetNamespaces: params.TargetNamespaces,
AllowedNamespaces: params.AllowedNamespaces,
},
}
if params.Url != nil {
Expand All @@ -144,13 +144,13 @@ func (e *EverestServer) CreateBackupStorage(ctx echo.Context) error { //nolint:f
})
}
result := BackupStorage{
Type: BackupStorageType(params.Type),
Name: params.Name,
Description: params.Description,
BucketName: params.BucketName,
Region: params.Region,
Url: params.Url,
TargetNamespaces: params.TargetNamespaces,
Type: BackupStorageType(params.Type),
Name: params.Name,
Description: params.Description,
BucketName: params.BucketName,
Region: params.Region,
Url: params.Url,
AllowedNamespaces: params.AllowedNamespaces,
}

return ctx.JSON(http.StatusOK, result)
Expand Down Expand Up @@ -219,13 +219,13 @@ func (e *EverestServer) GetBackupStorage(ctx echo.Context, backupStorageName str
})
}
return ctx.JSON(http.StatusOK, BackupStorage{
Type: BackupStorageType(s.Spec.Type),
Name: s.Name,
Description: &s.Spec.Description,
BucketName: s.Spec.Bucket,
Region: s.Spec.Region,
Url: &s.Spec.EndpointURL,
TargetNamespaces: s.Spec.TargetNamespaces,
Type: BackupStorageType(s.Spec.Type),
Name: s.Name,
Description: &s.Spec.Description,
BucketName: s.Spec.Bucket,
Region: s.Spec.Region,
Url: &s.Spec.EndpointURL,
AllowedNamespaces: s.Spec.AllowedNamespaces,
})
}

Expand Down Expand Up @@ -298,8 +298,8 @@ func (e *EverestServer) UpdateBackupStorage(ctx echo.Context, backupStorageName
if params.Description != nil {
bs.Spec.Description = *params.Description
}
if params.TargetNamespaces != nil {
bs.Spec.TargetNamespaces = *params.TargetNamespaces
if params.AllowedNamespaces != nil {
bs.Spec.AllowedNamespaces = *params.AllowedNamespaces
}

err = e.kubeClient.UpdateBackupStorage(c, bs)
Expand All @@ -310,13 +310,13 @@ func (e *EverestServer) UpdateBackupStorage(ctx echo.Context, backupStorageName
})
}
result := BackupStorage{
Type: BackupStorageType(bs.Spec.Type),
Name: bs.Name,
Description: params.Description,
BucketName: bs.Spec.Bucket,
Region: bs.Spec.Region,
Url: &bs.Spec.EndpointURL,
TargetNamespaces: bs.Spec.TargetNamespaces,
Type: BackupStorageType(bs.Spec.Type),
Name: bs.Name,
Description: params.Description,
BucketName: bs.Spec.Bucket,
Region: bs.Spec.Region,
Url: &bs.Spec.EndpointURL,
AllowedNamespaces: bs.Spec.AllowedNamespaces,
}

return ctx.JSON(http.StatusOK, result)
Expand Down
Loading

0 comments on commit 69f606d

Please sign in to comment.