Skip to content

Commit

Permalink
add aws/zone-aware-controllers-for-k8s
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastian Hoß <[email protected]>
  • Loading branch information
sebhoss committed Feb 4, 2024
1 parent fb3360a commit a699ef2
Show file tree
Hide file tree
Showing 10 changed files with 370 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .reuse/dep5
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ Files: crd-catalog/aws/aws-app-mesh-controller-for-k8/*
Copyright: The aws/aws-app-mesh-controller-for-k8 Authors
License: Apache-2.0

Files: crd-catalog/aws/zone-aware-controllers-for-k8s/*
Copyright: The aws/zone-aware-controllers-for-k8s Authors
License: Apache-2.0

Files: crd-catalog/aws-controllers-k8s/apigatewayv2-controller/*
Copyright: The aws-controllers-k8s/apigatewayv2-controller Authors
License: Apache-2.0
Expand Down
8 changes: 8 additions & 0 deletions code-generator/src/catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,14 @@ pub const CRD_V1_SOURCES: &'static [UpstreamSource] = &[
"https://github.com/aws/aws-app-mesh-controller-for-k8s/blob/master/config/crd/bases/appmesh.k8s.aws_virtualservices.yaml",
],
},
UpstreamSource {
project_name: "aws/zone-aware-controllers-for-k8s",
license: APACHE_V2,
urls: &[
"https://github.com/aws/zone-aware-controllers-for-k8s/blob/main/config/crd/bases/zonecontrol.k8s.aws_zoneawareupdates.yaml",
"https://github.com/aws/zone-aware-controllers-for-k8s/blob/main/config/crd/bases/zonecontrol.k8s.aws_zonedisruptionbudgets.yaml",
],
},
UpstreamSource {
project_name: "aws-controllers-k8s/apigatewayv2-controller",
license: APACHE_V2,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.9.2
name: zoneawareupdates.zonecontrol.k8s.aws
spec:
group: zonecontrol.k8s.aws
names:
kind: ZoneAwareUpdate
listKind: ZoneAwareUpdateList
plural: zoneawareupdates
shortNames:
- zau
singular: zoneawareupdate
scope: Namespaced
versions:
- name: v1
schema:
openAPIV3Schema:
description: ZoneAwareUpdate is the Schema for the zoneawareupdates 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: ZoneAwareUpdateSpec defines the desired state of ZoneAwareUpdate
properties:
dryRun:
description: Dryn-run mode that can be used to test the new controller before enable it
type: boolean
exponentialFactor:
default: '2.0'
description: The exponential growth rate in float string. Default value is 2.0. It's possible to disable exponential updates by setting the ExponentialFactor to 0. In this case, the number of pods updated at each step is defined only by the MaxUnavailable param.
type: string
ignoreAlarm:
description: Flag to ignore the PauseRolloutAlarm (default false)
type: boolean
maxUnavailable:
anyOf:
- type: integer
- type: string
description: Max number (or %) of pods that can be updated at the same time.
x-kubernetes-int-or-string: true
pauseRolloutAlarm:
description: CW alarm name used to pause/skip updates. Alarm should be on the same account and region.
type: string
statefulset:
description: The name of the StatefulSet for which the ZoneAwareUpdate applies to.
type: string
type: object
status:
description: ZoneAwareUpdateStatus defines the observed state of ZoneAwareUpdate
properties:
currentRevision:
description: CurrentRevision indicates the version of the StatefulSet used to generate Pods
type: string
deletedReplicas:
description: DeletedReplicas is the number of replicas deleted in the last reconcile loop.
format: int32
type: integer
oldReplicas:
additionalProperties:
format: int32
type: integer
description: OldReplicas is the number of Pods *per zone* in the CurrentRevision, when there is new UpdateRevision. It becomes zero for all zones when all pods are in the new revision.
type: object
pausedRollout:
description: PausedRollout indicates if the rollout was paused becaused the PauseRolloutAlarm is in alarm.
type: boolean
updateRevision:
description: UpdateRevision indicates the new version of the StatefulSet
type: string
updateStep:
description: UpdateStep is used to track the rollout progress. Everytime pods are deleted/updated this is increased. It becomes zero when all pods are in the new revision.
format: int32
type: integer
type: object
type: object
served: true
storage: true
subresources:
status: {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.9.2
name: zonedisruptionbudgets.zonecontrol.k8s.aws
spec:
group: zonecontrol.k8s.aws
names:
kind: ZoneDisruptionBudget
listKind: ZoneDisruptionBudgetList
plural: zonedisruptionbudgets
shortNames:
- zdb
singular: zonedisruptionbudget
scope: Namespaced
versions:
- name: v1
schema:
openAPIV3Schema:
description: ZoneDisruptionBudget is the Schema for the zonedisruptionbudgets 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: ZoneDisruptionBudgetSpec defines the desired state of ZoneDisruptionBudget
properties:
dryRun:
description: Dryn-run mode that can be used to test the new controller before enable it
type: boolean
maxUnavailable:
anyOf:
- type: integer
- type: string
description: Evict pod specification is allowed if at most "maxUnavailable" pods selected by "selector" are unavailable in the same zone after the above operation for pod. Evictions are not allowed if there are unavailable pods in other zones.
x-kubernetes-int-or-string: true
selector:
description: Selector label query over pods managed by the budget
properties:
matchExpressions:
description: matchExpressions is a list of label selector requirements. The requirements are ANDed.
items:
description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.
properties:
key:
description: key is the label key that the selector applies to.
type: string
operator:
description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.
type: string
values:
description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.
items:
type: string
type: array
required:
- key
- operator
type: object
type: array
matchLabels:
additionalProperties:
type: string
description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed.
type: object
type: object
x-kubernetes-map-type: atomic
type: object
status:
description: ZoneDisruptionBudgetStatus defines the observed state of ZoneDisruptionBudget
properties:
currentHealthy:
additionalProperties:
format: int32
type: integer
description: Current number of healthy pods per zone
type: object
currentUnhealthy:
additionalProperties:
format: int32
type: integer
description: Current number of unhealthy pods per zone
type: object
desiredHealthy:
additionalProperties:
format: int32
type: integer
description: Minimum desired number of healthy pods per zone
type: object
disruptedPods:
additionalProperties:
format: date-time
type: string
description: DisruptedPods contains information about pods whose eviction was processed by the API server eviction subresource handler but has not yet been observed by the ZoneDisruptionBudget controller. A pod will be in this map from the time when the API server processed the eviction request to the time when the pod is seen by ZDB controller as having been marked for deletion (or after a timeout). The key in the map is the name of the pod and the value is the time when the API server processed the eviction request. If the deletion didn't occur and a pod is still there it will be removed from the list automatically by ZoneDisruptionBudget controller after some time.
type: object
disruptionsAllowed:
additionalProperties:
format: int32
type: integer
description: Number of pod disruptions that are currently allowed *per zone*
type: object
expectedPods:
additionalProperties:
format: int32
type: integer
description: Total number of expected replicas per zone
type: object
observedGeneration:
description: Most recent generation observed when updating this ZDB status. DisruptionsAllowed and other status information is valid only if observedGeneration equals to ZDB's object generation.
format: int64
type: integer
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 @@ -296,3 +296,4 @@ wgpolicyk8s_io = []
wildfly_org = []
work_karmada_io = []
workloads_kubeblocks_io = []
zonecontrol_k8s_aws = []
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 @@ -2375,6 +2375,12 @@ apiVersion `work.karmada.io/v1alpha2`:
apiVersion `workloads.kubeblocks.io/v1alpha1`:
- `ReplicatedStateMachine`
## zonecontrol_k8s_aws
apiVersion `zonecontrol.k8s.aws/v1`:
- `ZoneAwareUpdate`
- `ZoneDisruptionBudget`
*/

