-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit adds two new collectors to the adapter: - ClusterScalingScheduleCollector; and - ScalingScheduleCollector Also, it introduces the required collectors plugins, initialization logic in the server startup, documentation and deployment example (including the helm chart). A new config flag is created, `-scaling-schedule`, and allows to enable and to disable the collection of such metrics. It's disabled by default. This collectors are the required logic to utilise the CRDs introduced in the #284 pull request. It makes use of the kubernetes go-client implementations of a [Store][0] and [Reflector][1]. [0]: https://pkg.go.dev/k8s.io/client-go/tools/cache#Store [1]: https://pkg.go.dev/k8s.io/client-go/tools/cache#Reflector Signed-off-by: Jonathan Juares Beber <[email protected]>
- Loading branch information
1 parent
7a68304
commit 4644d0d
Showing
17 changed files
with
1,835 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
FROM registry.opensource.zalan.do/library/alpine-3.12:latest | ||
LABEL maintainer="Team Teapot @ Zalando SE <[email protected]>" | ||
|
||
RUN apk add --no-cache tzdata | ||
|
||
# add binary | ||
ADD build/linux/kube-metrics-adapter / | ||
|
||
|
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
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,119 @@ | ||
{{- if .Values.scalingSchedule.enabled }} | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
controller-gen.kubebuilder.io/version: v0.5.0 | ||
creationTimestamp: null | ||
name: clusterscalingschedules.zalando.org | ||
spec: | ||
group: zalando.org | ||
names: | ||
kind: ClusterScalingSchedule | ||
listKind: ClusterScalingScheduleList | ||
plural: clusterscalingschedules | ||
singular: clusterscalingschedule | ||
scope: Cluster | ||
versions: | ||
- name: v1 | ||
schema: | ||
openAPIV3Schema: | ||
description: ClusterScalingSchedule describes a cluster scoped time based | ||
metric to be used in autoscaling operations. | ||
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: ScalingScheduleSpec is the spec part of the ScalingSchedule. | ||
properties: | ||
schedules: | ||
description: Schedules is the list of schedules for this ScalingSchedule | ||
resource. All the schedules defined here will result on the value | ||
to the same metric. New metrics require a new ScalingSchedule resource. | ||
items: | ||
description: Schedule is the schedule details to be used inside | ||
a ScalingSchedule. | ||
properties: | ||
date: | ||
description: Defines the starting date of a OneTime schedule. | ||
It has to be a RFC3339 formated date. | ||
format: date-time | ||
type: string | ||
durationMinutes: | ||
description: The duration in minutes that the configured value | ||
will be returned for the defined schedule. | ||
type: integer | ||
period: | ||
description: Defines the details of a Repeating schedule. | ||
properties: | ||
days: | ||
description: The days that this schedule will be active. | ||
items: | ||
description: ScheduleDay represents the valid inputs for | ||
days in a SchedulePeriod. | ||
enum: | ||
- Sun | ||
- Mon | ||
- Tue | ||
- Wed | ||
- Thu | ||
- Fri | ||
- Sat | ||
type: string | ||
type: array | ||
startTime: | ||
description: The startTime has the format HH:MM | ||
pattern: (([0-1][0-9])|([2][0-3])):([0-5][0-9]) | ||
type: string | ||
timezone: | ||
description: The location name corresponding to a file in | ||
the IANA Time Zone database, like Europe/Berlin. | ||
type: string | ||
required: | ||
- days | ||
- startTime | ||
- timezone | ||
type: object | ||
type: | ||
description: Defines if the schedule is a OneTime schedule or | ||
Repeating one. If OneTime, date has to be defined. If Repeating, | ||
Period has to be defined. | ||
enum: | ||
- OneTime | ||
- Repeating | ||
type: string | ||
value: | ||
description: The metric value that will be returned for the | ||
defined schedule. | ||
type: integer | ||
required: | ||
- durationMinutes | ||
- type | ||
- value | ||
type: object | ||
type: array | ||
required: | ||
- schedules | ||
type: object | ||
required: | ||
- spec | ||
type: object | ||
served: true | ||
storage: true | ||
status: | ||
acceptedNames: | ||
kind: "" | ||
plural: "" | ||
conditions: [] | ||
storedVersions: [] | ||
{{- end}} |
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
Oops, something went wrong.