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

Commit

Permalink
Revert "EVEREST-107 Rename TargetNamespaces to AllowedNamespaces" (#459)
Browse files Browse the repository at this point in the history
  • Loading branch information
recharte authored Feb 20, 2024
1 parent 3a91d3c commit 3ad4c2a
Show file tree
Hide file tree
Showing 13 changed files with 445 additions and 441 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 \
--namespaces everest
--namespace 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',
allowedNamespaces: [testsNs]
targetNamespaces: [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',
allowedNamespaces: [testsNs]
targetNamespaces: [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',
allowedNamespaces: [testsNs]
targetNamespaces: [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',
allowedNamespaces: [testsNs]
targetNamespaces: [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',
allowedNamespaces: [testsNs]
targetNamespaces: [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',
allowedNamespaces: [testsNs]
targetNamespaces: [testsNs]
},
errorText: 'Region is required',
},
Expand All @@ -222,7 +222,7 @@ test('create backup storage failures', async ({request}) => {
bucketName: 'invalid',
accessKey: 'ssdssd',
secretKey: 'ssdssdssdssd',
allowedNamespaces: [testsNs]
targetNamespaces: [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',
allowedNamespaces: [testsNs]
targetNamespaces: [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',
allowedNamespaces: [testsNs],
targetNamespaces: [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',
allowedNamespaces: [testsNs],
targetNamespaces: [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',
allowedNamespaces: [testsNs],
targetNamespaces: [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',
allowedNamespaces: [testsNs],
targetNamespaces: [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',
allowedNamespaces: [testsNs],
targetNamespaces: [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',
allowedNamespaces: [testsNs],
targetNamespaces: [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',
allowedNamespaces: [testsNs],
targetNamespaces: [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',
allowedNamespaces: [testsNs],
targetNamespaces: [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,
AllowedNamespaces: s.Spec.AllowedNamespaces,
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,
})
}

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,
AllowedNamespaces: params.AllowedNamespaces,
TargetNamespaces: params.TargetNamespaces,
},
}
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,
AllowedNamespaces: params.AllowedNamespaces,
Type: BackupStorageType(params.Type),
Name: params.Name,
Description: params.Description,
BucketName: params.BucketName,
Region: params.Region,
Url: params.Url,
TargetNamespaces: params.TargetNamespaces,
}

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,
AllowedNamespaces: s.Spec.AllowedNamespaces,
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,
})
}

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.AllowedNamespaces != nil {
bs.Spec.AllowedNamespaces = *params.AllowedNamespaces
if params.TargetNamespaces != nil {
bs.Spec.TargetNamespaces = *params.TargetNamespaces
}

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,
AllowedNamespaces: bs.Spec.AllowedNamespaces,
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,
}

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

0 comments on commit 3ad4c2a

Please sign in to comment.