#[cfg(feature = "about_k8s_io")]
Expand Down Expand Up @@ -2925,3 +2931,5 @@ pub mod wildfly_org;
pub mod work_karmada_io;
#[cfg(feature = "workloads_kubeblocks_io")]
pub mod workloads_kubeblocks_io;
#[cfg(feature = "zonecontrol_k8s_aws")]
pub mod zonecontrol_k8s_aws;
1 change: 1 addition & 0 deletions kube-custom-resources-rs/src/zonecontrol_k8s_aws/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod v1;
2 changes: 2 additions & 0 deletions kube-custom-resources-rs/src/zonecontrol_k8s_aws/v1/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pub mod zoneawareupdates;
pub mod zonedisruptionbudgets;
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// WARNING: generated by kopium - manual changes will be overwritten
// kopium command: kopium --docs --filename=./crd-catalog/aws/zone-aware-controllers-for-k8s/zonecontrol.k8s.aws/v1/zoneawareupdates.yaml --derive=Default --derive=PartialEq
// kopium version: 0.16.5

use kube::CustomResource;
use serde::{Serialize, Deserialize};
use std::collections::BTreeMap;
use k8s_openapi::apimachinery::pkg::util::intstr::IntOrString;

/// ZoneAwareUpdateSpec defines the desired state of ZoneAwareUpdate
#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[kube(group = "zonecontrol.k8s.aws", version = "v1", kind = "ZoneAwareUpdate", plural = "zoneawareupdates")]
#[kube(namespaced)]
#[kube(status = "ZoneAwareUpdateStatus")]
#[kube(schema = "disabled")]
pub struct ZoneAwareUpdateSpec {
/// Dryn-run mode that can be used to test the new controller before enable it
#[serde(default, skip_serializing_if = "Option::is_none", rename = "dryRun")]
pub dry_run: Option<bool>,
/// The exponential growth rate in float string. Default value is 2.0. It's possible to disable exponential updates by setting the ExponentialFactor to 0. In this case, the number of pods updated at each step is defined only by the MaxUnavailable param.
#[serde(default, skip_serializing_if = "Option::is_none", rename = "exponentialFactor")]
pub exponential_factor: Option<String>,
/// Flag to ignore the PauseRolloutAlarm (default false)
#[serde(default, skip_serializing_if = "Option::is_none", rename = "ignoreAlarm")]
pub ignore_alarm: Option<bool>,
/// Max number (or %) of pods that can be updated at the same time.
#[serde(default, skip_serializing_if = "Option::is_none", rename = "maxUnavailable")]
pub max_unavailable: Option<IntOrString>,
/// CW alarm name used to pause/skip updates. Alarm should be on the same account and region.
#[serde(default, skip_serializing_if = "Option::is_none", rename = "pauseRolloutAlarm")]
pub pause_rollout_alarm: Option<String>,
/// The name of the StatefulSet for which the ZoneAwareUpdate applies to.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub statefulset: Option<String>,
}

