-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into dependabot/npm_and_yarn/typescript-5.3.2
- Loading branch information
Showing
46 changed files
with
1,044 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
ansible/roles/schulcloud-server-core/templates/data-deletion-trigger-cronjob.yml.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
apiVersion: batch/v1 | ||
kind: CronJob | ||
metadata: | ||
namespace: {{ NAMESPACE }} | ||
labels: | ||
app: data-deletion-trigger | ||
app.kubernetes.io/part-of: schulcloud-verbund | ||
app.kubernetes.io/version: {{ SCHULCLOUD_SERVER_IMAGE_TAG }} | ||
app.kubernetes.io/name: data-deletion-trigger | ||
app.kubernetes.io/component: data-deletion | ||
app.kubernetes.io/managed-by: ansible | ||
git.branch: {{ SCHULCLOUD_SERVER_BRANCH_NAME }} | ||
git.repo: {{ SCHULCLOUD_SERVER_REPO_NAME }} | ||
name: data-deletion-trigger-cronjob | ||
spec: | ||
concurrencyPolicy: Forbid | ||
schedule: "{{ SERVER_DATA_DELETION_TRIGGER_CRONJOB_SCHEDULE|default("@hourly", true) }}" | ||
jobTemplate: | ||
metadata: | ||
labels: | ||
app: data-deletion-trigger | ||
app.kubernetes.io/part-of: schulcloud-verbund | ||
app.kubernetes.io/version: {{ SCHULCLOUD_SERVER_IMAGE_TAG }} | ||
app.kubernetes.io/name: data-deletion-trigger | ||
app.kubernetes.io/component: data-deletion | ||
app.kubernetes.io/managed-by: ansible | ||
git.branch: {{ SCHULCLOUD_SERVER_BRANCH_NAME }} | ||
git.repo: {{ SCHULCLOUD_SERVER_REPO_NAME }} | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: data-deletion-trigger-cronjob | ||
image: {{ SCHULCLOUD_SERVER_IMAGE }}:{{ SCHULCLOUD_SERVER_IMAGE_TAG }} | ||
envFrom: | ||
- secretRef: | ||
name: admin-api-client-secret | ||
command: ['/bin/sh', '-c'] | ||
args: ['npm run nest:start:deletion-console -- execution trigger'] | ||
resources: | ||
limits: | ||
cpu: {{ API_CPU_LIMITS|default("2000m", true) }} | ||
memory: {{ API_MEMORY_LIMITS|default("2Gi", true) }} | ||
requests: | ||
cpu: {{ API_CPU_REQUESTS|default("100m", true) }} | ||
memory: {{ API_MEMORY_REQUESTS|default("150Mi", true) }} | ||
restartPolicy: OnFailure | ||
metadata: | ||
labels: | ||
app: data-deletion-trigger | ||
app.kubernetes.io/part-of: schulcloud-verbund | ||
app.kubernetes.io/version: {{ SCHULCLOUD_SERVER_IMAGE_TAG }} | ||
app.kubernetes.io/name: data-deletion-trigger | ||
app.kubernetes.io/component: data-deletion | ||
app.kubernetes.io/managed-by: ansible | ||
git.branch: {{ SCHULCLOUD_SERVER_BRANCH_NAME }} | ||
git.repo: {{ SCHULCLOUD_SERVER_REPO_NAME }} |
7 changes: 7 additions & 0 deletions
7
ansible/roles/schulcloud-server-core/templates/onepassword-admin-api-client.yml.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
apiVersion: onepassword.com/v1 | ||
kind: OnePasswordItem | ||
metadata: | ||
name: admin-api-client-secret | ||
namespace: {{ NAMESPACE }} | ||
spec: | ||
itemPath: "vaults/{{ ONEPASSWORD_OPERATOR_VAULT }}/items/admin-api-client" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...er/src/modules/deletion/console/builder/deletion-execution-trigger-result.builder.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { DeletionExecutionTriggerResult, DeletionExecutionTriggerStatus } from '../interface'; | ||
import { DeletionExecutionTriggerResultBuilder } from './deletion-execution-trigger-result.builder'; | ||
|
||
describe(DeletionExecutionTriggerResultBuilder.name, () => { | ||
describe(DeletionExecutionTriggerResultBuilder.buildSuccess.name, () => { | ||
describe('when called', () => { | ||
const setup = () => { | ||
const expectedOutput: DeletionExecutionTriggerResult = { status: DeletionExecutionTriggerStatus.SUCCESS }; | ||
|
||
return { expectedOutput }; | ||
}; | ||
|
||
it('should return valid object indicating success', () => { | ||
const { expectedOutput } = setup(); | ||
|
||
const output = DeletionExecutionTriggerResultBuilder.buildSuccess(); | ||
|
||
expect(output).toStrictEqual(expectedOutput); | ||
}); | ||
}); | ||
}); | ||
|
||
describe(DeletionExecutionTriggerResultBuilder.buildFailure.name, () => { | ||
describe('when called with proper arguments', () => { | ||
const setup = () => { | ||
const error = new Error('test error message'); | ||
|
||
const expectedOutput: DeletionExecutionTriggerResult = { | ||
status: DeletionExecutionTriggerStatus.FAILURE, | ||
error: error.toString(), | ||
}; | ||
|
||
return { error, expectedOutput }; | ||
}; | ||
|
||
it('should return valid object with expected values', () => { | ||
const { error, expectedOutput } = setup(); | ||
|
||
const output = DeletionExecutionTriggerResultBuilder.buildFailure(error); | ||
|
||
expect(output).toStrictEqual(expectedOutput); | ||
}); | ||
}); | ||
}); | ||
}); |
21 changes: 21 additions & 0 deletions
21
.../server/src/modules/deletion/console/builder/deletion-execution-trigger-result.builder.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { DeletionExecutionTriggerResult, DeletionExecutionTriggerStatus } from '../interface'; | ||
|
||
export class DeletionExecutionTriggerResultBuilder { | ||
private static build(status: DeletionExecutionTriggerStatus, error?: string): DeletionExecutionTriggerResult { | ||
const output: DeletionExecutionTriggerResult = { status }; | ||
|
||
if (error) { | ||
output.error = error; | ||
} | ||
|
||
return output; | ||
} | ||
|
||
static buildSuccess(): DeletionExecutionTriggerResult { | ||
return this.build(DeletionExecutionTriggerStatus.SUCCESS); | ||
} | ||
|
||
static buildFailure(err: Error): DeletionExecutionTriggerResult { | ||
return this.build(DeletionExecutionTriggerStatus.FAILURE, err.toString()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
export * from './push-delete-requests-options.builder'; | ||
export * from './trigger-deletion-execution-options.builder'; | ||
export * from './deletion-execution-trigger-result.builder'; |
24 changes: 24 additions & 0 deletions
24
...r/src/modules/deletion/console/builder/trigger-deletion-execution-options.builder.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { TriggerDeletionExecutionOptions } from '../interface'; | ||
import { TriggerDeletionExecutionOptionsBuilder } from './trigger-deletion-execution-options.builder'; | ||
|
||
describe(TriggerDeletionExecutionOptionsBuilder.name, () => { | ||
describe(TriggerDeletionExecutionOptionsBuilder.build.name, () => { | ||
describe('when called with proper arguments', () => { | ||
const setup = () => { | ||
const limit = 1000; | ||
|
||
const expectedOutput: TriggerDeletionExecutionOptions = { limit }; | ||
|
||
return { limit, expectedOutput }; | ||
}; | ||
|
||
it('should return valid object with expected values', () => { | ||
const { limit, expectedOutput } = setup(); | ||
|
||
const output = TriggerDeletionExecutionOptionsBuilder.build(limit); | ||
|
||
expect(output).toStrictEqual(expectedOutput); | ||
}); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.