diff --git a/.reuse/dep5 b/.reuse/dep5 index 5d7b49dd3..99f7eada3 100644 --- a/.reuse/dep5 +++ b/.reuse/dep5 @@ -715,6 +715,10 @@ Files: crd-catalog/openshift/hive/* Copyright: The openshift/hive Authors License: Apache-2.0 +Files: crd-catalog/openshift/managed-upgrade-operator/* +Copyright: The openshift/managed-upgrade-operator Authors +License: Apache-2.0 + Files: crd-catalog/otterize/helm-charts/* Copyright: The otterize/helm-charts Authors License: Apache-2.0 diff --git a/code-generator/src/catalog.rs b/code-generator/src/catalog.rs index a258247ec..39e977bb6 100644 --- a/code-generator/src/catalog.rs +++ b/code-generator/src/catalog.rs @@ -1940,6 +1940,13 @@ pub const CRD_V1_SOURCES: &'static [UpstreamSource] = &[ "https://github.com/openshift/hive/blob/master/config/crds/hiveinternal.openshift.io_fakeclusterinstalls.yaml", ], }, + UpstreamSource { + project_name: "openshift/managed-upgrade-operator", + license: APACHE_V2, + urls: &[ + "https://github.com/openshift/managed-upgrade-operator/blob/master/deploy/crds/upgrade.managed.openshift.io_upgradeconfigs.yaml", + ], + }, UpstreamSource { project_name: "otterize/helm-charts", license: APACHE_V2, diff --git a/crd-catalog/openshift/managed-upgrade-operator/upgrade.managed.openshift.io/v1alpha1/upgradeconfigs.args b/crd-catalog/openshift/managed-upgrade-operator/upgrade.managed.openshift.io/v1alpha1/upgradeconfigs.args new file mode 100644 index 000000000..7ab47510b --- /dev/null +++ b/crd-catalog/openshift/managed-upgrade-operator/upgrade.managed.openshift.io/v1alpha1/upgradeconfigs.args @@ -0,0 +1 @@ +--derive=PartialEq diff --git a/crd-catalog/openshift/managed-upgrade-operator/upgrade.managed.openshift.io/v1alpha1/upgradeconfigs.yaml b/crd-catalog/openshift/managed-upgrade-operator/upgrade.managed.openshift.io/v1alpha1/upgradeconfigs.yaml new file mode 100644 index 000000000..dd9d56344 --- /dev/null +++ b/crd-catalog/openshift/managed-upgrade-operator/upgrade.managed.openshift.io/v1alpha1/upgradeconfigs.yaml @@ -0,0 +1,168 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.13.0 + name: upgradeconfigs.upgrade.managed.openshift.io +spec: + group: upgrade.managed.openshift.io + names: + kind: UpgradeConfig + listKind: UpgradeConfigList + plural: upgradeconfigs + shortNames: + - upgrade + singular: upgradeconfig + scope: Namespaced + versions: + - additionalPrinterColumns: + - jsonPath: .spec.desired.version + name: desired_version + type: string + - jsonPath: .status.history[0].phase + name: phase + type: string + - jsonPath: .status.history[0].conditions[0].type + name: stage + type: string + - jsonPath: .status.history[0].conditions[0].status + name: status + type: string + - jsonPath: .status.history[0].conditions[0].reason + name: reason + type: string + - jsonPath: .status.history[0].conditions[0].message + name: message + type: string + name: v1alpha1 + schema: + openAPIV3Schema: + description: UpgradeConfig is the Schema for the upgradeconfigs API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More 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. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: UpgradeConfigSpec defines the desired state of UpgradeConfig and upgrade window and freeze window + properties: + PDBForceDrainTimeout: + description: The maximum grace period granted to a node whose drain is blocked by a Pod Disruption Budget, before that drain is forced. Measured in minutes. The minimum accepted value is 0 and in this case it will trigger force drain after the expectedNodeDrainTime lapsed. + format: int32 + minimum: 0.0 + type: integer + capacityReservation: + description: Specify if scaling up an extra node for capacity reservation before upgrade starts is needed + type: boolean + desired: + description: Specify the desired OpenShift release + properties: + channel: + description: Channel used for upgrades + type: string + image: + description: Image reference used for upgrades + type: string + version: + description: Version of openshift release + type: string + type: object + type: + description: Type indicates the ClusterUpgrader implementation to use to perform an upgrade of the cluster + enum: + - OSD + - ARO + type: string + upgradeAt: + description: Specify the upgrade start time + type: string + required: + - PDBForceDrainTimeout + - desired + - type + - upgradeAt + type: object + status: + description: UpgradeConfigStatus defines the observed state of UpgradeConfig + properties: + history: + description: This record history of every upgrade + items: + description: UpgradeHistory record history of upgrade + properties: + completeTime: + format: date-time + type: string + conditions: + description: Conditions is a set of Condition instances. + items: + description: UpgradeCondition houses fields that describe the state of an Upgrade including metadata. + properties: + completeTime: + description: Complete time of this condition. + format: date-time + type: string + lastProbeTime: + description: Last time the condition was checked. + format: date-time + type: string + lastTransitionTime: + description: Last time the condition transit from one status to another. + format: date-time + type: string + message: + description: Human readable message indicating details about last transition. + type: string + reason: + description: (brief) reason for the condition's last transition. + type: string + startTime: + description: Start time of this condition. + format: date-time + type: string + status: + description: Status of condition, one of True, False, Unknown + type: string + type: + description: Type of upgrade condition + type: string + required: + - status + - type + type: object + type: array + phase: + description: This describe the status of the upgrade process + enum: + - New + - Pending + - Upgrading + - Upgraded + - Failed + type: string + startTime: + format: date-time + type: string + version: + description: Desired version of this upgrade + type: string + workerCompleteTime: + format: date-time + type: string + workerStartTime: + format: date-time + type: string + required: + - phase + type: object + type: array + 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 ab710702a..1e4f64888 100644 --- a/kube-custom-resources-rs/Cargo.toml +++ b/kube-custom-resources-rs/Cargo.toml @@ -282,6 +282,7 @@ topology_node_k8s_io = [] topolvm_cybozu_com = [] traefik_io = [] training_kubedl_io = [] +upgrade_managed_openshift_io = [] virt_virtink_smartx_com = [] wgpolicyk8s_io = [] wildfly_org = [] diff --git a/kube-custom-resources-rs/src/lib.rs b/kube-custom-resources-rs/src/lib.rs index 3b9431b42..b96cedb67 100644 --- a/kube-custom-resources-rs/src/lib.rs +++ b/kube-custom-resources-rs/src/lib.rs @@ -2598,6 +2598,12 @@ Every group has its own feature in this crate. The available features are as fol - `XDLJob` - `XGBoostJob` +## upgrade_managed_openshift_io + +- apiVersion: `upgrade.managed.openshift.io/v1alpha1` +- kinds: + - `UpgradeConfig` + ## virt_virtink_smartx_com - apiVersion: `virt.virtink.smartx.com/v1alpha1` @@ -3167,6 +3173,8 @@ pub mod topolvm_cybozu_com; pub mod traefik_io; #[cfg(feature = "training_kubedl_io")] pub mod training_kubedl_io; +#[cfg(feature = "upgrade_managed_openshift_io")] +pub mod upgrade_managed_openshift_io; #[cfg(feature = "virt_virtink_smartx_com")] pub mod virt_virtink_smartx_com; #[cfg(feature = "wgpolicyk8s_io")] diff --git a/kube-custom-resources-rs/src/upgrade_managed_openshift_io/mod.rs b/kube-custom-resources-rs/src/upgrade_managed_openshift_io/mod.rs new file mode 100644 index 000000000..32a5a9d4f --- /dev/null +++ b/kube-custom-resources-rs/src/upgrade_managed_openshift_io/mod.rs @@ -0,0 +1 @@ +pub mod v1alpha1; diff --git a/kube-custom-resources-rs/src/upgrade_managed_openshift_io/v1alpha1/mod.rs b/kube-custom-resources-rs/src/upgrade_managed_openshift_io/v1alpha1/mod.rs new file mode 100644 index 000000000..c2cff4c0b --- /dev/null +++ b/kube-custom-resources-rs/src/upgrade_managed_openshift_io/v1alpha1/mod.rs @@ -0,0 +1 @@ +pub mod upgradeconfigs; diff --git a/kube-custom-resources-rs/src/upgrade_managed_openshift_io/v1alpha1/upgradeconfigs.rs b/kube-custom-resources-rs/src/upgrade_managed_openshift_io/v1alpha1/upgradeconfigs.rs new file mode 100644 index 000000000..453739e95 --- /dev/null +++ b/kube-custom-resources-rs/src/upgrade_managed_openshift_io/v1alpha1/upgradeconfigs.rs @@ -0,0 +1,120 @@ +// WARNING: generated by kopium - manual changes will be overwritten +// kopium command: kopium --docs --filename=./crd-catalog/openshift/managed-upgrade-operator/upgrade.managed.openshift.io/v1alpha1/upgradeconfigs.yaml --derive=PartialEq +// kopium version: 0.16.2 + +use kube::CustomResource; +use serde::{Serialize, Deserialize}; + +/// UpgradeConfigSpec defines the desired state of UpgradeConfig and upgrade window and freeze window +#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, PartialEq)] +#[kube(group = "upgrade.managed.openshift.io", version = "v1alpha1", kind = "UpgradeConfig", plural = "upgradeconfigs")] +#[kube(namespaced)] +#[kube(status = "UpgradeConfigStatus")] +#[kube(schema = "disabled")] +pub struct UpgradeConfigSpec { + /// The maximum grace period granted to a node whose drain is blocked by a Pod Disruption Budget, before that drain is forced. Measured in minutes. The minimum accepted value is 0 and in this case it will trigger force drain after the expectedNodeDrainTime lapsed. + #[serde(rename = "PDBForceDrainTimeout")] + pub pdb_force_drain_timeout: i32, + /// Specify if scaling up an extra node for capacity reservation before upgrade starts is needed + #[serde(default, skip_serializing_if = "Option::is_none", rename = "capacityReservation")] + pub capacity_reservation: Option, + /// Specify the desired OpenShift release + pub desired: UpgradeConfigDesired, + /// Type indicates the ClusterUpgrader implementation to use to perform an upgrade of the cluster + #[serde(rename = "type")] + pub r#type: UpgradeConfigType, + /// Specify the upgrade start time + #[serde(rename = "upgradeAt")] + pub upgrade_at: String, +} + +/// Specify the desired OpenShift release +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] +pub struct UpgradeConfigDesired { + /// Channel used for upgrades + #[serde(default, skip_serializing_if = "Option::is_none")] + pub channel: Option, + /// Image reference used for upgrades + #[serde(default, skip_serializing_if = "Option::is_none")] + pub image: Option, + /// Version of openshift release + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, +} + +/// UpgradeConfigSpec defines the desired state of UpgradeConfig and upgrade window and freeze window +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] +pub enum UpgradeConfigType { + #[serde(rename = "OSD")] + Osd, + #[serde(rename = "ARO")] + Aro, +} + +/// UpgradeConfigStatus defines the observed state of UpgradeConfig +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] +pub struct UpgradeConfigStatus { + /// This record history of every upgrade + #[serde(default, skip_serializing_if = "Option::is_none")] + pub history: Option>, +} + +/// UpgradeHistory record history of upgrade +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] +pub struct UpgradeConfigStatusHistory { + #[serde(default, skip_serializing_if = "Option::is_none", rename = "completeTime")] + pub complete_time: Option, + /// Conditions is a set of Condition instances. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub conditions: Option>, + /// This describe the status of the upgrade process + pub phase: UpgradeConfigStatusHistoryPhase, + #[serde(default, skip_serializing_if = "Option::is_none", rename = "startTime")] + pub start_time: Option, + /// Desired version of this upgrade + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[serde(default, skip_serializing_if = "Option::is_none", rename = "workerCompleteTime")] + pub worker_complete_time: Option, + #[serde(default, skip_serializing_if = "Option::is_none", rename = "workerStartTime")] + pub worker_start_time: Option, +} + +/// UpgradeCondition houses fields that describe the state of an Upgrade including metadata. +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] +pub struct UpgradeConfigStatusHistoryConditions { + /// Complete time of this condition. + #[serde(default, skip_serializing_if = "Option::is_none", rename = "completeTime")] + pub complete_time: Option, + /// Last time the condition was checked. + #[serde(default, skip_serializing_if = "Option::is_none", rename = "lastProbeTime")] + pub last_probe_time: Option, + /// 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, + /// Human readable message indicating details about last transition. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + /// (brief) reason for the condition's last transition. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub reason: Option, + /// Start time of this condition. + #[serde(default, skip_serializing_if = "Option::is_none", rename = "startTime")] + pub start_time: Option, + /// Status of condition, one of True, False, Unknown + pub status: String, + /// Type of upgrade condition + #[serde(rename = "type")] + pub r#type: String, +} + +/// UpgradeHistory record history of upgrade +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] +pub enum UpgradeConfigStatusHistoryPhase { + New, + Pending, + Upgrading, + Upgraded, + Failed, +} +