/// ZoneAwareUpdateStatus defines the observed state of ZoneAwareUpdate
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct ZoneAwareUpdateStatus {
/// CurrentRevision indicates the version of the StatefulSet used to generate Pods
#[serde(default, skip_serializing_if = "Option::is_none", rename = "currentRevision")]
pub current_revision: Option<String>,
/// DeletedReplicas is the number of replicas deleted in the last reconcile loop.
#[serde(default, skip_serializing_if = "Option::is_none", rename = "deletedReplicas")]
pub deleted_replicas: Option<i32>,
/// OldReplicas is the number of Pods *per zone* in the CurrentRevision, when there is new UpdateRevision. It becomes zero for all zones when all pods are in the new revision.
#[serde(default, skip_serializing_if = "Option::is_none", rename = "oldReplicas")]
pub old_replicas: Option<BTreeMap<String, i32>>,
/// PausedRollout indicates if the rollout was paused becaused the PauseRolloutAlarm is in alarm.
#[serde(default, skip_serializing_if = "Option::is_none", rename = "pausedRollout")]
pub paused_rollout: Option<bool>,
/// UpdateRevision indicates the new version of the StatefulSet
#[serde(default, skip_serializing_if = "Option::is_none", rename = "updateRevision")]
pub update_revision: Option<String>,
/// UpdateStep is used to track the rollout progress. Everytime pods are deleted/updated this is increased. It becomes zero when all pods are in the new revision.
#[serde(default, skip_serializing_if = "Option::is_none", rename = "updateStep")]
pub update_step: Option<i32>,
}

Loading

0 comments on commit a699ef2

Please sign in to comment.