From 837b1b0a87148a1d63d0409d2270d33c4e433af0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Ho=C3=9F?= Date: Sun, 15 Sep 2024 06:51:59 +0200 Subject: [PATCH] add openshift/ocm-agent-operator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Sebastian Hoß --- .reuse/dep5 | 4 + code-generator/src/catalog.rs | 10 ++ .../managedfleetnotificationrecords.yaml | 87 ++++++++++++ .../v1alpha1/managedfleetnotifications.yaml | 84 ++++++++++++ .../v1alpha1/managednotifications.yaml | 129 ++++++++++++++++++ .../v1alpha1/ocmagents.yaml | 83 +++++++++++ kube-custom-resources-rs/Cargo.toml | 1 + kube-custom-resources-rs/src/lib.rs | 10 ++ .../src/ocmagent_managed_openshift_io/mod.rs | 1 + .../managedfleetnotificationrecords.rs | 53 +++++++ .../v1alpha1/managedfleetnotifications.rs | 58 ++++++++ .../v1alpha1/managednotifications.rs | 99 ++++++++++++++ .../v1alpha1/mod.rs | 4 + .../v1alpha1/ocmagents.rs | 56 ++++++++ 14 files changed, 679 insertions(+) create mode 100644 crd-catalog/openshift/ocm-agent-operator/ocmagent.managed.openshift.io/v1alpha1/managedfleetnotificationrecords.yaml create mode 100644 crd-catalog/openshift/ocm-agent-operator/ocmagent.managed.openshift.io/v1alpha1/managedfleetnotifications.yaml create mode 100644 crd-catalog/openshift/ocm-agent-operator/ocmagent.managed.openshift.io/v1alpha1/managednotifications.yaml create mode 100644 crd-catalog/openshift/ocm-agent-operator/ocmagent.managed.openshift.io/v1alpha1/ocmagents.yaml create mode 100644 kube-custom-resources-rs/src/ocmagent_managed_openshift_io/mod.rs create mode 100644 kube-custom-resources-rs/src/ocmagent_managed_openshift_io/v1alpha1/managedfleetnotificationrecords.rs create mode 100644 kube-custom-resources-rs/src/ocmagent_managed_openshift_io/v1alpha1/managedfleetnotifications.rs create mode 100644 kube-custom-resources-rs/src/ocmagent_managed_openshift_io/v1alpha1/managednotifications.rs create mode 100644 kube-custom-resources-rs/src/ocmagent_managed_openshift_io/v1alpha1/mod.rs create mode 100644 kube-custom-resources-rs/src/ocmagent_managed_openshift_io/v1alpha1/ocmagents.rs diff --git a/.reuse/dep5 b/.reuse/dep5 index 93baca419..ddfb05b2e 100644 --- a/.reuse/dep5 +++ b/.reuse/dep5 @@ -1003,6 +1003,10 @@ Files: crd-catalog/openshift/managed-upgrade-operator/* Copyright: The openshift/managed-upgrade-operator Authors License: Apache-2.0 +Files: crd-catalog/openshift/ocm-agent-operator/* +Copyright: The openshift/ocm-agent-operator Authors +License: Apache-2.0 + Files: crd-catalog/openshift/ptp-operator/* Copyright: The openshift/ptp-operator Authors License: Apache-2.0 diff --git a/code-generator/src/catalog.rs b/code-generator/src/catalog.rs index 330112517..50ea8b5e1 100644 --- a/code-generator/src/catalog.rs +++ b/code-generator/src/catalog.rs @@ -2545,6 +2545,16 @@ pub const CRD_V1_SOURCES: &'static [UpstreamSource] = &[ "https://github.com/openshift/managed-upgrade-operator/blob/master/deploy/crds/upgrade.managed.openshift.io_upgradeconfigs.yaml", ], }, + UpstreamSource { + project_name: "openshift/ocm-agent-operator", + license: APACHE_V2, + urls: &[ + "https://github.com/openshift/ocm-agent-operator/blob/master/deploy/crds/ocmagent.managed.openshift.io_managedfleetnotificationrecords.yaml", + "https://github.com/openshift/ocm-agent-operator/blob/master/deploy/crds/ocmagent.managed.openshift.io_managedfleetnotifications.yaml", + "https://github.com/openshift/ocm-agent-operator/blob/master/deploy/crds/ocmagent.managed.openshift.io_managednotifications.yaml", + "https://github.com/openshift/ocm-agent-operator/blob/master/deploy/crds/ocmagent.managed.openshift.io_ocmagents.yaml", + ], + }, UpstreamSource { project_name: "openshift/ptp-operator", license: APACHE_V2, diff --git a/crd-catalog/openshift/ocm-agent-operator/ocmagent.managed.openshift.io/v1alpha1/managedfleetnotificationrecords.yaml b/crd-catalog/openshift/ocm-agent-operator/ocmagent.managed.openshift.io/v1alpha1/managedfleetnotificationrecords.yaml new file mode 100644 index 000000000..e3bec3df6 --- /dev/null +++ b/crd-catalog/openshift/ocm-agent-operator/ocmagent.managed.openshift.io/v1alpha1/managedfleetnotificationrecords.yaml @@ -0,0 +1,87 @@ +apiVersion: "apiextensions.k8s.io/v1" +kind: "CustomResourceDefinition" +metadata: + annotations: + controller-gen.kubebuilder.io/version: "v0.15.0" + name: "managedfleetnotificationrecords.ocmagent.managed.openshift.io" +spec: + group: "ocmagent.managed.openshift.io" + names: + kind: "ManagedFleetNotificationRecord" + listKind: "ManagedFleetNotificationRecordList" + plural: "managedfleetnotificationrecords" + shortNames: + - "mfnr" + singular: "managedfleetnotificationrecord" + scope: "Namespaced" + versions: + - name: "v1alpha1" + schema: + openAPIV3Schema: + description: "ManagedFleetNotificationRecord is the Schema for the managedfleetnotificationrecords API" + properties: + apiVersion: + description: "APIVersion defines the versioned schema of this representation of an object.\nServers should convert recognized schemas to the latest internal value, and\nmay reject unrecognized values.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources" + type: "string" + kind: + description: "Kind is a string value representing the REST resource this object represents.\nServers may infer this from the endpoint the client submits requests to.\nCannot be updated.\nIn CamelCase.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds" + type: "string" + metadata: + type: "object" + status: + description: "ManagedFleetNotificationRecordStatus defines the observed state of ManagedFleetNotificationRecord" + properties: + managementCluster: + description: "Managed Fleet Notification name" + type: "string" + notificationRecordByName: + description: "An array structure to record the history for each hosted cluster" + items: + description: "NotificationRecordByName groups the notification record item by notification name" + properties: + notificationName: + description: "Name of the notification" + type: "string" + notificationRecordItems: + description: "Notification record item with the notification name" + items: + description: "NotificationRecordItem defines the basic structure of a notification record" + properties: + firingNotificationSentCount: + description: "FiringNotificationSentCount records the number of notifications sent for the alert status firing" + type: "integer" + hostedClusterID: + description: "The uuid for the hosted cluster per entry" + type: "string" + lastTransitionTime: + description: "The last notification sent timestamp" + format: "date-time" + type: "string" + resolvedNotificationSentCount: + description: "ResolvedNotificationSentCount records the number of notifications sent for the alert status resolving" + type: "integer" + required: + - "firingNotificationSentCount" + - "hostedClusterID" + - "resolvedNotificationSentCount" + type: "object" + type: "array" + resendWait: + description: "Resend interval for the notification" + format: "int32" + type: "integer" + required: + - "notificationName" + - "notificationRecordItems" + - "resendWait" + type: "object" + type: "array" + required: + - "managementCluster" + - "notificationRecordByName" + type: "object" + type: "object" + served: true + storage: true + subresources: + status: {} diff --git a/crd-catalog/openshift/ocm-agent-operator/ocmagent.managed.openshift.io/v1alpha1/managedfleetnotifications.yaml b/crd-catalog/openshift/ocm-agent-operator/ocmagent.managed.openshift.io/v1alpha1/managedfleetnotifications.yaml new file mode 100644 index 000000000..49812d459 --- /dev/null +++ b/crd-catalog/openshift/ocm-agent-operator/ocmagent.managed.openshift.io/v1alpha1/managedfleetnotifications.yaml @@ -0,0 +1,84 @@ +apiVersion: "apiextensions.k8s.io/v1" +kind: "CustomResourceDefinition" +metadata: + annotations: + controller-gen.kubebuilder.io/version: "v0.15.0" + name: "managedfleetnotifications.ocmagent.managed.openshift.io" +spec: + group: "ocmagent.managed.openshift.io" + names: + kind: "ManagedFleetNotification" + listKind: "ManagedFleetNotificationList" + plural: "managedfleetnotifications" + shortNames: + - "mfn" + singular: "managedfleetnotification" + scope: "Namespaced" + versions: + - name: "v1alpha1" + schema: + openAPIV3Schema: + description: "ManagedFleetNotification is the Schema for the managedfleetnotifications API" + properties: + apiVersion: + description: "APIVersion defines the versioned schema of this representation of an object.\nServers should convert recognized schemas to the latest internal value, and\nmay reject unrecognized values.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources" + type: "string" + kind: + description: "Kind is a string value representing the REST resource this object represents.\nServers may infer this from the endpoint the client submits requests to.\nCannot be updated.\nIn CamelCase.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds" + type: "string" + metadata: + type: "object" + spec: + properties: + fleetNotification: + description: "FleetNotification defines the desired spec of ManagedFleetNotification" + properties: + limitedSupport: + description: "Whether or not limited support should be sent for this notification" + type: "boolean" + logType: + description: "LogType is a categorization property that can be used to group service logs for aggregation and managing notification preferences." + type: "string" + name: + description: "The name of the notification used to associate with an alert" + type: "string" + notificationMessage: + description: "The body text of the notification when the alert is active" + type: "string" + references: + description: "References useful for context or remediation - this could be links to documentation, KB articles, etc" + items: + pattern: "^https?:\\/\\/.+$" + type: "string" + type: "array" + resendWait: + description: "Measured in hours. The minimum time interval that must elapse between active notifications" + format: "int32" + type: "integer" + severity: + description: "Re-use the severity definitation in managednotification_types" + enum: + - "Debug" + - "Info" + - "Warning" + - "Error" + - "Fatal" + type: "string" + summary: + description: "The summary line of the notification" + type: "string" + required: + - "name" + - "notificationMessage" + - "resendWait" + - "severity" + - "summary" + type: "object" + required: + - "fleetNotification" + type: "object" + type: "object" + served: true + storage: true + subresources: + status: {} diff --git a/crd-catalog/openshift/ocm-agent-operator/ocmagent.managed.openshift.io/v1alpha1/managednotifications.yaml b/crd-catalog/openshift/ocm-agent-operator/ocmagent.managed.openshift.io/v1alpha1/managednotifications.yaml new file mode 100644 index 000000000..e58bacec9 --- /dev/null +++ b/crd-catalog/openshift/ocm-agent-operator/ocmagent.managed.openshift.io/v1alpha1/managednotifications.yaml @@ -0,0 +1,129 @@ +apiVersion: "apiextensions.k8s.io/v1" +kind: "CustomResourceDefinition" +metadata: + annotations: + controller-gen.kubebuilder.io/version: "v0.15.0" + name: "managednotifications.ocmagent.managed.openshift.io" +spec: + group: "ocmagent.managed.openshift.io" + names: + kind: "ManagedNotification" + listKind: "ManagedNotificationList" + plural: "managednotifications" + singular: "managednotification" + scope: "Namespaced" + versions: + - name: "v1alpha1" + schema: + openAPIV3Schema: + description: "ManagedNotification is the Schema for the managednotifications API" + properties: + apiVersion: + description: "APIVersion defines the versioned schema of this representation of an object.\nServers should convert recognized schemas to the latest internal value, and\nmay reject unrecognized values.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources" + type: "string" + kind: + description: "Kind is a string value representing the REST resource this object represents.\nServers may infer this from the endpoint the client submits requests to.\nCannot be updated.\nIn CamelCase.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds" + type: "string" + metadata: + type: "object" + spec: + description: "ManagedNotificationSpec defines the desired state of ManagedNotification" + properties: + notifications: + description: "AgentConfig refers to OCM agent config fields separated" + items: + properties: + activeBody: + description: "The body text of the Service Log notification when the alert is active" + type: "string" + logType: + description: "LogType is a categorization property that can be used to group service logs for aggregation and managing notification preferences." + type: "string" + name: + description: "The name of the notification used to associate with an alert" + type: "string" + references: + description: "References useful for context or remediation - this could be links to documentation, KB articles, etc" + items: + pattern: "^https?:\\/\\/.+$" + type: "string" + type: "array" + resendWait: + description: "Measured in hours. The minimum time interval that must elapse between active Service Log notifications" + format: "int32" + type: "integer" + resolvedBody: + description: "The body text of the Service Log notification when the alert is resolved" + type: "string" + severity: + description: "The severity of the Service Log notification" + enum: + - "Debug" + - "Info" + - "Warning" + - "Major" + - "Critical" + type: "string" + summary: + description: "The summary line of the Service Log notification" + type: "string" + required: + - "activeBody" + - "name" + - "resendWait" + - "severity" + - "summary" + type: "object" + type: "array" + required: + - "notifications" + type: "object" + status: + description: "ManagedNotificationStatus defines the observed state of ManagedNotification" + properties: + notificationRecords: + items: + properties: + conditions: + description: "Conditions is a set of Condition instances." + items: + properties: + lastTransitionTime: + description: "Last time the condition transit from one status to another." + format: "date-time" + type: "string" + reason: + description: "(brief) reason for the condition's last transition." + type: "string" + status: + description: "Status of condition, one of True, False, Unknown" + type: "string" + type: + description: "Type of Notification condition" + enum: + - "AlertFiring" + - "AlertResolved" + - "ServiceLogSent" + type: "string" + required: + - "status" + - "type" + type: "object" + type: "array" + name: + description: "Name of the notification" + type: "string" + serviceLogSentCount: + description: "ServiceLogSentCount records the number of service logs sent for the notification" + format: "int32" + type: "integer" + required: + - "name" + type: "object" + type: "array" + type: "object" + type: "object" + served: true + storage: true + subresources: + status: {} diff --git a/crd-catalog/openshift/ocm-agent-operator/ocmagent.managed.openshift.io/v1alpha1/ocmagents.yaml b/crd-catalog/openshift/ocm-agent-operator/ocmagent.managed.openshift.io/v1alpha1/ocmagents.yaml new file mode 100644 index 000000000..44a56e8bf --- /dev/null +++ b/crd-catalog/openshift/ocm-agent-operator/ocmagent.managed.openshift.io/v1alpha1/ocmagents.yaml @@ -0,0 +1,83 @@ +apiVersion: "apiextensions.k8s.io/v1" +kind: "CustomResourceDefinition" +metadata: + annotations: + controller-gen.kubebuilder.io/version: "v0.15.0" + name: "ocmagents.ocmagent.managed.openshift.io" +spec: + group: "ocmagent.managed.openshift.io" + names: + kind: "OcmAgent" + listKind: "OcmAgentList" + plural: "ocmagents" + singular: "ocmagent" + scope: "Namespaced" + versions: + - name: "v1alpha1" + schema: + openAPIV3Schema: + description: "OcmAgent is the Schema for the ocmagents API" + properties: + apiVersion: + description: "APIVersion defines the versioned schema of this representation of an object.\nServers should convert recognized schemas to the latest internal value, and\nmay reject unrecognized values.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources" + type: "string" + kind: + description: "Kind is a string value representing the REST resource this object represents.\nServers may infer this from the endpoint the client submits requests to.\nCannot be updated.\nIn CamelCase.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds" + type: "string" + metadata: + type: "object" + spec: + description: "OcmAgentSpec defines the desired state of OcmAgent" + properties: + agentConfig: + description: "AgentConfig refers to OCM agent config fields separated" + properties: + ocmBaseUrl: + description: "OcmBaseUrl defines the OCM api endpoint for OCM agent to access" + type: "string" + services: + description: "Services defines the supported OCM services, eg, service_log, cluster_management" + items: + type: "string" + type: "array" + required: + - "ocmBaseUrl" + - "services" + type: "object" + fleetMode: + description: "FleetMode indicates if the OCM agent is running in fleet mode, default to false" + type: "boolean" + ocmAgentImage: + description: "OcmAgentImage defines the image which will be used by the OCM Agent" + type: "string" + replicas: + description: "Replicas defines the replica count for the OCM Agent service" + format: "int32" + type: "integer" + tokenSecret: + description: "TokenSecret points to the secret name which stores the access token to OCM server" + type: "string" + required: + - "agentConfig" + - "ocmAgentImage" + - "replicas" + - "tokenSecret" + type: "object" + status: + description: "OcmAgentStatus defines the observed state of OcmAgent" + properties: + availableReplicas: + format: "int32" + type: "integer" + serviceStatus: + description: "ServiceStatus indicates the status of OCM Agent service" + type: "string" + required: + - "availableReplicas" + - "serviceStatus" + type: "object" + type: "object" + served: true + storage: true + subresources: + status: {} diff --git a/kube-custom-resources-rs/Cargo.toml b/kube-custom-resources-rs/Cargo.toml index b0a5a037b..6467a0ec8 100644 --- a/kube-custom-resources-rs/Cargo.toml +++ b/kube-custom-resources-rs/Cargo.toml @@ -289,6 +289,7 @@ nodeinfo_volcano_sh = [] notebook_kubedl_io = [] notification_toolkit_fluxcd_io = [] objectbucket_io = [] +ocmagent_managed_openshift_io = [] onepassword_com = [] opensearchservice_services_k8s_aws = [] opentelemetry_io = [] diff --git a/kube-custom-resources-rs/src/lib.rs b/kube-custom-resources-rs/src/lib.rs index fe0ba9878..4d44f055c 100644 --- a/kube-custom-resources-rs/src/lib.rs +++ b/kube-custom-resources-rs/src/lib.rs @@ -2321,6 +2321,14 @@ apiVersion `objectbucket.io/v1alpha1`: - `ObjectBucketClaim` - `ObjectBucket` +## ocmagent_managed_openshift_io + +apiVersion `ocmagent.managed.openshift.io/v1alpha1`: +- `ManagedFleetNotificationRecord` +- `ManagedFleetNotification` +- `ManagedNotification` +- `OcmAgent` + ## onepassword_com apiVersion `onepassword.com/v1`: @@ -3796,6 +3804,8 @@ pub mod notebook_kubedl_io; pub mod notification_toolkit_fluxcd_io; #[cfg(feature = "objectbucket_io")] pub mod objectbucket_io; +#[cfg(feature = "ocmagent_managed_openshift_io")] +pub mod ocmagent_managed_openshift_io; #[cfg(feature = "onepassword_com")] pub mod onepassword_com; #[cfg(feature = "opensearchservice_services_k8s_aws")] diff --git a/kube-custom-resources-rs/src/ocmagent_managed_openshift_io/mod.rs b/kube-custom-resources-rs/src/ocmagent_managed_openshift_io/mod.rs new file mode 100644 index 000000000..32a5a9d4f --- /dev/null +++ b/kube-custom-resources-rs/src/ocmagent_managed_openshift_io/mod.rs @@ -0,0 +1 @@ +pub mod v1alpha1; diff --git a/kube-custom-resources-rs/src/ocmagent_managed_openshift_io/v1alpha1/managedfleetnotificationrecords.rs b/kube-custom-resources-rs/src/ocmagent_managed_openshift_io/v1alpha1/managedfleetnotificationrecords.rs new file mode 100644 index 000000000..eee4f623f --- /dev/null +++ b/kube-custom-resources-rs/src/ocmagent_managed_openshift_io/v1alpha1/managedfleetnotificationrecords.rs @@ -0,0 +1,53 @@ +// WARNING: generated by kopium - manual changes will be overwritten +// kopium command: kopium --docs --filename=./crd-catalog/openshift/ocm-agent-operator/ocmagent.managed.openshift.io/v1alpha1/managedfleetnotificationrecords.yaml --derive=Default --derive=PartialEq --smart-derive-elision +// kopium version: 0.21.1 + +#[allow(unused_imports)] +mod prelude { + pub use kube::CustomResource; + pub use serde::{Serialize, Deserialize}; +} +use self::prelude::*; + +/// ManagedFleetNotificationRecordStatus defines the observed state of ManagedFleetNotificationRecord +#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)] +pub struct ManagedFleetNotificationRecordStatus { + /// Managed Fleet Notification name + #[serde(rename = "managementCluster")] + pub management_cluster: String, + /// An array structure to record the history for each hosted cluster + #[serde(rename = "notificationRecordByName")] + pub notification_record_by_name: Vec, +} + +/// NotificationRecordByName groups the notification record item by notification name +#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)] +pub struct ManagedFleetNotificationRecordStatusNotificationRecordByName { + /// Name of the notification + #[serde(rename = "notificationName")] + pub notification_name: String, + /// Notification record item with the notification name + #[serde(rename = "notificationRecordItems")] + pub notification_record_items: Vec, + /// Resend interval for the notification + #[serde(rename = "resendWait")] + pub resend_wait: i32, +} + +/// NotificationRecordItem defines the basic structure of a notification record +#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)] +pub struct ManagedFleetNotificationRecordStatusNotificationRecordByNameNotificationRecordItems { + /// FiringNotificationSentCount records the number of notifications sent for the alert status firing + #[serde(rename = "firingNotificationSentCount")] + pub firing_notification_sent_count: i64, + /// The uuid for the hosted cluster per entry + #[serde(rename = "hostedClusterID")] + pub hosted_cluster_id: String, + /// The last notification sent timestamp + #[serde(default, skip_serializing_if = "Option::is_none", rename = "lastTransitionTime")] + pub last_transition_time: Option, + /// ResolvedNotificationSentCount records the number of notifications sent for the alert status resolving + #[serde(rename = "resolvedNotificationSentCount")] + pub resolved_notification_sent_count: i64, +} + diff --git a/kube-custom-resources-rs/src/ocmagent_managed_openshift_io/v1alpha1/managedfleetnotifications.rs b/kube-custom-resources-rs/src/ocmagent_managed_openshift_io/v1alpha1/managedfleetnotifications.rs new file mode 100644 index 000000000..cd7b1e3cb --- /dev/null +++ b/kube-custom-resources-rs/src/ocmagent_managed_openshift_io/v1alpha1/managedfleetnotifications.rs @@ -0,0 +1,58 @@ +// WARNING: generated by kopium - manual changes will be overwritten +// kopium command: kopium --docs --filename=./crd-catalog/openshift/ocm-agent-operator/ocmagent.managed.openshift.io/v1alpha1/managedfleetnotifications.yaml --derive=Default --derive=PartialEq --smart-derive-elision +// kopium version: 0.21.1 + +#[allow(unused_imports)] +mod prelude { + pub use kube::CustomResource; + pub use serde::{Serialize, Deserialize}; +} +use self::prelude::*; + +#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, PartialEq)] +#[kube(group = "ocmagent.managed.openshift.io", version = "v1alpha1", kind = "ManagedFleetNotification", plural = "managedfleetnotifications")] +#[kube(namespaced)] +#[kube(schema = "disabled")] +#[kube(derive="PartialEq")] +pub struct ManagedFleetNotificationSpec { + /// FleetNotification defines the desired spec of ManagedFleetNotification + #[serde(rename = "fleetNotification")] + pub fleet_notification: ManagedFleetNotificationFleetNotification, +} + +/// FleetNotification defines the desired spec of ManagedFleetNotification +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] +pub struct ManagedFleetNotificationFleetNotification { + /// Whether or not limited support should be sent for this notification + #[serde(default, skip_serializing_if = "Option::is_none", rename = "limitedSupport")] + pub limited_support: Option, + /// LogType is a categorization property that can be used to group service logs for aggregation and managing notification preferences. + #[serde(default, skip_serializing_if = "Option::is_none", rename = "logType")] + pub log_type: Option, + /// The name of the notification used to associate with an alert + pub name: String, + /// The body text of the notification when the alert is active + #[serde(rename = "notificationMessage")] + pub notification_message: String, + /// References useful for context or remediation - this could be links to documentation, KB articles, etc + #[serde(default, skip_serializing_if = "Option::is_none")] + pub references: Option>, + /// Measured in hours. The minimum time interval that must elapse between active notifications + #[serde(rename = "resendWait")] + pub resend_wait: i32, + /// Re-use the severity definitation in managednotification_types + pub severity: ManagedFleetNotificationFleetNotificationSeverity, + /// The summary line of the notification + pub summary: String, +} + +/// FleetNotification defines the desired spec of ManagedFleetNotification +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] +pub enum ManagedFleetNotificationFleetNotificationSeverity { + Debug, + Info, + Warning, + Error, + Fatal, +} + diff --git a/kube-custom-resources-rs/src/ocmagent_managed_openshift_io/v1alpha1/managednotifications.rs b/kube-custom-resources-rs/src/ocmagent_managed_openshift_io/v1alpha1/managednotifications.rs new file mode 100644 index 000000000..d21ebafda --- /dev/null +++ b/kube-custom-resources-rs/src/ocmagent_managed_openshift_io/v1alpha1/managednotifications.rs @@ -0,0 +1,99 @@ +// WARNING: generated by kopium - manual changes will be overwritten +// kopium command: kopium --docs --filename=./crd-catalog/openshift/ocm-agent-operator/ocmagent.managed.openshift.io/v1alpha1/managednotifications.yaml --derive=Default --derive=PartialEq --smart-derive-elision +// kopium version: 0.21.1 + +#[allow(unused_imports)] +mod prelude { + pub use kube::CustomResource; + pub use serde::{Serialize, Deserialize}; +} +use self::prelude::*; + +/// ManagedNotificationSpec defines the desired state of ManagedNotification +#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, Default, PartialEq)] +#[kube(group = "ocmagent.managed.openshift.io", version = "v1alpha1", kind = "ManagedNotification", plural = "managednotifications")] +#[kube(namespaced)] +#[kube(status = "ManagedNotificationStatus")] +#[kube(schema = "disabled")] +#[kube(derive="Default")] +#[kube(derive="PartialEq")] +pub struct ManagedNotificationSpec { + /// AgentConfig refers to OCM agent config fields separated + pub notifications: Vec, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] +pub struct ManagedNotificationNotifications { + /// The body text of the Service Log notification when the alert is active + #[serde(rename = "activeBody")] + pub active_body: String, + /// LogType is a categorization property that can be used to group service logs for aggregation and managing notification preferences. + #[serde(default, skip_serializing_if = "Option::is_none", rename = "logType")] + pub log_type: Option, + /// The name of the notification used to associate with an alert + pub name: String, + /// References useful for context or remediation - this could be links to documentation, KB articles, etc + #[serde(default, skip_serializing_if = "Option::is_none")] + pub references: Option>, + /// Measured in hours. The minimum time interval that must elapse between active Service Log notifications + #[serde(rename = "resendWait")] + pub resend_wait: i32, + /// The body text of the Service Log notification when the alert is resolved + #[serde(default, skip_serializing_if = "Option::is_none", rename = "resolvedBody")] + pub resolved_body: Option, + /// The severity of the Service Log notification + pub severity: ManagedNotificationNotificationsSeverity, + /// The summary line of the Service Log notification + pub summary: String, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] +pub enum ManagedNotificationNotificationsSeverity { + Debug, + Info, + Warning, + Major, + Critical, +} + +/// ManagedNotificationStatus defines the observed state of ManagedNotification +#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)] +pub struct ManagedNotificationStatus { + #[serde(default, skip_serializing_if = "Option::is_none", rename = "notificationRecords")] + pub notification_records: Option>, +} + +#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)] +pub struct ManagedNotificationStatusNotificationRecords { + /// Conditions is a set of Condition instances. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub conditions: Option>, + /// Name of the notification + pub name: String, + /// ServiceLogSentCount records the number of service logs sent for the notification + #[serde(default, skip_serializing_if = "Option::is_none", rename = "serviceLogSentCount")] + pub service_log_sent_count: Option, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] +pub struct ManagedNotificationStatusNotificationRecordsConditions { + /// Last time the condition transit from one status to another. + #[serde(default, skip_serializing_if = "Option::is_none", rename = "lastTransitionTime")] + pub last_transition_time: Option, + /// (brief) reason for the condition's last transition. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub reason: Option, + /// Status of condition, one of True, False, Unknown + pub status: String, + /// Type of Notification condition + #[serde(rename = "type")] + pub r#type: ManagedNotificationStatusNotificationRecordsConditionsType, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] +pub enum ManagedNotificationStatusNotificationRecordsConditionsType { + AlertFiring, + AlertResolved, + ServiceLogSent, +} + diff --git a/kube-custom-resources-rs/src/ocmagent_managed_openshift_io/v1alpha1/mod.rs b/kube-custom-resources-rs/src/ocmagent_managed_openshift_io/v1alpha1/mod.rs new file mode 100644 index 000000000..a3f732b69 --- /dev/null +++ b/kube-custom-resources-rs/src/ocmagent_managed_openshift_io/v1alpha1/mod.rs @@ -0,0 +1,4 @@ +pub mod managedfleetnotificationrecords; +pub mod managedfleetnotifications; +pub mod managednotifications; +pub mod ocmagents; diff --git a/kube-custom-resources-rs/src/ocmagent_managed_openshift_io/v1alpha1/ocmagents.rs b/kube-custom-resources-rs/src/ocmagent_managed_openshift_io/v1alpha1/ocmagents.rs new file mode 100644 index 000000000..3c50cf8d7 --- /dev/null +++ b/kube-custom-resources-rs/src/ocmagent_managed_openshift_io/v1alpha1/ocmagents.rs @@ -0,0 +1,56 @@ +// WARNING: generated by kopium - manual changes will be overwritten +// kopium command: kopium --docs --filename=./crd-catalog/openshift/ocm-agent-operator/ocmagent.managed.openshift.io/v1alpha1/ocmagents.yaml --derive=Default --derive=PartialEq --smart-derive-elision +// kopium version: 0.21.1 + +#[allow(unused_imports)] +mod prelude { + pub use kube::CustomResource; + pub use serde::{Serialize, Deserialize}; +} +use self::prelude::*; + +/// OcmAgentSpec defines the desired state of OcmAgent +#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, Default, PartialEq)] +#[kube(group = "ocmagent.managed.openshift.io", version = "v1alpha1", kind = "OcmAgent", plural = "ocmagents")] +#[kube(namespaced)] +#[kube(status = "OcmAgentStatus")] +#[kube(schema = "disabled")] +#[kube(derive="Default")] +#[kube(derive="PartialEq")] +pub struct OcmAgentSpec { + /// AgentConfig refers to OCM agent config fields separated + #[serde(rename = "agentConfig")] + pub agent_config: OcmAgentAgentConfig, + /// FleetMode indicates if the OCM agent is running in fleet mode, default to false + #[serde(default, skip_serializing_if = "Option::is_none", rename = "fleetMode")] + pub fleet_mode: Option, + /// OcmAgentImage defines the image which will be used by the OCM Agent + #[serde(rename = "ocmAgentImage")] + pub ocm_agent_image: String, + /// Replicas defines the replica count for the OCM Agent service + pub replicas: i32, + /// TokenSecret points to the secret name which stores the access token to OCM server + #[serde(rename = "tokenSecret")] + pub token_secret: String, +} + +/// AgentConfig refers to OCM agent config fields separated +#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)] +pub struct OcmAgentAgentConfig { + /// OcmBaseUrl defines the OCM api endpoint for OCM agent to access + #[serde(rename = "ocmBaseUrl")] + pub ocm_base_url: String, + /// Services defines the supported OCM services, eg, service_log, cluster_management + pub services: Vec, +} + +/// OcmAgentStatus defines the observed state of OcmAgent +#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)] +pub struct OcmAgentStatus { + #[serde(rename = "availableReplicas")] + pub available_replicas: i32, + /// ServiceStatus indicates the status of OCM Agent service + #[serde(rename = "serviceStatus")] + pub service_status: String, +} +