-
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.
- Loading branch information
Showing
107 changed files
with
6,840 additions
and
654 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
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 @@ | ||
SERVER_TSP_SYNC_CRONJOB_SCHEDULE: "9 3 * * *" |
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
18 changes: 18 additions & 0 deletions
18
ansible/roles/schulcloud-server-tspsync/templates/api-tsp-sync-cronjob-configmap.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,18 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
namespace: {{ NAMESPACE }} | ||
name: api-tsp-sync-cronjob-configmap | ||
labels: | ||
app: api-tsp-sync-cronjob | ||
data: | ||
NODE_OPTIONS: "--max-old-space-size=3072" | ||
NEST_LOG_LEVEL: "error" | ||
EXIT_ON_ERROR: "true" | ||
FEATURE_IDENTITY_MANAGEMENT_ENABLED: "{{ FEATURE_IDENTITY_MANAGEMENT_ENABLED }}" | ||
FEATURE_IDENTITY_MANAGEMENT_STORE_ENABLED: "{{ FEATURE_IDENTITY_MANAGEMENT_STORE_ENABLED }}" | ||
FEATURE_IDENTITY_MANAGEMENT_LOGIN_ENABLED: "{{ FEATURE_IDENTITY_MANAGEMENT_LOGIN_ENABLED }}" | ||
IDENTITY_MANAGEMENT__INTERNAL_URI: "{{ IDENTITY_MANAGEMENT__INTERNAL_URI }}" | ||
IDENTITY_MANAGEMENT__EXTERNAL_URI: "{{ IDENTITY_MANAGEMENT__EXTERNAL_URI }}" | ||
IDENTITY_MANAGEMENT__TENANT: "{{ IDENTITY_MANAGEMENT__TENANT }}" | ||
IDENTITY_MANAGEMENT__CLIENTID: "{{ IDENTITY_MANAGEMENT__CLIENTID }}" |
109 changes: 109 additions & 0 deletions
109
ansible/roles/schulcloud-server-tspsync/templates/api-tsp-sync-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,109 @@ | ||
apiVersion: batch/v1 | ||
kind: CronJob | ||
metadata: | ||
namespace: {{ NAMESPACE }} | ||
labels: | ||
app: api-tsp-sync-cronjob | ||
app.kubernetes.io/part-of: schulcloud-verbund | ||
app.kubernetes.io/version: {{ SCHULCLOUD_SERVER_IMAGE_TAG }} | ||
app.kubernetes.io/name: api-tsp-sync-cronjob | ||
app.kubernetes.io/component: sync | ||
app.kubernetes.io/managed-by: ansible | ||
git.branch: {{ SCHULCLOUD_SERVER_BRANCH_NAME }} | ||
git.repo: {{ SCHULCLOUD_SERVER_REPO_NAME }} | ||
name: api-tsp-sync-cronjob | ||
spec: | ||
concurrencyPolicy: Forbid | ||
schedule: "{{ SERVER_TSP_SYNC_CRONJOB_SCHEDULE }}" | ||
jobTemplate: | ||
metadata: | ||
labels: | ||
app: api-tsp-sync-cronjob | ||
app.kubernetes.io/part-of: schulcloud-verbund | ||
app.kubernetes.io/version: {{ SCHULCLOUD_SERVER_IMAGE_TAG }} | ||
app.kubernetes.io/name: api-tsp-sync-cronjob | ||
app.kubernetes.io/component: sync | ||
app.kubernetes.io/managed-by: ansible | ||
git.branch: {{ SCHULCLOUD_SERVER_BRANCH_NAME }} | ||
git.repo: {{ SCHULCLOUD_SERVER_REPO_NAME }} | ||
spec: | ||
template: | ||
metadata: | ||
labels: | ||
app: api-tsp-sync-cronjob | ||
app.kubernetes.io/part-of: schulcloud-verbund | ||
app.kubernetes.io/version: {{ SCHULCLOUD_SERVER_IMAGE_TAG }} | ||
app.kubernetes.io/name: api-tsp-sync-cronjob | ||
app.kubernetes.io/component: sync | ||
app.kubernetes.io/managed-by: ansible | ||
git.branch: {{ SCHULCLOUD_SERVER_BRANCH_NAME }} | ||
git.repo: {{ SCHULCLOUD_SERVER_REPO_NAME }} | ||
spec: | ||
securityContext: | ||
runAsUser: 1000 | ||
runAsGroup: 1000 | ||
fsGroup: 1000 | ||
runAsNonRoot: true | ||
containers: | ||
- name: api-tsp-sync-cronjob | ||
image: {{ SCHULCLOUD_SERVER_IMAGE }}:{{ SCHULCLOUD_SERVER_IMAGE_TAG }} | ||
envFrom: | ||
- configMapRef: | ||
name: api-tsp-sync-cronjob-configmap | ||
- secretRef: | ||
name: api-secret | ||
command: ['/bin/sh', '-c'] | ||
args: ['npm run nest:start:sync tsp'] | ||
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 | ||
{% if AFFINITY_ENABLE is defined and AFFINITY_ENABLE|bool %} | ||
affinity: | ||
podAffinity: | ||
preferredDuringSchedulingIgnoredDuringExecution: | ||
- weight: 20 | ||
podAffinityTerm: | ||
labelSelector: | ||
matchExpressions: | ||
- key: app.kubernetes.io/part-of | ||
operator: In | ||
values: | ||
- schulcloud-verbund | ||
topologyKey: "kubernetes.io/hostname" | ||
namespaceSelector: {} | ||
- weight: 10 | ||
podAffinityTerm: | ||
labelSelector: | ||
matchExpressions: | ||
- key: git.repo | ||
operator: In | ||
values: | ||
- {{ SCHULCLOUD_SERVER_REPO_NAME }} | ||
topologyKey: "kubernetes.io/hostname" | ||
namespaceSelector: {} | ||
- weight: 10 | ||
podAffinityTerm: | ||
labelSelector: | ||
matchExpressions: | ||
- key: git.branch | ||
operator: In | ||
values: | ||
- {{ SCHULCLOUD_SERVER_BRANCH_NAME }} | ||
topologyKey: "kubernetes.io/hostname" | ||
namespaceSelector: {} | ||
- weight: 10 | ||
podAffinityTerm: | ||
labelSelector: | ||
matchExpressions: | ||
- key: app.kubernetes.io/version | ||
operator: In | ||
values: | ||
- {{ SCHULCLOUD_SERVER_IMAGE_TAG }} | ||
topologyKey: "kubernetes.io/hostname" | ||
namespaceSelector: {} | ||
{% endif %} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
export { SchulconnexRestClientOptions } from './schulconnex-rest-client-options'; | ||
export { SchulconnexClientModule } from './schulconnex-client.module'; | ||
export { SchulconnexRestClient } from './schulconnex-rest-client'; | ||
export * from './response'; | ||
export { schulconnexResponseFactory, schulconnexPoliciesInfoResponseFactory } from './testing'; | ||
export { SchulconnexClientConfig } from './schulconnex-client-config'; |
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
13 changes: 13 additions & 0 deletions
13
...connex-client/response/policies-info/schulconnex-policies-info-access-control-response.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,13 @@ | ||
import { Type } from 'class-transformer'; | ||
import { IsObject, IsString, ValidateNested } from 'class-validator'; | ||
import { SchulconnexPoliciesInfoErrorDescriptionResponse } from './schulconnex-policies-info-error-description-response'; | ||
|
||
export class SchulconnexPoliciesInfoAccessControlResponse { | ||
@IsString() | ||
'@type'!: string; | ||
|
||
@IsObject() | ||
@ValidateNested() | ||
@Type(() => SchulconnexPoliciesInfoErrorDescriptionResponse) | ||
error!: SchulconnexPoliciesInfoErrorDescriptionResponse; | ||
} |
9 changes: 9 additions & 0 deletions
9
...nex-client/response/policies-info/schulconnex-policies-info-error-description-response.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,9 @@ | ||
import { IsString } from 'class-validator'; | ||
|
||
export class SchulconnexPoliciesInfoErrorDescriptionResponse { | ||
@IsString() | ||
code!: string; | ||
|
||
@IsString() | ||
value!: string; | ||
} |
10 changes: 10 additions & 0 deletions
10
...fra/schulconnex-client/response/policies-info/schulconnex-policies-info-error-response.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,10 @@ | ||
import { Type } from 'class-transformer'; | ||
import { IsObject, ValidateNested } from 'class-validator'; | ||
import { SchulconnexPoliciesInfoAccessControlResponse } from './schulconnex-policies-info-access-control-response'; | ||
|
||
export class SchulconnexPoliciesInfoErrorResponse { | ||
@IsObject() | ||
@ValidateNested() | ||
@Type(() => SchulconnexPoliciesInfoAccessControlResponse) | ||
access_control!: SchulconnexPoliciesInfoAccessControlResponse; | ||
} |
16 changes: 16 additions & 0 deletions
16
...a/schulconnex-client/response/policies-info/schulconnex-policies-info-license-response.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,16 @@ | ||
import { Type } from 'class-transformer'; | ||
import { IsArray, IsObject, ValidateNested } from 'class-validator'; | ||
import { SchulconnexPoliciesInfoPermissionResponse } from './schulconnex-policies-info-permission-response'; | ||
import { SchulconnexPoliciesInfoTargetResponse } from './schulconnex-policies-info-target-response'; | ||
|
||
export class SchulconnexPoliciesInfoLicenseResponse { | ||
@IsObject() | ||
@ValidateNested() | ||
@Type(() => SchulconnexPoliciesInfoTargetResponse) | ||
target!: SchulconnexPoliciesInfoTargetResponse; | ||
|
||
@IsArray() | ||
@ValidateNested({ each: true }) | ||
@Type(() => SchulconnexPoliciesInfoPermissionResponse) | ||
permission!: SchulconnexPoliciesInfoPermissionResponse[]; | ||
} |
3 changes: 2 additions & 1 deletion
3
...chulconnex-client/response/policies-info/schulconnex-policies-info-permission-response.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 |
---|---|---|
@@ -1,7 +1,8 @@ | ||
import { IsArray } from 'class-validator'; | ||
import { IsArray, IsString } from 'class-validator'; | ||
import { SchulconnexPoliciesInfoActionType } from './schulconnex-policies-info-action-type'; | ||
|
||
export class SchulconnexPoliciesInfoPermissionResponse { | ||
@IsArray() | ||
@IsString({ each: true }) | ||
action!: SchulconnexPoliciesInfoActionType[]; | ||
} |
25 changes: 14 additions & 11 deletions
25
...src/infra/schulconnex-client/response/policies-info/schulconnex-policies-info-response.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 |
---|---|---|
@@ -1,16 +1,19 @@ | ||
import { Type } from 'class-transformer'; | ||
import { IsArray, IsObject, ValidateNested } from 'class-validator'; | ||
import { SchulconnexPoliciesInfoPermissionResponse } from './schulconnex-policies-info-permission-response'; | ||
import { SchulconnexPoliciesInfoTargetResponse } from './schulconnex-policies-info-target-response'; | ||
import { PolymorphicArrayTransform } from '@shared/controller'; | ||
import { ClassConstructor } from 'class-transformer'; | ||
import { IsArray, ValidateNested } from 'class-validator'; | ||
import { SchulconnexPoliciesInfoErrorResponse } from './schulconnex-policies-info-error-response'; | ||
import { SchulconnexPoliciesInfoLicenseResponse } from './schulconnex-policies-info-license-response'; | ||
|
||
export class SchulconnexPoliciesInfoResponse { | ||
@IsObject() | ||
@ValidateNested() | ||
@Type(() => SchulconnexPoliciesInfoTargetResponse) | ||
target!: SchulconnexPoliciesInfoTargetResponse; | ||
const policiesInfoDiscriminator = ( | ||
obj: unknown | ||
): ClassConstructor<SchulconnexPoliciesInfoLicenseResponse | SchulconnexPoliciesInfoErrorResponse> => | ||
typeof obj === 'object' && obj !== null && 'target' in obj && 'permission' in obj | ||
? SchulconnexPoliciesInfoLicenseResponse | ||
: SchulconnexPoliciesInfoErrorResponse; | ||
|
||
export class SchulconnexPoliciesInfoResponse { | ||
@IsArray() | ||
@ValidateNested({ each: true }) | ||
@Type(() => SchulconnexPoliciesInfoPermissionResponse) | ||
permission!: SchulconnexPoliciesInfoPermissionResponse[]; | ||
@PolymorphicArrayTransform(policiesInfoDiscriminator) | ||
data!: (SchulconnexPoliciesInfoLicenseResponse | SchulconnexPoliciesInfoErrorResponse)[]; | ||
} |
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
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
Oops, something went wrong.