mirror of
https://github.com/zalando-incubator/kube-metrics-adapter.git
synced 2026-03-06 00:04:58 +00:00
Compare commits
57 Commits
4bfdecf896
...
v0.2.6
| Author | SHA1 | Date | |
|---|---|---|---|
| 32bda8016a | |||
| 42abde30f9 | |||
| 4fbc29df7a | |||
| 5124f33c5d | |||
| 592237dc0e | |||
| 1e042c124c | |||
| f7a4092a59 | |||
| 7f59aa03b6 | |||
| bd9291672d | |||
| 9b7cd55a64 | |||
| 2be79ae0f2 | |||
| 50c4a7e4fa | |||
| a485ee7942 | |||
| e30f772435 | |||
| bf80e85e58 | |||
| c5017c7f89 | |||
| 613d6ba302 | |||
| 2ed22f04c2 | |||
| b79f3bf065 | |||
| 292bd4fc27 | |||
| be40d664f6 | |||
| 5418c64e8f | |||
| f0a07e0c64 | |||
| a1d90533e8 | |||
| e16119f821 | |||
| 96a1315ad3 | |||
| 8b1245cbc8 | |||
| 30dcc24c7f | |||
| d1d37dca26 | |||
| 221589d630 | |||
| 3acdacf8c9 | |||
| 62c50df209 | |||
| 25e6ce4bd1 | |||
| 52d3980c56 | |||
| da84a4292d | |||
| 80b80c878d | |||
| e44da55641 | |||
| b9308bd8a9 | |||
| 29ce099563 | |||
| a4306be7a5 | |||
| d346066ee7 | |||
| 763ba23fd9 | |||
| f4e7a37a7b | |||
| 21dae23214 | |||
| 7d47ff5c06 | |||
| c027968c71 | |||
| eef3840510 | |||
| 716d03a09b | |||
| f625fe9540 | |||
| 9e38fe15a5 | |||
| 0c7b5bdafe | |||
| b44fcbaae8 | |||
| eb27f6037f | |||
| 6149308e6d | |||
| 62cc9c98f3 | |||
| e03222b12b | |||
| 063d3de6d2 |
@@ -19,3 +19,11 @@ updates:
|
||||
interval: monthly
|
||||
time: "07:00"
|
||||
open-pull-requests-limit: 10
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "monthly"
|
||||
groups:
|
||||
github-actions:
|
||||
patterns:
|
||||
- "*"
|
||||
|
||||
@@ -10,10 +10,10 @@ jobs:
|
||||
tests:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-go@v6.0.0
|
||||
with:
|
||||
go-version: '^1.23'
|
||||
go-version: '^1.25'
|
||||
- run: go version
|
||||
- run: go install github.com/mattn/goveralls@latest
|
||||
- run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
|
||||
|
||||
@@ -38,12 +38,12 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: setup go
|
||||
uses: actions/setup-go@v5
|
||||
uses: actions/setup-go@v6.0.0
|
||||
with:
|
||||
go-version: '1.22'
|
||||
go-version: '1.25'
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
|
||||
@@ -25,15 +25,15 @@ jobs:
|
||||
packages: write # to push packages
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
|
||||
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493
|
||||
|
||||
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753
|
||||
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00
|
||||
with:
|
||||
# https://www.npmjs.com/package/semver#caret-ranges-123-025-004
|
||||
go-version: '^1.21'
|
||||
go-version: '^1.25'
|
||||
|
||||
- name: Login to Github Container Registry
|
||||
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc
|
||||
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
@@ -47,21 +47,21 @@ jobs:
|
||||
make build.linux.amd64 build.linux.arm64
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@2b82ce82d56a2a04d2637cd93a637ae1b359c0a7
|
||||
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@4c0219f9ac95b02789c1075625400b2acbff50b1
|
||||
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc
|
||||
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Docker meta
|
||||
uses: docker/metadata-action@818d4b7b91585d195f67373fd9cb0332e31a7175
|
||||
uses: docker/metadata-action@c1e51972afc2121e065aed6d45c65596fe445f3f
|
||||
id: meta
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
@@ -70,10 +70,10 @@ jobs:
|
||||
type=semver,pattern=v{{major}}.{{minor}}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825
|
||||
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83
|
||||
with:
|
||||
context: .
|
||||
build-args: BASE_IMAGE=alpine:3
|
||||
build-args: BASE_IMAGE=gcr.io/distroless/static-debian12
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/v') }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
@@ -81,10 +81,10 @@ jobs:
|
||||
|
||||
# Build and push latest tag
|
||||
- name: Build and push latest
|
||||
uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825
|
||||
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83
|
||||
with:
|
||||
context: .
|
||||
build-args: BASE_IMAGE=alpine:3
|
||||
build-args: BASE_IMAGE=gcr.io/distroless/static-debian12
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
||||
|
||||
@@ -10,7 +10,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
@@ -20,7 +20,7 @@ jobs:
|
||||
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
|
||||
|
||||
- name: Run chart-releaser
|
||||
uses: helm/chart-releaser-action@v1.4.0
|
||||
uses: helm/chart-releaser-action@v1.7.0
|
||||
with:
|
||||
charts_dir: docs
|
||||
env:
|
||||
|
||||
@@ -243,6 +243,10 @@ metadata:
|
||||
# If specified, then this prometheus server is used,
|
||||
# instead of the prometheus server specified as the CLI argument `--prometheus-server`.
|
||||
metric-config.external.processed-events-per-second.prometheus/prometheus-server: http://prometheus.my-namespace.svc
|
||||
# This annotation is optional.
|
||||
# If specified, this will use one of the additional prometheus servers configured via the
|
||||
# --additional-prometheus-server <name>=<url>,<name>=<url>,... CLI argument.
|
||||
metric-config.external.processed-events-per-second.prometheus/prometheus-server-alias: external-prometheus
|
||||
# metric-config.<metricType>.<metricName>.<collectorType>/<configKey>
|
||||
metric-config.external.processed-events-per-second.prometheus/query: |
|
||||
scalar(sum(rate(event-service_events_count{application="event-service",processed="true"}[1m])))
|
||||
@@ -751,12 +755,12 @@ spec:
|
||||
- type: External
|
||||
external:
|
||||
metric:
|
||||
name: my-nakadi-consumer
|
||||
selector:
|
||||
matchLabels:
|
||||
type: nakadi
|
||||
subscription-id: "708095f6-cece-4d02-840e-ee488d710b29"
|
||||
metric-type: "consumer-lag-seconds|unconsumed-events"
|
||||
name: my-nakadi-consumer
|
||||
selector:
|
||||
matchLabels:
|
||||
type: nakadi
|
||||
subscription-id: "708095f6-cece-4d02-840e-ee488d710b29"
|
||||
metric-type: "consumer-lag-seconds|unconsumed-events"
|
||||
target:
|
||||
# value is compatible with the consumer-lag-seconds metric type.
|
||||
# It describes the amount of consumer lag in seconds before scaling
|
||||
@@ -805,6 +809,27 @@ with more consumers.
|
||||
For this case you should also account for the average time for processing an
|
||||
event when defining the target.
|
||||
|
||||
Alternative to defining `subscription-id` you can also filter based on
|
||||
`owning_application`, `event-types` and `consumer-group`:
|
||||
|
||||
```yaml
|
||||
metrics:
|
||||
- type: External
|
||||
external:
|
||||
metric:
|
||||
name: my-nakadi-consumer
|
||||
selector:
|
||||
matchLabels:
|
||||
type: nakadi
|
||||
owning-application: "example-app"
|
||||
# comma separated list of event types
|
||||
event-types: "example-event-type,example-event-type2"
|
||||
consumer-group: "abcd1234"
|
||||
metric-type: "consumer-lag-seconds|unconsumed-events"
|
||||
```
|
||||
|
||||
This is useful in dynamic environments where the subscription ID might not be
|
||||
known before deployment time (e.g. because it's created by the same deployment).
|
||||
|
||||
## HTTP Collector
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
controller-gen.kubebuilder.io/version: v0.16.5
|
||||
controller-gen.kubebuilder.io/version: v0.19.0
|
||||
name: clusterscalingschedules.zalando.org
|
||||
spec:
|
||||
group: zalando.org
|
||||
@@ -11,6 +11,10 @@ spec:
|
||||
kind: ClusterScalingSchedule
|
||||
listKind: ClusterScalingScheduleList
|
||||
plural: clusterscalingschedules
|
||||
shortNames:
|
||||
- css
|
||||
- clustersched
|
||||
- clusterschedule
|
||||
singular: clusterscalingschedule
|
||||
scope: Cluster
|
||||
versions:
|
||||
|
||||
@@ -39,170 +39,179 @@ spec:
|
||||
args:
|
||||
{{- if .Values.addDirectoryHeader }}
|
||||
- --add_dir_header={{ .Values.addDirectoryHeader }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.log.alsoToStderr }}
|
||||
- --alsologtostderr={{ .Values.log.alsoToStderr }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.authentication.kubeConfig }}
|
||||
- --authentication-kubeconfig={{ .Values.authentication.kubeConfig }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.authentication.skipLookup }}
|
||||
- --authentication-skip-lookup={{ .Values.authentication.skipLookup }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.authentication.tokenWebhookCacheTtl }}
|
||||
- --authentication-token-webhook-cache-ttl={{ .Values.authentication.tokenWebhookCacheTtl }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.authentication.tolerateLookupFailure }}
|
||||
- --authentication-tolerate-lookup-failure={{ .Values.authentication.tolerateLookupFailure }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.authorization.alwaysAllowPaths }}
|
||||
- --authorization-always-allow-paths={{ .Values.authorization.alwaysAllowPaths }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.authorization.kubeConfig }}
|
||||
- --authorization-kubeconfig={{ .Values.authorization.kubeConfig }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.authorization.webhookCache.authorizedTtl }}
|
||||
- --authorization-webhook-cache-authorized-ttl={{ .Values.authorization.webhookCache.authorizedTtl }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.authorization.webhookCache.unauthorizedTtl }}
|
||||
- --authorization-webhook-cache-unauthorized-ttl={{ .Values.authorization.webhookCache.unauthorizedTtl }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.aws.externalMetrics }}
|
||||
- --aws-external-metrics={{ .Values.aws.externalMetrics }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.aws.region }}
|
||||
- --aws-region={{ .Values.aws.region }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.tls.certificateDirectory }}
|
||||
- --cert-dir={{ .Values.tls.certificateDirectory }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.tls.clientCaFile }}
|
||||
- --client-ca-file={{ .Values.tls.clientCaFile }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.contentionProfiling }}
|
||||
- --contention-profiling={{ .Values.contentionProfiling }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.credentialsDirectory }}
|
||||
- --credentials-dir={{ .Values.credentialsDirectory }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.disregardIncompatibleHPAs }}
|
||||
- --disregard-incompatible-hpas={{ .Values.disregardIncompatibleHPAs }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.enableCustomMetricsApi }}
|
||||
- --enable-custom-metrics-api={{ .Values.enableCustomMetricsApi }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.enableExternalMetricsApi }}
|
||||
- --enable-external-metrics-api={{ .Values.enableExternalMetricsApi }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.http2MaxStreamsPerConnection }}
|
||||
- --http2-max-streams-per-connection={{ .Values.http2MaxStreamsPerConnection }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.influxDB.address }}
|
||||
- --influxdb-address={{ .Values.influxDB.address }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.influxDB.organization }}
|
||||
- --influxdb-org={{ .Values.influxDB.organization }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.influxDB.token }}
|
||||
- --influxdb-token={{ .Values.influxDB.token }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.listerKubeConfig }}
|
||||
- --lister-kubeconfig={{ .Values.listerKubeConfig }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.log.flushFrequency }}
|
||||
- --log-flush-frequency={{ .Values.log.flushFrequency }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.log.backtraceAtTraceLocation }}
|
||||
- --log_backtrace_at={{ .Values.log.backtraceAtTraceLocation }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.log.directory }}
|
||||
- --log_dir={{ .Values.log.directory }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.log.file }}
|
||||
- --log_file={{ .Values.log.file }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.log.fileMaxSize }}
|
||||
- --log_file_max_size={{ .Values.log.fileMaxSize }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.log.toStderr }}
|
||||
- --logtostderr={{ .Values.log.toStderr }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.prometheus.metricsAddress }}
|
||||
- --metrics-address={{ .Values.prometheus.metricsAddress }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.profiling }}
|
||||
- --profiling={{ .Values.profiling }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.prometheus.server }}
|
||||
- --prometheus-server={{ .Values.prometheus.server }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.prometheus.serverTokenFile }}
|
||||
- --prometheus-server-token-file={{ .Values.prometheus.serverTokenFile }}
|
||||
{{- end }}
|
||||
{{- range $name, $url := .Values.prometheus.additionalServers }}
|
||||
- --additional-prometheus-server={{ $name }}={{ $url }}
|
||||
{{- end }}
|
||||
{{- range $name, $path := .Values.prometheus.additionalServerTokenFiles }}
|
||||
- --additional-prometheus-server-token-file={{ $name }}={{ $path }}
|
||||
{{- end }}
|
||||
{{- if .Values.requestHeader.allowedNames }}
|
||||
- --requestheader-allowed-names={{ .Values.requestHeader.allowedNames }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.requestHeader.clientCaFile }}
|
||||
- --requestheader-client-ca-file={{ .Values.requestHeader.clientCaFile }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.requestHeader.extraHeadersPrefix }}
|
||||
- --requestheader-extra-headers-prefix={{ .Values.requestHeader.extraHeadersPrefix }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.requestHeader.groupHeaders }}
|
||||
- --requestheader-group-headers={{ .Values.requestHeader.groupHeaders }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.requestHeader.usernameHeaders }}
|
||||
- --requestheader-username-headers={{ .Values.requestHeader.usernameHeaders }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
- --secure-port={{ .Values.service.internalPort }}
|
||||
{{- if .Values.log.skipHeaders }}
|
||||
- --skip_headers={{ .Values.log.skipHeaders }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.log.skipLogHeaders }}
|
||||
- --skip_log_headers={{ .Values.log.skipLogHeaders }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.skipperBackendsAnnotation }}
|
||||
- --skipper-backends-annotation={{ .Values.skipperBackendsAnnotation }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.skipperIngressMetrics }}
|
||||
- --skipper-ingress-metrics={{ .Values.skipperIngressMetrics }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.skipperRouteGroupMetrics }}
|
||||
- --skipper-routegroup-metrics={{ .Values.skipperRouteGroupMetrics }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.log.stderrThreshold }}
|
||||
- --stderrthreshold={{ .Values.log.stderrThreshold }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.tls.certFile }}
|
||||
- --tls-cert-file={{ .Values.tls.certFile }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.tls.cipherSuites }}
|
||||
- --tls-cipher-suites={{ .Values.tls.cipherSuites }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.tls.minVersion }}
|
||||
- --tls-min-version={{ .Values.tls.minVersion }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.tls.privateKeyFile }}
|
||||
- --tls-private-key-file={{ .Values.tls.privateKeyFile }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.tls.sniCertKey }}
|
||||
- --tls-sni-cert-key={{ .Values.tls.sniCertKey }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.token }}
|
||||
- --token={{ .Values.token }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.log.level }}
|
||||
- --v={{ .Values.log.level }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.vmodule }}
|
||||
- --vmodule={{ .Values.vmodule }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.zmon.kariosdbEndpoint }}
|
||||
- --zmon-kariosdb-endpoint={{ .Values.zmon.kariosdbEndpoint }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.zmon.tokenName }}
|
||||
- --zmon-token-name={{ .Values.zmon.tokenName }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- if .Values.scalingSchedule.enabled }}
|
||||
- --scaling-schedule
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
resources:
|
||||
limits:
|
||||
cpu: {{ .Values.resources.limits.cpu }}
|
||||
@@ -210,3 +219,9 @@ spec:
|
||||
requests:
|
||||
cpu: {{ .Values.resources.requests.cpu }}
|
||||
memory: {{ .Values.resources.requests.memory }}
|
||||
{{- if .Values.volumeMounts }}
|
||||
volumeMounts: {{- toYaml .Values.volumeMounts | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if .Values.volumes }}
|
||||
volumes: {{- toYaml .Values.volumes | nindent 8 }}
|
||||
{{- end }}
|
||||
|
||||
@@ -3,7 +3,7 @@ namespace: kube-system
|
||||
replicas: 1
|
||||
|
||||
registry:
|
||||
image: registry.opensource.zalan.do/teapot/kube-metrics-adapter
|
||||
image: ghcr.io/zalando-incubator/kube-metrics-adapter
|
||||
imageTag: v0.2.3
|
||||
imagePullPolicy: IfNotPresent
|
||||
|
||||
@@ -63,6 +63,9 @@ log:
|
||||
|
||||
prometheus:
|
||||
server: http://prometheus.kube-system.svc.cluster.local
|
||||
serverTokenFile:
|
||||
additionalServers: {}
|
||||
additionalServerTokenFiles: {}
|
||||
metricsAddress:
|
||||
|
||||
requestHeader:
|
||||
@@ -109,3 +112,7 @@ priorityClassName: ""
|
||||
podAnnotations: {}
|
||||
|
||||
serviceAccountAnnotations: {}
|
||||
|
||||
volumes: []
|
||||
|
||||
volumeMounts: []
|
||||
|
||||
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
controller-gen.kubebuilder.io/version: v0.16.5
|
||||
controller-gen.kubebuilder.io/version: v0.19.0
|
||||
name: scalingschedules.zalando.org
|
||||
spec:
|
||||
group: zalando.org
|
||||
@@ -13,6 +13,9 @@ spec:
|
||||
kind: ScalingSchedule
|
||||
listKind: ScalingScheduleList
|
||||
plural: scalingschedules
|
||||
shortNames:
|
||||
- sched
|
||||
- schedule
|
||||
singular: scalingschedule
|
||||
scope: Namespaced
|
||||
versions:
|
||||
|
||||
@@ -1,37 +1,38 @@
|
||||
module github.com/zalando-incubator/kube-metrics-adapter
|
||||
|
||||
require (
|
||||
github.com/argoproj/argo-rollouts v1.8.0
|
||||
github.com/aws/aws-sdk-go-v2 v1.36.0
|
||||
github.com/aws/aws-sdk-go-v2/config v1.29.4
|
||||
github.com/aws/aws-sdk-go-v2/service/sqs v1.37.12
|
||||
github.com/argoproj/argo-rollouts v1.8.3
|
||||
github.com/aws/aws-sdk-go-v2 v1.38.3
|
||||
github.com/aws/aws-sdk-go-v2/config v1.31.6
|
||||
github.com/aws/aws-sdk-go-v2/service/sqs v1.42.3
|
||||
github.com/influxdata/influxdb-client-go v1.4.0
|
||||
github.com/prometheus/client_golang v1.20.5
|
||||
github.com/prometheus/common v0.62.0
|
||||
github.com/prometheus/client_golang v1.23.2
|
||||
github.com/prometheus/common v0.66.1
|
||||
github.com/sirupsen/logrus v1.9.3
|
||||
github.com/spf13/cobra v1.8.1
|
||||
github.com/spf13/cobra v1.10.1
|
||||
github.com/spyzhov/ajson v0.9.6
|
||||
github.com/stretchr/testify v1.10.0
|
||||
github.com/stretchr/testify v1.11.1
|
||||
github.com/szuecs/routegroup-client v0.28.2
|
||||
github.com/zalando-incubator/cluster-lifecycle-manager v0.0.0-20240619093047-7853f3386b71
|
||||
golang.org/x/net v0.34.0
|
||||
golang.org/x/oauth2 v0.25.0
|
||||
golang.org/x/sync v0.10.0
|
||||
k8s.io/api v0.31.5
|
||||
k8s.io/apimachinery v0.31.5
|
||||
k8s.io/apiserver v0.31.5
|
||||
k8s.io/client-go v0.31.5
|
||||
k8s.io/code-generator v0.31.5
|
||||
k8s.io/component-base v0.31.5
|
||||
github.com/zalando-incubator/cluster-lifecycle-manager v0.0.0-20250912104308-4489de744ee3
|
||||
golang.org/x/net v0.44.0
|
||||
golang.org/x/oauth2 v0.31.0
|
||||
golang.org/x/sync v0.17.0
|
||||
k8s.io/api v0.34.0
|
||||
k8s.io/apimachinery v0.34.0
|
||||
k8s.io/apiserver v0.34.0
|
||||
k8s.io/client-go v0.34.0
|
||||
k8s.io/code-generator v0.34.0
|
||||
k8s.io/component-base v0.34.0
|
||||
k8s.io/klog v1.0.0
|
||||
k8s.io/kube-openapi v0.0.0-20240620174524-b456828f718b
|
||||
k8s.io/metrics v0.31.5
|
||||
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8
|
||||
sigs.k8s.io/controller-tools v0.16.5
|
||||
sigs.k8s.io/custom-metrics-apiserver v1.30.1-0.20241105195130-84dc8cfe2555
|
||||
k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b
|
||||
k8s.io/metrics v0.33.1
|
||||
k8s.io/utils v0.0.0-20250604170112-4c0f3b243397
|
||||
sigs.k8s.io/controller-tools v0.19.0
|
||||
sigs.k8s.io/custom-metrics-apiserver v1.33.0
|
||||
)
|
||||
|
||||
require (
|
||||
cel.dev/expr v0.24.0 // indirect
|
||||
github.com/BurntSushi/toml v1.4.0 // indirect
|
||||
github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53 // indirect
|
||||
github.com/CloudyKit/jet/v6 v6.2.0 // indirect
|
||||
@@ -41,18 +42,17 @@ require (
|
||||
github.com/andybalholm/brotli v1.1.0 // indirect
|
||||
github.com/antlr4-go/antlr/v4 v4.13.0 // indirect
|
||||
github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect
|
||||
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.17.57 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.27 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.31 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.31 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.2 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.2 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.12 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.24.14 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.13 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.33.12 // indirect
|
||||
github.com/aws/smithy-go v1.22.2 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.18.10 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.6 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.6 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.6 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.3 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.1 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.6 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.29.1 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.34.2 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.38.2 // indirect
|
||||
github.com/aws/smithy-go v1.23.0 // indirect
|
||||
github.com/aymerick/douceur v0.2.0 // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/blang/semver/v4 v4.0.0 // indirect
|
||||
@@ -66,45 +66,55 @@ require (
|
||||
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
|
||||
github.com/deepmap/oapi-codegen v1.16.3 // indirect
|
||||
github.com/emicklei/go-restful/v3 v3.12.1 // indirect
|
||||
github.com/emicklei/go-restful/v3 v3.12.2 // indirect
|
||||
github.com/fatih/color v1.18.0 // indirect
|
||||
github.com/fatih/structs v1.1.0 // indirect
|
||||
github.com/felixge/httpsnoop v1.0.4 // indirect
|
||||
github.com/flosch/pongo2/v4 v4.0.2 // indirect
|
||||
github.com/fsnotify/fsnotify v1.7.0 // indirect
|
||||
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
|
||||
github.com/fsnotify/fsnotify v1.9.0 // indirect
|
||||
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.4 // indirect
|
||||
github.com/gin-contrib/sse v0.1.0 // indirect
|
||||
github.com/gin-gonic/gin v1.10.0 // indirect
|
||||
github.com/go-logr/logr v1.4.2 // indirect
|
||||
github.com/go-logr/logr v1.4.3 // indirect
|
||||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.21.0 // indirect
|
||||
github.com/go-openapi/jsonreference v0.21.0 // indirect
|
||||
github.com/go-openapi/swag v0.23.0 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.22.0 // indirect
|
||||
github.com/go-openapi/jsonreference v0.21.1 // indirect
|
||||
github.com/go-openapi/swag v0.24.1 // indirect
|
||||
github.com/go-openapi/swag/cmdutils v0.24.0 // indirect
|
||||
github.com/go-openapi/swag/conv v0.24.0 // indirect
|
||||
github.com/go-openapi/swag/fileutils v0.24.0 // indirect
|
||||
github.com/go-openapi/swag/jsonname v0.24.0 // indirect
|
||||
github.com/go-openapi/swag/jsonutils v0.24.0 // indirect
|
||||
github.com/go-openapi/swag/loading v0.24.0 // indirect
|
||||
github.com/go-openapi/swag/mangling v0.24.0 // indirect
|
||||
github.com/go-openapi/swag/netutils v0.24.0 // indirect
|
||||
github.com/go-openapi/swag/stringutils v0.24.0 // indirect
|
||||
github.com/go-openapi/swag/typeutils v0.24.0 // indirect
|
||||
github.com/go-openapi/swag/yamlutils v0.24.0 // indirect
|
||||
github.com/go-playground/locales v0.14.1 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||
github.com/go-playground/validator/v10 v10.22.0 // indirect
|
||||
github.com/gobuffalo/flect v1.0.3 // indirect
|
||||
github.com/goccy/go-json v0.10.3 // indirect
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
|
||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
||||
github.com/golang-jwt/jwt/v5 v5.3.0 // indirect
|
||||
github.com/golang/protobuf v1.5.4 // indirect
|
||||
github.com/golang/snappy v0.0.4 // indirect
|
||||
github.com/gomarkdown/markdown v0.0.0-20241205020045-f7e15b2f3e62 // indirect
|
||||
github.com/google/cel-go v0.20.1 // indirect
|
||||
github.com/google/gnostic-models v0.6.9-0.20230804172637-c7be7c783f49 // indirect
|
||||
github.com/google/go-cmp v0.6.0 // indirect
|
||||
github.com/google/gofuzz v1.2.0 // indirect
|
||||
github.com/google/btree v1.1.3 // indirect
|
||||
github.com/google/cel-go v0.26.0 // indirect
|
||||
github.com/google/gnostic-models v0.7.0 // indirect
|
||||
github.com/google/go-cmp v0.7.0 // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/gorilla/css v1.0.1 // indirect
|
||||
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect
|
||||
github.com/imdario/mergo v0.3.16 // indirect
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||
github.com/influxdata/line-protocol v0.0.0-20210922203350-b1ad95c89adf // indirect
|
||||
github.com/iris-contrib/schema v0.0.6 // indirect
|
||||
github.com/josharian/intern v1.0.0 // indirect
|
||||
github.com/jpillora/backoff v1.0.0 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/kataras/blocks v0.0.8 // indirect
|
||||
github.com/kataras/golog v0.1.12 // indirect
|
||||
@@ -112,28 +122,30 @@ require (
|
||||
github.com/kataras/pio v0.0.13 // indirect
|
||||
github.com/kataras/sitemap v0.0.6 // indirect
|
||||
github.com/kataras/tunnel v0.0.4 // indirect
|
||||
github.com/klauspost/compress v1.17.9 // indirect
|
||||
github.com/klauspost/compress v1.18.0 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.2.8 // indirect
|
||||
github.com/kylelemons/godebug v1.1.0 // indirect
|
||||
github.com/labstack/echo/v4 v4.12.0 // indirect
|
||||
github.com/labstack/gommon v0.4.2 // indirect
|
||||
github.com/leodido/go-urn v1.4.0 // indirect
|
||||
github.com/mailgun/raymond/v2 v2.0.48 // indirect
|
||||
github.com/mailru/easyjson v0.7.7 // indirect
|
||||
github.com/mailru/easyjson v0.9.0 // indirect
|
||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/microcosm-cc/bluemonday v1.0.26 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
|
||||
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
|
||||
github.com/prometheus/client_model v0.6.1 // indirect
|
||||
github.com/prometheus/procfs v0.15.1 // indirect
|
||||
github.com/prometheus/client_model v0.6.2 // indirect
|
||||
github.com/prometheus/procfs v0.16.1 // indirect
|
||||
github.com/rogpeppe/go-internal v1.14.1 // indirect
|
||||
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
||||
github.com/schollz/closestmatch v2.1.0+incompatible // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/spf13/pflag v1.0.10 // indirect
|
||||
github.com/stoewer/go-strcase v1.3.0 // indirect
|
||||
github.com/tdewolff/minify/v2 v2.20.34 // indirect
|
||||
github.com/tdewolff/parse/v2 v2.7.15 // indirect
|
||||
@@ -145,47 +157,51 @@ require (
|
||||
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
|
||||
github.com/x448/float16 v0.8.4 // indirect
|
||||
github.com/yosssi/ace v0.0.5 // indirect
|
||||
go.etcd.io/etcd/api/v3 v3.5.14 // indirect
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.14 // indirect
|
||||
go.etcd.io/etcd/client/v3 v3.5.14 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 // indirect
|
||||
go.opentelemetry.io/otel v1.28.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.27.0 // indirect
|
||||
go.opentelemetry.io/otel/metric v1.28.0 // indirect
|
||||
go.opentelemetry.io/otel/sdk v1.28.0 // indirect
|
||||
go.opentelemetry.io/otel/trace v1.28.0 // indirect
|
||||
go.opentelemetry.io/proto/otlp v1.3.1 // indirect
|
||||
go.etcd.io/etcd/api/v3 v3.6.4 // indirect
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.6.4 // indirect
|
||||
go.etcd.io/etcd/client/v3 v3.6.4 // indirect
|
||||
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.60.0 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.58.0 // indirect
|
||||
go.opentelemetry.io/otel v1.35.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.34.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.34.0 // indirect
|
||||
go.opentelemetry.io/otel/metric v1.35.0 // indirect
|
||||
go.opentelemetry.io/otel/sdk v1.34.0 // indirect
|
||||
go.opentelemetry.io/otel/trace v1.35.0 // indirect
|
||||
go.opentelemetry.io/proto/otlp v1.5.0 // indirect
|
||||
go.uber.org/multierr v1.11.0 // indirect
|
||||
go.uber.org/zap v1.26.0 // indirect
|
||||
go.uber.org/zap v1.27.0 // indirect
|
||||
go.yaml.in/yaml/v2 v2.4.2 // indirect
|
||||
go.yaml.in/yaml/v3 v3.0.4 // indirect
|
||||
golang.org/x/arch v0.8.0 // indirect
|
||||
golang.org/x/crypto v0.32.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 // indirect
|
||||
golang.org/x/mod v0.21.0 // indirect
|
||||
golang.org/x/sys v0.29.0 // indirect
|
||||
golang.org/x/term v0.28.0 // indirect
|
||||
golang.org/x/text v0.21.0 // indirect
|
||||
golang.org/x/time v0.5.0 // indirect
|
||||
golang.org/x/tools v0.26.0 // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect
|
||||
google.golang.org/grpc v1.68.1 // indirect
|
||||
google.golang.org/protobuf v1.36.1 // indirect
|
||||
golang.org/x/crypto v0.42.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
|
||||
golang.org/x/mod v0.28.0 // indirect
|
||||
golang.org/x/sys v0.36.0 // indirect
|
||||
golang.org/x/term v0.35.0 // indirect
|
||||
golang.org/x/text v0.29.0 // indirect
|
||||
golang.org/x/time v0.11.0 // indirect
|
||||
golang.org/x/tools v0.37.0 // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250303144028-a0af3efb3deb // indirect
|
||||
google.golang.org/grpc v1.72.1 // indirect
|
||||
google.golang.org/protobuf v1.36.8 // indirect
|
||||
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
|
||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
k8s.io/apiextensions-apiserver v0.31.2 // indirect
|
||||
k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70 // indirect
|
||||
k8s.io/apiextensions-apiserver v0.34.0 // indirect
|
||||
k8s.io/gengo/v2 v2.0.0-20250604051438-85fd79dbfd9f // indirect
|
||||
k8s.io/klog/v2 v2.130.1 // indirect
|
||||
k8s.io/kms v0.31.5 // indirect
|
||||
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.3 // indirect
|
||||
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
|
||||
sigs.k8s.io/yaml v1.4.0 // indirect
|
||||
k8s.io/kms v0.34.0 // indirect
|
||||
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2 // indirect
|
||||
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect
|
||||
sigs.k8s.io/randfill v1.0.0 // indirect
|
||||
sigs.k8s.io/structured-merge-diff/v6 v6.3.0 // indirect
|
||||
sigs.k8s.io/yaml v1.6.0 // indirect
|
||||
)
|
||||
|
||||
go 1.23
|
||||
go 1.24.2
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -20,7 +20,7 @@ type ScalingScheduler interface {
|
||||
// ScalingSchedule describes a namespaced time based metric to be used
|
||||
// in autoscaling operations.
|
||||
// +k8s:deepcopy-gen=true
|
||||
// +kubebuilder:resource:categories=all
|
||||
// +kubebuilder:resource:categories=all,shortName=sched;schedule
|
||||
// +kubebuilder:printcolumn:name="Active",type=boolean,JSONPath=`.status.active`,description="Whether one or more schedules are currently active."
|
||||
// +kubebuilder:subresource:status
|
||||
type ScalingSchedule struct {
|
||||
@@ -51,10 +51,9 @@ func (s *ScalingSchedule) ResourceSpec() ScalingScheduleSpec {
|
||||
// ClusterScalingSchedule describes a cluster scoped time based metric
|
||||
// to be used in autoscaling operations.
|
||||
// +k8s:deepcopy-gen=true
|
||||
// +kubebuilder:resource:categories=all
|
||||
// +kubebuilder:resource:scope=Cluster,shortName=css;clustersched;clusterschedule
|
||||
// +kubebuilder:printcolumn:name="Active",type=boolean,JSONPath=`.status.active`,description="Whether one or more schedules are currently active."
|
||||
// +kubebuilder:subresource:status
|
||||
// +kubebuilder:resource:scope=Cluster
|
||||
type ClusterScalingSchedule struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
@@ -19,8 +19,8 @@ limitations under the License.
|
||||
package versioned
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
fmt "fmt"
|
||||
http "net/http"
|
||||
|
||||
zalandov1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/client/clientset/versioned/typed/zalando.org/v1"
|
||||
discovery "k8s.io/client-go/discovery"
|
||||
|
||||
@@ -22,6 +22,7 @@ import (
|
||||
clientset "github.com/zalando-incubator/kube-metrics-adapter/pkg/client/clientset/versioned"
|
||||
zalandov1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/client/clientset/versioned/typed/zalando.org/v1"
|
||||
fakezalandov1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/client/clientset/versioned/typed/zalando.org/v1/fake"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/watch"
|
||||
"k8s.io/client-go/discovery"
|
||||
@@ -49,9 +50,13 @@ func NewSimpleClientset(objects ...runtime.Object) *Clientset {
|
||||
cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake}
|
||||
cs.AddReactor("*", "*", testing.ObjectReaction(o))
|
||||
cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) {
|
||||
var opts metav1.ListOptions
|
||||
if watchActcion, ok := action.(testing.WatchActionImpl); ok {
|
||||
opts = watchActcion.ListOptions
|
||||
}
|
||||
gvr := action.GetResource()
|
||||
ns := action.GetNamespace()
|
||||
watch, err := o.Watch(gvr, ns)
|
||||
watch, err := o.Watch(gvr, ns, opts)
|
||||
if err != nil {
|
||||
return false, nil, err
|
||||
}
|
||||
|
||||
@@ -19,9 +19,9 @@ limitations under the License.
|
||||
package v1
|
||||
|
||||
import (
|
||||
"context"
|
||||
context "context"
|
||||
|
||||
v1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/apis/zalando.org/v1"
|
||||
zalandoorgv1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/apis/zalando.org/v1"
|
||||
scheme "github.com/zalando-incubator/kube-metrics-adapter/pkg/client/clientset/versioned/scheme"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
@@ -37,33 +37,34 @@ type ClusterScalingSchedulesGetter interface {
|
||||
|
||||
// ClusterScalingScheduleInterface has methods to work with ClusterScalingSchedule resources.
|
||||
type ClusterScalingScheduleInterface interface {
|
||||
Create(ctx context.Context, clusterScalingSchedule *v1.ClusterScalingSchedule, opts metav1.CreateOptions) (*v1.ClusterScalingSchedule, error)
|
||||
Update(ctx context.Context, clusterScalingSchedule *v1.ClusterScalingSchedule, opts metav1.UpdateOptions) (*v1.ClusterScalingSchedule, error)
|
||||
Create(ctx context.Context, clusterScalingSchedule *zalandoorgv1.ClusterScalingSchedule, opts metav1.CreateOptions) (*zalandoorgv1.ClusterScalingSchedule, error)
|
||||
Update(ctx context.Context, clusterScalingSchedule *zalandoorgv1.ClusterScalingSchedule, opts metav1.UpdateOptions) (*zalandoorgv1.ClusterScalingSchedule, error)
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
UpdateStatus(ctx context.Context, clusterScalingSchedule *v1.ClusterScalingSchedule, opts metav1.UpdateOptions) (*v1.ClusterScalingSchedule, error)
|
||||
UpdateStatus(ctx context.Context, clusterScalingSchedule *zalandoorgv1.ClusterScalingSchedule, opts metav1.UpdateOptions) (*zalandoorgv1.ClusterScalingSchedule, error)
|
||||
Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error
|
||||
DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error
|
||||
Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.ClusterScalingSchedule, error)
|
||||
List(ctx context.Context, opts metav1.ListOptions) (*v1.ClusterScalingScheduleList, error)
|
||||
Get(ctx context.Context, name string, opts metav1.GetOptions) (*zalandoorgv1.ClusterScalingSchedule, error)
|
||||
List(ctx context.Context, opts metav1.ListOptions) (*zalandoorgv1.ClusterScalingScheduleList, error)
|
||||
Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)
|
||||
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ClusterScalingSchedule, err error)
|
||||
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *zalandoorgv1.ClusterScalingSchedule, err error)
|
||||
ClusterScalingScheduleExpansion
|
||||
}
|
||||
|
||||
// clusterScalingSchedules implements ClusterScalingScheduleInterface
|
||||
type clusterScalingSchedules struct {
|
||||
*gentype.ClientWithList[*v1.ClusterScalingSchedule, *v1.ClusterScalingScheduleList]
|
||||
*gentype.ClientWithList[*zalandoorgv1.ClusterScalingSchedule, *zalandoorgv1.ClusterScalingScheduleList]
|
||||
}
|
||||
|
||||
// newClusterScalingSchedules returns a ClusterScalingSchedules
|
||||
func newClusterScalingSchedules(c *ZalandoV1Client) *clusterScalingSchedules {
|
||||
return &clusterScalingSchedules{
|
||||
gentype.NewClientWithList[*v1.ClusterScalingSchedule, *v1.ClusterScalingScheduleList](
|
||||
gentype.NewClientWithList[*zalandoorgv1.ClusterScalingSchedule, *zalandoorgv1.ClusterScalingScheduleList](
|
||||
"clusterscalingschedules",
|
||||
c.RESTClient(),
|
||||
scheme.ParameterCodec,
|
||||
"",
|
||||
func() *v1.ClusterScalingSchedule { return &v1.ClusterScalingSchedule{} },
|
||||
func() *v1.ClusterScalingScheduleList { return &v1.ClusterScalingScheduleList{} }),
|
||||
func() *zalandoorgv1.ClusterScalingSchedule { return &zalandoorgv1.ClusterScalingSchedule{} },
|
||||
func() *zalandoorgv1.ClusterScalingScheduleList { return &zalandoorgv1.ClusterScalingScheduleList{} },
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
+23
-109
@@ -19,120 +19,34 @@ limitations under the License.
|
||||
package fake
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/apis/zalando.org/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
labels "k8s.io/apimachinery/pkg/labels"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
testing "k8s.io/client-go/testing"
|
||||
zalandoorgv1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/client/clientset/versioned/typed/zalando.org/v1"
|
||||
gentype "k8s.io/client-go/gentype"
|
||||
)
|
||||
|
||||
// FakeClusterScalingSchedules implements ClusterScalingScheduleInterface
|
||||
type FakeClusterScalingSchedules struct {
|
||||
// fakeClusterScalingSchedules implements ClusterScalingScheduleInterface
|
||||
type fakeClusterScalingSchedules struct {
|
||||
*gentype.FakeClientWithList[*v1.ClusterScalingSchedule, *v1.ClusterScalingScheduleList]
|
||||
Fake *FakeZalandoV1
|
||||
}
|
||||
|
||||
var clusterscalingschedulesResource = v1.SchemeGroupVersion.WithResource("clusterscalingschedules")
|
||||
|
||||
var clusterscalingschedulesKind = v1.SchemeGroupVersion.WithKind("ClusterScalingSchedule")
|
||||
|
||||
// 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 metav1.GetOptions) (result *v1.ClusterScalingSchedule, err error) {
|
||||
emptyResult := &v1.ClusterScalingSchedule{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootGetActionWithOptions(clusterscalingschedulesResource, name, options), emptyResult)
|
||||
if obj == nil {
|
||||
return emptyResult, err
|
||||
func newFakeClusterScalingSchedules(fake *FakeZalandoV1) zalandoorgv1.ClusterScalingScheduleInterface {
|
||||
return &fakeClusterScalingSchedules{
|
||||
gentype.NewFakeClientWithList[*v1.ClusterScalingSchedule, *v1.ClusterScalingScheduleList](
|
||||
fake.Fake,
|
||||
"",
|
||||
v1.SchemeGroupVersion.WithResource("clusterscalingschedules"),
|
||||
v1.SchemeGroupVersion.WithKind("ClusterScalingSchedule"),
|
||||
func() *v1.ClusterScalingSchedule { return &v1.ClusterScalingSchedule{} },
|
||||
func() *v1.ClusterScalingScheduleList { return &v1.ClusterScalingScheduleList{} },
|
||||
func(dst, src *v1.ClusterScalingScheduleList) { dst.ListMeta = src.ListMeta },
|
||||
func(list *v1.ClusterScalingScheduleList) []*v1.ClusterScalingSchedule {
|
||||
return gentype.ToPointerSlice(list.Items)
|
||||
},
|
||||
func(list *v1.ClusterScalingScheduleList, items []*v1.ClusterScalingSchedule) {
|
||||
list.Items = gentype.FromPointerSlice(items)
|
||||
},
|
||||
),
|
||||
fake,
|
||||
}
|
||||
return obj.(*v1.ClusterScalingSchedule), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of ClusterScalingSchedules that match those selectors.
|
||||
func (c *FakeClusterScalingSchedules) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ClusterScalingScheduleList, err error) {
|
||||
emptyResult := &v1.ClusterScalingScheduleList{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootListActionWithOptions(clusterscalingschedulesResource, clusterscalingschedulesKind, opts), emptyResult)
|
||||
if obj == nil {
|
||||
return emptyResult, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &v1.ClusterScalingScheduleList{ListMeta: obj.(*v1.ClusterScalingScheduleList).ListMeta}
|
||||
for _, item := range obj.(*v1.ClusterScalingScheduleList).Items {
|
||||
if label.Matches(labels.Set(item.Labels)) {
|
||||
list.Items = append(list.Items, item)
|
||||
}
|
||||
}
|
||||
return list, err
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested clusterScalingSchedules.
|
||||
func (c *FakeClusterScalingSchedules) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewRootWatchActionWithOptions(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 *v1.ClusterScalingSchedule, opts metav1.CreateOptions) (result *v1.ClusterScalingSchedule, err error) {
|
||||
emptyResult := &v1.ClusterScalingSchedule{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootCreateActionWithOptions(clusterscalingschedulesResource, clusterScalingSchedule, opts), emptyResult)
|
||||
if obj == nil {
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v1.ClusterScalingSchedule), err
|
||||
}
|
||||
|
||||
// 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 *v1.ClusterScalingSchedule, opts metav1.UpdateOptions) (result *v1.ClusterScalingSchedule, err error) {
|
||||
emptyResult := &v1.ClusterScalingSchedule{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootUpdateActionWithOptions(clusterscalingschedulesResource, clusterScalingSchedule, opts), emptyResult)
|
||||
if obj == nil {
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v1.ClusterScalingSchedule), err
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *FakeClusterScalingSchedules) UpdateStatus(ctx context.Context, clusterScalingSchedule *v1.ClusterScalingSchedule, opts metav1.UpdateOptions) (result *v1.ClusterScalingSchedule, err error) {
|
||||
emptyResult := &v1.ClusterScalingSchedule{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootUpdateSubresourceActionWithOptions(clusterscalingschedulesResource, "status", clusterScalingSchedule, opts), emptyResult)
|
||||
if obj == nil {
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v1.ClusterScalingSchedule), err
|
||||
}
|
||||
|
||||
// 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 metav1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewRootDeleteActionWithOptions(clusterscalingschedulesResource, name, opts), &v1.ClusterScalingSchedule{})
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeClusterScalingSchedules) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
|
||||
action := testing.NewRootDeleteCollectionActionWithOptions(clusterscalingschedulesResource, opts, listOpts)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &v1.ClusterScalingScheduleList{})
|
||||
return err
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched clusterScalingSchedule.
|
||||
func (c *FakeClusterScalingSchedules) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ClusterScalingSchedule, err error) {
|
||||
emptyResult := &v1.ClusterScalingSchedule{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootPatchSubresourceActionWithOptions(clusterscalingschedulesResource, name, pt, data, opts, subresources...), emptyResult)
|
||||
if obj == nil {
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v1.ClusterScalingSchedule), err
|
||||
}
|
||||
|
||||
@@ -19,129 +19,32 @@ limitations under the License.
|
||||
package fake
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/apis/zalando.org/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
labels "k8s.io/apimachinery/pkg/labels"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
testing "k8s.io/client-go/testing"
|
||||
zalandoorgv1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/client/clientset/versioned/typed/zalando.org/v1"
|
||||
gentype "k8s.io/client-go/gentype"
|
||||
)
|
||||
|
||||
// FakeScalingSchedules implements ScalingScheduleInterface
|
||||
type FakeScalingSchedules struct {
|
||||
// fakeScalingSchedules implements ScalingScheduleInterface
|
||||
type fakeScalingSchedules struct {
|
||||
*gentype.FakeClientWithList[*v1.ScalingSchedule, *v1.ScalingScheduleList]
|
||||
Fake *FakeZalandoV1
|
||||
ns string
|
||||
}
|
||||
|
||||
var scalingschedulesResource = v1.SchemeGroupVersion.WithResource("scalingschedules")
|
||||
|
||||
var scalingschedulesKind = v1.SchemeGroupVersion.WithKind("ScalingSchedule")
|
||||
|
||||
// Get takes name of the scalingSchedule, and returns the corresponding scalingSchedule object, and an error if there is any.
|
||||
func (c *FakeScalingSchedules) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ScalingSchedule, err error) {
|
||||
emptyResult := &v1.ScalingSchedule{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewGetActionWithOptions(scalingschedulesResource, c.ns, name, options), emptyResult)
|
||||
|
||||
if obj == nil {
|
||||
return emptyResult, err
|
||||
func newFakeScalingSchedules(fake *FakeZalandoV1, namespace string) zalandoorgv1.ScalingScheduleInterface {
|
||||
return &fakeScalingSchedules{
|
||||
gentype.NewFakeClientWithList[*v1.ScalingSchedule, *v1.ScalingScheduleList](
|
||||
fake.Fake,
|
||||
namespace,
|
||||
v1.SchemeGroupVersion.WithResource("scalingschedules"),
|
||||
v1.SchemeGroupVersion.WithKind("ScalingSchedule"),
|
||||
func() *v1.ScalingSchedule { return &v1.ScalingSchedule{} },
|
||||
func() *v1.ScalingScheduleList { return &v1.ScalingScheduleList{} },
|
||||
func(dst, src *v1.ScalingScheduleList) { dst.ListMeta = src.ListMeta },
|
||||
func(list *v1.ScalingScheduleList) []*v1.ScalingSchedule { return gentype.ToPointerSlice(list.Items) },
|
||||
func(list *v1.ScalingScheduleList, items []*v1.ScalingSchedule) {
|
||||
list.Items = gentype.FromPointerSlice(items)
|
||||
},
|
||||
),
|
||||
fake,
|
||||
}
|
||||
return obj.(*v1.ScalingSchedule), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of ScalingSchedules that match those selectors.
|
||||
func (c *FakeScalingSchedules) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ScalingScheduleList, err error) {
|
||||
emptyResult := &v1.ScalingScheduleList{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewListActionWithOptions(scalingschedulesResource, scalingschedulesKind, c.ns, opts), emptyResult)
|
||||
|
||||
if obj == nil {
|
||||
return emptyResult, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &v1.ScalingScheduleList{ListMeta: obj.(*v1.ScalingScheduleList).ListMeta}
|
||||
for _, item := range obj.(*v1.ScalingScheduleList).Items {
|
||||
if label.Matches(labels.Set(item.Labels)) {
|
||||
list.Items = append(list.Items, item)
|
||||
}
|
||||
}
|
||||
return list, err
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested scalingSchedules.
|
||||
func (c *FakeScalingSchedules) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewWatchActionWithOptions(scalingschedulesResource, c.ns, opts))
|
||||
|
||||
}
|
||||
|
||||
// Create takes the representation of a scalingSchedule and creates it. Returns the server's representation of the scalingSchedule, and an error, if there is any.
|
||||
func (c *FakeScalingSchedules) Create(ctx context.Context, scalingSchedule *v1.ScalingSchedule, opts metav1.CreateOptions) (result *v1.ScalingSchedule, err error) {
|
||||
emptyResult := &v1.ScalingSchedule{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewCreateActionWithOptions(scalingschedulesResource, c.ns, scalingSchedule, opts), emptyResult)
|
||||
|
||||
if obj == nil {
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v1.ScalingSchedule), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a scalingSchedule and updates it. Returns the server's representation of the scalingSchedule, and an error, if there is any.
|
||||
func (c *FakeScalingSchedules) Update(ctx context.Context, scalingSchedule *v1.ScalingSchedule, opts metav1.UpdateOptions) (result *v1.ScalingSchedule, err error) {
|
||||
emptyResult := &v1.ScalingSchedule{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateActionWithOptions(scalingschedulesResource, c.ns, scalingSchedule, opts), emptyResult)
|
||||
|
||||
if obj == nil {
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v1.ScalingSchedule), err
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *FakeScalingSchedules) UpdateStatus(ctx context.Context, scalingSchedule *v1.ScalingSchedule, opts metav1.UpdateOptions) (result *v1.ScalingSchedule, err error) {
|
||||
emptyResult := &v1.ScalingSchedule{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateSubresourceActionWithOptions(scalingschedulesResource, "status", c.ns, scalingSchedule, opts), emptyResult)
|
||||
|
||||
if obj == nil {
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v1.ScalingSchedule), err
|
||||
}
|
||||
|
||||
// Delete takes name of the scalingSchedule and deletes it. Returns an error if one occurs.
|
||||
func (c *FakeScalingSchedules) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewDeleteActionWithOptions(scalingschedulesResource, c.ns, name, opts), &v1.ScalingSchedule{})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeScalingSchedules) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
|
||||
action := testing.NewDeleteCollectionActionWithOptions(scalingschedulesResource, c.ns, opts, listOpts)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &v1.ScalingScheduleList{})
|
||||
return err
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched scalingSchedule.
|
||||
func (c *FakeScalingSchedules) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ScalingSchedule, err error) {
|
||||
emptyResult := &v1.ScalingSchedule{}
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewPatchSubresourceActionWithOptions(scalingschedulesResource, c.ns, name, pt, data, opts, subresources...), emptyResult)
|
||||
|
||||
if obj == nil {
|
||||
return emptyResult, err
|
||||
}
|
||||
return obj.(*v1.ScalingSchedule), err
|
||||
}
|
||||
|
||||
@@ -29,11 +29,11 @@ type FakeZalandoV1 struct {
|
||||
}
|
||||
|
||||
func (c *FakeZalandoV1) ClusterScalingSchedules() v1.ClusterScalingScheduleInterface {
|
||||
return &FakeClusterScalingSchedules{c}
|
||||
return newFakeClusterScalingSchedules(c)
|
||||
}
|
||||
|
||||
func (c *FakeZalandoV1) ScalingSchedules(namespace string) v1.ScalingScheduleInterface {
|
||||
return &FakeScalingSchedules{c, namespace}
|
||||
return newFakeScalingSchedules(c, namespace)
|
||||
}
|
||||
|
||||
// RESTClient returns a RESTClient that is used to communicate
|
||||
|
||||
@@ -19,9 +19,9 @@ limitations under the License.
|
||||
package v1
|
||||
|
||||
import (
|
||||
"context"
|
||||
context "context"
|
||||
|
||||
v1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/apis/zalando.org/v1"
|
||||
zalandoorgv1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/apis/zalando.org/v1"
|
||||
scheme "github.com/zalando-incubator/kube-metrics-adapter/pkg/client/clientset/versioned/scheme"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
@@ -37,33 +37,34 @@ type ScalingSchedulesGetter interface {
|
||||
|
||||
// ScalingScheduleInterface has methods to work with ScalingSchedule resources.
|
||||
type ScalingScheduleInterface interface {
|
||||
Create(ctx context.Context, scalingSchedule *v1.ScalingSchedule, opts metav1.CreateOptions) (*v1.ScalingSchedule, error)
|
||||
Update(ctx context.Context, scalingSchedule *v1.ScalingSchedule, opts metav1.UpdateOptions) (*v1.ScalingSchedule, error)
|
||||
Create(ctx context.Context, scalingSchedule *zalandoorgv1.ScalingSchedule, opts metav1.CreateOptions) (*zalandoorgv1.ScalingSchedule, error)
|
||||
Update(ctx context.Context, scalingSchedule *zalandoorgv1.ScalingSchedule, opts metav1.UpdateOptions) (*zalandoorgv1.ScalingSchedule, error)
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
UpdateStatus(ctx context.Context, scalingSchedule *v1.ScalingSchedule, opts metav1.UpdateOptions) (*v1.ScalingSchedule, error)
|
||||
UpdateStatus(ctx context.Context, scalingSchedule *zalandoorgv1.ScalingSchedule, opts metav1.UpdateOptions) (*zalandoorgv1.ScalingSchedule, error)
|
||||
Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error
|
||||
DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error
|
||||
Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.ScalingSchedule, error)
|
||||
List(ctx context.Context, opts metav1.ListOptions) (*v1.ScalingScheduleList, error)
|
||||
Get(ctx context.Context, name string, opts metav1.GetOptions) (*zalandoorgv1.ScalingSchedule, error)
|
||||
List(ctx context.Context, opts metav1.ListOptions) (*zalandoorgv1.ScalingScheduleList, error)
|
||||
Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)
|
||||
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ScalingSchedule, err error)
|
||||
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *zalandoorgv1.ScalingSchedule, err error)
|
||||
ScalingScheduleExpansion
|
||||
}
|
||||
|
||||
// scalingSchedules implements ScalingScheduleInterface
|
||||
type scalingSchedules struct {
|
||||
*gentype.ClientWithList[*v1.ScalingSchedule, *v1.ScalingScheduleList]
|
||||
*gentype.ClientWithList[*zalandoorgv1.ScalingSchedule, *zalandoorgv1.ScalingScheduleList]
|
||||
}
|
||||
|
||||
// newScalingSchedules returns a ScalingSchedules
|
||||
func newScalingSchedules(c *ZalandoV1Client, namespace string) *scalingSchedules {
|
||||
return &scalingSchedules{
|
||||
gentype.NewClientWithList[*v1.ScalingSchedule, *v1.ScalingScheduleList](
|
||||
gentype.NewClientWithList[*zalandoorgv1.ScalingSchedule, *zalandoorgv1.ScalingScheduleList](
|
||||
"scalingschedules",
|
||||
c.RESTClient(),
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *v1.ScalingSchedule { return &v1.ScalingSchedule{} },
|
||||
func() *v1.ScalingScheduleList { return &v1.ScalingScheduleList{} }),
|
||||
func() *zalandoorgv1.ScalingSchedule { return &zalandoorgv1.ScalingSchedule{} },
|
||||
func() *zalandoorgv1.ScalingScheduleList { return &zalandoorgv1.ScalingScheduleList{} },
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,10 +19,10 @@ limitations under the License.
|
||||
package v1
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
http "net/http"
|
||||
|
||||
v1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/apis/zalando.org/v1"
|
||||
"github.com/zalando-incubator/kube-metrics-adapter/pkg/client/clientset/versioned/scheme"
|
||||
zalandoorgv1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/apis/zalando.org/v1"
|
||||
scheme "github.com/zalando-incubator/kube-metrics-adapter/pkg/client/clientset/versioned/scheme"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
@@ -50,9 +50,7 @@ func (c *ZalandoV1Client) ScalingSchedules(namespace string) ScalingScheduleInte
|
||||
// where httpClient was generated with rest.HTTPClientFor(c).
|
||||
func NewForConfig(c *rest.Config) (*ZalandoV1Client, error) {
|
||||
config := *c
|
||||
if err := setConfigDefaults(&config); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
setConfigDefaults(&config)
|
||||
httpClient, err := rest.HTTPClientFor(&config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -64,9 +62,7 @@ func NewForConfig(c *rest.Config) (*ZalandoV1Client, error) {
|
||||
// Note the http client provided takes precedence over the configured transport values.
|
||||
func NewForConfigAndClient(c *rest.Config, h *http.Client) (*ZalandoV1Client, error) {
|
||||
config := *c
|
||||
if err := setConfigDefaults(&config); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
setConfigDefaults(&config)
|
||||
client, err := rest.RESTClientForConfigAndClient(&config, h)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -89,17 +85,15 @@ func New(c rest.Interface) *ZalandoV1Client {
|
||||
return &ZalandoV1Client{c}
|
||||
}
|
||||
|
||||
func setConfigDefaults(config *rest.Config) error {
|
||||
gv := v1.SchemeGroupVersion
|
||||
func setConfigDefaults(config *rest.Config) {
|
||||
gv := zalandoorgv1.SchemeGroupVersion
|
||||
config.GroupVersion = &gv
|
||||
config.APIPath = "/apis"
|
||||
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
|
||||
config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion()
|
||||
|
||||
if config.UserAgent == "" {
|
||||
config.UserAgent = rest.DefaultKubernetesUserAgent()
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// RESTClient returns a RESTClient that is used to communicate
|
||||
|
||||
@@ -19,7 +19,7 @@ limitations under the License.
|
||||
package externalversions
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
fmt "fmt"
|
||||
|
||||
v1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/apis/zalando.org/v1"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
|
||||
@@ -19,13 +19,13 @@ limitations under the License.
|
||||
package v1
|
||||
|
||||
import (
|
||||
"context"
|
||||
context "context"
|
||||
time "time"
|
||||
|
||||
zalandoorgv1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/apis/zalando.org/v1"
|
||||
apiszalandoorgv1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/apis/zalando.org/v1"
|
||||
versioned "github.com/zalando-incubator/kube-metrics-adapter/pkg/client/clientset/versioned"
|
||||
internalinterfaces "github.com/zalando-incubator/kube-metrics-adapter/pkg/client/informers/externalversions/internalinterfaces"
|
||||
v1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/client/listers/zalando.org/v1"
|
||||
zalandoorgv1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/client/listers/zalando.org/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
@@ -36,7 +36,7 @@ import (
|
||||
// ClusterScalingSchedules.
|
||||
type ClusterScalingScheduleInformer interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() v1.ClusterScalingScheduleLister
|
||||
Lister() zalandoorgv1.ClusterScalingScheduleLister
|
||||
}
|
||||
|
||||
type clusterScalingScheduleInformer struct {
|
||||
@@ -61,16 +61,28 @@ func NewFilteredClusterScalingScheduleInformer(client versioned.Interface, resyn
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.ZalandoV1().ClusterScalingSchedules().List(context.TODO(), options)
|
||||
return client.ZalandoV1().ClusterScalingSchedules().List(context.Background(), options)
|
||||
},
|
||||
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.ZalandoV1().ClusterScalingSchedules().Watch(context.TODO(), options)
|
||||
return client.ZalandoV1().ClusterScalingSchedules().Watch(context.Background(), options)
|
||||
},
|
||||
ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.ZalandoV1().ClusterScalingSchedules().List(ctx, options)
|
||||
},
|
||||
WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.ZalandoV1().ClusterScalingSchedules().Watch(ctx, options)
|
||||
},
|
||||
},
|
||||
&zalandoorgv1.ClusterScalingSchedule{},
|
||||
&apiszalandoorgv1.ClusterScalingSchedule{},
|
||||
resyncPeriod,
|
||||
indexers,
|
||||
)
|
||||
@@ -81,9 +93,9 @@ func (f *clusterScalingScheduleInformer) defaultInformer(client versioned.Interf
|
||||
}
|
||||
|
||||
func (f *clusterScalingScheduleInformer) Informer() cache.SharedIndexInformer {
|
||||
return f.factory.InformerFor(&zalandoorgv1.ClusterScalingSchedule{}, f.defaultInformer)
|
||||
return f.factory.InformerFor(&apiszalandoorgv1.ClusterScalingSchedule{}, f.defaultInformer)
|
||||
}
|
||||
|
||||
func (f *clusterScalingScheduleInformer) Lister() v1.ClusterScalingScheduleLister {
|
||||
return v1.NewClusterScalingScheduleLister(f.Informer().GetIndexer())
|
||||
func (f *clusterScalingScheduleInformer) Lister() zalandoorgv1.ClusterScalingScheduleLister {
|
||||
return zalandoorgv1.NewClusterScalingScheduleLister(f.Informer().GetIndexer())
|
||||
}
|
||||
|
||||
@@ -19,13 +19,13 @@ limitations under the License.
|
||||
package v1
|
||||
|
||||
import (
|
||||
"context"
|
||||
context "context"
|
||||
time "time"
|
||||
|
||||
zalandoorgv1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/apis/zalando.org/v1"
|
||||
apiszalandoorgv1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/apis/zalando.org/v1"
|
||||
versioned "github.com/zalando-incubator/kube-metrics-adapter/pkg/client/clientset/versioned"
|
||||
internalinterfaces "github.com/zalando-incubator/kube-metrics-adapter/pkg/client/informers/externalversions/internalinterfaces"
|
||||
v1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/client/listers/zalando.org/v1"
|
||||
zalandoorgv1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/client/listers/zalando.org/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
@@ -36,7 +36,7 @@ import (
|
||||
// ScalingSchedules.
|
||||
type ScalingScheduleInformer interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() v1.ScalingScheduleLister
|
||||
Lister() zalandoorgv1.ScalingScheduleLister
|
||||
}
|
||||
|
||||
type scalingScheduleInformer struct {
|
||||
@@ -62,16 +62,28 @@ func NewFilteredScalingScheduleInformer(client versioned.Interface, namespace st
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.ZalandoV1().ScalingSchedules(namespace).List(context.TODO(), options)
|
||||
return client.ZalandoV1().ScalingSchedules(namespace).List(context.Background(), options)
|
||||
},
|
||||
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.ZalandoV1().ScalingSchedules(namespace).Watch(context.TODO(), options)
|
||||
return client.ZalandoV1().ScalingSchedules(namespace).Watch(context.Background(), options)
|
||||
},
|
||||
ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.ZalandoV1().ScalingSchedules(namespace).List(ctx, options)
|
||||
},
|
||||
WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.ZalandoV1().ScalingSchedules(namespace).Watch(ctx, options)
|
||||
},
|
||||
},
|
||||
&zalandoorgv1.ScalingSchedule{},
|
||||
&apiszalandoorgv1.ScalingSchedule{},
|
||||
resyncPeriod,
|
||||
indexers,
|
||||
)
|
||||
@@ -82,9 +94,9 @@ func (f *scalingScheduleInformer) defaultInformer(client versioned.Interface, re
|
||||
}
|
||||
|
||||
func (f *scalingScheduleInformer) Informer() cache.SharedIndexInformer {
|
||||
return f.factory.InformerFor(&zalandoorgv1.ScalingSchedule{}, f.defaultInformer)
|
||||
return f.factory.InformerFor(&apiszalandoorgv1.ScalingSchedule{}, f.defaultInformer)
|
||||
}
|
||||
|
||||
func (f *scalingScheduleInformer) Lister() v1.ScalingScheduleLister {
|
||||
return v1.NewScalingScheduleLister(f.Informer().GetIndexer())
|
||||
func (f *scalingScheduleInformer) Lister() zalandoorgv1.ScalingScheduleLister {
|
||||
return zalandoorgv1.NewScalingScheduleLister(f.Informer().GetIndexer())
|
||||
}
|
||||
|
||||
@@ -19,10 +19,10 @@ limitations under the License.
|
||||
package v1
|
||||
|
||||
import (
|
||||
v1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/apis/zalando.org/v1"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/client-go/listers"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
zalandoorgv1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/apis/zalando.org/v1"
|
||||
labels "k8s.io/apimachinery/pkg/labels"
|
||||
listers "k8s.io/client-go/listers"
|
||||
cache "k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
// ClusterScalingScheduleLister helps list ClusterScalingSchedules.
|
||||
@@ -30,19 +30,19 @@ import (
|
||||
type ClusterScalingScheduleLister interface {
|
||||
// List lists all ClusterScalingSchedules in the indexer.
|
||||
// Objects returned here must be treated as read-only.
|
||||
List(selector labels.Selector) (ret []*v1.ClusterScalingSchedule, err error)
|
||||
List(selector labels.Selector) (ret []*zalandoorgv1.ClusterScalingSchedule, err error)
|
||||
// Get retrieves the ClusterScalingSchedule from the index for a given name.
|
||||
// Objects returned here must be treated as read-only.
|
||||
Get(name string) (*v1.ClusterScalingSchedule, error)
|
||||
Get(name string) (*zalandoorgv1.ClusterScalingSchedule, error)
|
||||
ClusterScalingScheduleListerExpansion
|
||||
}
|
||||
|
||||
// clusterScalingScheduleLister implements the ClusterScalingScheduleLister interface.
|
||||
type clusterScalingScheduleLister struct {
|
||||
listers.ResourceIndexer[*v1.ClusterScalingSchedule]
|
||||
listers.ResourceIndexer[*zalandoorgv1.ClusterScalingSchedule]
|
||||
}
|
||||
|
||||
// NewClusterScalingScheduleLister returns a new ClusterScalingScheduleLister.
|
||||
func NewClusterScalingScheduleLister(indexer cache.Indexer) ClusterScalingScheduleLister {
|
||||
return &clusterScalingScheduleLister{listers.New[*v1.ClusterScalingSchedule](indexer, v1.Resource("clusterscalingschedule"))}
|
||||
return &clusterScalingScheduleLister{listers.New[*zalandoorgv1.ClusterScalingSchedule](indexer, zalandoorgv1.Resource("clusterscalingschedule"))}
|
||||
}
|
||||
|
||||
@@ -19,10 +19,10 @@ limitations under the License.
|
||||
package v1
|
||||
|
||||
import (
|
||||
v1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/apis/zalando.org/v1"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/client-go/listers"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
zalandoorgv1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/apis/zalando.org/v1"
|
||||
labels "k8s.io/apimachinery/pkg/labels"
|
||||
listers "k8s.io/client-go/listers"
|
||||
cache "k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
// ScalingScheduleLister helps list ScalingSchedules.
|
||||
@@ -30,7 +30,7 @@ import (
|
||||
type ScalingScheduleLister interface {
|
||||
// List lists all ScalingSchedules in the indexer.
|
||||
// Objects returned here must be treated as read-only.
|
||||
List(selector labels.Selector) (ret []*v1.ScalingSchedule, err error)
|
||||
List(selector labels.Selector) (ret []*zalandoorgv1.ScalingSchedule, err error)
|
||||
// ScalingSchedules returns an object that can list and get ScalingSchedules.
|
||||
ScalingSchedules(namespace string) ScalingScheduleNamespaceLister
|
||||
ScalingScheduleListerExpansion
|
||||
@@ -38,17 +38,17 @@ type ScalingScheduleLister interface {
|
||||
|
||||
// scalingScheduleLister implements the ScalingScheduleLister interface.
|
||||
type scalingScheduleLister struct {
|
||||
listers.ResourceIndexer[*v1.ScalingSchedule]
|
||||
listers.ResourceIndexer[*zalandoorgv1.ScalingSchedule]
|
||||
}
|
||||
|
||||
// NewScalingScheduleLister returns a new ScalingScheduleLister.
|
||||
func NewScalingScheduleLister(indexer cache.Indexer) ScalingScheduleLister {
|
||||
return &scalingScheduleLister{listers.New[*v1.ScalingSchedule](indexer, v1.Resource("scalingschedule"))}
|
||||
return &scalingScheduleLister{listers.New[*zalandoorgv1.ScalingSchedule](indexer, zalandoorgv1.Resource("scalingschedule"))}
|
||||
}
|
||||
|
||||
// ScalingSchedules returns an object that can list and get ScalingSchedules.
|
||||
func (s *scalingScheduleLister) ScalingSchedules(namespace string) ScalingScheduleNamespaceLister {
|
||||
return scalingScheduleNamespaceLister{listers.NewNamespaced[*v1.ScalingSchedule](s.ResourceIndexer, namespace)}
|
||||
return scalingScheduleNamespaceLister{listers.NewNamespaced[*zalandoorgv1.ScalingSchedule](s.ResourceIndexer, namespace)}
|
||||
}
|
||||
|
||||
// ScalingScheduleNamespaceLister helps list and get ScalingSchedules.
|
||||
@@ -56,15 +56,15 @@ func (s *scalingScheduleLister) ScalingSchedules(namespace string) ScalingSchedu
|
||||
type ScalingScheduleNamespaceLister interface {
|
||||
// List lists all ScalingSchedules in the indexer for a given namespace.
|
||||
// Objects returned here must be treated as read-only.
|
||||
List(selector labels.Selector) (ret []*v1.ScalingSchedule, err error)
|
||||
List(selector labels.Selector) (ret []*zalandoorgv1.ScalingSchedule, err error)
|
||||
// Get retrieves the ScalingSchedule from the indexer for a given namespace and name.
|
||||
// Objects returned here must be treated as read-only.
|
||||
Get(name string) (*v1.ScalingSchedule, error)
|
||||
Get(name string) (*zalandoorgv1.ScalingSchedule, error)
|
||||
ScalingScheduleNamespaceListerExpansion
|
||||
}
|
||||
|
||||
// scalingScheduleNamespaceLister implements the ScalingScheduleNamespaceLister
|
||||
// interface.
|
||||
type scalingScheduleNamespaceLister struct {
|
||||
listers.ResourceIndexer[*v1.ScalingSchedule]
|
||||
listers.ResourceIndexer[*zalandoorgv1.ScalingSchedule]
|
||||
}
|
||||
|
||||
@@ -279,7 +279,7 @@ func TestExternalRPSPrometheusCollectorInteraction(t *testing.T) {
|
||||
}
|
||||
|
||||
factory := NewCollectorFactory()
|
||||
promPlugin, err := NewPrometheusCollectorPlugin(nil, "http://prometheus")
|
||||
promPlugin, err := NewPrometheusCollectorPlugin(nil, "http://prometheus", "", map[string]string{}, map[string]string{})
|
||||
require.NoError(t, err)
|
||||
factory.RegisterExternalCollector([]string{PrometheusMetricType, PrometheusMetricNameLegacy}, promPlugin)
|
||||
hostnamePlugin, err := NewExternalRPSCollectorPlugin(promPlugin, "a_metric")
|
||||
|
||||
@@ -3,6 +3,7 @@ package collector
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/zalando-incubator/kube-metrics-adapter/pkg/nakadi"
|
||||
@@ -17,6 +18,9 @@ const (
|
||||
// subscriptions.
|
||||
NakadiMetricType = "nakadi"
|
||||
nakadiSubscriptionIDKey = "subscription-id"
|
||||
nakadiOwningApplicationKey = "owning-application"
|
||||
nakadiConsumerGroupKey = "consumer-group"
|
||||
nakadiEventTypesKey = "event-types"
|
||||
nakadiMetricTypeKey = "metric-type"
|
||||
nakadiMetricTypeConsumerLagSeconds = "consumer-lag-seconds"
|
||||
nakadiMetricTypeUnconsumedEvents = "unconsumed-events"
|
||||
@@ -43,26 +47,21 @@ func (c *NakadiCollectorPlugin) NewCollector(ctx context.Context, hpa *autoscali
|
||||
// NakadiCollector defines a collector that is able to collect metrics from
|
||||
// Nakadi.
|
||||
type NakadiCollector struct {
|
||||
nakadi nakadi.Nakadi
|
||||
interval time.Duration
|
||||
subscriptionID string
|
||||
nakadiMetricType string
|
||||
metric autoscalingv2.MetricIdentifier
|
||||
metricType autoscalingv2.MetricSourceType
|
||||
namespace string
|
||||
nakadi nakadi.Nakadi
|
||||
interval time.Duration
|
||||
subscriptionFilter *nakadi.SubscriptionFilter
|
||||
nakadiMetricType string
|
||||
metric autoscalingv2.MetricIdentifier
|
||||
metricType autoscalingv2.MetricSourceType
|
||||
namespace string
|
||||
}
|
||||
|
||||
// NewNakadiCollector initializes a new NakadiCollector.
|
||||
func NewNakadiCollector(_ context.Context, nakadi nakadi.Nakadi, hpa *autoscalingv2.HorizontalPodAutoscaler, config *MetricConfig, interval time.Duration) (*NakadiCollector, error) {
|
||||
func NewNakadiCollector(_ context.Context, nakadiClient nakadi.Nakadi, hpa *autoscalingv2.HorizontalPodAutoscaler, config *MetricConfig, interval time.Duration) (*NakadiCollector, error) {
|
||||
if config.Metric.Selector == nil {
|
||||
return nil, fmt.Errorf("selector for nakadi is not specified")
|
||||
}
|
||||
|
||||
subscriptionID, ok := config.Config[nakadiSubscriptionIDKey]
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("subscription-id not specified on metric")
|
||||
}
|
||||
|
||||
metricType, ok := config.Config[nakadiMetricTypeKey]
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("metric-type not specified on metric")
|
||||
@@ -72,14 +71,40 @@ func NewNakadiCollector(_ context.Context, nakadi nakadi.Nakadi, hpa *autoscalin
|
||||
return nil, fmt.Errorf("metric-type must be either '%s' or '%s', was '%s'", nakadiMetricTypeConsumerLagSeconds, nakadiMetricTypeUnconsumedEvents, metricType)
|
||||
}
|
||||
|
||||
// Either subscription-id or filtering via owning-application,
|
||||
// event-types, and consumer-group is supported. If all are defined
|
||||
// then only subscription-id is used and the rest of the fields are
|
||||
// ignored.
|
||||
subscriptionFilter := &nakadi.SubscriptionFilter{}
|
||||
if subscriptionID, ok := config.Config[nakadiSubscriptionIDKey]; ok {
|
||||
subscriptionFilter.SubscriptionID = subscriptionID
|
||||
}
|
||||
|
||||
if owningApplication, ok := config.Config[nakadiOwningApplicationKey]; ok {
|
||||
subscriptionFilter.OwningApplication = owningApplication
|
||||
}
|
||||
|
||||
if nakadiEventTypes, ok := config.Config[nakadiEventTypesKey]; ok {
|
||||
eventTypes := strings.Split(nakadiEventTypes, ",")
|
||||
subscriptionFilter.EventTypes = eventTypes
|
||||
}
|
||||
|
||||
if consumerGroup, ok := config.Config[nakadiConsumerGroupKey]; ok {
|
||||
subscriptionFilter.ConsumerGroup = consumerGroup
|
||||
}
|
||||
|
||||
if subscriptionFilter.SubscriptionID == "" && (subscriptionFilter.OwningApplication == "" || len(subscriptionFilter.EventTypes) == 0 || subscriptionFilter.ConsumerGroup == "") {
|
||||
return nil, fmt.Errorf("either subscription-id or all of [owning-application, event-types, consumer-group] must be specified on the metric")
|
||||
}
|
||||
|
||||
return &NakadiCollector{
|
||||
nakadi: nakadi,
|
||||
interval: interval,
|
||||
subscriptionID: subscriptionID,
|
||||
nakadiMetricType: metricType,
|
||||
metric: config.Metric,
|
||||
metricType: config.Type,
|
||||
namespace: hpa.Namespace,
|
||||
nakadi: nakadiClient,
|
||||
interval: interval,
|
||||
subscriptionFilter: subscriptionFilter,
|
||||
nakadiMetricType: metricType,
|
||||
metric: config.Metric,
|
||||
metricType: config.Type,
|
||||
namespace: hpa.Namespace,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -89,12 +114,12 @@ func (c *NakadiCollector) GetMetrics(ctx context.Context) ([]CollectedMetric, er
|
||||
var err error
|
||||
switch c.nakadiMetricType {
|
||||
case nakadiMetricTypeConsumerLagSeconds:
|
||||
value, err = c.nakadi.ConsumerLagSeconds(ctx, c.subscriptionID)
|
||||
value, err = c.nakadi.ConsumerLagSeconds(ctx, c.subscriptionFilter)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
case nakadiMetricTypeUnconsumedEvents:
|
||||
value, err = c.nakadi.UnconsumedEvents(ctx, c.subscriptionID)
|
||||
value, err = c.nakadi.UnconsumedEvents(ctx, c.subscriptionFilter)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
|
||||
"github.com/prometheus/client_golang/api"
|
||||
promv1 "github.com/prometheus/client_golang/api/prometheus/v1"
|
||||
promconfig "github.com/prometheus/common/config"
|
||||
"github.com/prometheus/common/model"
|
||||
autoscalingv2 "k8s.io/api/autoscaling/v2"
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
@@ -19,10 +20,11 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
PrometheusMetricType = "prometheus"
|
||||
PrometheusMetricNameLegacy = "prometheus-query"
|
||||
prometheusQueryNameLabelKey = "query-name"
|
||||
prometheusServerAnnotationKey = "prometheus-server"
|
||||
PrometheusMetricType = "prometheus"
|
||||
PrometheusMetricNameLegacy = "prometheus-query"
|
||||
prometheusQueryNameLabelKey = "query-name"
|
||||
prometheusServerAnnotationKey = "prometheus-server"
|
||||
prometheusServerAliasAnnotationKey = "prometheus-server-alias"
|
||||
)
|
||||
|
||||
type NoResultError struct {
|
||||
@@ -34,14 +36,26 @@ func (r NoResultError) Error() string {
|
||||
}
|
||||
|
||||
type PrometheusCollectorPlugin struct {
|
||||
promAPI promv1.API
|
||||
client kubernetes.Interface
|
||||
promAPI promv1.API
|
||||
client kubernetes.Interface
|
||||
additionalPromAPIs map[string]promv1.API
|
||||
}
|
||||
|
||||
func NewPrometheusCollectorPlugin(client kubernetes.Interface, prometheusServer string) (*PrometheusCollectorPlugin, error) {
|
||||
func getPrometheusAPI(prometheusServer, tokenFile string) (promv1.API, error) {
|
||||
roundTripper := http.DefaultTransport
|
||||
|
||||
// If a token file is specified, use it for authentication.
|
||||
if tokenFile != "" {
|
||||
roundTripper = promconfig.NewAuthorizationCredentialsRoundTripper(
|
||||
"Bearer",
|
||||
promconfig.NewFileSecret(tokenFile),
|
||||
roundTripper,
|
||||
)
|
||||
}
|
||||
|
||||
cfg := api.Config{
|
||||
Address: prometheusServer,
|
||||
RoundTripper: http.DefaultTransport,
|
||||
RoundTripper: roundTripper,
|
||||
}
|
||||
|
||||
promClient, err := api.NewClient(cfg)
|
||||
@@ -49,14 +63,33 @@ func NewPrometheusCollectorPlugin(client kubernetes.Interface, prometheusServer
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return promv1.NewAPI(promClient), nil
|
||||
}
|
||||
|
||||
func NewPrometheusCollectorPlugin(client kubernetes.Interface, prometheusServer, tokenFile string, additionalServers, additionalServerTokenFiles map[string]string) (*PrometheusCollectorPlugin, error) {
|
||||
promAPI, err := getPrometheusAPI(prometheusServer, tokenFile)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
additionalPromAPIs := make(map[string]promv1.API)
|
||||
|
||||
for alias, server := range additionalServers {
|
||||
additionalPromAPIs[alias], err = getPrometheusAPI(server, additionalServerTokenFiles[alias])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return &PrometheusCollectorPlugin{
|
||||
client: client,
|
||||
promAPI: promv1.NewAPI(promClient),
|
||||
client: client,
|
||||
promAPI: promAPI,
|
||||
additionalPromAPIs: additionalPromAPIs,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (p *PrometheusCollectorPlugin) NewCollector(_ context.Context, hpa *autoscalingv2.HorizontalPodAutoscaler, config *MetricConfig, interval time.Duration) (Collector, error) {
|
||||
return NewPrometheusCollector(p.client, p.promAPI, hpa, config, interval)
|
||||
return NewPrometheusCollector(p.client, p.promAPI, p.additionalPromAPIs, hpa, config, interval)
|
||||
}
|
||||
|
||||
type PrometheusCollector struct {
|
||||
@@ -71,7 +104,7 @@ type PrometheusCollector struct {
|
||||
hpa *autoscalingv2.HorizontalPodAutoscaler
|
||||
}
|
||||
|
||||
func NewPrometheusCollector(client kubernetes.Interface, promAPI promv1.API, hpa *autoscalingv2.HorizontalPodAutoscaler, config *MetricConfig, interval time.Duration) (*PrometheusCollector, error) {
|
||||
func NewPrometheusCollector(client kubernetes.Interface, promAPI promv1.API, additionalPromAPIs map[string]promv1.API, hpa *autoscalingv2.HorizontalPodAutoscaler, config *MetricConfig, interval time.Duration) (*PrometheusCollector, error) {
|
||||
c := &PrometheusCollector{
|
||||
client: client,
|
||||
promAPI: promAPI,
|
||||
@@ -127,6 +160,12 @@ func NewPrometheusCollector(client kubernetes.Interface, promAPI promv1.API, hpa
|
||||
return nil, err
|
||||
}
|
||||
c.promAPI = promv1.NewAPI(promClient)
|
||||
} else if promServerAlias, ok := config.Config[prometheusServerAliasAnnotationKey]; ok {
|
||||
if promAPI, ok := additionalPromAPIs[promServerAlias]; ok {
|
||||
c.promAPI = promAPI
|
||||
} else {
|
||||
return nil, fmt.Errorf("no additional prometheus server found for alias %s", promServerAlias)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user