From 212c13da6a3726b586d39af821d96939c23f313a Mon Sep 17 00:00:00 2001 From: Priyank Upadhyay Date: Mon, 3 Apr 2023 11:23:02 +0530 Subject: [PATCH] fix(): Refactoring event recorder (#25) * fix(): Moving event schema to respective components * fix(): Accept events map from components * fix(): Updated Readme and map generator function --------- Signed-off-by: Priyank Upadhyay Signed-off-by: Puran Adhikari Co-authored-by: Puran Adhikari --- Makefile | 4 - README.md | 66 +- config/events/controller.yaml | 1047 --------------------- config/events/example.yaml | 8 + config/events/worker.yaml | 31 - hack/generate/generate.go | 25 +- hack/templates/schema.tmpl | 11 +- pkg/events/events.go | 29 +- pkg/events/events_generated.go | 1598 +------------------------------- pkg/events/events_parser.go | 4 +- pkg/events/events_test.go | 4 +- 11 files changed, 100 insertions(+), 2727 deletions(-) delete mode 100644 config/events/controller.yaml create mode 100644 config/events/example.yaml delete mode 100644 config/events/worker.yaml diff --git a/Makefile b/Makefile index cd02361..6e063a4 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,3 @@ -.PHONY: generate -generate: - go run hack/generate/generate.go - go fmt ./... .PHONY: test test: diff --git a/README.md b/README.md index 5bc948b..df3b965 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,9 @@ kubeslice-monitoring : Repository for kubeslice-monitoring package -## Using event schema +## Event Schema -Event schema files are located in `config/events/controller.yaml` and `config/events/worker.yaml` respectively. It contains the following fields for each event +It contains the following fields for each event * name: Name of the event * reason: Reason for raising the event @@ -13,36 +13,60 @@ Event schema files are located in `config/events/controller.yaml` and `config/ev * reportingController: Name of the component which reported the event * message: Human readable message explaining the event -make sure to run `make generate` after modifying the above files -## Disabling events -TODO: fill this section +## Using events framework in your component -## Generate parsed event schema code +1. Copy the `hack/` directory to your component. -Run this command after making any changes to event schema files +It contains `generate/generate.go` and `templates/schema.tmpl` files. You will require both to create a helper to generate Events Map. +Modify template and output file paths in `generate.go` if needed. -``` -make generate +2. Create a events schema yaml for your component in the following format: + +```yaml +events: + - name: ExampleEvent + reason: ExampleEvent + action: ExampleEvent + type: Warning + reportingController: controller + message: ExampleEvent message. + ``` -## Using events framework in your component +3. Add the following lines to your Makefile. (Make path modifications if required.) + +```Makefile +.PHONY: generate-events +generate-events: + go run hack/generate/generate.go + go fmt ./... +``` +4. Generate Events Map -1. Import events package and schema +Run this command after making any changes to event schema files +```shell +make generate-events ``` +This will generate `events_generated.go` file in the events directory. (Check file output path in `hack/generate/generate.go`) + + +5. Import events package from monitoring framework and the generated Events Map from your component. + +```go import( "github.com/kubeslice/kubeslice-monitoring/pkg/events" - "github.com/kubeslice/kubeslice-monitoring/pkg/schema" + componentEvents "github.com/kubeslice//events" ) ``` -2. Initialize event recorder +6. Initialize event recorder -``` -recorder := events.NewEventRecorder(k8sClient, schema, events.EventRecorderOptions{ +```go +recorder := events.NewEventRecorder(k8sClient, schema, componentEvents.EventsMap, events.EventRecorderOptions{ Version: "1", Cluster: "cluster-1", Component: "controller", @@ -54,9 +78,9 @@ recorder := events.NewEventRecorder(k8sClient, schema, events.EventRecorderOptio Slice and Namespace names are optional if the recorder is not part of a slice specific or namespace specific component. -3. Raise events +7. Raise events -``` +```go err := recorder.RecordEvent(ctx, &events.Event{ Object: obj, RelatedObject: robj, @@ -65,13 +89,17 @@ err := recorder.RecordEvent(ctx, &events.Event{ }) ``` -4. Raise events with slice/namespace name added at the time of raising events +8. Raise events with slice/namespace name added at the time of raising events In some cases, the recorder will be part of a controller which manages multiple namespaces. In that case, events can be raises by providing namespace like below instead of Initializing the recorder with specific namespace name. -``` +```go recorder.WithNamespace(ns).RecordEvent(...) recorder.WithSlice(sliceName).RecordEvent(...) ``` + + +## Disabling events +TODO: fill this section \ No newline at end of file diff --git a/config/events/controller.yaml b/config/events/controller.yaml deleted file mode 100644 index b00d84f..0000000 --- a/config/events/controller.yaml +++ /dev/null @@ -1,1047 +0,0 @@ -events: - - name: LicenseSecretNotFound - reason: LicenseNotFound - action: LicenseValidation - type: Warning - reportingController: controller - message: Secret with license config not found. Please ensure to create license secret if this is airgapped cluster. - - name: MachineFileNotFound - reason: MachineFileNotFound - action: FetchMachineFileFromSecret - type: Warning - reportingController: controller - message: Machine File not present in license secret. Please contact kubeslice support team. - - name: MachineFileInvalid - reason: MachineFileInvalid - action: VerifyMachineFile - type: Warning - reportingController: controller - message: Machine File is invalid in license secret. Please contact kubeslice support team. - - name: LicenseKeyInvalid - reason: LicenseKeyInvalid - action: DecryptMachineFile - type: Warning - reportingController: controller - message: License Key is invalid in license secret. Please contact kubeslice support team. - - name: LicenseExpired - reason: LicenseExpired - action: ValidateLicense - type: Warning - reportingController: controller - message: License Expired, please contact kubeslice support team to get it renewed! - - name: LicenseExpiredGracePeriodOn - reason: LicenseExpiredGracePeriodOn - action: ValidateLicense - type: Warning - reportingController: controller - message: License Expired, grace period is on, please contact kubeslice support team to get it renewed! - - name: MachineFingerPrintErr - reason: MachineFingerPrintErr - action: GetMachineFingerPrint - type: Warning - reportingController: kubeslice-controller - message: Unable to fetch MachineFingerPrint. Please look at the kubeslice-controller logs for more details. - - name: GotMachineFingerPrint - reason: GotMachineFingerPrint - action: GetMachineFingerPrint - type: Normal - reportingController: kubeslice-controller - message: Got MachineFingerPrint successfully - - name: ConfigMapErr - reason: ConfigMapErr - action: GetConfigMap - type: Warning - reportingController: kubeslice-controller - message: Unable to validate license keys from configmap. Please contact kubeslice support team - - name: GotConfigMap - reason: GotConfigMap - action: GetConfigMap - type: Normal - reportingController: kubeslice-controller - message: Got ConfigMap and kubeslice-license public keys successfully. - # license Job Events - - name: LicenseProxyUnreachable - reason: LicenseProxyUnreachable - action: LicenseProxy - type: Warning - reportingController: kubeslice-controller - message: Failed to get response from license proxy for automatic license creation. Please contact Avesha to obtain licernse manually. - - name: LicenseDeployError - reason: LicenseDeployError - action: LicenseDeploy - type: Warning - reportingController: kubeslice-controller - message: Failed to deploy license secret. - - name: LicenseDeploySuccess - reason: LicenseDeploySuccess - action: LicenseDeploy - type: Normal - reportingController: kubeslice-controller - message: Successfully fetched license data & deployed license secret. - - name: ClusterMetadataCollectionFailed - reason: ClusterMetadataCollectionFailed - action: CollectClusterMetadata - type: Warning - reportingController: kubeslice-controller - message: Failed to collect cluster metadata for cluster creation. - - name: ClusterMetadataCollectionSuccess - reason: ClusterMetadataCollectionSuccess - action: CollectClusterMetadata - type: Normal - reportingController: kubeslice-controller - message: Successfully collected cluster metadata for license creation. - - name: LicenseDataFetchError - reason: LicenseDataFetchError - action: LicenseDataFetch - type: Warning - reportingController: kubeslice-controller - message: Failed to fetch license data from license proxy. - - name: LicenseDataFetchSuccess - reason: LicenseDataFetchSuccess - action: LicenseDataFetch - type: Normal - reportingController: kubeslice-controller - message: Successfully fetched license data from license proxy. - - name: LicenseSecretCreationFailed - reason: LicenseSecretCreationFailed - action: LicenseSecretCreation - type: Warning - reportingController: kubeslice-controller - message: Failed to create license secret. - - name: LicenseSecretCreationSuccess - reason: LicenseSecretCreationSuccess - action: LicenseSecretCreation - type: Normal - reportingController: kubeslice-controller - message: Successfully created license secret. - #Controller OSS Events - ## Project Events - - name: ProjectDeleted - reason: ProjectDeleted - action: DeleteProject - type: Warning - reportingController: controller - message: Project got deleted. - - name: ProjectDeletionFailed - reason: ProjectDeletionFailed - action: DeleteProject - type: Warning - reportingController: controller - message: Project deletion failed. - - name: ClusterDeleted - reason: ClusterDeleted - action: DeleteCluster - type: Warning - reportingController: controller - message: Cluster got deleted. - - name: ClusterDeletionFailed - reason: ClusterDeletionFailed - action: DeleteCluster - type: Warning - reportingController: controller - message: Cluster deletion failed. - - name: SliceConfigDeleted - reason: SliceConfigDeleted - action: DeleteSliceConfig - type: Warning - reportingController: controller - message: Slice config got deleted. - - name: SliceConfigDeletionFailed - reason: SliceConfigDeletionFailed - action: DeleteSliceConfig - type: Warning - reportingController: controller - message: Slice config deletion failed. - - name: ServiceExportConfigDeleted - reason: ServiceExportConfigDeleted - action: DeleteServiceExportConfig - type: Warning - reportingController: controller - message: Service export config got deleted. - - name: ServiceExportConfigDeletionFailed - reason: ServiceExportConfigDeletionFailed - action: DeleteServiceExportConfig - type: Warning - reportingController: controller - message: Service export config deletion failed. - - name: SliceQoSConfigDeleted - reason: SliceQoSConfigDeleted - action: DeleteSliceQoSConfig - type: Warning - reportingController: controller - message: Slice QoS config got deleted. - - name: SliceQoSConfigDeletionFailed - reason: SliceQoSConfigDeletionFailed - action: DeleteSliceQoSConfig - type: Warning - reportingController: controller - message: Slice QoS config deletion failed. - - name: SecretDeleted - reason: SecretDeleted - action: DeleteSecret - type: Warning - reportingController: controller - message: Secret got deleted. - - name: SecretDeletionFailed - reason: SecretDeletionFailed - action: DeleteSecret - type: Warning - reportingController: controller - message: Secret deletion failed. - - name: NamespaceCreated - reason: NamespaceCreated - action: CreateNamespace - type: Normal - reportingController: controller - message: Namespace got created. - - name: NamespaceCreationFailed - reason: NamespaceCreationFailed - action: CreateNamespace - type: Warning - reportingController: controller - message: Namespace creation failed. - - name: NamespaceDeleted - reason: NamespaceDeleted - action: DeleteNamespace - type: Warning - reportingController: controller - message: Namespace got deleted. - - name: NamespaceDeletionFailed - reason: NamespaceDeletionFailed - action: DeleteNamespace - type: Warning - reportingController: controller - message: Namespace deletion failed. - - name: WorkerClusterRoleCreated - reason: WorkerClusterRoleCreated - action: CreateWorkerClusterRole - type: Normal - reportingController: controller - message: Worker cluster role got created. - - name: WorkerClusterRoleCreationFailed - reason: WorkerClusterRoleCreationFailed - action: CreateWorkerClusterRole - type: Warning - reportingController: controller - message: Worker cluster role creation failed. - - name: WorkerClusterRoleUpdated - reason: WorkerClusterRoleUpdated - action: UpdateWorkerClusterRole - type: Normal - reportingController: controller - message: Worker cluster role got updated. - - name: WorkerClusterRoleUpdateFailed - reason: WorkerClusterRoleUpdateFailed - action: UpdateWorkerClusterRole - type: Warning - reportingController: controller - message: Worker cluster role update failed. - - name: ReadOnlyRoleCreated - reason: ReadOnlyRoleCreated - action: CreateReadOnlyRole - type: Normal - reportingController: controller - message: Read only role got created. - - name: ReadOnlyRoleCreationFailed - reason: ReadOnlyRoleCreationFailed - action: CreateReadOnlyRole - type: Warning - reportingController: controller - message: Read only role creation failed. - - name: ReadOnlyRoleUpdated - reason: ReadOnlyRoleUpdated - action: UpdateReadOnlyRole - type: Normal - reportingController: controller - message: Read only role got updated. - - name: ReadOnlyRoleUpdateFailed - reason: ReadOnlyRoleUpdateFailed - action: UpdateReadOnlyRole - type: Warning - reportingController: controller - message: Read only role update failed. - - name: ReadWriteRoleCreated - reason: ReadWriteRoleCreated - action: CreateReadWriteRole - type: Normal - reportingController: controller - message: Read write role got created. - - name: ReadWriteRoleCreationFailed - reason: ReadWriteRoleCreationFailed - action: CreateReadWriteRole - type: Warning - reportingController: controller - message: Read write role creation failed. - - name: ReadWriteRoleUpdated - reason: ReadWriteRoleUpdated - action: UpdateReadWriteRole - type: Normal - reportingController: controller - message: Read write role got updated. - - name: ReadWriteRoleUpdateFailed - reason: ReadWriteRoleUpdateFailed - action: UpdateReadWriteRole - type: Warning - reportingController: controller - message: Read write role update failed. - - name: ServiceAccountCreated - reason: ServiceAccountCreated - action: CreateServiceAccount - type: Normal - reportingController: controller - message: Service account got created. - - name: ServiceAccountCreationFailed - reason: ServiceAccountCreationFailed - action: CreateServiceAccount - type: Warning - reportingController: controller - message: Service account creation failed. - - name: ServiceAccountSecretCreated - reason: ServiceAccountSecretCreated - action: CreateServiceAccountSecret - type: Normal - reportingController: controller - message: Service account secret got created. - - name: ServiceAccountSecretCreationFailed - reason: ServiceAccountSecretCreationFailed - action: CreateServiceAccountSecret - type: Warning - reportingController: controller - message: Service account secret creation failed. - - name: DefaultRoleBindingCreated - reason: DefaultRoleBindingCreated - action: CreateDefaultRoleBinding - type: Normal - reportingController: controller - message: Default role binding got created. - - name: DefaultRoleBindingCreationFailed - reason: DefaultRoleBindingCreationFailed - action: CreateDefaultRoleBinding - type: Warning - reportingController: controller - message: Default role binding creation failed. - - name: DefaultRoleBindingUpdated - reason: DefaultRoleBindingUpdated - action: UpdateDefaultRoleBinding - type: Normal - reportingController: controller - message: Default role binding got updated. - - name: DefaultRoleBindingUpdateFailed - reason: DefaultRoleBindingUpdateFailed - action: UpdateDefaultRoleBinding - type: Warning - reportingController: controller - message: Default role binding update failed. - - name: DefaultRoleBindingDeleted - reason: DefaultRoleBindingDeleted - action: DeleteDefaultRoleBinding - type: Warning - reportingController: controller - message: Default role binding got deleted. - - name: DefaultRoleBindingDeletionFailed - reason: DefaultRoleBindingDeletionFailed - action: DeleteDefaultRoleBinding - type: Warning - reportingController: controller - message: Default role binding deletion failed. - - name: InactiveRoleBindingDeleted - reason: InactiveRoleBindingDeleted - action: DeleteInactiveRoleBinding - type: Warning - reportingController: controller - message: Inactive role binding got deleted. - - name: InactiveRoleBindingDeletionFailed - reason: InactiveRoleBindingDeletionFailed - action: DeleteInactiveRoleBinding - type: Warning - reportingController: controller - message: Inactive role binding deletion failed. - - name: InactiveServiceAccountDeleted - reason: InactiveServiceAccountDeleted - action: DeleteInactiveServiceAccount - type: Warning - reportingController: controller - message: Inactive service account got deleted. - - name: InactiveServiceAccountDeletionFailed - reason: InactiveServiceAccountDeletionFailed - action: DeleteInactiveServiceAccount - type: Warning - reportingController: controller - message: Inactive service account deletion failed. - - name: ServiceAccountDeleted - reason: ServiceAccountDeleted - action: DeleteServiceAccount - type: Warning - reportingController: controller - message: Service account got deleted. - - name: ServiceAccountDeletionFailed - reason: ServiceAccountDeletionFailed - action: DeleteServiceAccount - type: Warning - reportingController: controller - message: Service account deletion failed. - ## Worker Service Import - - name: WorkerServiceImportDeletedForcefully - reason: WorkerServiceImportDeletedForcefully - action: DeleteWorkerServiceImport - type: Warning - reportingController: controller - message: Worker service import got deleted forcefully. - - name: WorkerServiceImportRecreationFailed - reason: WorkerServiceImportRecreationFailed - action: CreateWorkerServiceImport - type: Warning - reportingController: controller - message: Worker service import recreation failed after forceful deletion. - - name: WorkerServiceImportRecreated - reason: WorkerServiceImportRecreated - action: CreateWorkerServiceImport - type: Normal - reportingController: controller - message: Worker service import got recreated after forceful deletion. - - name: WorkerServiceImportCreationFailed - reason: WorkerServiceImportCreationFailed - action: CreateWorkerServiceImport - type: Warning - reportingController: controller - message: Worker service import creation failed. - - name: WorkerServiceImportCreated - reason: WorkerServiceImportCreated - action: CreateWorkerServiceImport - type: Normal - reportingController: controller - message: Worker service import got created. - - name: WorkerServiceImportUpdateFailed - reason: WorkerServiceImportUpdateFailed - action: UpdateWorkerServiceImport - type: Warning - reportingController: controller - message: Worker service import update failed. - - name: WorkerServiceImportUpdated - reason: WorkerServiceImportUpdated - action: UpdateWorkerServiceImport - type: Normal - reportingController: controller - message: Worker service import got updated. - - name: WorkerServiceImportDeleted - reason: WorkerServiceImportDeleted - action: DeleteWorkerServiceImport - type: Warning - reportingController: controller - message: Worker service import got deleted. - - name: WorkerServiceImportDeletionFailed - reason: WorkerServiceImportDeletionFailed - action: DeleteWorkerServiceImport - type: Warning - reportingController: controller - message: Worker service import deletion failed. - ## Worker Slice Config - - name: WorkerSliceConfigDeletedForcefully - reason: WorkerSliceConfigDeletedForcefully - action: DeleteWorkerSliceConfig - type: Warning - reportingController: controller - message: Worker slice config got deleted forcefully. - - name: WorkerSliceConfigRecreationFailed - reason: WorkerSliceConfigRecreationFailed - action: CreateWorkerSliceConfig - type: Warning - reportingController: controller - message: Worker slice config recreation failed after forceful deletion. - - name: WorkerSliceConfigRecreated - reason: WorkerSliceConfigRecreated - action: CreateWorkerSliceConfig - type: Normal - reportingController: controller - message: Worker slice config got recreated after forceful deletion. - - name: WorkerSliceConfigCreationFailed - reason: WorkerSliceConfigCreationFailed - action: CreateWorkerSliceConfig - type: Warning - reportingController: controller - message: Worker slice config creation failed. - - name: WorkerSliceConfigCreated - reason: WorkerSliceConfigCreated - action: CreateWorkerSliceConfig - type: Normal - reportingController: controller - message: Worker slice config got created. - - name: WorkerSliceConfigUpdateFailed - reason: WorkerSliceConfigUpdateFailed - action: UpdateWorkerSliceConfig - type: Warning - reportingController: controller - message: Worker slice config update failed. - - name: WorkerSliceConfigUpdated - reason: WorkerSliceConfigUpdated - action: UpdateWorkerSliceConfig - type: Normal - reportingController: controller - message: Worker slice config got updated. - - name: WorkerSliceConfigDeleted - reason: WorkerSliceConfigDeleted - action: DeleteWorkerSliceConfig - type: Warning - reportingController: controller - message: Worker slice config got deleted. - - name: WorkerSliceConfigDeletionFailed - reason: WorkerSliceConfigDeletionFailed - action: DeleteWorkerSliceConfig - type: Warning - reportingController: controller - message: Worker slice config deletion failed. - ## Worker Slice Gateway - - name: WorkerSliceGatewayDeletedForcefully - reason: WorkerSliceGatewayDeletedForcefully - action: DeleteWorkerSliceGateway - type: Warning - reportingController: controller - message: Worker slice gateway got deleted forcefully. - - name: WorkerSliceGatewayRecreationFailed - reason: WorkerSliceGatewayRecreationFailed - action: CreateWorkerSliceGateway - type: Warning - reportingController: controller - message: Worker slice gateway recreation failed after forceful deletion. - - name: WorkerSliceGatewayRecreated - reason: WorkerSliceGatewayRecreated - action: CreateWorkerSliceGateway - type: Normal - reportingController: controller - message: Worker slice gateway got recreated after forceful deletion. - - name: WorkerSliceGatewayDeletionFailed - reason: WorkerSliceGatewayDeletionFailed - action: DeleteWorkerSliceGateway - type: Warning - reportingController: controller - message: Worker slice gateway deletion failed. - - name: WorkerSliceGatewayDeleted - reason: WorkerSliceGatewayDeleted - action: DeleteWorkerSliceGateway - type: Warning - reportingController: controller - message: Worker slice gateway got deleted. - - name: WorkerSliceGatewayCreationFailed - reason: WorkerSliceGatewayCreationFailed - action: CreateWorkerSliceGateway - type: Warning - reportingController: controller - message: Worker slice gateway creation failed. - - name: WorkerSliceGatewayCreated - reason: WorkerSliceGatewayCreated - action: CreateWorkerSliceGateway - type: Normal - reportingController: controller - message: Worker slice gateway got created. - - name: SliceGatewayJobCreationFailed - reason: SliceGatewayJobCreationFailed - action: CreateSliceGatewayJob - type: Warning - reportingController: controller - message: Slice gateway job creation failed. - - name: SliceGatewayJobCreated - reason: SliceGatewayJobCreated - action: CreateSliceGatewayJob - type: Normal - reportingController: controller - message: Slice gateway job got created. - #Controller Enterprise Events - ## Slice Role Template - - name: DefaultDeploymentSliceRoleTemplateCreationFailed - reason: DefaultDeploymentSliceRoleTemplateCreationFailed - action: CreateSliceRoleTemplate - type: Warning - reportingController: controller - message: Default deployment slice role template creation failed. - - name: DefaultDeploymentSliceRoleTemplateCreated - reason: DefaultDeploymentSliceRoleTemplateCreated - action: CreateSliceRoleTemplate - type: Normal - reportingController: controller - message: Default deployment slice role template got created. - - name: DefaultReaderSliceRoleTemplateCreationFailed - reason: DefaultReaderSliceRoleTemplateCreationFailed - action: CreateSliceRoleTemplate - type: Warning - reportingController: controller - message: Default reader slice role template creation failed. - - name: DefaultReaderSliceRoleTemplateCreated - reason: DefaultReaderSliceRoleTemplateCreated - action: CreateSliceRoleTemplate - type: Normal - reportingController: controller - message: Default reader slice role template got created. - - name: SliceRoleTemplateDeletionFailed - reason: SliceRoleTemplateDeletionFailed - action: DeleteSliceRoleTemplate - type: Warning - reportingController: controller - message: Slice role template deletion failed. - - name: SliceRoleTemplateDeleted - reason: SliceRoleTemplateDeleted - action: DeleteSliceRoleTemplate - type: Normal - reportingController: controller - message: Slice role template got deleted. - ##Slice Resource Quota Config - - name: SliceResourceQuotaCreationFailed - reason: SliceResourceQuotaCreationFailed - action: CreateSliceResourceQuota - type: Warning - reportingController: controller - message: Slice resource quota creation failed while creating slice config. - - name: SliceResourceQuotaCreatedOnSliceConfigCreation - reason: SliceResourceQuotaCreatedOnSliceConfigCreation - action: CreateSliceResourceQuota - type: Normal - reportingController: controller - message: Slice resource quota got created while creating slice config. - - name: SliceResourceQuotaDeletionFailed - reason: SliceResourceQuotaDeletionFailed - action: DeleteSliceResourceQuota - type: Warning - reportingController: controller - message: Slice resource quota deletion failed. - - name: SliceResourceQuotaDeleted - reason: SliceResourceQuotaDeleted - action: DeleteSliceResourceQuota - type: Warning - reportingController: controller - message: Slice resource quota got deleted. - - name: SliceResourceQuotaRecreationFailed - reason: SliceResourceQuotaRecreationFailed - action: CreateSliceResourceQuota - type: Warning - reportingController: controller - message: Slice resource quota recreation failed after forceful deletion. - - name: SliceResourceQuotaRecreated - reason: SliceResourceQuotaRecreated - action: CreateSliceResourceQuota - type: Normal - reportingController: controller - message: Slice resource quota got recreated after forceful deletion. - - name: SetSliceConfigAsOwnerOfSliceResourceQuotaFailed - reason: SetSliceConfigAsOwnerOfSliceResourceQuotaFailed - action: SetSliceConfigAsOwnerOfSliceResourceQuota - type: Warning - reportingController: controller - message: Failed to set slice config as owner of slice resource quota config. - - name: SetSliceConfigAsOwnerOfSliceResourceQuotaSucceeded - reason: SetSliceConfigAsOwnerOfSliceResourceQuotaSucceeded - action: SetSliceConfigAsOwnerOfSliceResourceQuota - type: Normal - reportingController: controller - message: Successfully set slice config as owner of slice resource quota config. - - name: SliceResourceQuotaCreated - reason: SliceResourceQuotaCreated - action: CreateSliceResourceQuota - type: Normal - reportingController: controller - message: Slice resource quota config got created successfully. - - name: SliceResourceQuotaUpdated - reason: SliceResourceQuotaUpdated - action: UpdateSliceResourceQuota - type: Normal - reportingController: controller - message: Slice resource quota config got updated successfully. - - name: AllRQSpecificationViolationMetricsResetSuccess - reason: AllRQSpecificationViolationMetricsResetSuccess - action: ResetResourceQuotaMetrics - type: Normal - reportingController: controller - message: All resource quota specifications and violations metrics got reset successfully. - - name: SliceRQSpecificationViolationMetricsResetSuccess - reason: SliceRQSpecificationViolationMetricsResetSuccess - action: ResetResourceQuotaMetrics - type: Normal - reportingController: controller - message: All slice level resource quota specifications and violations metrics got reset successfully. - - name: ClusterRQSpecificationViolationMetricsResetSuccess - reason: ClusterRQSpecificationViolationMetricsResetSuccess - action: ResetResourceQuotaMetrics - type: Normal - reportingController: controller - message: All cluster level resource quota specifications and violations metrics got reset successfully. - - name: OutdatedNamespaceRQSpecificationViolationMetricsResetSuccess - reason: OutdatedNamespaceRQSpecificationViolationMetricsResetSuccess - action: ResetResourceQuotaMetrics - type: Normal - reportingController: controller - message: All outdated namespace level resource quota specifications and violations metrics got reset successfully. - - name: OutdatedClusterRQSpecificationViolationMetricsResetSuccess - reason: OutdatedClusterRQSpecificationViolationMetricsResetSuccess - action: ResetResourceQuotaMetrics - type: Normal - reportingController: controller - message: All outdated cluster level resource quota specifications and violations metrics got reset successfully. - ##Slice Node Affinity - - name: SliceNodeAffinityDeletionFailed - reason: SliceNodeAffinityDeletionFailed - action: DeleteSliceNodeAffinity - type: Warning - reportingController: controller - message: Slice node affinity deletion failed. - - name: SliceNodeAffinityDeleted - reason: SliceNodeAffinityDeleted - action: DeleteSliceNodeAffinity - type: Warning - reportingController: controller - message: Slice node affinity got deleted. - - name: SetSliceConfigAsOwnerOfSliceNodeAffinityFailed - reason: SetSliceConfigAsOwnerOfSliceNodeAffinityFailed - action: SetSliceConfigAsOwnerOfSliceNodeAffinity - type: Warning - reportingController: controller - message: Failed to set slice config as owner of slice node affinity. - - name: SetSliceConfigAsOwnerOfSliceNodeAffinitySucceeded - reason: SetSliceConfigAsOwnerOfSliceNodeAffinitySucceeded - action: SetSliceConfigAsOwnerOfSliceNodeAffinity - type: Normal - reportingController: controller - message: Successfully set slice config as owner of slice node affinity. - ##Slice Role Binding - - name: SliceRoleBindingDeletingFailed - reason: SliceRoleBindingDeletingFailed - action: DeleteSliceRoleBinding - type: Warning - reportingController: controller - message: Slice role binding deletion failed. - - name: SliceRoleBindingDeleted - reason: SliceRoleBindingDeleted - action: DeleteSliceRoleBinding - type: Normal - reportingController: controller - message: Slice role binding got deleted. - - name: SetSliceConfigAsOwnerOfSliceRoleBindingFailed - reason: SetSliceConfigAsOwnerOfSliceRoleBindingFailed - action: SetSliceConfigAsOwnerOfSliceRoleBinding - type: Warning - reportingController: controller - message: Failed to set slice config as owner of slice role binding. - - name: SetSliceConfigAsOwnerOfSliceRoleBindingSucceeded - reason: SetSliceConfigAsOwnerOfSliceRoleBindingSucceeded - action: SetSliceConfigAsOwnerOfSliceRoleBinding - type: Normal - reportingController: controller - message: Successfully set slice config as owner of slice role binding. - ##Worker Slice Role Binding - - name: WorkerSliceRoleBindingReconciliationSuccess - reason: WorkerSliceRoleBindingReconciliationSuccess - action: ReconcileWorkerSliceRoleBinding - type: Normal - reportingController: controller - message: Reconciliation of worker slice role binding is successful due to the change in slice role template. - - name: WorkerSliceRoleBindingDeletedForcefully - reason: WorkerSliceRoleBindingDeletedForcefully - action: DeleteWorkerSliceRoleBinding - type: Warning - reportingController: controller - message: Worker slice role binding got deleted forcefully. - - name: WorkerSliceRoleBindingRecreationFailed - reason: WorkerSliceRoleBindingRecreationFailed - action: CreateWorkerSliceRoleBinding - type: Warning - reportingController: controller - message: Worker slice role binding recreation failed after forceful deletion. - - name: WorkerSliceRoleBindingRecreated - reason: WorkerSliceRoleBindingRecreated - action: CreateWorkerSliceRoleBinding - type: Normal - reportingController: controller - message: Worker slice role binding got recreated after forceful deletion. - - name: WorkerSliceRoleBindingCreationFailed - reason: WorkerSliceRoleBindingCreationFailed - action: CreateWorkerSliceRoleBinding - type: Warning - reportingController: controller - message: Worker slice role binding creation failed. - - name: WorkerSliceRoleBindingCreated - reason: WorkerSliceRoleBindingCreated - action: CreateWorkerSliceRoleBinding - type: Normal - reportingController: controller - message: Worker slice role binding got created successfully. - - name: WorkerSliceRoleBindingUpdateFailed - reason: WorkerSliceRoleBindingUpdateFailed - action: UpdateWorkerSliceRoleBinding - type: Warning - reportingController: controller - message: Worker slice role binding update failed. - - name: WorkerSliceRoleBindingUpdated - reason: WorkerSliceRoleBindingUpdated - action: UpdateWorkerSliceRoleBinding - type: Normal - reportingController: controller - message: Worker slice role binding got updated successfully. - - name: WorkerSliceRoleBindingDeletionFailed - reason: WorkerSliceRoleBindingDeletionFailed - action: DeleteWorkerSliceRoleBinding - type: Warning - reportingController: controller - message: Worker slice role binding deletion failed. - - name: WorkerSliceRoleBindingDeleted - reason: WorkerSliceRoleBindingDeleted - action: DeleteWorkerSliceRoleBinding - type: Normal - reportingController: controller - message: Worker slice role binding got deleted successfully. - ##Worker Slice Node Affinity - - name: WorkerSliceNodeAffinityDeletedForcefully - reason: WorkerSliceNodeAffinityDeletedForcefully - action: DeleteWorkerSliceNodeAffinity - type: Warning - reportingController: controller - message: Worker slice node affinity got deleted forcefully. - - name: WorkerSliceNodeAffinityRecreationFailed - reason: WorkerSliceNodeAffinityRecreationFailed - action: CreateWorkerSliceNodeAffinity - type: Warning - reportingController: controller - message: Worker slice node affinity recreation failed after forceful deletion. - - name: WorkerSliceNodeAffinityRecreated - reason: WorkerSliceNodeAffinityRecreated - action: CreateWorkerSliceNodeAffinity - type: Normal - reportingController: controller - message: Worker slice node affinity got recreated after forceful deletion. - - name: NodeAffinityRilesExpansionFailed - reason: NodeAffinityRilesExpansionFailed - action: ExpandNodeAffinityRules - type: Warning - reportingController: controller - message: Node affinity rules expansion failed. - - name: SliceNodeAffinityConfigDeepCopyFailed - reason: SliceNodeAffinityConfigDeepCopyFailed - action: DeepCopySliceNodeAffinityConfig - type: Warning - reportingController: controller - message: Deep copy of slice node affinity configuration got failed. - - name: WorkerSliceNodeAffinityCreationFailed - reason: WorkerSliceNodeAffinityCreationFailed - action: CreateWorkerSliceNodeAffinity - type: Warning - reportingController: controller - message: Worker slice node affinity creation failed. - - name: WorkerSliceNodeAffinityCreated - reason: WorkerSliceNodeAffinityCreated - action: CreateWorkerSliceNodeAffinity - type: Normal - reportingController: controller - message: Worker slice node affinity got created successfully. - - name: WorkerSliceNodeAffinityUpdateFailed - reason: WorkerSliceNodeAffinityUpdateFailed - action: UpdateWorkerSliceNodeAffinity - type: Warning - reportingController: controller - message: Worker slice node affinity update failed. - - name: WorkerSliceNodeAffinityUpdated - reason: WorkerSliceNodeAffinityUpdated - action: UpdateWorkerSliceNodeAffinity - type: Normal - reportingController: controller - message: Worker slice node affinity got updated successfully. - - name: WorkerSliceNodeAffinityDeletionFailed - reason: WorkerSliceNodeAffinityDeletionFailed - action: DeleteWorkerSliceNodeAffinity - type: Warning - reportingController: controller - message: Worker slice node affinity deletion failed. - - name: WorkerSliceNodeAffinityDeleted - reason: WorkerSliceNodeAffinityDeleted - action: DeleteWorkerSliceNodeAffinity - type: Normal - reportingController: controller - message: Worker slice node affinity got deleted successfully. - ##Worker Slice Resource Quota - - name: WorkerSliceResourceQuotaDeletedForcefully - reason: WorkerSliceResourceQuotaDeletedForcefully - action: DeleteWorkerSliceResourceQuota - type: Warning - reportingController: controller - message: Worker slice resource quota got deleted forcefully. - - name: WorkerSliceResourceQuotaRecreationFailed - reason: WorkerSliceResourceQuotaRecreationFailed - action: CreateWorkerSliceResourceQuota - type: Warning - reportingController: controller - message: Worker slice resource quota recreation failed after forceful deletion. - - name: WorkerSliceResourceQuotaRecreated - reason: WorkerSliceResourceQuotaRecreated - action: CreateWorkerSliceResourceQuota - type: Normal - reportingController: controller - message: Worker slice resource quota got recreated after forceful deletion. - - name: OffBoardedNamespaceUtilizationMetricsReset - reason: OffBoardedNamespaceUtilizationMetricsReset - action: ResetOffBoardedNamespaceUtilizationMetrics - type: Normal - reportingController: controller - message: Utilization metrics of off-boarded namespaces got reset successfully. - - name: ResourceQuotaMetricsPopulated - reason: ResourceQuotaMetricsPopulated - action: PopulateResourceQuotaMetrics - type: Normal - reportingController: controller - message: Resource quota metrics got populated successfully. - - name: ClusterCPULimitViolated - reason: ClusterCPULimitViolated - action: ViolateClusterCPULimit - type: Warning - reportingController: controller - message: CPU limit is violated at cluster level. - - name: ClusterMemoryLimitViolated - reason: ClusterMemoryLimitViolated - action: ViolateClusterMemoryLimit - type: Warning - reportingController: controller - message: Memory limit is violated at cluster level. - - name: ClusterPodCountViolated - reason: ClusterPodCountViolated - action: ViolateClusterPodCount - type: Warning - reportingController: controller - message: Pod count is violated at cluster level. - - name: ClusterEphemeralStorageLimitViolated - reason: ClusterEphemeralStorageLimitViolated - action: ViolateClusterEphemeralStorageLimit - type: Warning - reportingController: controller - message: Ephemeral storage limit is violated at cluster level. - - name: ClusterCPURequestViolated - reason: ClusterCPURequestViolated - action: ViolateClusterCPURequest - type: Warning - reportingController: controller - message: CPU request is violated at cluster level. - - name: ClusterMemoryRequestViolated - reason: ClusterMemoryRequestViolated - action: ViolateClusterMemoryRequest - type: Warning - reportingController: controller - message: Memory request is violated at cluster level. - - name: ClusterEphemeralStorageRequestViolated - reason: ClusterEphemeralStorageRequestViolated - action: ViolateClusterEphemeralStorageRequest - type: Warning - reportingController: controller - message: Ephemeral storage request is violated at cluster level. - - name: NamespaceCPULimitViolated - reason: NamespaceCPULimitViolated - action: ViolateNamespaceCPULimit - type: Warning - reportingController: controller - message: CPU limit is violated at namespace level. - - name: NamespaceMemoryLimitViolated - reason: NamespaceMemoryLimitViolated - action: ViolateNamespaceMemoryLimit - type: Warning - reportingController: controller - message: Memory limit is violated at namespace level. - - name: NamespacePodCountViolated - reason: NamespacePodCountViolated - action: ViolateNamespacePodCount - type: Warning - reportingController: controller - message: Pod count is violated at namespace level. - - name: NamespaceEphemeralStorageLimitViolated - reason: NamespaceEphemeralStorageLimitViolated - action: ViolateNamespaceEphemeralStorageLimit - type: Warning - reportingController: controller - message: Ephemeral storage limit is violated at namespace level. - - name: NamespaceCPURequestViolated - reason: NamespaceCPURequestViolated - action: ViolateNamespaceCPURequest - type: Warning - reportingController: controller - message: CPU request is violated at namespace level. - - name: NamespaceMemoryRequestViolated - reason: NamespaceMemoryRequestViolated - action: ViolateNamespaceMemoryRequest - type: Warning - reportingController: controller - message: Memory request is violated at namespace level. - - name: NamespaceEphemeralStorageRequestViolated - reason: NamespaceEphemeralStorageRequestViolated - action: ViolateNamespaceEphemeralStorageRequest - type: Warning - reportingController: controller - message: Ephemeral storage request is violated at namespace level. - - name: SliceCPULimitViolated - reason: SliceCPULimitViolated - action: ViolateSliceCPULimit - type: Warning - reportingController: controller - message: CPU limit is violated at slice level. - - name: SliceMemoryLimitViolated - reason: SliceMemoryLimitViolated - action: ViolateSliceMemoryLimit - type: Warning - reportingController: controller - message: Memory limit is violated at slice level. - - name: SlicePodCountViolated - reason: SlicePodCountViolated - action: ViolateSlicePodCount - type: Warning - reportingController: controller - message: Pod count is violated at slice level. - - name: SliceEphemeralStorageLimitViolated - reason: SliceEphemeralStorageLimitViolated - action: ViolateSliceEphemeralStorageLimit - type: Warning - reportingController: controller - message: Ephemeral storage limit is violated at slice level. - - name: SliceCPURequestViolated - reason: SliceCPURequestViolated - action: ViolateSliceCPURequest - type: Warning - reportingController: controller - message: CPU request is violated at slice level. - - name: SliceMemoryRequestViolated - reason: SliceMemoryRequestViolated - action: ViolateSliceMemoryRequest - type: Warning - reportingController: controller - message: Memory request is violated at slice level. - - name: SliceEphemeralStorageRequestViolated - reason: SliceEphemeralStorageRequestViolated - action: ViolateSliceEphemeralStorageRequest - type: Warning - reportingController: controller - message: Ephemeral storage request is violated at slice level. - - name: WorkerSliceResourceQuotaCreationFailed - reason: WorkerSliceResourceQuotaCreationFailed - action: CreateWorkerSliceResourceQuota - type: Warning - reportingController: controller - message: Worker slice resource quota creation failed. - - name: WorkerSliceResourceQuotaCreated - reason: WorkerSliceResourceQuotaCreated - action: CreateWorkerSliceResourceQuota - type: Normal - reportingController: controller - message: Worker slice resource quota got created successfully. - - name: WorkerSliceResourceQuotaUpdateFailed - reason: WorkerSliceResourceQuotaUpdateFailed - action: UpdateWorkerSliceResourceQuota - type: Warning - reportingController: controller - message: Worker slice resource quota update failed. - - name: WorkerSliceResourceQuotaUpdated - reason: WorkerSliceResourceQuotaUpdated - action: UpdateWorkerSliceResourceQuota - type: Normal - reportingController: controller - message: Worker slice resource quota got updated successfully. - - name: WorkerSliceResourceQuotaDeletionFailed - reason: WorkerSliceResourceQuotaDeletionFailed - action: DeleteWorkerSliceResourceQuota - type: Warning - reportingController: controller - message: Worker slice resource quota deletion failed. - - name: WorkerSliceResourceQuotaDeleted - reason: WorkerSliceResourceQuotaDeleted - action: DeleteWorkerSliceResourceQuota - type: Normal - reportingController: controller - message: Worker slice resource quota got deleted successfully. \ No newline at end of file diff --git a/config/events/example.yaml b/config/events/example.yaml new file mode 100644 index 0000000..5855a71 --- /dev/null +++ b/config/events/example.yaml @@ -0,0 +1,8 @@ +events: + - name: ExampleEvent + reason: ExampleEvent + action: ExampleEvent + type: Warning + reportingController: controller + message: ExampleEvent message. + \ No newline at end of file diff --git a/config/events/worker.yaml b/config/events/worker.yaml deleted file mode 100644 index c0dcdc2..0000000 --- a/config/events/worker.yaml +++ /dev/null @@ -1,31 +0,0 @@ -events: - - name: NetPolViolation - reason: PolicyViolation - action: PolicyMonitoring - type: Warning - reportingController: worker - message: Network policy violation - please ask admin to check the network policy configuration on the worker cluster. - - name: ClusterUnhealthy - reason: ComponentStatusChange - action: CheckComponents - type: Warning - reportingController: worker - message: Cluster is unhealthy - Please check if all worker components are running as expected - - name: ClusterHealthy - reason: ComponentStatusChange - action: None - type: Normal - reportingController: worker - message: Cluster is healthy - Cluster is back to healthy state - - name: ClusterNodeIpUpdated - reason: ClusterNodeIpUpdated - action: None - type: Normal - reportingController: worker - message: Successfully updated cluster as change detected in cluster nodes - - name: ClusterNodeIpUpdateFail - reason: ClusterNodeIpUpdateFail - action: None - type: Warning - reportingController: worker - message: Failed to update node ip in cluster CR \ No newline at end of file diff --git a/hack/generate/generate.go b/hack/generate/generate.go index c7ae536..eb5d832 100644 --- a/hack/generate/generate.go +++ b/hack/generate/generate.go @@ -3,33 +3,30 @@ package main import ( "fmt" "os" - "path" "text/template" "github.com/kubeslice/kubeslice-monitoring/pkg/events" "gopkg.in/yaml.v2" ) +var ( + templateFilePath = "hack/templates/schema.tmpl" + outputFilePath = "events/events_generated.go" +) + func main() { fmt.Println("generating event schema code from schema file") + if len(os.Args) < 2 { + handleError(fmt.Errorf("must pass schema file path")) + } - file1 := "controller.yaml" - file2 := "worker.yaml" - pwd, err := os.Getwd() + events, err := parseEvent(os.Args[1]) handleError(err) - controllerFilePath := path.Join(pwd, "config/events", file1) - workerFilePath := path.Join(pwd, "config/events", file2) - controllerEvents, err := parseEvent(controllerFilePath) - handleError(err) - workerEvents, err := parseEvent(workerFilePath) - handleError(err) - - events := append(controllerEvents, workerEvents...) - t, err := template.ParseFiles("hack/templates/schema.tmpl") + t, err := template.ParseFiles(templateFilePath) handleError(err) - f, err := os.Create("pkg/events/events_generated.go") + f, err := os.Create(outputFilePath) handleError(err) t.Execute(f, events) } diff --git a/hack/templates/schema.tmpl b/hack/templates/schema.tmpl index 1a016cb..b1c7ab7 100644 --- a/hack/templates/schema.tmpl +++ b/hack/templates/schema.tmpl @@ -19,12 +19,15 @@ package events * limitations under the License. */ -var eventsMap = map[EventName]*EventSchema{ +import "github.com/kubeslice/kubeslice-monitoring/pkg/events" + + +var EventsMap = map[events.EventName]*events.EventSchema{ {{ range . }}"{{.Name}}": { Name: "{{.Name}}", Reason: "{{.Reason}}", Action: "{{.Action}}", - Type: EventType{{.Type}}, + Type: events.EventType{{.Type}}, ReportingController: "{{.ReportingController}}", Message: "{{.Message}}", }, @@ -32,6 +35,6 @@ var eventsMap = map[EventName]*EventSchema{ } var ( -{{ range . }} Event{{.Name}} EventName = "{{.Name}}" +{{ range . }} Event{{.Name}} events.EventName = "{{.Name}}" {{ end }} -) +) \ No newline at end of file diff --git a/pkg/events/events.go b/pkg/events/events.go index 1fdafd6..a41189f 100644 --- a/pkg/events/events.go +++ b/pkg/events/events.go @@ -44,13 +44,14 @@ type EventRecorder interface { WithProject(string) EventRecorder } -func NewEventRecorder(c client.Writer, s *runtime.Scheme, o EventRecorderOptions) EventRecorder { +func NewEventRecorder(c client.Writer, s *runtime.Scheme, em map[EventName]*EventSchema, o EventRecorderOptions) EventRecorder { log := logger.NewLogger().With("name", o.Component) return &eventRecorder{ - Client: c, - Scheme: s, - Options: o, - Logger: log, + Client: c, + Scheme: s, + EventsMap: em, + Options: o, + Logger: log, } } @@ -81,17 +82,19 @@ type Event struct { } type eventRecorder struct { - Client client.Writer - Logger *zap.SugaredLogger - Scheme *runtime.Scheme - Options EventRecorderOptions + Client client.Writer + Logger *zap.SugaredLogger + Scheme *runtime.Scheme + EventsMap map[EventName]*EventSchema + Options EventRecorderOptions } func (er *eventRecorder) Copy() *eventRecorder { return &eventRecorder{ - Client: er.Client, - Logger: er.Logger, - Scheme: er.Scheme, + Client: er.Client, + Logger: er.Logger, + Scheme: er.Scheme, + EventsMap: er.EventsMap, Options: EventRecorderOptions{ Version: er.Options.Version, Cluster: er.Options.Cluster, @@ -144,7 +147,7 @@ func (er *eventRecorder) RecordEvent(ctx context.Context, e *Event) error { return nil } - event, err := GetEvent(e.Name) + event, err := GetEvent(e.Name, er.EventsMap) if err != nil { er.Logger.With("error", err).Error("Unable to get event") return err diff --git a/pkg/events/events_generated.go b/pkg/events/events_generated.go index e8a050d..3bbb069 100644 --- a/pkg/events/events_generated.go +++ b/pkg/events/events_generated.go @@ -19,1601 +19,17 @@ package events * limitations under the License. */ -var eventsMap = map[EventName]*EventSchema{ - "LicenseSecretNotFound": { - Name: "LicenseSecretNotFound", - Reason: "LicenseNotFound", - Action: "LicenseValidation", +var EventsMap = map[EventName]*EventSchema{ + "ExampleEvent": { + Name: "ExampleEvent", + Reason: "ExampleEvent", + Action: "ExampleEvent", Type: EventTypeWarning, ReportingController: "controller", - Message: "Secret with license config not found. Please ensure to create license secret if this is airgapped cluster.", - }, - "MachineFileNotFound": { - Name: "MachineFileNotFound", - Reason: "MachineFileNotFound", - Action: "FetchMachineFileFromSecret", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Machine File not present in license secret. Please contact kubeslice support team.", - }, - "MachineFileInvalid": { - Name: "MachineFileInvalid", - Reason: "MachineFileInvalid", - Action: "VerifyMachineFile", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Machine File is invalid in license secret. Please contact kubeslice support team.", - }, - "LicenseKeyInvalid": { - Name: "LicenseKeyInvalid", - Reason: "LicenseKeyInvalid", - Action: "DecryptMachineFile", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "License Key is invalid in license secret. Please contact kubeslice support team.", - }, - "LicenseExpired": { - Name: "LicenseExpired", - Reason: "LicenseExpired", - Action: "ValidateLicense", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "License Expired, please contact kubeslice support team to get it renewed!", - }, - "LicenseExpiredGracePeriodOn": { - Name: "LicenseExpiredGracePeriodOn", - Reason: "LicenseExpiredGracePeriodOn", - Action: "ValidateLicense", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "License Expired, grace period is on, please contact kubeslice support team to get it renewed!", - }, - "MachineFingerPrintErr": { - Name: "MachineFingerPrintErr", - Reason: "MachineFingerPrintErr", - Action: "GetMachineFingerPrint", - Type: EventTypeWarning, - ReportingController: "kubeslice-controller", - Message: "Unable to fetch MachineFingerPrint. Please look at the kubeslice-controller logs for more details.", - }, - "GotMachineFingerPrint": { - Name: "GotMachineFingerPrint", - Reason: "GotMachineFingerPrint", - Action: "GetMachineFingerPrint", - Type: EventTypeNormal, - ReportingController: "kubeslice-controller", - Message: "Got MachineFingerPrint successfully", - }, - "ConfigMapErr": { - Name: "ConfigMapErr", - Reason: "ConfigMapErr", - Action: "GetConfigMap", - Type: EventTypeWarning, - ReportingController: "kubeslice-controller", - Message: "Unable to validate license keys from configmap. Please contact kubeslice support team", - }, - "GotConfigMap": { - Name: "GotConfigMap", - Reason: "GotConfigMap", - Action: "GetConfigMap", - Type: EventTypeNormal, - ReportingController: "kubeslice-controller", - Message: "Got ConfigMap and kubeslice-license public keys successfully.", - }, - "LicenseProxyUnreachable": { - Name: "LicenseProxyUnreachable", - Reason: "LicenseProxyUnreachable", - Action: "LicenseProxy", - Type: EventTypeWarning, - ReportingController: "kubeslice-controller", - Message: "Failed to get response from license proxy for automatic license creation. Please contact Avesha to obtain licernse manually.", - }, - "LicenseDeployError": { - Name: "LicenseDeployError", - Reason: "LicenseDeployError", - Action: "LicenseDeploy", - Type: EventTypeWarning, - ReportingController: "kubeslice-controller", - Message: "Failed to deploy license secret.", - }, - "LicenseDeploySuccess": { - Name: "LicenseDeploySuccess", - Reason: "LicenseDeploySuccess", - Action: "LicenseDeploy", - Type: EventTypeNormal, - ReportingController: "kubeslice-controller", - Message: "Successfully fetched license data & deployed license secret.", - }, - "ClusterMetadataCollectionFailed": { - Name: "ClusterMetadataCollectionFailed", - Reason: "ClusterMetadataCollectionFailed", - Action: "CollectClusterMetadata", - Type: EventTypeWarning, - ReportingController: "kubeslice-controller", - Message: "Failed to collect cluster metadata for cluster creation.", - }, - "ClusterMetadataCollectionSuccess": { - Name: "ClusterMetadataCollectionSuccess", - Reason: "ClusterMetadataCollectionSuccess", - Action: "CollectClusterMetadata", - Type: EventTypeNormal, - ReportingController: "kubeslice-controller", - Message: "Successfully collected cluster metadata for license creation.", - }, - "LicenseDataFetchError": { - Name: "LicenseDataFetchError", - Reason: "LicenseDataFetchError", - Action: "LicenseDataFetch", - Type: EventTypeWarning, - ReportingController: "kubeslice-controller", - Message: "Failed to fetch license data from license proxy.", - }, - "LicenseDataFetchSuccess": { - Name: "LicenseDataFetchSuccess", - Reason: "LicenseDataFetchSuccess", - Action: "LicenseDataFetch", - Type: EventTypeNormal, - ReportingController: "kubeslice-controller", - Message: "Successfully fetched license data from license proxy.", - }, - "LicenseSecretCreationFailed": { - Name: "LicenseSecretCreationFailed", - Reason: "LicenseSecretCreationFailed", - Action: "LicenseSecretCreation", - Type: EventTypeWarning, - ReportingController: "kubeslice-controller", - Message: "Failed to create license secret.", - }, - "LicenseSecretCreationSuccess": { - Name: "LicenseSecretCreationSuccess", - Reason: "LicenseSecretCreationSuccess", - Action: "LicenseSecretCreation", - Type: EventTypeNormal, - ReportingController: "kubeslice-controller", - Message: "Successfully created license secret.", - }, - "ProjectDeleted": { - Name: "ProjectDeleted", - Reason: "ProjectDeleted", - Action: "DeleteProject", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Project got deleted.", - }, - "ProjectDeletionFailed": { - Name: "ProjectDeletionFailed", - Reason: "ProjectDeletionFailed", - Action: "DeleteProject", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Project deletion failed.", - }, - "ClusterDeleted": { - Name: "ClusterDeleted", - Reason: "ClusterDeleted", - Action: "DeleteCluster", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Cluster got deleted.", - }, - "ClusterDeletionFailed": { - Name: "ClusterDeletionFailed", - Reason: "ClusterDeletionFailed", - Action: "DeleteCluster", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Cluster deletion failed.", - }, - "SliceConfigDeleted": { - Name: "SliceConfigDeleted", - Reason: "SliceConfigDeleted", - Action: "DeleteSliceConfig", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Slice config got deleted.", - }, - "SliceConfigDeletionFailed": { - Name: "SliceConfigDeletionFailed", - Reason: "SliceConfigDeletionFailed", - Action: "DeleteSliceConfig", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Slice config deletion failed.", - }, - "ServiceExportConfigDeleted": { - Name: "ServiceExportConfigDeleted", - Reason: "ServiceExportConfigDeleted", - Action: "DeleteServiceExportConfig", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Service export config got deleted.", - }, - "ServiceExportConfigDeletionFailed": { - Name: "ServiceExportConfigDeletionFailed", - Reason: "ServiceExportConfigDeletionFailed", - Action: "DeleteServiceExportConfig", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Service export config deletion failed.", - }, - "SliceQoSConfigDeleted": { - Name: "SliceQoSConfigDeleted", - Reason: "SliceQoSConfigDeleted", - Action: "DeleteSliceQoSConfig", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Slice QoS config got deleted.", - }, - "SliceQoSConfigDeletionFailed": { - Name: "SliceQoSConfigDeletionFailed", - Reason: "SliceQoSConfigDeletionFailed", - Action: "DeleteSliceQoSConfig", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Slice QoS config deletion failed.", - }, - "SecretDeleted": { - Name: "SecretDeleted", - Reason: "SecretDeleted", - Action: "DeleteSecret", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Secret got deleted.", - }, - "SecretDeletionFailed": { - Name: "SecretDeletionFailed", - Reason: "SecretDeletionFailed", - Action: "DeleteSecret", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Secret deletion failed.", - }, - "NamespaceCreated": { - Name: "NamespaceCreated", - Reason: "NamespaceCreated", - Action: "CreateNamespace", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "Namespace got created.", - }, - "NamespaceCreationFailed": { - Name: "NamespaceCreationFailed", - Reason: "NamespaceCreationFailed", - Action: "CreateNamespace", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Namespace creation failed.", - }, - "NamespaceDeleted": { - Name: "NamespaceDeleted", - Reason: "NamespaceDeleted", - Action: "DeleteNamespace", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Namespace got deleted.", - }, - "NamespaceDeletionFailed": { - Name: "NamespaceDeletionFailed", - Reason: "NamespaceDeletionFailed", - Action: "DeleteNamespace", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Namespace deletion failed.", - }, - "WorkerClusterRoleCreated": { - Name: "WorkerClusterRoleCreated", - Reason: "WorkerClusterRoleCreated", - Action: "CreateWorkerClusterRole", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "Worker cluster role got created.", - }, - "WorkerClusterRoleCreationFailed": { - Name: "WorkerClusterRoleCreationFailed", - Reason: "WorkerClusterRoleCreationFailed", - Action: "CreateWorkerClusterRole", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Worker cluster role creation failed.", - }, - "WorkerClusterRoleUpdated": { - Name: "WorkerClusterRoleUpdated", - Reason: "WorkerClusterRoleUpdated", - Action: "UpdateWorkerClusterRole", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "Worker cluster role got updated.", - }, - "WorkerClusterRoleUpdateFailed": { - Name: "WorkerClusterRoleUpdateFailed", - Reason: "WorkerClusterRoleUpdateFailed", - Action: "UpdateWorkerClusterRole", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Worker cluster role update failed.", - }, - "ReadOnlyRoleCreated": { - Name: "ReadOnlyRoleCreated", - Reason: "ReadOnlyRoleCreated", - Action: "CreateReadOnlyRole", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "Read only role got created.", - }, - "ReadOnlyRoleCreationFailed": { - Name: "ReadOnlyRoleCreationFailed", - Reason: "ReadOnlyRoleCreationFailed", - Action: "CreateReadOnlyRole", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Read only role creation failed.", - }, - "ReadOnlyRoleUpdated": { - Name: "ReadOnlyRoleUpdated", - Reason: "ReadOnlyRoleUpdated", - Action: "UpdateReadOnlyRole", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "Read only role got updated.", - }, - "ReadOnlyRoleUpdateFailed": { - Name: "ReadOnlyRoleUpdateFailed", - Reason: "ReadOnlyRoleUpdateFailed", - Action: "UpdateReadOnlyRole", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Read only role update failed.", - }, - "ReadWriteRoleCreated": { - Name: "ReadWriteRoleCreated", - Reason: "ReadWriteRoleCreated", - Action: "CreateReadWriteRole", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "Read write role got created.", - }, - "ReadWriteRoleCreationFailed": { - Name: "ReadWriteRoleCreationFailed", - Reason: "ReadWriteRoleCreationFailed", - Action: "CreateReadWriteRole", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Read write role creation failed.", - }, - "ReadWriteRoleUpdated": { - Name: "ReadWriteRoleUpdated", - Reason: "ReadWriteRoleUpdated", - Action: "UpdateReadWriteRole", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "Read write role got updated.", - }, - "ReadWriteRoleUpdateFailed": { - Name: "ReadWriteRoleUpdateFailed", - Reason: "ReadWriteRoleUpdateFailed", - Action: "UpdateReadWriteRole", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Read write role update failed.", - }, - "ServiceAccountCreated": { - Name: "ServiceAccountCreated", - Reason: "ServiceAccountCreated", - Action: "CreateServiceAccount", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "Service account got created.", - }, - "ServiceAccountCreationFailed": { - Name: "ServiceAccountCreationFailed", - Reason: "ServiceAccountCreationFailed", - Action: "CreateServiceAccount", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Service account creation failed.", - }, - "ServiceAccountSecretCreated": { - Name: "ServiceAccountSecretCreated", - Reason: "ServiceAccountSecretCreated", - Action: "CreateServiceAccountSecret", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "Service account secret got created.", - }, - "ServiceAccountSecretCreationFailed": { - Name: "ServiceAccountSecretCreationFailed", - Reason: "ServiceAccountSecretCreationFailed", - Action: "CreateServiceAccountSecret", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Service account secret creation failed.", - }, - "DefaultRoleBindingCreated": { - Name: "DefaultRoleBindingCreated", - Reason: "DefaultRoleBindingCreated", - Action: "CreateDefaultRoleBinding", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "Default role binding got created.", - }, - "DefaultRoleBindingCreationFailed": { - Name: "DefaultRoleBindingCreationFailed", - Reason: "DefaultRoleBindingCreationFailed", - Action: "CreateDefaultRoleBinding", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Default role binding creation failed.", - }, - "DefaultRoleBindingUpdated": { - Name: "DefaultRoleBindingUpdated", - Reason: "DefaultRoleBindingUpdated", - Action: "UpdateDefaultRoleBinding", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "Default role binding got updated.", - }, - "DefaultRoleBindingUpdateFailed": { - Name: "DefaultRoleBindingUpdateFailed", - Reason: "DefaultRoleBindingUpdateFailed", - Action: "UpdateDefaultRoleBinding", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Default role binding update failed.", - }, - "DefaultRoleBindingDeleted": { - Name: "DefaultRoleBindingDeleted", - Reason: "DefaultRoleBindingDeleted", - Action: "DeleteDefaultRoleBinding", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Default role binding got deleted.", - }, - "DefaultRoleBindingDeletionFailed": { - Name: "DefaultRoleBindingDeletionFailed", - Reason: "DefaultRoleBindingDeletionFailed", - Action: "DeleteDefaultRoleBinding", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Default role binding deletion failed.", - }, - "InactiveRoleBindingDeleted": { - Name: "InactiveRoleBindingDeleted", - Reason: "InactiveRoleBindingDeleted", - Action: "DeleteInactiveRoleBinding", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Inactive role binding got deleted.", - }, - "InactiveRoleBindingDeletionFailed": { - Name: "InactiveRoleBindingDeletionFailed", - Reason: "InactiveRoleBindingDeletionFailed", - Action: "DeleteInactiveRoleBinding", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Inactive role binding deletion failed.", - }, - "InactiveServiceAccountDeleted": { - Name: "InactiveServiceAccountDeleted", - Reason: "InactiveServiceAccountDeleted", - Action: "DeleteInactiveServiceAccount", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Inactive service account got deleted.", - }, - "InactiveServiceAccountDeletionFailed": { - Name: "InactiveServiceAccountDeletionFailed", - Reason: "InactiveServiceAccountDeletionFailed", - Action: "DeleteInactiveServiceAccount", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Inactive service account deletion failed.", - }, - "ServiceAccountDeleted": { - Name: "ServiceAccountDeleted", - Reason: "ServiceAccountDeleted", - Action: "DeleteServiceAccount", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Service account got deleted.", - }, - "ServiceAccountDeletionFailed": { - Name: "ServiceAccountDeletionFailed", - Reason: "ServiceAccountDeletionFailed", - Action: "DeleteServiceAccount", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Service account deletion failed.", - }, - "WorkerServiceImportDeletedForcefully": { - Name: "WorkerServiceImportDeletedForcefully", - Reason: "WorkerServiceImportDeletedForcefully", - Action: "DeleteWorkerServiceImport", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Worker service import got deleted forcefully.", - }, - "WorkerServiceImportRecreationFailed": { - Name: "WorkerServiceImportRecreationFailed", - Reason: "WorkerServiceImportRecreationFailed", - Action: "CreateWorkerServiceImport", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Worker service import recreation failed after forceful deletion.", - }, - "WorkerServiceImportRecreated": { - Name: "WorkerServiceImportRecreated", - Reason: "WorkerServiceImportRecreated", - Action: "CreateWorkerServiceImport", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "Worker service import got recreated after forceful deletion.", - }, - "WorkerServiceImportCreationFailed": { - Name: "WorkerServiceImportCreationFailed", - Reason: "WorkerServiceImportCreationFailed", - Action: "CreateWorkerServiceImport", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Worker service import creation failed.", - }, - "WorkerServiceImportCreated": { - Name: "WorkerServiceImportCreated", - Reason: "WorkerServiceImportCreated", - Action: "CreateWorkerServiceImport", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "Worker service import got created.", - }, - "WorkerServiceImportUpdateFailed": { - Name: "WorkerServiceImportUpdateFailed", - Reason: "WorkerServiceImportUpdateFailed", - Action: "UpdateWorkerServiceImport", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Worker service import update failed.", - }, - "WorkerServiceImportUpdated": { - Name: "WorkerServiceImportUpdated", - Reason: "WorkerServiceImportUpdated", - Action: "UpdateWorkerServiceImport", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "Worker service import got updated.", - }, - "WorkerServiceImportDeleted": { - Name: "WorkerServiceImportDeleted", - Reason: "WorkerServiceImportDeleted", - Action: "DeleteWorkerServiceImport", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Worker service import got deleted.", - }, - "WorkerServiceImportDeletionFailed": { - Name: "WorkerServiceImportDeletionFailed", - Reason: "WorkerServiceImportDeletionFailed", - Action: "DeleteWorkerServiceImport", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Worker service import deletion failed.", - }, - "WorkerSliceConfigDeletedForcefully": { - Name: "WorkerSliceConfigDeletedForcefully", - Reason: "WorkerSliceConfigDeletedForcefully", - Action: "DeleteWorkerSliceConfig", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Worker slice config got deleted forcefully.", - }, - "WorkerSliceConfigRecreationFailed": { - Name: "WorkerSliceConfigRecreationFailed", - Reason: "WorkerSliceConfigRecreationFailed", - Action: "CreateWorkerSliceConfig", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Worker slice config recreation failed after forceful deletion.", - }, - "WorkerSliceConfigRecreated": { - Name: "WorkerSliceConfigRecreated", - Reason: "WorkerSliceConfigRecreated", - Action: "CreateWorkerSliceConfig", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "Worker slice config got recreated after forceful deletion.", - }, - "WorkerSliceConfigCreationFailed": { - Name: "WorkerSliceConfigCreationFailed", - Reason: "WorkerSliceConfigCreationFailed", - Action: "CreateWorkerSliceConfig", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Worker slice config creation failed.", - }, - "WorkerSliceConfigCreated": { - Name: "WorkerSliceConfigCreated", - Reason: "WorkerSliceConfigCreated", - Action: "CreateWorkerSliceConfig", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "Worker slice config got created.", - }, - "WorkerSliceConfigUpdateFailed": { - Name: "WorkerSliceConfigUpdateFailed", - Reason: "WorkerSliceConfigUpdateFailed", - Action: "UpdateWorkerSliceConfig", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Worker slice config update failed.", - }, - "WorkerSliceConfigUpdated": { - Name: "WorkerSliceConfigUpdated", - Reason: "WorkerSliceConfigUpdated", - Action: "UpdateWorkerSliceConfig", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "Worker slice config got updated.", - }, - "WorkerSliceConfigDeleted": { - Name: "WorkerSliceConfigDeleted", - Reason: "WorkerSliceConfigDeleted", - Action: "DeleteWorkerSliceConfig", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Worker slice config got deleted.", - }, - "WorkerSliceConfigDeletionFailed": { - Name: "WorkerSliceConfigDeletionFailed", - Reason: "WorkerSliceConfigDeletionFailed", - Action: "DeleteWorkerSliceConfig", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Worker slice config deletion failed.", - }, - "WorkerSliceGatewayDeletedForcefully": { - Name: "WorkerSliceGatewayDeletedForcefully", - Reason: "WorkerSliceGatewayDeletedForcefully", - Action: "DeleteWorkerSliceGateway", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Worker slice gateway got deleted forcefully.", - }, - "WorkerSliceGatewayRecreationFailed": { - Name: "WorkerSliceGatewayRecreationFailed", - Reason: "WorkerSliceGatewayRecreationFailed", - Action: "CreateWorkerSliceGateway", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Worker slice gateway recreation failed after forceful deletion.", - }, - "WorkerSliceGatewayRecreated": { - Name: "WorkerSliceGatewayRecreated", - Reason: "WorkerSliceGatewayRecreated", - Action: "CreateWorkerSliceGateway", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "Worker slice gateway got recreated after forceful deletion.", - }, - "WorkerSliceGatewayDeletionFailed": { - Name: "WorkerSliceGatewayDeletionFailed", - Reason: "WorkerSliceGatewayDeletionFailed", - Action: "DeleteWorkerSliceGateway", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Worker slice gateway deletion failed.", - }, - "WorkerSliceGatewayDeleted": { - Name: "WorkerSliceGatewayDeleted", - Reason: "WorkerSliceGatewayDeleted", - Action: "DeleteWorkerSliceGateway", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Worker slice gateway got deleted.", - }, - "WorkerSliceGatewayCreationFailed": { - Name: "WorkerSliceGatewayCreationFailed", - Reason: "WorkerSliceGatewayCreationFailed", - Action: "CreateWorkerSliceGateway", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Worker slice gateway creation failed.", - }, - "WorkerSliceGatewayCreated": { - Name: "WorkerSliceGatewayCreated", - Reason: "WorkerSliceGatewayCreated", - Action: "CreateWorkerSliceGateway", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "Worker slice gateway got created.", - }, - "SliceGatewayJobCreationFailed": { - Name: "SliceGatewayJobCreationFailed", - Reason: "SliceGatewayJobCreationFailed", - Action: "CreateSliceGatewayJob", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Slice gateway job creation failed.", - }, - "SliceGatewayJobCreated": { - Name: "SliceGatewayJobCreated", - Reason: "SliceGatewayJobCreated", - Action: "CreateSliceGatewayJob", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "Slice gateway job got created.", - }, - "DefaultDeploymentSliceRoleTemplateCreationFailed": { - Name: "DefaultDeploymentSliceRoleTemplateCreationFailed", - Reason: "DefaultDeploymentSliceRoleTemplateCreationFailed", - Action: "CreateSliceRoleTemplate", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Default deployment slice role template creation failed.", - }, - "DefaultDeploymentSliceRoleTemplateCreated": { - Name: "DefaultDeploymentSliceRoleTemplateCreated", - Reason: "DefaultDeploymentSliceRoleTemplateCreated", - Action: "CreateSliceRoleTemplate", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "Default deployment slice role template got created.", - }, - "DefaultReaderSliceRoleTemplateCreationFailed": { - Name: "DefaultReaderSliceRoleTemplateCreationFailed", - Reason: "DefaultReaderSliceRoleTemplateCreationFailed", - Action: "CreateSliceRoleTemplate", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Default reader slice role template creation failed.", - }, - "DefaultReaderSliceRoleTemplateCreated": { - Name: "DefaultReaderSliceRoleTemplateCreated", - Reason: "DefaultReaderSliceRoleTemplateCreated", - Action: "CreateSliceRoleTemplate", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "Default reader slice role template got created.", - }, - "SliceRoleTemplateDeletionFailed": { - Name: "SliceRoleTemplateDeletionFailed", - Reason: "SliceRoleTemplateDeletionFailed", - Action: "DeleteSliceRoleTemplate", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Slice role template deletion failed.", - }, - "SliceRoleTemplateDeleted": { - Name: "SliceRoleTemplateDeleted", - Reason: "SliceRoleTemplateDeleted", - Action: "DeleteSliceRoleTemplate", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "Slice role template got deleted.", - }, - "SliceResourceQuotaCreationFailed": { - Name: "SliceResourceQuotaCreationFailed", - Reason: "SliceResourceQuotaCreationFailed", - Action: "CreateSliceResourceQuota", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Slice resource quota creation failed while creating slice config.", - }, - "SliceResourceQuotaCreatedOnSliceConfigCreation": { - Name: "SliceResourceQuotaCreatedOnSliceConfigCreation", - Reason: "SliceResourceQuotaCreatedOnSliceConfigCreation", - Action: "CreateSliceResourceQuota", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "Slice resource quota got created while creating slice config.", - }, - "SliceResourceQuotaDeletionFailed": { - Name: "SliceResourceQuotaDeletionFailed", - Reason: "SliceResourceQuotaDeletionFailed", - Action: "DeleteSliceResourceQuota", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Slice resource quota deletion failed.", - }, - "SliceResourceQuotaDeleted": { - Name: "SliceResourceQuotaDeleted", - Reason: "SliceResourceQuotaDeleted", - Action: "DeleteSliceResourceQuota", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Slice resource quota got deleted.", - }, - "SliceResourceQuotaRecreationFailed": { - Name: "SliceResourceQuotaRecreationFailed", - Reason: "SliceResourceQuotaRecreationFailed", - Action: "CreateSliceResourceQuota", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Slice resource quota recreation failed after forceful deletion.", - }, - "SliceResourceQuotaRecreated": { - Name: "SliceResourceQuotaRecreated", - Reason: "SliceResourceQuotaRecreated", - Action: "CreateSliceResourceQuota", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "Slice resource quota got recreated after forceful deletion.", - }, - "SetSliceConfigAsOwnerOfSliceResourceQuotaFailed": { - Name: "SetSliceConfigAsOwnerOfSliceResourceQuotaFailed", - Reason: "SetSliceConfigAsOwnerOfSliceResourceQuotaFailed", - Action: "SetSliceConfigAsOwnerOfSliceResourceQuota", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Failed to set slice config as owner of slice resource quota config.", - }, - "SetSliceConfigAsOwnerOfSliceResourceQuotaSucceeded": { - Name: "SetSliceConfigAsOwnerOfSliceResourceQuotaSucceeded", - Reason: "SetSliceConfigAsOwnerOfSliceResourceQuotaSucceeded", - Action: "SetSliceConfigAsOwnerOfSliceResourceQuota", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "Successfully set slice config as owner of slice resource quota config.", - }, - "SliceResourceQuotaCreated": { - Name: "SliceResourceQuotaCreated", - Reason: "SliceResourceQuotaCreated", - Action: "CreateSliceResourceQuota", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "Slice resource quota config got created successfully.", - }, - "SliceResourceQuotaUpdated": { - Name: "SliceResourceQuotaUpdated", - Reason: "SliceResourceQuotaUpdated", - Action: "UpdateSliceResourceQuota", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "Slice resource quota config got updated successfully.", - }, - "AllRQSpecificationViolationMetricsResetSuccess": { - Name: "AllRQSpecificationViolationMetricsResetSuccess", - Reason: "AllRQSpecificationViolationMetricsResetSuccess", - Action: "ResetResourceQuotaMetrics", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "All resource quota specifications and violations metrics got reset successfully.", - }, - "SliceRQSpecificationViolationMetricsResetSuccess": { - Name: "SliceRQSpecificationViolationMetricsResetSuccess", - Reason: "SliceRQSpecificationViolationMetricsResetSuccess", - Action: "ResetResourceQuotaMetrics", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "All slice level resource quota specifications and violations metrics got reset successfully.", - }, - "ClusterRQSpecificationViolationMetricsResetSuccess": { - Name: "ClusterRQSpecificationViolationMetricsResetSuccess", - Reason: "ClusterRQSpecificationViolationMetricsResetSuccess", - Action: "ResetResourceQuotaMetrics", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "All cluster level resource quota specifications and violations metrics got reset successfully.", - }, - "OutdatedNamespaceRQSpecificationViolationMetricsResetSuccess": { - Name: "OutdatedNamespaceRQSpecificationViolationMetricsResetSuccess", - Reason: "OutdatedNamespaceRQSpecificationViolationMetricsResetSuccess", - Action: "ResetResourceQuotaMetrics", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "All outdated namespace level resource quota specifications and violations metrics got reset successfully.", - }, - "OutdatedClusterRQSpecificationViolationMetricsResetSuccess": { - Name: "OutdatedClusterRQSpecificationViolationMetricsResetSuccess", - Reason: "OutdatedClusterRQSpecificationViolationMetricsResetSuccess", - Action: "ResetResourceQuotaMetrics", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "All outdated cluster level resource quota specifications and violations metrics got reset successfully.", - }, - "SliceNodeAffinityDeletionFailed": { - Name: "SliceNodeAffinityDeletionFailed", - Reason: "SliceNodeAffinityDeletionFailed", - Action: "DeleteSliceNodeAffinity", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Slice node affinity deletion failed.", - }, - "SliceNodeAffinityDeleted": { - Name: "SliceNodeAffinityDeleted", - Reason: "SliceNodeAffinityDeleted", - Action: "DeleteSliceNodeAffinity", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Slice node affinity got deleted.", - }, - "SetSliceConfigAsOwnerOfSliceNodeAffinityFailed": { - Name: "SetSliceConfigAsOwnerOfSliceNodeAffinityFailed", - Reason: "SetSliceConfigAsOwnerOfSliceNodeAffinityFailed", - Action: "SetSliceConfigAsOwnerOfSliceNodeAffinity", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Failed to set slice config as owner of slice node affinity.", - }, - "SetSliceConfigAsOwnerOfSliceNodeAffinitySucceeded": { - Name: "SetSliceConfigAsOwnerOfSliceNodeAffinitySucceeded", - Reason: "SetSliceConfigAsOwnerOfSliceNodeAffinitySucceeded", - Action: "SetSliceConfigAsOwnerOfSliceNodeAffinity", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "Successfully set slice config as owner of slice node affinity.", - }, - "SliceRoleBindingDeletingFailed": { - Name: "SliceRoleBindingDeletingFailed", - Reason: "SliceRoleBindingDeletingFailed", - Action: "DeleteSliceRoleBinding", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Slice role binding deletion failed.", - }, - "SliceRoleBindingDeleted": { - Name: "SliceRoleBindingDeleted", - Reason: "SliceRoleBindingDeleted", - Action: "DeleteSliceRoleBinding", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "Slice role binding got deleted.", - }, - "SetSliceConfigAsOwnerOfSliceRoleBindingFailed": { - Name: "SetSliceConfigAsOwnerOfSliceRoleBindingFailed", - Reason: "SetSliceConfigAsOwnerOfSliceRoleBindingFailed", - Action: "SetSliceConfigAsOwnerOfSliceRoleBinding", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Failed to set slice config as owner of slice role binding.", - }, - "SetSliceConfigAsOwnerOfSliceRoleBindingSucceeded": { - Name: "SetSliceConfigAsOwnerOfSliceRoleBindingSucceeded", - Reason: "SetSliceConfigAsOwnerOfSliceRoleBindingSucceeded", - Action: "SetSliceConfigAsOwnerOfSliceRoleBinding", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "Successfully set slice config as owner of slice role binding.", - }, - "WorkerSliceRoleBindingReconciliationSuccess": { - Name: "WorkerSliceRoleBindingReconciliationSuccess", - Reason: "WorkerSliceRoleBindingReconciliationSuccess", - Action: "ReconcileWorkerSliceRoleBinding", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "Reconciliation of worker slice role binding is successful due to the change in slice role template.", - }, - "WorkerSliceRoleBindingDeletedForcefully": { - Name: "WorkerSliceRoleBindingDeletedForcefully", - Reason: "WorkerSliceRoleBindingDeletedForcefully", - Action: "DeleteWorkerSliceRoleBinding", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Worker slice role binding got deleted forcefully.", - }, - "WorkerSliceRoleBindingRecreationFailed": { - Name: "WorkerSliceRoleBindingRecreationFailed", - Reason: "WorkerSliceRoleBindingRecreationFailed", - Action: "CreateWorkerSliceRoleBinding", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Worker slice role binding recreation failed after forceful deletion.", - }, - "WorkerSliceRoleBindingRecreated": { - Name: "WorkerSliceRoleBindingRecreated", - Reason: "WorkerSliceRoleBindingRecreated", - Action: "CreateWorkerSliceRoleBinding", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "Worker slice role binding got recreated after forceful deletion.", - }, - "WorkerSliceRoleBindingCreationFailed": { - Name: "WorkerSliceRoleBindingCreationFailed", - Reason: "WorkerSliceRoleBindingCreationFailed", - Action: "CreateWorkerSliceRoleBinding", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Worker slice role binding creation failed.", - }, - "WorkerSliceRoleBindingCreated": { - Name: "WorkerSliceRoleBindingCreated", - Reason: "WorkerSliceRoleBindingCreated", - Action: "CreateWorkerSliceRoleBinding", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "Worker slice role binding got created successfully.", - }, - "WorkerSliceRoleBindingUpdateFailed": { - Name: "WorkerSliceRoleBindingUpdateFailed", - Reason: "WorkerSliceRoleBindingUpdateFailed", - Action: "UpdateWorkerSliceRoleBinding", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Worker slice role binding update failed.", - }, - "WorkerSliceRoleBindingUpdated": { - Name: "WorkerSliceRoleBindingUpdated", - Reason: "WorkerSliceRoleBindingUpdated", - Action: "UpdateWorkerSliceRoleBinding", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "Worker slice role binding got updated successfully.", - }, - "WorkerSliceRoleBindingDeletionFailed": { - Name: "WorkerSliceRoleBindingDeletionFailed", - Reason: "WorkerSliceRoleBindingDeletionFailed", - Action: "DeleteWorkerSliceRoleBinding", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Worker slice role binding deletion failed.", - }, - "WorkerSliceRoleBindingDeleted": { - Name: "WorkerSliceRoleBindingDeleted", - Reason: "WorkerSliceRoleBindingDeleted", - Action: "DeleteWorkerSliceRoleBinding", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "Worker slice role binding got deleted successfully.", - }, - "WorkerSliceNodeAffinityDeletedForcefully": { - Name: "WorkerSliceNodeAffinityDeletedForcefully", - Reason: "WorkerSliceNodeAffinityDeletedForcefully", - Action: "DeleteWorkerSliceNodeAffinity", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Worker slice node affinity got deleted forcefully.", - }, - "WorkerSliceNodeAffinityRecreationFailed": { - Name: "WorkerSliceNodeAffinityRecreationFailed", - Reason: "WorkerSliceNodeAffinityRecreationFailed", - Action: "CreateWorkerSliceNodeAffinity", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Worker slice node affinity recreation failed after forceful deletion.", - }, - "WorkerSliceNodeAffinityRecreated": { - Name: "WorkerSliceNodeAffinityRecreated", - Reason: "WorkerSliceNodeAffinityRecreated", - Action: "CreateWorkerSliceNodeAffinity", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "Worker slice node affinity got recreated after forceful deletion.", - }, - "NodeAffinityRilesExpansionFailed": { - Name: "NodeAffinityRilesExpansionFailed", - Reason: "NodeAffinityRilesExpansionFailed", - Action: "ExpandNodeAffinityRules", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Node affinity rules expansion failed.", - }, - "SliceNodeAffinityConfigDeepCopyFailed": { - Name: "SliceNodeAffinityConfigDeepCopyFailed", - Reason: "SliceNodeAffinityConfigDeepCopyFailed", - Action: "DeepCopySliceNodeAffinityConfig", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Deep copy of slice node affinity configuration got failed.", - }, - "WorkerSliceNodeAffinityCreationFailed": { - Name: "WorkerSliceNodeAffinityCreationFailed", - Reason: "WorkerSliceNodeAffinityCreationFailed", - Action: "CreateWorkerSliceNodeAffinity", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Worker slice node affinity creation failed.", - }, - "WorkerSliceNodeAffinityCreated": { - Name: "WorkerSliceNodeAffinityCreated", - Reason: "WorkerSliceNodeAffinityCreated", - Action: "CreateWorkerSliceNodeAffinity", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "Worker slice node affinity got created successfully.", - }, - "WorkerSliceNodeAffinityUpdateFailed": { - Name: "WorkerSliceNodeAffinityUpdateFailed", - Reason: "WorkerSliceNodeAffinityUpdateFailed", - Action: "UpdateWorkerSliceNodeAffinity", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Worker slice node affinity update failed.", - }, - "WorkerSliceNodeAffinityUpdated": { - Name: "WorkerSliceNodeAffinityUpdated", - Reason: "WorkerSliceNodeAffinityUpdated", - Action: "UpdateWorkerSliceNodeAffinity", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "Worker slice node affinity got updated successfully.", - }, - "WorkerSliceNodeAffinityDeletionFailed": { - Name: "WorkerSliceNodeAffinityDeletionFailed", - Reason: "WorkerSliceNodeAffinityDeletionFailed", - Action: "DeleteWorkerSliceNodeAffinity", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Worker slice node affinity deletion failed.", - }, - "WorkerSliceNodeAffinityDeleted": { - Name: "WorkerSliceNodeAffinityDeleted", - Reason: "WorkerSliceNodeAffinityDeleted", - Action: "DeleteWorkerSliceNodeAffinity", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "Worker slice node affinity got deleted successfully.", - }, - "WorkerSliceResourceQuotaDeletedForcefully": { - Name: "WorkerSliceResourceQuotaDeletedForcefully", - Reason: "WorkerSliceResourceQuotaDeletedForcefully", - Action: "DeleteWorkerSliceResourceQuota", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Worker slice resource quota got deleted forcefully.", - }, - "WorkerSliceResourceQuotaRecreationFailed": { - Name: "WorkerSliceResourceQuotaRecreationFailed", - Reason: "WorkerSliceResourceQuotaRecreationFailed", - Action: "CreateWorkerSliceResourceQuota", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Worker slice resource quota recreation failed after forceful deletion.", - }, - "WorkerSliceResourceQuotaRecreated": { - Name: "WorkerSliceResourceQuotaRecreated", - Reason: "WorkerSliceResourceQuotaRecreated", - Action: "CreateWorkerSliceResourceQuota", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "Worker slice resource quota got recreated after forceful deletion.", - }, - "OffBoardedNamespaceUtilizationMetricsReset": { - Name: "OffBoardedNamespaceUtilizationMetricsReset", - Reason: "OffBoardedNamespaceUtilizationMetricsReset", - Action: "ResetOffBoardedNamespaceUtilizationMetrics", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "Utilization metrics of off-boarded namespaces got reset successfully.", - }, - "ResourceQuotaMetricsPopulated": { - Name: "ResourceQuotaMetricsPopulated", - Reason: "ResourceQuotaMetricsPopulated", - Action: "PopulateResourceQuotaMetrics", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "Resource quota metrics got populated successfully.", - }, - "ClusterCPULimitViolated": { - Name: "ClusterCPULimitViolated", - Reason: "ClusterCPULimitViolated", - Action: "ViolateClusterCPULimit", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "CPU limit is violated at cluster level.", - }, - "ClusterMemoryLimitViolated": { - Name: "ClusterMemoryLimitViolated", - Reason: "ClusterMemoryLimitViolated", - Action: "ViolateClusterMemoryLimit", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Memory limit is violated at cluster level.", - }, - "ClusterPodCountViolated": { - Name: "ClusterPodCountViolated", - Reason: "ClusterPodCountViolated", - Action: "ViolateClusterPodCount", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Pod count is violated at cluster level.", - }, - "ClusterEphemeralStorageLimitViolated": { - Name: "ClusterEphemeralStorageLimitViolated", - Reason: "ClusterEphemeralStorageLimitViolated", - Action: "ViolateClusterEphemeralStorageLimit", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Ephemeral storage limit is violated at cluster level.", - }, - "ClusterCPURequestViolated": { - Name: "ClusterCPURequestViolated", - Reason: "ClusterCPURequestViolated", - Action: "ViolateClusterCPURequest", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "CPU request is violated at cluster level.", - }, - "ClusterMemoryRequestViolated": { - Name: "ClusterMemoryRequestViolated", - Reason: "ClusterMemoryRequestViolated", - Action: "ViolateClusterMemoryRequest", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Memory request is violated at cluster level.", - }, - "ClusterEphemeralStorageRequestViolated": { - Name: "ClusterEphemeralStorageRequestViolated", - Reason: "ClusterEphemeralStorageRequestViolated", - Action: "ViolateClusterEphemeralStorageRequest", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Ephemeral storage request is violated at cluster level.", - }, - "NamespaceCPULimitViolated": { - Name: "NamespaceCPULimitViolated", - Reason: "NamespaceCPULimitViolated", - Action: "ViolateNamespaceCPULimit", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "CPU limit is violated at namespace level.", - }, - "NamespaceMemoryLimitViolated": { - Name: "NamespaceMemoryLimitViolated", - Reason: "NamespaceMemoryLimitViolated", - Action: "ViolateNamespaceMemoryLimit", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Memory limit is violated at namespace level.", - }, - "NamespacePodCountViolated": { - Name: "NamespacePodCountViolated", - Reason: "NamespacePodCountViolated", - Action: "ViolateNamespacePodCount", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Pod count is violated at namespace level.", - }, - "NamespaceEphemeralStorageLimitViolated": { - Name: "NamespaceEphemeralStorageLimitViolated", - Reason: "NamespaceEphemeralStorageLimitViolated", - Action: "ViolateNamespaceEphemeralStorageLimit", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Ephemeral storage limit is violated at namespace level.", - }, - "NamespaceCPURequestViolated": { - Name: "NamespaceCPURequestViolated", - Reason: "NamespaceCPURequestViolated", - Action: "ViolateNamespaceCPURequest", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "CPU request is violated at namespace level.", - }, - "NamespaceMemoryRequestViolated": { - Name: "NamespaceMemoryRequestViolated", - Reason: "NamespaceMemoryRequestViolated", - Action: "ViolateNamespaceMemoryRequest", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Memory request is violated at namespace level.", - }, - "NamespaceEphemeralStorageRequestViolated": { - Name: "NamespaceEphemeralStorageRequestViolated", - Reason: "NamespaceEphemeralStorageRequestViolated", - Action: "ViolateNamespaceEphemeralStorageRequest", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Ephemeral storage request is violated at namespace level.", - }, - "SliceCPULimitViolated": { - Name: "SliceCPULimitViolated", - Reason: "SliceCPULimitViolated", - Action: "ViolateSliceCPULimit", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "CPU limit is violated at slice level.", - }, - "SliceMemoryLimitViolated": { - Name: "SliceMemoryLimitViolated", - Reason: "SliceMemoryLimitViolated", - Action: "ViolateSliceMemoryLimit", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Memory limit is violated at slice level.", - }, - "SlicePodCountViolated": { - Name: "SlicePodCountViolated", - Reason: "SlicePodCountViolated", - Action: "ViolateSlicePodCount", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Pod count is violated at slice level.", - }, - "SliceEphemeralStorageLimitViolated": { - Name: "SliceEphemeralStorageLimitViolated", - Reason: "SliceEphemeralStorageLimitViolated", - Action: "ViolateSliceEphemeralStorageLimit", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Ephemeral storage limit is violated at slice level.", - }, - "SliceCPURequestViolated": { - Name: "SliceCPURequestViolated", - Reason: "SliceCPURequestViolated", - Action: "ViolateSliceCPURequest", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "CPU request is violated at slice level.", - }, - "SliceMemoryRequestViolated": { - Name: "SliceMemoryRequestViolated", - Reason: "SliceMemoryRequestViolated", - Action: "ViolateSliceMemoryRequest", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Memory request is violated at slice level.", - }, - "SliceEphemeralStorageRequestViolated": { - Name: "SliceEphemeralStorageRequestViolated", - Reason: "SliceEphemeralStorageRequestViolated", - Action: "ViolateSliceEphemeralStorageRequest", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Ephemeral storage request is violated at slice level.", - }, - "WorkerSliceResourceQuotaCreationFailed": { - Name: "WorkerSliceResourceQuotaCreationFailed", - Reason: "WorkerSliceResourceQuotaCreationFailed", - Action: "CreateWorkerSliceResourceQuota", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Worker slice resource quota creation failed.", - }, - "WorkerSliceResourceQuotaCreated": { - Name: "WorkerSliceResourceQuotaCreated", - Reason: "WorkerSliceResourceQuotaCreated", - Action: "CreateWorkerSliceResourceQuota", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "Worker slice resource quota got created successfully.", - }, - "WorkerSliceResourceQuotaUpdateFailed": { - Name: "WorkerSliceResourceQuotaUpdateFailed", - Reason: "WorkerSliceResourceQuotaUpdateFailed", - Action: "UpdateWorkerSliceResourceQuota", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Worker slice resource quota update failed.", - }, - "WorkerSliceResourceQuotaUpdated": { - Name: "WorkerSliceResourceQuotaUpdated", - Reason: "WorkerSliceResourceQuotaUpdated", - Action: "UpdateWorkerSliceResourceQuota", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "Worker slice resource quota got updated successfully.", - }, - "WorkerSliceResourceQuotaDeletionFailed": { - Name: "WorkerSliceResourceQuotaDeletionFailed", - Reason: "WorkerSliceResourceQuotaDeletionFailed", - Action: "DeleteWorkerSliceResourceQuota", - Type: EventTypeWarning, - ReportingController: "controller", - Message: "Worker slice resource quota deletion failed.", - }, - "WorkerSliceResourceQuotaDeleted": { - Name: "WorkerSliceResourceQuotaDeleted", - Reason: "WorkerSliceResourceQuotaDeleted", - Action: "DeleteWorkerSliceResourceQuota", - Type: EventTypeNormal, - ReportingController: "controller", - Message: "Worker slice resource quota got deleted successfully.", - }, - "NetPolViolation": { - Name: "NetPolViolation", - Reason: "PolicyViolation", - Action: "PolicyMonitoring", - Type: EventTypeWarning, - ReportingController: "worker", - Message: "Network policy violation - please ask admin to check the network policy configuration on the worker cluster. ", - }, - "ClusterUnhealthy": { - Name: "ClusterUnhealthy", - Reason: "ComponentStatusChange", - Action: "CheckComponents", - Type: EventTypeWarning, - ReportingController: "worker", - Message: "Cluster is unhealthy - Please check if all worker components are running as expected", - }, - "ClusterHealthy": { - Name: "ClusterHealthy", - Reason: "ComponentStatusChange", - Action: "None", - Type: EventTypeNormal, - ReportingController: "worker", - Message: "Cluster is healthy - Cluster is back to healthy state", - }, - "ClusterNodeIpUpdated": { - Name: "ClusterNodeIpUpdated", - Reason: "ClusterNodeIpUpdated", - Action: "None", - Type: EventTypeNormal, - ReportingController: "worker", - Message: "Successfully updated cluster as change detected in cluster nodes", - }, - "ClusterNodeIpUpdateFail": { - Name: "ClusterNodeIpUpdateFail", - Reason: "ClusterNodeIpUpdateFail", - Action: "None", - Type: EventTypeWarning, - ReportingController: "worker", - Message: "Failed to update node ip in cluster CR", + Message: "ExampleEvent message.", }, } var ( - EventLicenseSecretNotFound EventName = "LicenseSecretNotFound" - EventMachineFileNotFound EventName = "MachineFileNotFound" - EventMachineFileInvalid EventName = "MachineFileInvalid" - EventLicenseKeyInvalid EventName = "LicenseKeyInvalid" - EventLicenseExpired EventName = "LicenseExpired" - EventLicenseExpiredGracePeriodOn EventName = "LicenseExpiredGracePeriodOn" - EventMachineFingerPrintErr EventName = "MachineFingerPrintErr" - EventGotMachineFingerPrint EventName = "GotMachineFingerPrint" - EventConfigMapErr EventName = "ConfigMapErr" - EventGotConfigMap EventName = "GotConfigMap" - EventLicenseProxyUnreachable EventName = "LicenseProxyUnreachable" - EventLicenseDeployError EventName = "LicenseDeployError" - EventLicenseDeploySuccess EventName = "LicenseDeploySuccess" - EventClusterMetadataCollectionFailed EventName = "ClusterMetadataCollectionFailed" - EventClusterMetadataCollectionSuccess EventName = "ClusterMetadataCollectionSuccess" - EventLicenseDataFetchError EventName = "LicenseDataFetchError" - EventLicenseDataFetchSuccess EventName = "LicenseDataFetchSuccess" - EventLicenseSecretCreationFailed EventName = "LicenseSecretCreationFailed" - EventLicenseSecretCreationSuccess EventName = "LicenseSecretCreationSuccess" - EventProjectDeleted EventName = "ProjectDeleted" - EventProjectDeletionFailed EventName = "ProjectDeletionFailed" - EventClusterDeleted EventName = "ClusterDeleted" - EventClusterDeletionFailed EventName = "ClusterDeletionFailed" - EventSliceConfigDeleted EventName = "SliceConfigDeleted" - EventSliceConfigDeletionFailed EventName = "SliceConfigDeletionFailed" - EventServiceExportConfigDeleted EventName = "ServiceExportConfigDeleted" - EventServiceExportConfigDeletionFailed EventName = "ServiceExportConfigDeletionFailed" - EventSliceQoSConfigDeleted EventName = "SliceQoSConfigDeleted" - EventSliceQoSConfigDeletionFailed EventName = "SliceQoSConfigDeletionFailed" - EventSecretDeleted EventName = "SecretDeleted" - EventSecretDeletionFailed EventName = "SecretDeletionFailed" - EventNamespaceCreated EventName = "NamespaceCreated" - EventNamespaceCreationFailed EventName = "NamespaceCreationFailed" - EventNamespaceDeleted EventName = "NamespaceDeleted" - EventNamespaceDeletionFailed EventName = "NamespaceDeletionFailed" - EventWorkerClusterRoleCreated EventName = "WorkerClusterRoleCreated" - EventWorkerClusterRoleCreationFailed EventName = "WorkerClusterRoleCreationFailed" - EventWorkerClusterRoleUpdated EventName = "WorkerClusterRoleUpdated" - EventWorkerClusterRoleUpdateFailed EventName = "WorkerClusterRoleUpdateFailed" - EventReadOnlyRoleCreated EventName = "ReadOnlyRoleCreated" - EventReadOnlyRoleCreationFailed EventName = "ReadOnlyRoleCreationFailed" - EventReadOnlyRoleUpdated EventName = "ReadOnlyRoleUpdated" - EventReadOnlyRoleUpdateFailed EventName = "ReadOnlyRoleUpdateFailed" - EventReadWriteRoleCreated EventName = "ReadWriteRoleCreated" - EventReadWriteRoleCreationFailed EventName = "ReadWriteRoleCreationFailed" - EventReadWriteRoleUpdated EventName = "ReadWriteRoleUpdated" - EventReadWriteRoleUpdateFailed EventName = "ReadWriteRoleUpdateFailed" - EventServiceAccountCreated EventName = "ServiceAccountCreated" - EventServiceAccountCreationFailed EventName = "ServiceAccountCreationFailed" - EventServiceAccountSecretCreated EventName = "ServiceAccountSecretCreated" - EventServiceAccountSecretCreationFailed EventName = "ServiceAccountSecretCreationFailed" - EventDefaultRoleBindingCreated EventName = "DefaultRoleBindingCreated" - EventDefaultRoleBindingCreationFailed EventName = "DefaultRoleBindingCreationFailed" - EventDefaultRoleBindingUpdated EventName = "DefaultRoleBindingUpdated" - EventDefaultRoleBindingUpdateFailed EventName = "DefaultRoleBindingUpdateFailed" - EventDefaultRoleBindingDeleted EventName = "DefaultRoleBindingDeleted" - EventDefaultRoleBindingDeletionFailed EventName = "DefaultRoleBindingDeletionFailed" - EventInactiveRoleBindingDeleted EventName = "InactiveRoleBindingDeleted" - EventInactiveRoleBindingDeletionFailed EventName = "InactiveRoleBindingDeletionFailed" - EventInactiveServiceAccountDeleted EventName = "InactiveServiceAccountDeleted" - EventInactiveServiceAccountDeletionFailed EventName = "InactiveServiceAccountDeletionFailed" - EventServiceAccountDeleted EventName = "ServiceAccountDeleted" - EventServiceAccountDeletionFailed EventName = "ServiceAccountDeletionFailed" - EventWorkerServiceImportDeletedForcefully EventName = "WorkerServiceImportDeletedForcefully" - EventWorkerServiceImportRecreationFailed EventName = "WorkerServiceImportRecreationFailed" - EventWorkerServiceImportRecreated EventName = "WorkerServiceImportRecreated" - EventWorkerServiceImportCreationFailed EventName = "WorkerServiceImportCreationFailed" - EventWorkerServiceImportCreated EventName = "WorkerServiceImportCreated" - EventWorkerServiceImportUpdateFailed EventName = "WorkerServiceImportUpdateFailed" - EventWorkerServiceImportUpdated EventName = "WorkerServiceImportUpdated" - EventWorkerServiceImportDeleted EventName = "WorkerServiceImportDeleted" - EventWorkerServiceImportDeletionFailed EventName = "WorkerServiceImportDeletionFailed" - EventWorkerSliceConfigDeletedForcefully EventName = "WorkerSliceConfigDeletedForcefully" - EventWorkerSliceConfigRecreationFailed EventName = "WorkerSliceConfigRecreationFailed" - EventWorkerSliceConfigRecreated EventName = "WorkerSliceConfigRecreated" - EventWorkerSliceConfigCreationFailed EventName = "WorkerSliceConfigCreationFailed" - EventWorkerSliceConfigCreated EventName = "WorkerSliceConfigCreated" - EventWorkerSliceConfigUpdateFailed EventName = "WorkerSliceConfigUpdateFailed" - EventWorkerSliceConfigUpdated EventName = "WorkerSliceConfigUpdated" - EventWorkerSliceConfigDeleted EventName = "WorkerSliceConfigDeleted" - EventWorkerSliceConfigDeletionFailed EventName = "WorkerSliceConfigDeletionFailed" - EventWorkerSliceGatewayDeletedForcefully EventName = "WorkerSliceGatewayDeletedForcefully" - EventWorkerSliceGatewayRecreationFailed EventName = "WorkerSliceGatewayRecreationFailed" - EventWorkerSliceGatewayRecreated EventName = "WorkerSliceGatewayRecreated" - EventWorkerSliceGatewayDeletionFailed EventName = "WorkerSliceGatewayDeletionFailed" - EventWorkerSliceGatewayDeleted EventName = "WorkerSliceGatewayDeleted" - EventWorkerSliceGatewayCreationFailed EventName = "WorkerSliceGatewayCreationFailed" - EventWorkerSliceGatewayCreated EventName = "WorkerSliceGatewayCreated" - EventSliceGatewayJobCreationFailed EventName = "SliceGatewayJobCreationFailed" - EventSliceGatewayJobCreated EventName = "SliceGatewayJobCreated" - EventDefaultDeploymentSliceRoleTemplateCreationFailed EventName = "DefaultDeploymentSliceRoleTemplateCreationFailed" - EventDefaultDeploymentSliceRoleTemplateCreated EventName = "DefaultDeploymentSliceRoleTemplateCreated" - EventDefaultReaderSliceRoleTemplateCreationFailed EventName = "DefaultReaderSliceRoleTemplateCreationFailed" - EventDefaultReaderSliceRoleTemplateCreated EventName = "DefaultReaderSliceRoleTemplateCreated" - EventSliceRoleTemplateDeletionFailed EventName = "SliceRoleTemplateDeletionFailed" - EventSliceRoleTemplateDeleted EventName = "SliceRoleTemplateDeleted" - EventSliceResourceQuotaCreationFailed EventName = "SliceResourceQuotaCreationFailed" - EventSliceResourceQuotaCreatedOnSliceConfigCreation EventName = "SliceResourceQuotaCreatedOnSliceConfigCreation" - EventSliceResourceQuotaDeletionFailed EventName = "SliceResourceQuotaDeletionFailed" - EventSliceResourceQuotaDeleted EventName = "SliceResourceQuotaDeleted" - EventSliceResourceQuotaRecreationFailed EventName = "SliceResourceQuotaRecreationFailed" - EventSliceResourceQuotaRecreated EventName = "SliceResourceQuotaRecreated" - EventSetSliceConfigAsOwnerOfSliceResourceQuotaFailed EventName = "SetSliceConfigAsOwnerOfSliceResourceQuotaFailed" - EventSetSliceConfigAsOwnerOfSliceResourceQuotaSucceeded EventName = "SetSliceConfigAsOwnerOfSliceResourceQuotaSucceeded" - EventSliceResourceQuotaCreated EventName = "SliceResourceQuotaCreated" - EventSliceResourceQuotaUpdated EventName = "SliceResourceQuotaUpdated" - EventAllRQSpecificationViolationMetricsResetSuccess EventName = "AllRQSpecificationViolationMetricsResetSuccess" - EventSliceRQSpecificationViolationMetricsResetSuccess EventName = "SliceRQSpecificationViolationMetricsResetSuccess" - EventClusterRQSpecificationViolationMetricsResetSuccess EventName = "ClusterRQSpecificationViolationMetricsResetSuccess" - EventOutdatedNamespaceRQSpecificationViolationMetricsResetSuccess EventName = "OutdatedNamespaceRQSpecificationViolationMetricsResetSuccess" - EventOutdatedClusterRQSpecificationViolationMetricsResetSuccess EventName = "OutdatedClusterRQSpecificationViolationMetricsResetSuccess" - EventSliceNodeAffinityDeletionFailed EventName = "SliceNodeAffinityDeletionFailed" - EventSliceNodeAffinityDeleted EventName = "SliceNodeAffinityDeleted" - EventSetSliceConfigAsOwnerOfSliceNodeAffinityFailed EventName = "SetSliceConfigAsOwnerOfSliceNodeAffinityFailed" - EventSetSliceConfigAsOwnerOfSliceNodeAffinitySucceeded EventName = "SetSliceConfigAsOwnerOfSliceNodeAffinitySucceeded" - EventSliceRoleBindingDeletingFailed EventName = "SliceRoleBindingDeletingFailed" - EventSliceRoleBindingDeleted EventName = "SliceRoleBindingDeleted" - EventSetSliceConfigAsOwnerOfSliceRoleBindingFailed EventName = "SetSliceConfigAsOwnerOfSliceRoleBindingFailed" - EventSetSliceConfigAsOwnerOfSliceRoleBindingSucceeded EventName = "SetSliceConfigAsOwnerOfSliceRoleBindingSucceeded" - EventWorkerSliceRoleBindingReconciliationSuccess EventName = "WorkerSliceRoleBindingReconciliationSuccess" - EventWorkerSliceRoleBindingDeletedForcefully EventName = "WorkerSliceRoleBindingDeletedForcefully" - EventWorkerSliceRoleBindingRecreationFailed EventName = "WorkerSliceRoleBindingRecreationFailed" - EventWorkerSliceRoleBindingRecreated EventName = "WorkerSliceRoleBindingRecreated" - EventWorkerSliceRoleBindingCreationFailed EventName = "WorkerSliceRoleBindingCreationFailed" - EventWorkerSliceRoleBindingCreated EventName = "WorkerSliceRoleBindingCreated" - EventWorkerSliceRoleBindingUpdateFailed EventName = "WorkerSliceRoleBindingUpdateFailed" - EventWorkerSliceRoleBindingUpdated EventName = "WorkerSliceRoleBindingUpdated" - EventWorkerSliceRoleBindingDeletionFailed EventName = "WorkerSliceRoleBindingDeletionFailed" - EventWorkerSliceRoleBindingDeleted EventName = "WorkerSliceRoleBindingDeleted" - EventWorkerSliceNodeAffinityDeletedForcefully EventName = "WorkerSliceNodeAffinityDeletedForcefully" - EventWorkerSliceNodeAffinityRecreationFailed EventName = "WorkerSliceNodeAffinityRecreationFailed" - EventWorkerSliceNodeAffinityRecreated EventName = "WorkerSliceNodeAffinityRecreated" - EventNodeAffinityRilesExpansionFailed EventName = "NodeAffinityRilesExpansionFailed" - EventSliceNodeAffinityConfigDeepCopyFailed EventName = "SliceNodeAffinityConfigDeepCopyFailed" - EventWorkerSliceNodeAffinityCreationFailed EventName = "WorkerSliceNodeAffinityCreationFailed" - EventWorkerSliceNodeAffinityCreated EventName = "WorkerSliceNodeAffinityCreated" - EventWorkerSliceNodeAffinityUpdateFailed EventName = "WorkerSliceNodeAffinityUpdateFailed" - EventWorkerSliceNodeAffinityUpdated EventName = "WorkerSliceNodeAffinityUpdated" - EventWorkerSliceNodeAffinityDeletionFailed EventName = "WorkerSliceNodeAffinityDeletionFailed" - EventWorkerSliceNodeAffinityDeleted EventName = "WorkerSliceNodeAffinityDeleted" - EventWorkerSliceResourceQuotaDeletedForcefully EventName = "WorkerSliceResourceQuotaDeletedForcefully" - EventWorkerSliceResourceQuotaRecreationFailed EventName = "WorkerSliceResourceQuotaRecreationFailed" - EventWorkerSliceResourceQuotaRecreated EventName = "WorkerSliceResourceQuotaRecreated" - EventOffBoardedNamespaceUtilizationMetricsReset EventName = "OffBoardedNamespaceUtilizationMetricsReset" - EventResourceQuotaMetricsPopulated EventName = "ResourceQuotaMetricsPopulated" - EventClusterCPULimitViolated EventName = "ClusterCPULimitViolated" - EventClusterMemoryLimitViolated EventName = "ClusterMemoryLimitViolated" - EventClusterPodCountViolated EventName = "ClusterPodCountViolated" - EventClusterEphemeralStorageLimitViolated EventName = "ClusterEphemeralStorageLimitViolated" - EventClusterCPURequestViolated EventName = "ClusterCPURequestViolated" - EventClusterMemoryRequestViolated EventName = "ClusterMemoryRequestViolated" - EventClusterEphemeralStorageRequestViolated EventName = "ClusterEphemeralStorageRequestViolated" - EventNamespaceCPULimitViolated EventName = "NamespaceCPULimitViolated" - EventNamespaceMemoryLimitViolated EventName = "NamespaceMemoryLimitViolated" - EventNamespacePodCountViolated EventName = "NamespacePodCountViolated" - EventNamespaceEphemeralStorageLimitViolated EventName = "NamespaceEphemeralStorageLimitViolated" - EventNamespaceCPURequestViolated EventName = "NamespaceCPURequestViolated" - EventNamespaceMemoryRequestViolated EventName = "NamespaceMemoryRequestViolated" - EventNamespaceEphemeralStorageRequestViolated EventName = "NamespaceEphemeralStorageRequestViolated" - EventSliceCPULimitViolated EventName = "SliceCPULimitViolated" - EventSliceMemoryLimitViolated EventName = "SliceMemoryLimitViolated" - EventSlicePodCountViolated EventName = "SlicePodCountViolated" - EventSliceEphemeralStorageLimitViolated EventName = "SliceEphemeralStorageLimitViolated" - EventSliceCPURequestViolated EventName = "SliceCPURequestViolated" - EventSliceMemoryRequestViolated EventName = "SliceMemoryRequestViolated" - EventSliceEphemeralStorageRequestViolated EventName = "SliceEphemeralStorageRequestViolated" - EventWorkerSliceResourceQuotaCreationFailed EventName = "WorkerSliceResourceQuotaCreationFailed" - EventWorkerSliceResourceQuotaCreated EventName = "WorkerSliceResourceQuotaCreated" - EventWorkerSliceResourceQuotaUpdateFailed EventName = "WorkerSliceResourceQuotaUpdateFailed" - EventWorkerSliceResourceQuotaUpdated EventName = "WorkerSliceResourceQuotaUpdated" - EventWorkerSliceResourceQuotaDeletionFailed EventName = "WorkerSliceResourceQuotaDeletionFailed" - EventWorkerSliceResourceQuotaDeleted EventName = "WorkerSliceResourceQuotaDeleted" - EventNetPolViolation EventName = "NetPolViolation" - EventClusterUnhealthy EventName = "ClusterUnhealthy" - EventClusterHealthy EventName = "ClusterHealthy" - EventClusterNodeIpUpdated EventName = "ClusterNodeIpUpdated" - EventClusterNodeIpUpdateFail EventName = "ClusterNodeIpUpdateFail" + EventExampleEvent EventName = "ExampleEvent" ) diff --git a/pkg/events/events_parser.go b/pkg/events/events_parser.go index 1d8ee09..6d8939b 100644 --- a/pkg/events/events_parser.go +++ b/pkg/events/events_parser.go @@ -29,9 +29,9 @@ type EventSchema struct { Message string } -func GetEvent(name EventName) (*EventSchema, error) { +func GetEvent(name EventName, eventsMap map[EventName]*EventSchema) (*EventSchema, error) { if _, ok := eventsMap[name]; !ok { - return nil, fmt.Errorf("Invalid event") + return nil, fmt.Errorf("invalid event") } return eventsMap[name], nil } diff --git a/pkg/events/events_test.go b/pkg/events/events_test.go index 0d2eef0..e7ec63a 100644 --- a/pkg/events/events_test.go +++ b/pkg/events/events_test.go @@ -39,7 +39,7 @@ func (o *k8sClientMock) DeleteAllOf(ctx context.Context, obj client.Object, opts func TestRecordEvent(t *testing.T) { clientMock := &k8sClientMock{} - recorder := events.NewEventRecorder(clientMock, newTestScheme(), events.EventRecorderOptions{ + recorder := events.NewEventRecorder(clientMock, newTestScheme(), events.EventsMap, events.EventRecorderOptions{ Version: "1", Cluster: "cluster-1", Component: "controller", @@ -52,7 +52,7 @@ func TestRecordEvent(t *testing.T) { Object: pod, RelatedObject: nil, ReportingInstance: "controller", - Name: events.EventSliceConfigDeletionFailed, + Name: events.EventExampleEvent, }) if err != nil { t.Error("event not recorded")