Skip to content

Commit

Permalink
add openshift/managed-upgrade-operator
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastian Hoß <[email protected]>
  • Loading branch information
sebhoss committed Dec 26, 2023
1 parent 3387920 commit 91ab975
Show file tree
Hide file tree
Showing 9 changed files with 311 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .reuse/dep5
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions code-generator/src/catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--derive=PartialEq
Original file line number Diff line number Diff line change
@@ -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: {}
1 change: 1 addition & 0 deletions kube-custom-resources-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down
8 changes: 8 additions & 0 deletions kube-custom-resources-rs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down Expand Up @@ -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")]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod v1alpha1;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod upgradeconfigs;
Original file line number Diff line number Diff line change
@@ -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<bool>,
/// 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<String>,
/// Image reference used for upgrades
#[serde(default, skip_serializing_if = "Option::is_none")]
pub image: Option<String>,
/// Version of openshift release
#[serde(default, skip_serializing_if = "Option::is_none")]
pub version: Option<String>,
}

/// 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<Vec<UpgradeConfigStatusHistory>>,
}

/// 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<String>,
/// Conditions is a set of Condition instances.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub conditions: Option<Vec<UpgradeConfigStatusHistoryConditions>>,
/// 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<String>,
/// Desired version of this upgrade
#[serde(default, skip_serializing_if = "Option::is_none")]
pub version: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none", rename = "workerCompleteTime")]
pub worker_complete_time: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none", rename = "workerStartTime")]
pub worker_start_time: Option<String>,
}

/// 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<String>,
/// Last time the condition was checked.
#[serde(default, skip_serializing_if = "Option::is_none", rename = "lastProbeTime")]
pub last_probe_time: Option<String>,
/// 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<String>,
/// Human readable message indicating details about last transition.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub message: Option<String>,
/// (brief) reason for the condition's last transition.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub reason: Option<String>,
/// Start time of this condition.
#[serde(default, skip_serializing_if = "Option::is_none", rename = "startTime")]
pub start_time: Option<String>,
/// 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,
}

0 comments on commit 91ab975

Please sign in to comment.