Skip to content

Commit

Permalink
add kube-green/kube-green
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastian Hoß <[email protected]>
  • Loading branch information
sebhoss committed Nov 17, 2023
1 parent a68aee2 commit 9e10a15
Show file tree
Hide file tree
Showing 7 changed files with 178 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .reuse/dep5
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,10 @@ Files: crd-catalog/Kuadrant/limitador-operator/*
Copyright: The Kuadrant/limitador-operator Authors
License: Apache-2.0

Files: crd-catalog/kube-green/kube-green/*
Copyright: The kube-green/kube-green Authors
License: MIT

Files: crd-catalog/kube-logging/logging-operator/*
Copyright: The kube-logging/logging-operator 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 @@ -1168,6 +1168,13 @@ pub const CRD_V1_SOURCES: &'static [UpstreamSource] = &[
"https://github.com/Kuadrant/limitador-operator/blob/main/config/crd/bases/limitador.kuadrant.io_limitadors.yaml",
],
},
UpstreamSource {
project_name: "kube-green/kube-green",
license: MIT,
urls: &[
"https://github.com/kube-green/kube-green/blob/main/config/crd/bases/kube-green.com_sleepinfos.yaml",
],
},
UpstreamSource {
project_name: "kube-logging/logging-operator",
license: APACHE_V2,
Expand Down
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: {}
1 change: 1 addition & 0 deletions kube-custom-resources-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ keycloak_org_v1alpha1 = []
kibana_k8s_elastic_co_v1 = []
kibana_k8s_elastic_co_v1beta1 = []
kms_services_k8s_aws_v1alpha1 = []
kube_green_com_v1alpha1 = []
kubean_io_v1alpha1 = []
kubevious_io_v1alpha1 = []
kueue_x_k8s_io_v1beta1 = []
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod sleepinfos;
67 changes: 67 additions & 0 deletions kube-custom-resources-rs/src/kube_green_com_v1alpha1/sleepinfos.rs
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>,
}

9 changes: 9 additions & 0 deletions kube-custom-resources-rs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1569,6 +1569,13 @@ kinds:
- `Grant`
- `Key`
## kube_green_com_v1alpha1
apiVersion: `kube-green.com/v1alpha1`
kinds:
- `SleepInfo`
## kubean_io_v1alpha1
apiVersion: `kubean.io/v1alpha1`
Expand Down Expand Up @@ -3170,6 +3177,8 @@ pub mod kibana_k8s_elastic_co_v1;
pub mod kibana_k8s_elastic_co_v1beta1;
#[cfg(feature = "kms_services_k8s_aws_v1alpha1")]
pub mod kms_services_k8s_aws_v1alpha1;
#[cfg(feature = "kube_green_com_v1alpha1")]
pub mod kube_green_com_v1alpha1;
#[cfg(feature = "kubean_io_v1alpha1")]
pub mod kubean_io_v1alpha1;
#[cfg(feature = "kubevious_io_v1alpha1")]
Expand Down

0 comments on commit 9e10a15

Please sign in to comment.