mirror of
https://github.com/zalando-incubator/kube-metrics-adapter.git
synced 2025-06-14 07:46:04 +00:00
Compare commits
91 Commits
bugfix/fix
...
v0.1.16
Author | SHA1 | Date | |
---|---|---|---|
1c9038b2cc | |||
fd4ead837e | |||
f46f801811 | |||
4acdf72ef7 | |||
e04cd10bfc | |||
8fe330941a | |||
0730c6ef1e | |||
c5411c74b7 | |||
4ba6b66441 | |||
0dbe769e1b | |||
582a78d4ec | |||
481df883e5 | |||
318d47e05e | |||
190f0db092 | |||
c618494177 | |||
a08860d06c | |||
6b0afe5180 | |||
9722e38f62 | |||
35aa03c771 | |||
34c833e04a | |||
c93c1dd7bb | |||
59d39bc51c | |||
4066e450e5 | |||
8415373f3d | |||
d1969a3020 | |||
582c94255f | |||
c626f414db | |||
1d4beab7a4 | |||
eefd5ef512 | |||
599b3bf805 | |||
ecf21df9c0 | |||
ecd296e644 | |||
446b7f01ea | |||
0ad7296d56 | |||
9da155554b | |||
d7f9664d52 | |||
85f6dda229 | |||
64a6b85c73 | |||
f41af0d82b | |||
194bede7a3 | |||
c4f5efb6a7 | |||
51e9378ee6 | |||
ce27ef1798 | |||
a73ef467cd | |||
e6a04531fb | |||
7289e6f8e2 | |||
60b1dc097a | |||
6b46cc2599 | |||
6f9aba8db8 | |||
a382dbfe7b | |||
7a68304389 | |||
7044e79b08 | |||
e16bacb24e | |||
726c1e691d | |||
debc90ca72 | |||
6343c8ea15 | |||
eb0575f11e | |||
52bfbbb1b0 | |||
cf5872ef08 | |||
b5432fb1f3 | |||
5466badd90 | |||
aef1837e47 | |||
4e86d6ae34 | |||
2874c1a6a7 | |||
b5006746f0 | |||
9496ab7fd3 | |||
aa7f86291e | |||
486a6c4262 | |||
aaf66f31a0 | |||
e5bee93bf6 | |||
aae3772472 | |||
76d3726e5b | |||
ea4a651afe | |||
721c6553d8 | |||
5aa2272e37 | |||
b9300d1e46 | |||
5747b6c9de | |||
6d15a1635a | |||
4090ab8b32 | |||
1f56abf931 | |||
f216070630 | |||
8725f02db7 | |||
240452ca27 | |||
9bb7d976a0 | |||
816661f7fd | |||
7ae70d798d | |||
0ef5ad1cfe | |||
c86235636b | |||
2d119e68e4 | |||
df3efe0e39 | |||
a5b5cb91c3 |
@ -1,6 +1,8 @@
|
||||
FROM registry.opensource.zalan.do/library/alpine-3.12:latest
|
||||
LABEL maintainer="Team Teapot @ Zalando SE <team-teapot@zalando.de>"
|
||||
|
||||
RUN apk add --no-cache tzdata
|
||||
|
||||
# add binary
|
||||
ADD build/linux/kube-metrics-adapter /
|
||||
|
||||
|
10
Makefile
10
Makefile
@ -30,7 +30,7 @@ check: $(GENERATED)
|
||||
golangci-lint run --timeout=2m ./...
|
||||
|
||||
|
||||
$(GENERATED): go.mod $(CRD_TYPE_SOURCE)
|
||||
$(GENERATED): go.mod $(CRD_TYPE_SOURCE) $(OPENAPI)
|
||||
./hack/update-codegen.sh
|
||||
|
||||
$(GENERATED_CRDS): $(GENERATED) $(CRD_SOURCES)
|
||||
@ -48,17 +48,17 @@ $(OPENAPI): go.mod
|
||||
-O zz_generated.openapi \
|
||||
-r /dev/null
|
||||
|
||||
build.local: build/$(BINARY)
|
||||
build.local: build/$(BINARY) $(GENERATED_CRDS)
|
||||
build.linux: build/linux/$(BINARY)
|
||||
build.osx: build/osx/$(BINARY)
|
||||
|
||||
build/$(BINARY): go.mod $(SOURCES) $(OPENAPI)
|
||||
build/$(BINARY): go.mod $(SOURCES) $(GENERATED)
|
||||
CGO_ENABLED=0 go build -o build/$(BINARY) $(BUILD_FLAGS) -ldflags "$(LDFLAGS)" .
|
||||
|
||||
build/linux/$(BINARY): go.mod $(SOURCES) $(OPENAPI)
|
||||
build/linux/$(BINARY): go.mod $(SOURCES) $(GENERATED)
|
||||
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build $(BUILD_FLAGS) -o build/linux/$(BINARY) -ldflags "$(LDFLAGS)" .
|
||||
|
||||
build/osx/$(BINARY): go.mod $(SOURCES) $(OPENAPI)
|
||||
build/osx/$(BINARY): go.mod $(SOURCES) $(GENERATED)
|
||||
GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build $(BUILD_FLAGS) -o build/osx/$(BINARY) -ldflags "$(LDFLAGS)" .
|
||||
|
||||
build.docker: build.linux
|
||||
|
@ -37,6 +37,11 @@ spec:
|
||||
spec:
|
||||
description: ScalingScheduleSpec is the spec part of the ScalingSchedule.
|
||||
properties:
|
||||
scalingWindowDurationMinutes:
|
||||
description: Fade the scheduled values in and out over this many minutes.
|
||||
If unset, the default per-cluster value will be used.
|
||||
format: int64
|
||||
type: integer
|
||||
schedules:
|
||||
description: Schedules is the list of schedules for this ScalingSchedule
|
||||
resource. All the schedules defined here will result on the value
|
||||
@ -96,6 +101,7 @@ spec:
|
||||
value:
|
||||
description: The metric value that will be returned for the
|
||||
defined schedule.
|
||||
format: int64
|
||||
type: integer
|
||||
required:
|
||||
- durationMinutes
|
||||
|
@ -1,4 +1,4 @@
|
||||
apiVersion: apiregistration.k8s.io/v1beta1
|
||||
apiVersion: apiregistration.k8s.io/v1
|
||||
kind: APIService
|
||||
metadata:
|
||||
name: v1beta1.custom.metrics.k8s.io
|
||||
|
@ -28,6 +28,7 @@ spec:
|
||||
- --prometheus-server=http://prometheus.kube-system.svc.cluster.local
|
||||
- --skipper-ingress-metrics
|
||||
- --aws-external-metrics
|
||||
- --scaling-schedule
|
||||
env:
|
||||
- name: AWS_REGION
|
||||
value: eu-central-1
|
||||
|
@ -1,4 +1,4 @@
|
||||
apiVersion: apiregistration.k8s.io/v1beta1
|
||||
apiVersion: apiregistration.k8s.io/v1
|
||||
kind: APIService
|
||||
metadata:
|
||||
name: v1beta1.external.metrics.k8s.io
|
||||
|
@ -1,6 +1,6 @@
|
||||
apiVersion: v2
|
||||
name: kube-metrics-adapter
|
||||
version: 0.1.9
|
||||
version: 0.1.11
|
||||
description: kube-metrics-adapter helm chart
|
||||
home: https://github.com/zalando-incubator/kube-metrics-adapter
|
||||
maintainers:
|
||||
|
119
docs/helm/templates/cluster_scaling_schedules_crd.yaml
Normal file
119
docs/helm/templates/cluster_scaling_schedules_crd.yaml
Normal file
@ -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}}
|
@ -1,5 +1,5 @@
|
||||
{{- if .Values.enableCustomMetricsApi }}
|
||||
apiVersion: apiregistration.k8s.io/v1beta1
|
||||
apiVersion: apiregistration.k8s.io/v1
|
||||
kind: APIService
|
||||
metadata:
|
||||
name: v1beta1.custom.metrics.k8s.io
|
||||
@ -12,4 +12,4 @@ spec:
|
||||
insecureSkipTLSVerify: {{ .Values.tls.skipTLSVerify }}
|
||||
groupPriorityMinimum: 100
|
||||
versionPriority: 100
|
||||
{{- end}}
|
||||
{{- end}}
|
||||
|
@ -182,6 +182,9 @@ spec:
|
||||
{{- if .Values.zmon.tokenName }}
|
||||
- --zmon-token-name={{ .Values.zmon.tokenName }}
|
||||
{{- end}}
|
||||
{{- if .Values.scalingSchedule.enabled }}
|
||||
- --scaling-schedule
|
||||
{{- end}}
|
||||
resources:
|
||||
limits:
|
||||
cpu: {{ .Values.resources.limits.cpu }}
|
||||
|
@ -1,5 +1,5 @@
|
||||
{{- if .Values.enableExternalMetricsApi }}
|
||||
apiVersion: apiregistration.k8s.io/v1beta1
|
||||
apiVersion: apiregistration.k8s.io/v1
|
||||
kind: APIService
|
||||
metadata:
|
||||
name: v1beta1.external.metrics.k8s.io
|
||||
|
@ -73,6 +73,17 @@ rules:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
{{- if .Values.scalingSchedule.enabled }}
|
||||
- apiGroups:
|
||||
- zalando.org
|
||||
resources:
|
||||
- clusterscalingschedules
|
||||
- scalingschedules
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
{{- end}}
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
|
119
docs/helm/templates/scaling_schedules_crd.yaml
Normal file
119
docs/helm/templates/scaling_schedules_crd.yaml
Normal file
@ -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: scalingschedules.zalando.org
|
||||
spec:
|
||||
group: zalando.org
|
||||
names:
|
||||
kind: ScalingSchedule
|
||||
listKind: ScalingScheduleList
|
||||
plural: scalingschedules
|
||||
singular: scalingschedule
|
||||
scope: Namespaced
|
||||
versions:
|
||||
- name: v1
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
description: ScalingSchedule describes a namespaced 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}}
|
@ -4,7 +4,7 @@ replicas: 1
|
||||
|
||||
registry:
|
||||
image: registry.opensource.zalan.do/teapot/kube-metrics-adapter
|
||||
imageTag: v0.1.9
|
||||
imageTag: v0.1.10
|
||||
imagePullPolicy: IfNotPresent
|
||||
|
||||
service:
|
||||
@ -92,3 +92,6 @@ resources:
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 100Mi
|
||||
|
||||
scalingSchedule:
|
||||
enabled: false
|
||||
|
@ -64,12 +64,23 @@ rules:
|
||||
- statefulsets
|
||||
verbs:
|
||||
- get
|
||||
# only relevant if running with the flag:
|
||||
# --skipper-ingress-metrics
|
||||
- apiGroups:
|
||||
- extensions
|
||||
- networking.k8s.io
|
||||
resources:
|
||||
- ingresses
|
||||
verbs:
|
||||
- get
|
||||
# only relevant if running with the flag:
|
||||
# --skipper-routegroup-metrics
|
||||
- apiGroups:
|
||||
- zalando.org
|
||||
resources:
|
||||
- routegroups
|
||||
verbs:
|
||||
- get
|
||||
- apiGroups:
|
||||
- autoscaling
|
||||
resources:
|
||||
@ -78,6 +89,15 @@ rules:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- zalando.org
|
||||
resources:
|
||||
- clusterscalingschedules
|
||||
- scalingschedules
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
|
@ -37,6 +37,11 @@ spec:
|
||||
spec:
|
||||
description: ScalingScheduleSpec is the spec part of the ScalingSchedule.
|
||||
properties:
|
||||
scalingWindowDurationMinutes:
|
||||
description: Fade the scheduled values in and out over this many minutes.
|
||||
If unset, the default per-cluster value will be used.
|
||||
format: int64
|
||||
type: integer
|
||||
schedules:
|
||||
description: Schedules is the list of schedules for this ScalingSchedule
|
||||
resource. All the schedules defined here will result on the value
|
||||
@ -96,6 +101,7 @@ spec:
|
||||
value:
|
||||
description: The metric value that will be returned for the
|
||||
defined schedule.
|
||||
format: int64
|
||||
type: integer
|
||||
required:
|
||||
- durationMinutes
|
||||
|
29
go.mod
29
go.mod
@ -2,34 +2,33 @@ module github.com/zalando-incubator/kube-metrics-adapter
|
||||
|
||||
require (
|
||||
github.com/NYTimes/gziphandler v1.0.1 // indirect
|
||||
github.com/aws/aws-sdk-go v1.37.20
|
||||
github.com/aws/aws-sdk-go v1.40.22
|
||||
github.com/go-openapi/spec v0.20.3
|
||||
github.com/influxdata/influxdb-client-go v0.2.0
|
||||
github.com/influxdata/line-protocol v0.0.0-20201012155213-5f565037cbc9 // indirect
|
||||
github.com/kubernetes-sigs/custom-metrics-apiserver v0.0.0-20201216091021-1b9fa998bbaa
|
||||
github.com/magefile/mage v1.11.0 // indirect
|
||||
github.com/mailru/easyjson v0.7.7 // indirect
|
||||
github.com/prometheus/client_golang v1.9.0
|
||||
github.com/prometheus/common v0.18.0
|
||||
github.com/sirupsen/logrus v1.8.0
|
||||
github.com/spf13/cobra v1.1.1
|
||||
github.com/prometheus/client_golang v1.11.0
|
||||
github.com/prometheus/common v0.26.0
|
||||
github.com/sirupsen/logrus v1.8.1
|
||||
github.com/spf13/cobra v1.1.3
|
||||
github.com/spyzhov/ajson v0.4.2
|
||||
github.com/stretchr/testify v1.7.0
|
||||
github.com/szuecs/routegroup-client v0.18.3
|
||||
github.com/zalando-incubator/cluster-lifecycle-manager v0.0.0-20180921141935-824b77fb1f84
|
||||
go.uber.org/zap v1.13.0 // indirect
|
||||
golang.org/x/crypto v0.0.0-20201124201722-c8d3bf9c5392 // indirect
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 // indirect
|
||||
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
|
||||
golang.org/x/sys v0.0.0-20210301091718-77cc2087c03b // indirect
|
||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
|
||||
k8s.io/api v0.20.4
|
||||
k8s.io/apimachinery v0.20.4
|
||||
k8s.io/apiserver v0.20.4
|
||||
k8s.io/client-go v0.20.4
|
||||
k8s.io/code-generator v0.20.4
|
||||
k8s.io/component-base v0.20.4
|
||||
k8s.io/api v0.20.9
|
||||
k8s.io/apimachinery v0.20.9
|
||||
k8s.io/apiserver v0.20.9
|
||||
k8s.io/client-go v0.20.9
|
||||
k8s.io/code-generator v0.20.9
|
||||
k8s.io/component-base v0.20.9
|
||||
k8s.io/klog v1.0.0
|
||||
k8s.io/kube-openapi v0.0.0-20201113171705-d219536bb9fd
|
||||
k8s.io/metrics v0.20.4
|
||||
k8s.io/metrics v0.20.9
|
||||
sigs.k8s.io/controller-tools v0.5.0
|
||||
)
|
||||
|
||||
|
@ -12,13 +12,15 @@ const (
|
||||
customMetricsPrefix = "metric-config."
|
||||
perReplicaMetricsConfKey = "per-replica"
|
||||
intervalMetricsConfKey = "interval"
|
||||
minPodReadyAgeConfKey = "min-pod-ready-age"
|
||||
)
|
||||
|
||||
type AnnotationConfigs struct {
|
||||
CollectorType string
|
||||
Configs map[string]string
|
||||
PerReplica bool
|
||||
Interval time.Duration
|
||||
CollectorType string
|
||||
Configs map[string]string
|
||||
PerReplica bool
|
||||
Interval time.Duration
|
||||
MinPodReadyAge time.Duration
|
||||
}
|
||||
|
||||
type MetricConfigKey struct {
|
||||
@ -89,6 +91,15 @@ func (m AnnotationConfigMap) Parse(annotations map[string]string) error {
|
||||
continue
|
||||
}
|
||||
|
||||
if parts[1] == minPodReadyAgeConfKey {
|
||||
minPodReadyAge, err := time.ParseDuration(val)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to parse min-pod-ready-age value %s for %s: %v", val, key, err)
|
||||
}
|
||||
config.MinPodReadyAge = minPodReadyAge
|
||||
continue
|
||||
}
|
||||
|
||||
config.Configs[parts[1]] = val
|
||||
}
|
||||
return nil
|
||||
|
@ -24,10 +24,11 @@ func TestParser(t *testing.T) {
|
||||
{
|
||||
Name: "pod metrics",
|
||||
Annotations: map[string]string{
|
||||
"metric-config.pods.requests-per-second.json-path/json-key": "$.http_server.rps",
|
||||
"metric-config.pods.requests-per-second.json-path/path": "/metrics",
|
||||
"metric-config.pods.requests-per-second.json-path/port": "9090",
|
||||
"metric-config.pods.requests-per-second.json-path/scheme": "https",
|
||||
"metric-config.pods.requests-per-second.json-path/json-key": "$.http_server.rps",
|
||||
"metric-config.pods.requests-per-second.json-path/path": "/metrics",
|
||||
"metric-config.pods.requests-per-second.json-path/port": "9090",
|
||||
"metric-config.pods.requests-per-second.json-path/scheme": "https",
|
||||
"metric-config.pods.requests-per-second.json-path/min-pod-ready-age": "30s",
|
||||
},
|
||||
MetricName: "requests-per-second",
|
||||
MetricType: autoscalingv2.PodsMetricSourceType,
|
||||
|
@ -1,3 +1,4 @@
|
||||
//go:build !ignore_autogenerated
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
@ -10415,6 +10416,7 @@ func schema_k8sio_api_core_v1_ServicePort(ref common.ReferenceCallback) common.O
|
||||
"protocol": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "The IP protocol for this port. Supports \"TCP\", \"UDP\", and \"SCTP\". Default is TCP.",
|
||||
Default: "TCP",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
|
@ -1,6 +1,8 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
@ -19,6 +21,7 @@ type ScalingSchedule struct {
|
||||
}
|
||||
|
||||
// +genclient
|
||||
// +genclient:nonNamespaced
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
@ -36,6 +39,10 @@ type ClusterScalingSchedule struct {
|
||||
// ScalingScheduleSpec is the spec part of the ScalingSchedule.
|
||||
// +k8s:deepcopy-gen=true
|
||||
type ScalingScheduleSpec struct {
|
||||
// Fade the scheduled values in and out over this many minutes. If unset, the default per-cluster value will be used.
|
||||
// +optional
|
||||
ScalingWindowDurationMinutes *int64 `json:"scalingWindowDurationMinutes,omitempty"`
|
||||
|
||||
// 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
|
||||
@ -49,16 +56,20 @@ type Schedule struct {
|
||||
Type ScheduleType `json:"type"`
|
||||
// Defines the details of a Repeating schedule.
|
||||
// +optional
|
||||
Period SchedulePeriod `json:"period"`
|
||||
Period *SchedulePeriod `json:"period,omitempty"`
|
||||
// Defines the starting date of a OneTime schedule. It has to
|
||||
// be a RFC3339 formated date.
|
||||
// +optional
|
||||
Date ScheduleDate `json:"date"`
|
||||
Date *ScheduleDate `json:"date,omitempty"`
|
||||
// The duration in minutes that the configured value will be
|
||||
// returned for the defined schedule.
|
||||
DurationMinutes int `json:"durationMinutes"`
|
||||
// The metric value that will be returned for the defined schedule.
|
||||
Value int `json:"value"`
|
||||
Value int64 `json:"value"`
|
||||
}
|
||||
|
||||
func (in Schedule) Duration() time.Duration {
|
||||
return time.Duration(in.DurationMinutes) * time.Minute
|
||||
}
|
||||
|
||||
// Defines if the schedule is a OneTime schedule or
|
||||
@ -88,7 +99,6 @@ type SchedulePeriod struct {
|
||||
|
||||
// ScheduleDay represents the valid inputs for days in a SchedulePeriod.
|
||||
// +kubebuilder:validation:Enum=Sun;Mon;Tue;Wed;Thu;Fri;Sat
|
||||
// +k8s:deepcopy-gen=true
|
||||
type ScheduleDay string
|
||||
|
||||
const (
|
||||
@ -98,13 +108,12 @@ const (
|
||||
WednesdaySchedule ScheduleDay = "Wed"
|
||||
ThursdaySchedule ScheduleDay = "Thu"
|
||||
FridaySchedule ScheduleDay = "Fri"
|
||||
StaturdaySchedule ScheduleDay = "Sat"
|
||||
SaturdaySchedule ScheduleDay = "Sat"
|
||||
)
|
||||
|
||||
// ScheduleDate is a RFC3339 representation of the date for a Schedule
|
||||
// of the OneTime type.
|
||||
// +kubebuilder:validation:Format="date-time"
|
||||
// +k8s:deepcopy-gen=true
|
||||
type ScheduleDate string
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
@ -120,11 +129,11 @@ type ScalingScheduleList struct {
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// ScalingScheduleList is a list of cluster scoped scaling schedules.
|
||||
// ClusterScalingScheduleList is a list of cluster scoped scaling schedules.
|
||||
// +k8s:deepcopy-gen=true
|
||||
type ClusterScalingScheduleList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
|
||||
Items []ScalingSchedule `json:"items"`
|
||||
Items []ClusterScalingSchedule `json:"items"`
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ func (in *ClusterScalingScheduleList) DeepCopyInto(out *ClusterScalingScheduleLi
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]ScalingSchedule, len(*in))
|
||||
*out = make([]ClusterScalingSchedule, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
@ -147,6 +147,11 @@ func (in *ScalingScheduleList) DeepCopyObject() runtime.Object {
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ScalingScheduleSpec) DeepCopyInto(out *ScalingScheduleSpec) {
|
||||
*out = *in
|
||||
if in.ScalingWindowDurationMinutes != nil {
|
||||
in, out := &in.ScalingWindowDurationMinutes, &out.ScalingWindowDurationMinutes
|
||||
*out = new(int64)
|
||||
**out = **in
|
||||
}
|
||||
if in.Schedules != nil {
|
||||
in, out := &in.Schedules, &out.Schedules
|
||||
*out = make([]Schedule, len(*in))
|
||||
@ -170,7 +175,16 @@ func (in *ScalingScheduleSpec) DeepCopy() *ScalingScheduleSpec {
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Schedule) DeepCopyInto(out *Schedule) {
|
||||
*out = *in
|
||||
in.Period.DeepCopyInto(&out.Period)
|
||||
if in.Period != nil {
|
||||
in, out := &in.Period, &out.Period
|
||||
*out = new(SchedulePeriod)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.Date != nil {
|
||||
in, out := &in.Date, &out.Date
|
||||
*out = new(ScheduleDate)
|
||||
**out = **in
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ import (
|
||||
// ClusterScalingSchedulesGetter has a method to return a ClusterScalingScheduleInterface.
|
||||
// A group's client should implement this interface.
|
||||
type ClusterScalingSchedulesGetter interface {
|
||||
ClusterScalingSchedules(namespace string) ClusterScalingScheduleInterface
|
||||
ClusterScalingSchedules() ClusterScalingScheduleInterface
|
||||
}
|
||||
|
||||
// ClusterScalingScheduleInterface has methods to work with ClusterScalingSchedule resources.
|
||||
@ -52,14 +52,12 @@ type ClusterScalingScheduleInterface interface {
|
||||
// clusterScalingSchedules implements ClusterScalingScheduleInterface
|
||||
type clusterScalingSchedules struct {
|
||||
client rest.Interface
|
||||
ns string
|
||||
}
|
||||
|
||||
// newClusterScalingSchedules returns a ClusterScalingSchedules
|
||||
func newClusterScalingSchedules(c *ZalandoV1Client, namespace string) *clusterScalingSchedules {
|
||||
func newClusterScalingSchedules(c *ZalandoV1Client) *clusterScalingSchedules {
|
||||
return &clusterScalingSchedules{
|
||||
client: c.RESTClient(),
|
||||
ns: namespace,
|
||||
}
|
||||
}
|
||||
|
||||
@ -67,7 +65,6 @@ func newClusterScalingSchedules(c *ZalandoV1Client, namespace string) *clusterSc
|
||||
func (c *clusterScalingSchedules) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ClusterScalingSchedule, err error) {
|
||||
result = &v1.ClusterScalingSchedule{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("clusterscalingschedules").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
@ -84,7 +81,6 @@ func (c *clusterScalingSchedules) List(ctx context.Context, opts metav1.ListOpti
|
||||
}
|
||||
result = &v1.ClusterScalingScheduleList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("clusterscalingschedules").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
@ -101,7 +97,6 @@ func (c *clusterScalingSchedules) Watch(ctx context.Context, opts metav1.ListOpt
|
||||
}
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("clusterscalingschedules").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
@ -112,7 +107,6 @@ func (c *clusterScalingSchedules) Watch(ctx context.Context, opts metav1.ListOpt
|
||||
func (c *clusterScalingSchedules) Create(ctx context.Context, clusterScalingSchedule *v1.ClusterScalingSchedule, opts metav1.CreateOptions) (result *v1.ClusterScalingSchedule, err error) {
|
||||
result = &v1.ClusterScalingSchedule{}
|
||||
err = c.client.Post().
|
||||
Namespace(c.ns).
|
||||
Resource("clusterscalingschedules").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(clusterScalingSchedule).
|
||||
@ -125,7 +119,6 @@ func (c *clusterScalingSchedules) Create(ctx context.Context, clusterScalingSche
|
||||
func (c *clusterScalingSchedules) Update(ctx context.Context, clusterScalingSchedule *v1.ClusterScalingSchedule, opts metav1.UpdateOptions) (result *v1.ClusterScalingSchedule, err error) {
|
||||
result = &v1.ClusterScalingSchedule{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("clusterscalingschedules").
|
||||
Name(clusterScalingSchedule.Name).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
@ -138,7 +131,6 @@ func (c *clusterScalingSchedules) Update(ctx context.Context, clusterScalingSche
|
||||
// Delete takes name of the clusterScalingSchedule and deletes it. Returns an error if one occurs.
|
||||
func (c *clusterScalingSchedules) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("clusterscalingschedules").
|
||||
Name(name).
|
||||
Body(&opts).
|
||||
@ -153,7 +145,6 @@ func (c *clusterScalingSchedules) DeleteCollection(ctx context.Context, opts met
|
||||
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("clusterscalingschedules").
|
||||
VersionedParams(&listOpts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
@ -166,7 +157,6 @@ func (c *clusterScalingSchedules) DeleteCollection(ctx context.Context, opts met
|
||||
func (c *clusterScalingSchedules) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ClusterScalingSchedule, err error) {
|
||||
result = &v1.ClusterScalingSchedule{}
|
||||
err = c.client.Patch(pt).
|
||||
Namespace(c.ns).
|
||||
Resource("clusterscalingschedules").
|
||||
Name(name).
|
||||
SubResource(subresources...).
|
||||
|
@ -33,7 +33,6 @@ import (
|
||||
// FakeClusterScalingSchedules implements ClusterScalingScheduleInterface
|
||||
type FakeClusterScalingSchedules struct {
|
||||
Fake *FakeZalandoV1
|
||||
ns string
|
||||
}
|
||||
|
||||
var clusterscalingschedulesResource = schema.GroupVersionResource{Group: "zalando.org", Version: "v1", Resource: "clusterscalingschedules"}
|
||||
@ -43,8 +42,7 @@ var clusterscalingschedulesKind = schema.GroupVersionKind{Group: "zalando.org",
|
||||
// Get takes name of the clusterScalingSchedule, and returns the corresponding clusterScalingSchedule object, and an error if there is any.
|
||||
func (c *FakeClusterScalingSchedules) Get(ctx context.Context, name string, options v1.GetOptions) (result *zalandoorgv1.ClusterScalingSchedule, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewGetAction(clusterscalingschedulesResource, c.ns, name), &zalandoorgv1.ClusterScalingSchedule{})
|
||||
|
||||
Invokes(testing.NewRootGetAction(clusterscalingschedulesResource, name), &zalandoorgv1.ClusterScalingSchedule{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -54,8 +52,7 @@ func (c *FakeClusterScalingSchedules) Get(ctx context.Context, name string, opti
|
||||
// List takes label and field selectors, and returns the list of ClusterScalingSchedules that match those selectors.
|
||||
func (c *FakeClusterScalingSchedules) List(ctx context.Context, opts v1.ListOptions) (result *zalandoorgv1.ClusterScalingScheduleList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewListAction(clusterscalingschedulesResource, clusterscalingschedulesKind, c.ns, opts), &zalandoorgv1.ClusterScalingScheduleList{})
|
||||
|
||||
Invokes(testing.NewRootListAction(clusterscalingschedulesResource, clusterscalingschedulesKind, opts), &zalandoorgv1.ClusterScalingScheduleList{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -76,15 +73,13 @@ func (c *FakeClusterScalingSchedules) List(ctx context.Context, opts v1.ListOpti
|
||||
// Watch returns a watch.Interface that watches the requested clusterScalingSchedules.
|
||||
func (c *FakeClusterScalingSchedules) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewWatchAction(clusterscalingschedulesResource, c.ns, opts))
|
||||
|
||||
InvokesWatch(testing.NewRootWatchAction(clusterscalingschedulesResource, opts))
|
||||
}
|
||||
|
||||
// Create takes the representation of a clusterScalingSchedule and creates it. Returns the server's representation of the clusterScalingSchedule, and an error, if there is any.
|
||||
func (c *FakeClusterScalingSchedules) Create(ctx context.Context, clusterScalingSchedule *zalandoorgv1.ClusterScalingSchedule, opts v1.CreateOptions) (result *zalandoorgv1.ClusterScalingSchedule, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewCreateAction(clusterscalingschedulesResource, c.ns, clusterScalingSchedule), &zalandoorgv1.ClusterScalingSchedule{})
|
||||
|
||||
Invokes(testing.NewRootCreateAction(clusterscalingschedulesResource, clusterScalingSchedule), &zalandoorgv1.ClusterScalingSchedule{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -94,8 +89,7 @@ func (c *FakeClusterScalingSchedules) Create(ctx context.Context, clusterScaling
|
||||
// Update takes the representation of a clusterScalingSchedule and updates it. Returns the server's representation of the clusterScalingSchedule, and an error, if there is any.
|
||||
func (c *FakeClusterScalingSchedules) Update(ctx context.Context, clusterScalingSchedule *zalandoorgv1.ClusterScalingSchedule, opts v1.UpdateOptions) (result *zalandoorgv1.ClusterScalingSchedule, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateAction(clusterscalingschedulesResource, c.ns, clusterScalingSchedule), &zalandoorgv1.ClusterScalingSchedule{})
|
||||
|
||||
Invokes(testing.NewRootUpdateAction(clusterscalingschedulesResource, clusterScalingSchedule), &zalandoorgv1.ClusterScalingSchedule{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -105,14 +99,13 @@ func (c *FakeClusterScalingSchedules) Update(ctx context.Context, clusterScaling
|
||||
// Delete takes name of the clusterScalingSchedule and deletes it. Returns an error if one occurs.
|
||||
func (c *FakeClusterScalingSchedules) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewDeleteAction(clusterscalingschedulesResource, c.ns, name), &zalandoorgv1.ClusterScalingSchedule{})
|
||||
|
||||
Invokes(testing.NewRootDeleteAction(clusterscalingschedulesResource, name), &zalandoorgv1.ClusterScalingSchedule{})
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeClusterScalingSchedules) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||
action := testing.NewDeleteCollectionAction(clusterscalingschedulesResource, c.ns, listOpts)
|
||||
action := testing.NewRootDeleteCollectionAction(clusterscalingschedulesResource, listOpts)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &zalandoorgv1.ClusterScalingScheduleList{})
|
||||
return err
|
||||
@ -121,8 +114,7 @@ func (c *FakeClusterScalingSchedules) DeleteCollection(ctx context.Context, opts
|
||||
// Patch applies the patch and returns the patched clusterScalingSchedule.
|
||||
func (c *FakeClusterScalingSchedules) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *zalandoorgv1.ClusterScalingSchedule, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewPatchSubresourceAction(clusterscalingschedulesResource, c.ns, name, pt, data, subresources...), &zalandoorgv1.ClusterScalingSchedule{})
|
||||
|
||||
Invokes(testing.NewRootPatchSubresourceAction(clusterscalingschedulesResource, name, pt, data, subresources...), &zalandoorgv1.ClusterScalingSchedule{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -28,8 +28,8 @@ type FakeZalandoV1 struct {
|
||||
*testing.Fake
|
||||
}
|
||||
|
||||
func (c *FakeZalandoV1) ClusterScalingSchedules(namespace string) v1.ClusterScalingScheduleInterface {
|
||||
return &FakeClusterScalingSchedules{c, namespace}
|
||||
func (c *FakeZalandoV1) ClusterScalingSchedules() v1.ClusterScalingScheduleInterface {
|
||||
return &FakeClusterScalingSchedules{c}
|
||||
}
|
||||
|
||||
func (c *FakeZalandoV1) ScalingSchedules(namespace string) v1.ScalingScheduleInterface {
|
||||
|
@ -35,8 +35,8 @@ type ZalandoV1Client struct {
|
||||
restClient rest.Interface
|
||||
}
|
||||
|
||||
func (c *ZalandoV1Client) ClusterScalingSchedules(namespace string) ClusterScalingScheduleInterface {
|
||||
return newClusterScalingSchedules(c, namespace)
|
||||
func (c *ZalandoV1Client) ClusterScalingSchedules() ClusterScalingScheduleInterface {
|
||||
return newClusterScalingSchedules(c)
|
||||
}
|
||||
|
||||
func (c *ZalandoV1Client) ScalingSchedules(namespace string) ScalingScheduleInterface {
|
||||
|
@ -42,33 +42,32 @@ type ClusterScalingScheduleInformer interface {
|
||||
type clusterScalingScheduleInformer struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||
namespace string
|
||||
}
|
||||
|
||||
// NewClusterScalingScheduleInformer constructs a new informer for ClusterScalingSchedule type.
|
||||
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||
// one. This reduces memory footprint and number of connections to the server.
|
||||
func NewClusterScalingScheduleInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
||||
return NewFilteredClusterScalingScheduleInformer(client, namespace, resyncPeriod, indexers, nil)
|
||||
func NewClusterScalingScheduleInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
||||
return NewFilteredClusterScalingScheduleInformer(client, resyncPeriod, indexers, nil)
|
||||
}
|
||||
|
||||
// NewFilteredClusterScalingScheduleInformer constructs a new informer for ClusterScalingSchedule type.
|
||||
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||
// one. This reduces memory footprint and number of connections to the server.
|
||||
func NewFilteredClusterScalingScheduleInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
|
||||
func NewFilteredClusterScalingScheduleInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
|
||||
return cache.NewSharedIndexInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.ZalandoV1().ClusterScalingSchedules(namespace).List(context.TODO(), options)
|
||||
return client.ZalandoV1().ClusterScalingSchedules().List(context.TODO(), options)
|
||||
},
|
||||
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.ZalandoV1().ClusterScalingSchedules(namespace).Watch(context.TODO(), options)
|
||||
return client.ZalandoV1().ClusterScalingSchedules().Watch(context.TODO(), options)
|
||||
},
|
||||
},
|
||||
&zalandoorgv1.ClusterScalingSchedule{},
|
||||
@ -78,7 +77,7 @@ func NewFilteredClusterScalingScheduleInformer(client versioned.Interface, names
|
||||
}
|
||||
|
||||
func (f *clusterScalingScheduleInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||
return NewFilteredClusterScalingScheduleInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
||||
return NewFilteredClusterScalingScheduleInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
||||
}
|
||||
|
||||
func (f *clusterScalingScheduleInformer) Informer() cache.SharedIndexInformer {
|
||||
|
@ -43,7 +43,7 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList
|
||||
|
||||
// ClusterScalingSchedules returns a ClusterScalingScheduleInformer.
|
||||
func (v *version) ClusterScalingSchedules() ClusterScalingScheduleInformer {
|
||||
return &clusterScalingScheduleInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
||||
return &clusterScalingScheduleInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
|
||||
}
|
||||
|
||||
// ScalingSchedules returns a ScalingScheduleInformer.
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user