-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Sebastian Hoß <[email protected]>
- Loading branch information
Showing
7 changed files
with
178 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
crd-catalog/kube-green/kube-green/kube-green.com/v1alpha1/sleepinfos.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
controller-gen.kubebuilder.io/version: v0.10.0 | ||
name: sleepinfos.kube-green.com | ||
spec: | ||
group: kube-green.com | ||
names: | ||
kind: SleepInfo | ||
listKind: SleepInfoList | ||
plural: sleepinfos | ||
singular: sleepinfo | ||
scope: Namespaced | ||
versions: | ||
- name: v1alpha1 | ||
schema: | ||
openAPIV3Schema: | ||
description: SleepInfo is the Schema for the sleepinfos 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: SleepInfoSpec defines the desired state of SleepInfo | ||
properties: | ||
excludeRef: | ||
description: ExcludeRef define the resource to exclude from the sleep. | ||
items: | ||
properties: | ||
apiVersion: | ||
description: ApiVersion of the kubernetes resources. Supported api version is "apps/v1". | ||
type: string | ||
kind: | ||
description: Kind of the kubernetes resources of the specific version. Supported kind are "Deployment" and "CronJob". | ||
type: string | ||
matchLabels: | ||
additionalProperties: | ||
type: string | ||
description: MatchLabels which identify the kubernetes resource by labels | ||
type: object | ||
name: | ||
description: Name which identify the kubernetes resource. | ||
type: string | ||
type: object | ||
type: array | ||
sleepAt: | ||
description: "Hours:Minutes \n Accept cron schedule for both hour and minute. For example, *:*/2 is set to configure a run every even minute." | ||
type: string | ||
suspendCronJobs: | ||
description: If SuspendCronjobs is set to true, on sleep the cronjobs of the namespace will be suspended. | ||
type: boolean | ||
suspendDeployments: | ||
description: If SuspendDeployments is set to false, on sleep the deployment of the namespace will not be suspended. By default Deployment will be suspended. | ||
type: boolean | ||
timeZone: | ||
description: Time zone to set the schedule, in IANA time zone identifier. It is not required, default to UTC. For example, for the Italy time zone set Europe/Rome. | ||
type: string | ||
wakeUpAt: | ||
description: "Hours:Minutes \n Accept cron schedule for both hour and minute. For example, *:*/2 is set to configure a run every even minute. It is not required." | ||
type: string | ||
weekdays: | ||
description: "Weekdays are in cron notation. \n For example, to configure a schedule from monday to friday, set it to \"1-5\"" | ||
type: string | ||
required: | ||
- sleepAt | ||
- weekdays | ||
type: object | ||
status: | ||
description: SleepInfoStatus defines the observed state of SleepInfo | ||
properties: | ||
lastScheduleTime: | ||
description: Information when was the last time the run was successfully scheduled. | ||
format: date-time | ||
type: string | ||
operation: | ||
description: The operation type handled in last schedule. SLEEP or WAKE_UP are the possibilities | ||
type: string | ||
type: object | ||
type: object | ||
served: true | ||
storage: true | ||
subresources: | ||
status: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub mod sleepinfos; |
67 changes: 67 additions & 0 deletions
67
kube-custom-resources-rs/src/kube_green_com_v1alpha1/sleepinfos.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
// WARNING: generated by kopium - manual changes will be overwritten | ||
// kopium command: kopium --docs --filename=./crd-catalog/kube-green/kube-green/kube-green.com/v1alpha1/sleepinfos.yaml --derive=Default --derive=PartialEq | ||
// kopium version: 0.16.2 | ||
|
||
use kube::CustomResource; | ||
use serde::{Serialize, Deserialize}; | ||
use std::collections::BTreeMap; | ||
|
||
/// SleepInfoSpec defines the desired state of SleepInfo | ||
#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, Default, PartialEq)] | ||
#[kube(group = "kube-green.com", version = "v1alpha1", kind = "SleepInfo", plural = "sleepinfos")] | ||
#[kube(namespaced)] | ||
#[kube(status = "SleepInfoStatus")] | ||
#[kube(schema = "disabled")] | ||
pub struct SleepInfoSpec { | ||
/// ExcludeRef define the resource to exclude from the sleep. | ||
#[serde(default, skip_serializing_if = "Option::is_none", rename = "excludeRef")] | ||
pub exclude_ref: Option<Vec<SleepInfoExcludeRef>>, | ||
/// Hours:Minutes | ||
/// Accept cron schedule for both hour and minute. For example, *:*/2 is set to configure a run every even minute. | ||
#[serde(rename = "sleepAt")] | ||
pub sleep_at: String, | ||
/// If SuspendCronjobs is set to true, on sleep the cronjobs of the namespace will be suspended. | ||
#[serde(default, skip_serializing_if = "Option::is_none", rename = "suspendCronJobs")] | ||
pub suspend_cron_jobs: Option<bool>, | ||
/// If SuspendDeployments is set to false, on sleep the deployment of the namespace will not be suspended. By default Deployment will be suspended. | ||
#[serde(default, skip_serializing_if = "Option::is_none", rename = "suspendDeployments")] | ||
pub suspend_deployments: Option<bool>, | ||
/// Time zone to set the schedule, in IANA time zone identifier. It is not required, default to UTC. For example, for the Italy time zone set Europe/Rome. | ||
#[serde(default, skip_serializing_if = "Option::is_none", rename = "timeZone")] | ||
pub time_zone: Option<String>, | ||
/// Hours:Minutes | ||
/// Accept cron schedule for both hour and minute. For example, *:*/2 is set to configure a run every even minute. It is not required. | ||
#[serde(default, skip_serializing_if = "Option::is_none", rename = "wakeUpAt")] | ||
pub wake_up_at: Option<String>, | ||
/// Weekdays are in cron notation. | ||
/// For example, to configure a schedule from monday to friday, set it to "1-5" | ||
pub weekdays: String, | ||
} | ||
|
||
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)] | ||
pub struct SleepInfoExcludeRef { | ||
/// ApiVersion of the kubernetes resources. Supported api version is "apps/v1". | ||
#[serde(default, skip_serializing_if = "Option::is_none", rename = "apiVersion")] | ||
pub api_version: Option<String>, | ||
/// Kind of the kubernetes resources of the specific version. Supported kind are "Deployment" and "CronJob". | ||
#[serde(default, skip_serializing_if = "Option::is_none")] | ||
pub kind: Option<String>, | ||
/// MatchLabels which identify the kubernetes resource by labels | ||
#[serde(default, skip_serializing_if = "Option::is_none", rename = "matchLabels")] | ||
pub match_labels: Option<BTreeMap<String, String>>, | ||
/// Name which identify the kubernetes resource. | ||
#[serde(default, skip_serializing_if = "Option::is_none")] | ||
pub name: Option<String>, | ||
} | ||
|
||
/// SleepInfoStatus defines the observed state of SleepInfo | ||
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)] | ||
pub struct SleepInfoStatus { | ||
/// Information when was the last time the run was successfully scheduled. | ||
#[serde(default, skip_serializing_if = "Option::is_none", rename = "lastScheduleTime")] | ||
pub last_schedule_time: Option<String>, | ||
/// The operation type handled in last schedule. SLEEP or WAKE_UP are the possibilities | ||
#[serde(default, skip_serializing_if = "Option::is_none")] | ||
pub operation: Option<String>, | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters