mirror of
https://github.com/zalando-incubator/kube-metrics-adapter.git
synced 2026-06-10 07:03:52 +00:00
Compare commits
93
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5ed6fec37d | ||
|
|
fa91142ee3 | ||
|
|
1acac49615 | ||
|
|
529fd3e059 | ||
|
|
55bb290076 | ||
|
|
70641827ce | ||
|
|
99ca95588e | ||
|
|
cc9952d66e | ||
|
|
58c6a56cbf | ||
|
|
9e3a1760f1 | ||
|
|
0e52e076c1 | ||
|
|
18faf9c076 | ||
|
|
170faf8809 | ||
|
|
419f75cf18 | ||
|
|
0fe764be7c | ||
|
|
6a245b7e1e | ||
|
|
7a4d08cd77 | ||
|
|
1a9eaeedcb | ||
|
|
0227a3fa07 | ||
|
|
430b2382f6 | ||
|
|
f64cfab5c9 | ||
|
|
19b1706f6c | ||
|
|
335dc1ff56 | ||
|
|
23f65af774 | ||
|
|
a0263ae7f9 | ||
|
|
90a0e28490 | ||
|
|
724a613dda | ||
|
|
33db2b700c | ||
|
|
4bde6c3b98 | ||
|
|
f295dfa4b6 | ||
|
|
b9a1cf9a26 | ||
|
|
adba88129b | ||
|
|
0a6f40369b | ||
|
|
e263f964e9 | ||
|
|
88d8843e96 | ||
|
|
ef298ca774 | ||
|
|
bfd050e5b6 | ||
|
|
e0240911c6 | ||
|
|
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 |
@@ -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@v6.0.2
|
||||
- uses: actions/setup-go@v6.2.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,16 +38,16 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6.0.2
|
||||
|
||||
- name: setup go
|
||||
uses: actions/setup-go@v5
|
||||
uses: actions/setup-go@v6.2.0
|
||||
with:
|
||||
go-version: '1.22'
|
||||
go-version: '1.25'
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v3
|
||||
uses: github/codeql-action/init@v4
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
@@ -61,7 +61,7 @@ jobs:
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v3
|
||||
uses: github/codeql-action/autobuild@v4
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
||||
@@ -74,4 +74,4 @@ jobs:
|
||||
# ./location_of_script_within_repo/buildscript.sh
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v3
|
||||
uses: github/codeql-action/analyze@v4
|
||||
|
||||
@@ -25,15 +25,15 @@ jobs:
|
||||
packages: write # to push packages
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
|
||||
uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98
|
||||
|
||||
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753
|
||||
- uses: actions/setup-go@a5f9b05d2d216f63e13859e0d847461041025775
|
||||
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@c94ce9fb468520275223c153574b00df6fe4bcc9
|
||||
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@c7c53464625b32c7a7e944ae62b3e17d2b600130
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@4c0219f9ac95b02789c1075625400b2acbff50b1
|
||||
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc
|
||||
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Docker meta
|
||||
uses: docker/metadata-action@818d4b7b91585d195f67373fd9cb0332e31a7175
|
||||
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051
|
||||
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@v6.0.2
|
||||
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:
|
||||
|
||||
@@ -34,18 +34,19 @@ $(GENERATED): go.mod $(CRD_TYPE_SOURCE) $(OPENAPI)
|
||||
./hack/update-codegen.sh
|
||||
|
||||
$(GENERATED_CRDS): $(GENERATED) $(CRD_SOURCES)
|
||||
go run sigs.k8s.io/controller-tools/cmd/controller-gen crd:crdVersions=v1 paths=./pkg/apis/... output:crd:dir=docs
|
||||
go tool controller-gen crd:crdVersions=v1 paths=./pkg/apis/... output:crd:dir=docs
|
||||
mv docs/zalando.org_clusterscalingschedules.yaml docs/cluster_scaling_schedules_crd.yaml
|
||||
mv docs/zalando.org_scalingschedules.yaml docs/scaling_schedules_crd.yaml
|
||||
|
||||
$(OPENAPI): go.mod
|
||||
go run k8s.io/kube-openapi/cmd/openapi-gen \
|
||||
go tool openapi-gen \
|
||||
--go-header-file hack/boilerplate.go.txt \
|
||||
--logtostderr \
|
||||
--output-dir pkg/api/generated/openapi \
|
||||
--output-pkg github.com/zalando-incubator/kube-metrics-adapter/pkg/api/generated/openapi \
|
||||
--output-file zz_generated.openapi.go \
|
||||
-r /dev/null \
|
||||
github.com/zalando-incubator/kube-metrics-adapter/pkg/apis/zalando.org/v1 \
|
||||
k8s.io/metrics/pkg/apis/custom_metrics \
|
||||
k8s.io/metrics/pkg/apis/custom_metrics/v1beta1 \
|
||||
k8s.io/metrics/pkg/apis/custom_metrics/v1beta2 \
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
apiVersion: v2
|
||||
name: kube-metrics-adapter
|
||||
version: 0.2.3
|
||||
version: 0.2.6
|
||||
description: kube-metrics-adapter helm chart
|
||||
home: https://github.com/zalando-incubator/kube-metrics-adapter
|
||||
maintainers:
|
||||
|
||||
@@ -3,6 +3,13 @@ apiVersion: apiregistration.k8s.io/v1
|
||||
kind: APIService
|
||||
metadata:
|
||||
name: v1beta1.custom.metrics.k8s.io
|
||||
{{- with .Values.customMetricsApi.annotations }}
|
||||
annotations:
|
||||
{{- range $k, $v := . }}
|
||||
{{- $value := $v | quote }}
|
||||
{{- printf "%s: %s" (tpl $k $) (tpl $value $) | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
spec:
|
||||
service:
|
||||
name: kube-metrics-adapter
|
||||
@@ -13,3 +20,4 @@ spec:
|
||||
groupPriorityMinimum: 100
|
||||
versionPriority: 100
|
||||
{{- end}}
|
||||
""
|
||||
|
||||
@@ -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,6 +3,13 @@ apiVersion: apiregistration.k8s.io/v1
|
||||
kind: APIService
|
||||
metadata:
|
||||
name: v1beta1.external.metrics.k8s.io
|
||||
{{- with .Values.externalMetricsApi.annotations }}
|
||||
annotations:
|
||||
{{- range $k, $v := . }}
|
||||
{{- $value := $v | quote }}
|
||||
{{- printf "%s: %s" (tpl $k $) (tpl $value $) | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
spec:
|
||||
service:
|
||||
name: kube-metrics-adapter
|
||||
|
||||
+21
-2
@@ -3,8 +3,8 @@ namespace: kube-system
|
||||
replicas: 1
|
||||
|
||||
registry:
|
||||
image: registry.opensource.zalan.do/teapot/kube-metrics-adapter
|
||||
imageTag: v0.2.3
|
||||
image: ghcr.io/zalando-incubator/kube-metrics-adapter
|
||||
imageTag: v0.2.6
|
||||
imagePullPolicy: IfNotPresent
|
||||
|
||||
service:
|
||||
@@ -15,7 +15,19 @@ addDirectoryHeader:
|
||||
contentionProfiling:
|
||||
profiling:
|
||||
enableCustomMetricsApi: true
|
||||
|
||||
# -- add annotations to the custom metrics apiservice resource, e.g.
|
||||
# cert-manager.io/inject-ca-from: {{.Release.Namespace}}/kube-metrics-adapter to inject the CA certificate form a cert-manager-issued cert used for the deployment
|
||||
customMetricsApi:
|
||||
annotations: {}
|
||||
|
||||
enableExternalMetricsApi: true
|
||||
|
||||
# -- add annotations to the custom metrics apiservice resource, e.g.
|
||||
# cert-manager.io/inject-ca-from: {{.Release.Namespace}}/kube-metrics-adapter to inject the CA certificate form a cert-manager-issued cert used for the deployment
|
||||
externalMetricsApi:
|
||||
annotations: {}
|
||||
|
||||
credentialsDirectory:
|
||||
disregardIncompatibleHPAs:
|
||||
http2MaxStreamsPerConnection:
|
||||
@@ -63,6 +75,9 @@ log:
|
||||
|
||||
prometheus:
|
||||
server: http://prometheus.kube-system.svc.cluster.local
|
||||
serverTokenFile:
|
||||
additionalServers: {}
|
||||
additionalServerTokenFiles: {}
|
||||
metricsAddress:
|
||||
|
||||
requestHeader:
|
||||
@@ -109,3 +124,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:
|
||||
|
||||
+23
-5
@@ -31,30 +31,48 @@ APIS_PKG="${GOPKG}/pkg/apis"
|
||||
GROUPS_WITH_VERSIONS="${CUSTOM_RESOURCE_NAME}:${CUSTOM_RESOURCE_VERSION}"
|
||||
|
||||
echo "Generating deepcopy funcs"
|
||||
go run k8s.io/code-generator/cmd/deepcopy-gen \
|
||||
go tool deepcopy-gen \
|
||||
--output-file zz_generated.deepcopy.go \
|
||||
--bounding-dirs "${APIS_PKG}" \
|
||||
--go-header-file "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \
|
||||
"${APIS_PKG}/${CUSTOM_RESOURCE_NAME}/${CUSTOM_RESOURCE_VERSION}"
|
||||
|
||||
APPLYCONFIG_PKG="${OUTPUT_PKG}/applyconfiguration"
|
||||
|
||||
echo "Generating apply configurations for ${GROUPS_WITH_VERSIONS} at ${APPLYCONFIG_PKG}"
|
||||
|
||||
# Generate the OpenAPI schema JSON to use for applyconfiguration-gen
|
||||
OPENAPI_SCHEMA_FILE=$(mktemp -t "openapi-schema-XXXXXX.json")
|
||||
trap 'rm -f ${OPENAPI_SCHEMA_FILE}' EXIT
|
||||
echo "Extracting OpenAPI schema to ${OPENAPI_SCHEMA_FILE}"
|
||||
go tool models-schema >"${OPENAPI_SCHEMA_FILE}"
|
||||
|
||||
go tool applyconfiguration-gen \
|
||||
--output-pkg "${APPLYCONFIG_PKG}" \
|
||||
--go-header-file "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \
|
||||
--output-dir "${OUTPUT_DIR}/applyconfiguration" \
|
||||
--openapi-schema "${OPENAPI_SCHEMA_FILE}" \
|
||||
"${APIS_PKG}/${CUSTOM_RESOURCE_NAME}/${CUSTOM_RESOURCE_VERSION}"
|
||||
|
||||
echo "Generating clientset for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/${CLIENTSET_PKG_NAME:-clientset}"
|
||||
go run k8s.io/code-generator/cmd/client-gen \
|
||||
go tool client-gen \
|
||||
--clientset-name versioned \
|
||||
--input-base "" \
|
||||
--input "${APIS_PKG}/${CUSTOM_RESOURCE_NAME}/${CUSTOM_RESOURCE_VERSION}" \
|
||||
--output-pkg "${OUTPUT_PKG}/clientset" \
|
||||
--go-header-file "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \
|
||||
--output-dir "${OUTPUT_DIR}/clientset"
|
||||
--output-dir "${OUTPUT_DIR}/clientset" \
|
||||
--apply-configuration-package "${APPLYCONFIG_PKG}"
|
||||
|
||||
echo "Generating listers for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/listers"
|
||||
go run k8s.io/code-generator/cmd/lister-gen \
|
||||
go tool lister-gen \
|
||||
--output-pkg "${OUTPUT_PKG}/listers" \
|
||||
--go-header-file "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \
|
||||
--output-dir "${OUTPUT_DIR}/listers" \
|
||||
"${APIS_PKG}/${CUSTOM_RESOURCE_NAME}/${CUSTOM_RESOURCE_VERSION}"
|
||||
|
||||
echo "Generating informers for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/informers"
|
||||
go run k8s.io/code-generator/cmd/informer-gen \
|
||||
go tool informer-gen \
|
||||
--versioned-clientset-package "${OUTPUT_PKG}/${CLIENTSET_PKG_NAME:-clientset}/${CLIENTSET_NAME_VERSIONED:-versioned}" \
|
||||
--listers-package "${OUTPUT_PKG}/listers" \
|
||||
--output-pkg "${OUTPUT_PKG}/informers" \
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/zalando-incubator/kube-metrics-adapter/pkg/api/generated/openapi"
|
||||
"k8s.io/kube-openapi/pkg/common"
|
||||
"k8s.io/kube-openapi/pkg/validation/spec"
|
||||
)
|
||||
|
||||
// Outputs openAPI schema JSON containing the schema definitions in zz_generated.openapi.go.
|
||||
func main() {
|
||||
err := output()
|
||||
if err != nil {
|
||||
os.Stderr.WriteString(fmt.Sprintf("Failed: %v", err))
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
func output() error {
|
||||
refFunc := func(name string) spec.Ref {
|
||||
return spec.MustCreateRef(fmt.Sprintf("#/definitions/%s", name))
|
||||
}
|
||||
defs := openapi.GetOpenAPIDefinitions(refFunc)
|
||||
schemaDefs := make(map[string]spec.Schema, len(defs))
|
||||
for k, v := range defs {
|
||||
// Replace top-level schema with v2 if a v2 schema is embedded
|
||||
// so that the output of this program is always in OpenAPI v2.
|
||||
// This is done by looking up an extension that marks the embedded v2
|
||||
// schema, and, if the v2 schema is found, make it the resulting schema for
|
||||
// the type.
|
||||
if schema, ok := v.Schema.Extensions[common.ExtensionV2Schema]; ok {
|
||||
if v2Schema, isOpenAPISchema := schema.(spec.Schema); isOpenAPISchema {
|
||||
schemaDefs[k] = v2Schema
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
schemaDefs[k] = v.Schema
|
||||
}
|
||||
data, err := json.Marshal(&spec.Swagger{
|
||||
SwaggerProps: spec.SwaggerProps{
|
||||
Definitions: schemaDefs,
|
||||
Info: &spec.Info{
|
||||
InfoProps: spec.InfoProps{
|
||||
Title: "Kube Metrics Adapter",
|
||||
Version: "unversioned",
|
||||
},
|
||||
},
|
||||
Swagger: "2.0",
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("error serializing api definitions: %w", err)
|
||||
}
|
||||
os.Stdout.Write(data)
|
||||
return nil
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,11 +1,12 @@
|
||||
// +build tools
|
||||
|
||||
/*
|
||||
Copyright 2019 The Kubernetes Authors.
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@@ -13,11 +14,6 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// This package imports things required by build scripts, to force `go mod` to see them as dependencies
|
||||
package tools
|
||||
// +k8s:openapi-gen=true
|
||||
|
||||
import (
|
||||
_ "k8s.io/code-generator"
|
||||
_ "k8s.io/kube-openapi/cmd/openapi-gen"
|
||||
_ "sigs.k8s.io/controller-tools/cmd/controller-gen"
|
||||
)
|
||||
package v1
|
||||
@@ -1,5 +1,6 @@
|
||||
// Package v1 contains API Schema definitions for the zalando v1 API group
|
||||
// +kubebuilder:object:generate=true
|
||||
// +k8s:openapi-gen=true
|
||||
// +groupName=zalando.org
|
||||
package v1
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package v1
|
||||
|
||||
// +k8s:openapi-gen=true
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
@@ -20,7 +22,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 +53,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"`
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
fmt "fmt"
|
||||
sync "sync"
|
||||
|
||||
typed "sigs.k8s.io/structured-merge-diff/v6/typed"
|
||||
)
|
||||
|
||||
func Parser() *typed.Parser {
|
||||
parserOnce.Do(func() {
|
||||
var err error
|
||||
parser, err = typed.NewParser(schemaYAML)
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("Failed to parse schema: %v", err))
|
||||
}
|
||||
})
|
||||
return parser
|
||||
}
|
||||
|
||||
var parserOnce sync.Once
|
||||
var parser *typed.Parser
|
||||
var schemaYAML = typed.YAMLObject(`types:
|
||||
- name: com.github.zalando-incubator.kube-metrics-adapter.pkg.apis.zalando.org.v1.ClusterScalingSchedule
|
||||
scalar: untyped
|
||||
list:
|
||||
elementType:
|
||||
namedType: __untyped_atomic_
|
||||
elementRelationship: atomic
|
||||
map:
|
||||
elementType:
|
||||
namedType: __untyped_deduced_
|
||||
elementRelationship: separable
|
||||
- name: com.github.zalando-incubator.kube-metrics-adapter.pkg.apis.zalando.org.v1.ScalingSchedule
|
||||
scalar: untyped
|
||||
list:
|
||||
elementType:
|
||||
namedType: __untyped_atomic_
|
||||
elementRelationship: atomic
|
||||
map:
|
||||
elementType:
|
||||
namedType: __untyped_deduced_
|
||||
elementRelationship: separable
|
||||
- name: __untyped_atomic_
|
||||
scalar: untyped
|
||||
list:
|
||||
elementType:
|
||||
namedType: __untyped_atomic_
|
||||
elementRelationship: atomic
|
||||
map:
|
||||
elementType:
|
||||
namedType: __untyped_atomic_
|
||||
elementRelationship: atomic
|
||||
- name: __untyped_deduced_
|
||||
scalar: untyped
|
||||
list:
|
||||
elementType:
|
||||
namedType: __untyped_atomic_
|
||||
elementRelationship: atomic
|
||||
map:
|
||||
elementType:
|
||||
namedType: __untyped_deduced_
|
||||
elementRelationship: separable
|
||||
`)
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package applyconfiguration
|
||||
|
||||
import (
|
||||
v1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/apis/zalando.org/v1"
|
||||
internal "github.com/zalando-incubator/kube-metrics-adapter/pkg/client/applyconfiguration/internal"
|
||||
zalandoorgv1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/client/applyconfiguration/zalando.org/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
managedfields "k8s.io/apimachinery/pkg/util/managedfields"
|
||||
)
|
||||
|
||||
// ForKind returns an apply configuration type for the given GroupVersionKind, or nil if no
|
||||
// apply configuration type exists for the given GroupVersionKind.
|
||||
func ForKind(kind schema.GroupVersionKind) interface{} {
|
||||
switch kind {
|
||||
// Group=zalando.org, Version=v1
|
||||
case v1.SchemeGroupVersion.WithKind("ClusterScalingSchedule"):
|
||||
return &zalandoorgv1.ClusterScalingScheduleApplyConfiguration{}
|
||||
case v1.SchemeGroupVersion.WithKind("ScalingSchedule"):
|
||||
return &zalandoorgv1.ScalingScheduleApplyConfiguration{}
|
||||
case v1.SchemeGroupVersion.WithKind("ScalingScheduleSpec"):
|
||||
return &zalandoorgv1.ScalingScheduleSpecApplyConfiguration{}
|
||||
case v1.SchemeGroupVersion.WithKind("ScalingScheduleStatus"):
|
||||
return &zalandoorgv1.ScalingScheduleStatusApplyConfiguration{}
|
||||
case v1.SchemeGroupVersion.WithKind("Schedule"):
|
||||
return &zalandoorgv1.ScheduleApplyConfiguration{}
|
||||
case v1.SchemeGroupVersion.WithKind("SchedulePeriod"):
|
||||
return &zalandoorgv1.SchedulePeriodApplyConfiguration{}
|
||||
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewTypeConverter(scheme *runtime.Scheme) managedfields.TypeConverter {
|
||||
return managedfields.NewSchemeTypeConverter(scheme, internal.Parser())
|
||||
}
|
||||
@@ -0,0 +1,288 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
zalandoorgv1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/apis/zalando.org/v1"
|
||||
internal "github.com/zalando-incubator/kube-metrics-adapter/pkg/client/applyconfiguration/internal"
|
||||
apismetav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
managedfields "k8s.io/apimachinery/pkg/util/managedfields"
|
||||
metav1 "k8s.io/client-go/applyconfigurations/meta/v1"
|
||||
)
|
||||
|
||||
// ClusterScalingScheduleApplyConfiguration represents a declarative configuration of the ClusterScalingSchedule type for use
|
||||
// with apply.
|
||||
//
|
||||
// ClusterScalingSchedule describes a cluster scoped time based metric
|
||||
// to be used in autoscaling operations.
|
||||
type ClusterScalingScheduleApplyConfiguration struct {
|
||||
metav1.TypeMetaApplyConfiguration `json:",inline"`
|
||||
*metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
|
||||
Spec *ScalingScheduleSpecApplyConfiguration `json:"spec,omitempty"`
|
||||
Status *ScalingScheduleStatusApplyConfiguration `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// ClusterScalingSchedule constructs a declarative configuration of the ClusterScalingSchedule type for use with
|
||||
// apply.
|
||||
func ClusterScalingSchedule(name string) *ClusterScalingScheduleApplyConfiguration {
|
||||
b := &ClusterScalingScheduleApplyConfiguration{}
|
||||
b.WithName(name)
|
||||
b.WithKind("ClusterScalingSchedule")
|
||||
b.WithAPIVersion("zalando.org/v1")
|
||||
return b
|
||||
}
|
||||
|
||||
// ExtractClusterScalingScheduleFrom extracts the applied configuration owned by fieldManager from
|
||||
// clusterScalingSchedule for the specified subresource. Pass an empty string for subresource to extract
|
||||
// the main resource. Common subresources include "status", "scale", etc.
|
||||
// clusterScalingSchedule must be a unmodified ClusterScalingSchedule API object that was retrieved from the Kubernetes API.
|
||||
// ExtractClusterScalingScheduleFrom provides a way to perform a extract/modify-in-place/apply workflow.
|
||||
// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously
|
||||
// applied if another fieldManager has updated or force applied any of the previously applied fields.
|
||||
func ExtractClusterScalingScheduleFrom(clusterScalingSchedule *zalandoorgv1.ClusterScalingSchedule, fieldManager string, subresource string) (*ClusterScalingScheduleApplyConfiguration, error) {
|
||||
b := &ClusterScalingScheduleApplyConfiguration{}
|
||||
err := managedfields.ExtractInto(clusterScalingSchedule, internal.Parser().Type("com.github.zalando-incubator.kube-metrics-adapter.pkg.apis.zalando.org.v1.ClusterScalingSchedule"), fieldManager, b, subresource)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
b.WithName(clusterScalingSchedule.Name)
|
||||
|
||||
b.WithKind("ClusterScalingSchedule")
|
||||
b.WithAPIVersion("zalando.org/v1")
|
||||
return b, nil
|
||||
}
|
||||
|
||||
// ExtractClusterScalingSchedule extracts the applied configuration owned by fieldManager from
|
||||
// clusterScalingSchedule. If no managedFields are found in clusterScalingSchedule for fieldManager, a
|
||||
// ClusterScalingScheduleApplyConfiguration is returned with only the Name, Namespace (if applicable),
|
||||
// APIVersion and Kind populated. It is possible that no managed fields were found for because other
|
||||
// field managers have taken ownership of all the fields previously owned by fieldManager, or because
|
||||
// the fieldManager never owned fields any fields.
|
||||
// clusterScalingSchedule must be a unmodified ClusterScalingSchedule API object that was retrieved from the Kubernetes API.
|
||||
// ExtractClusterScalingSchedule provides a way to perform a extract/modify-in-place/apply workflow.
|
||||
// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously
|
||||
// applied if another fieldManager has updated or force applied any of the previously applied fields.
|
||||
func ExtractClusterScalingSchedule(clusterScalingSchedule *zalandoorgv1.ClusterScalingSchedule, fieldManager string) (*ClusterScalingScheduleApplyConfiguration, error) {
|
||||
return ExtractClusterScalingScheduleFrom(clusterScalingSchedule, fieldManager, "")
|
||||
}
|
||||
|
||||
// ExtractClusterScalingScheduleStatus extracts the applied configuration owned by fieldManager from
|
||||
// clusterScalingSchedule for the status subresource.
|
||||
func ExtractClusterScalingScheduleStatus(clusterScalingSchedule *zalandoorgv1.ClusterScalingSchedule, fieldManager string) (*ClusterScalingScheduleApplyConfiguration, error) {
|
||||
return ExtractClusterScalingScheduleFrom(clusterScalingSchedule, fieldManager, "status")
|
||||
}
|
||||
|
||||
func (b ClusterScalingScheduleApplyConfiguration) IsApplyConfiguration() {}
|
||||
|
||||
// WithKind sets the Kind field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Kind field is set to the value of the last call.
|
||||
func (b *ClusterScalingScheduleApplyConfiguration) WithKind(value string) *ClusterScalingScheduleApplyConfiguration {
|
||||
b.TypeMetaApplyConfiguration.Kind = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the APIVersion field is set to the value of the last call.
|
||||
func (b *ClusterScalingScheduleApplyConfiguration) WithAPIVersion(value string) *ClusterScalingScheduleApplyConfiguration {
|
||||
b.TypeMetaApplyConfiguration.APIVersion = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithName sets the Name field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Name field is set to the value of the last call.
|
||||
func (b *ClusterScalingScheduleApplyConfiguration) WithName(value string) *ClusterScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.Name = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithGenerateName sets the GenerateName field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the GenerateName field is set to the value of the last call.
|
||||
func (b *ClusterScalingScheduleApplyConfiguration) WithGenerateName(value string) *ClusterScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.GenerateName = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithNamespace sets the Namespace field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Namespace field is set to the value of the last call.
|
||||
func (b *ClusterScalingScheduleApplyConfiguration) WithNamespace(value string) *ClusterScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.Namespace = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithUID sets the UID field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the UID field is set to the value of the last call.
|
||||
func (b *ClusterScalingScheduleApplyConfiguration) WithUID(value types.UID) *ClusterScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.UID = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the ResourceVersion field is set to the value of the last call.
|
||||
func (b *ClusterScalingScheduleApplyConfiguration) WithResourceVersion(value string) *ClusterScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.ResourceVersion = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithGeneration sets the Generation field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Generation field is set to the value of the last call.
|
||||
func (b *ClusterScalingScheduleApplyConfiguration) WithGeneration(value int64) *ClusterScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.Generation = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the CreationTimestamp field is set to the value of the last call.
|
||||
func (b *ClusterScalingScheduleApplyConfiguration) WithCreationTimestamp(value apismetav1.Time) *ClusterScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.CreationTimestamp = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the DeletionTimestamp field is set to the value of the last call.
|
||||
func (b *ClusterScalingScheduleApplyConfiguration) WithDeletionTimestamp(value apismetav1.Time) *ClusterScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call.
|
||||
func (b *ClusterScalingScheduleApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ClusterScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithLabels puts the entries into the Labels field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, the entries provided by each call will be put on the Labels field,
|
||||
// overwriting an existing map entries in Labels field with the same key.
|
||||
func (b *ClusterScalingScheduleApplyConfiguration) WithLabels(entries map[string]string) *ClusterScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 {
|
||||
b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries))
|
||||
}
|
||||
for k, v := range entries {
|
||||
b.ObjectMetaApplyConfiguration.Labels[k] = v
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// WithAnnotations puts the entries into the Annotations field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, the entries provided by each call will be put on the Annotations field,
|
||||
// overwriting an existing map entries in Annotations field with the same key.
|
||||
func (b *ClusterScalingScheduleApplyConfiguration) WithAnnotations(entries map[string]string) *ClusterScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 {
|
||||
b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries))
|
||||
}
|
||||
for k, v := range entries {
|
||||
b.ObjectMetaApplyConfiguration.Annotations[k] = v
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, values provided by each call will be appended to the OwnerReferences field.
|
||||
func (b *ClusterScalingScheduleApplyConfiguration) WithOwnerReferences(values ...*metav1.OwnerReferenceApplyConfiguration) *ClusterScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
for i := range values {
|
||||
if values[i] == nil {
|
||||
panic("nil value passed to WithOwnerReferences")
|
||||
}
|
||||
b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i])
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// WithFinalizers adds the given value to the Finalizers field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, values provided by each call will be appended to the Finalizers field.
|
||||
func (b *ClusterScalingScheduleApplyConfiguration) WithFinalizers(values ...string) *ClusterScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
for i := range values {
|
||||
b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i])
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func (b *ClusterScalingScheduleApplyConfiguration) ensureObjectMetaApplyConfigurationExists() {
|
||||
if b.ObjectMetaApplyConfiguration == nil {
|
||||
b.ObjectMetaApplyConfiguration = &metav1.ObjectMetaApplyConfiguration{}
|
||||
}
|
||||
}
|
||||
|
||||
// WithSpec sets the Spec field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Spec field is set to the value of the last call.
|
||||
func (b *ClusterScalingScheduleApplyConfiguration) WithSpec(value *ScalingScheduleSpecApplyConfiguration) *ClusterScalingScheduleApplyConfiguration {
|
||||
b.Spec = value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithStatus sets the Status field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Status field is set to the value of the last call.
|
||||
func (b *ClusterScalingScheduleApplyConfiguration) WithStatus(value *ScalingScheduleStatusApplyConfiguration) *ClusterScalingScheduleApplyConfiguration {
|
||||
b.Status = value
|
||||
return b
|
||||
}
|
||||
|
||||
// GetKind retrieves the value of the Kind field in the declarative configuration.
|
||||
func (b *ClusterScalingScheduleApplyConfiguration) GetKind() *string {
|
||||
return b.TypeMetaApplyConfiguration.Kind
|
||||
}
|
||||
|
||||
// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration.
|
||||
func (b *ClusterScalingScheduleApplyConfiguration) GetAPIVersion() *string {
|
||||
return b.TypeMetaApplyConfiguration.APIVersion
|
||||
}
|
||||
|
||||
// GetName retrieves the value of the Name field in the declarative configuration.
|
||||
func (b *ClusterScalingScheduleApplyConfiguration) GetName() *string {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
return b.ObjectMetaApplyConfiguration.Name
|
||||
}
|
||||
|
||||
// GetNamespace retrieves the value of the Namespace field in the declarative configuration.
|
||||
func (b *ClusterScalingScheduleApplyConfiguration) GetNamespace() *string {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
return b.ObjectMetaApplyConfiguration.Namespace
|
||||
}
|
||||
@@ -0,0 +1,290 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
zalandoorgv1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/apis/zalando.org/v1"
|
||||
internal "github.com/zalando-incubator/kube-metrics-adapter/pkg/client/applyconfiguration/internal"
|
||||
apismetav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
managedfields "k8s.io/apimachinery/pkg/util/managedfields"
|
||||
metav1 "k8s.io/client-go/applyconfigurations/meta/v1"
|
||||
)
|
||||
|
||||
// ScalingScheduleApplyConfiguration represents a declarative configuration of the ScalingSchedule type for use
|
||||
// with apply.
|
||||
//
|
||||
// ScalingSchedule describes a namespaced time based metric to be used
|
||||
// in autoscaling operations.
|
||||
type ScalingScheduleApplyConfiguration struct {
|
||||
metav1.TypeMetaApplyConfiguration `json:",inline"`
|
||||
*metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
|
||||
Spec *ScalingScheduleSpecApplyConfiguration `json:"spec,omitempty"`
|
||||
Status *ScalingScheduleStatusApplyConfiguration `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// ScalingSchedule constructs a declarative configuration of the ScalingSchedule type for use with
|
||||
// apply.
|
||||
func ScalingSchedule(name, namespace string) *ScalingScheduleApplyConfiguration {
|
||||
b := &ScalingScheduleApplyConfiguration{}
|
||||
b.WithName(name)
|
||||
b.WithNamespace(namespace)
|
||||
b.WithKind("ScalingSchedule")
|
||||
b.WithAPIVersion("zalando.org/v1")
|
||||
return b
|
||||
}
|
||||
|
||||
// ExtractScalingScheduleFrom extracts the applied configuration owned by fieldManager from
|
||||
// scalingSchedule for the specified subresource. Pass an empty string for subresource to extract
|
||||
// the main resource. Common subresources include "status", "scale", etc.
|
||||
// scalingSchedule must be a unmodified ScalingSchedule API object that was retrieved from the Kubernetes API.
|
||||
// ExtractScalingScheduleFrom provides a way to perform a extract/modify-in-place/apply workflow.
|
||||
// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously
|
||||
// applied if another fieldManager has updated or force applied any of the previously applied fields.
|
||||
func ExtractScalingScheduleFrom(scalingSchedule *zalandoorgv1.ScalingSchedule, fieldManager string, subresource string) (*ScalingScheduleApplyConfiguration, error) {
|
||||
b := &ScalingScheduleApplyConfiguration{}
|
||||
err := managedfields.ExtractInto(scalingSchedule, internal.Parser().Type("com.github.zalando-incubator.kube-metrics-adapter.pkg.apis.zalando.org.v1.ScalingSchedule"), fieldManager, b, subresource)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
b.WithName(scalingSchedule.Name)
|
||||
b.WithNamespace(scalingSchedule.Namespace)
|
||||
|
||||
b.WithKind("ScalingSchedule")
|
||||
b.WithAPIVersion("zalando.org/v1")
|
||||
return b, nil
|
||||
}
|
||||
|
||||
// ExtractScalingSchedule extracts the applied configuration owned by fieldManager from
|
||||
// scalingSchedule. If no managedFields are found in scalingSchedule for fieldManager, a
|
||||
// ScalingScheduleApplyConfiguration is returned with only the Name, Namespace (if applicable),
|
||||
// APIVersion and Kind populated. It is possible that no managed fields were found for because other
|
||||
// field managers have taken ownership of all the fields previously owned by fieldManager, or because
|
||||
// the fieldManager never owned fields any fields.
|
||||
// scalingSchedule must be a unmodified ScalingSchedule API object that was retrieved from the Kubernetes API.
|
||||
// ExtractScalingSchedule provides a way to perform a extract/modify-in-place/apply workflow.
|
||||
// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously
|
||||
// applied if another fieldManager has updated or force applied any of the previously applied fields.
|
||||
func ExtractScalingSchedule(scalingSchedule *zalandoorgv1.ScalingSchedule, fieldManager string) (*ScalingScheduleApplyConfiguration, error) {
|
||||
return ExtractScalingScheduleFrom(scalingSchedule, fieldManager, "")
|
||||
}
|
||||
|
||||
// ExtractScalingScheduleStatus extracts the applied configuration owned by fieldManager from
|
||||
// scalingSchedule for the status subresource.
|
||||
func ExtractScalingScheduleStatus(scalingSchedule *zalandoorgv1.ScalingSchedule, fieldManager string) (*ScalingScheduleApplyConfiguration, error) {
|
||||
return ExtractScalingScheduleFrom(scalingSchedule, fieldManager, "status")
|
||||
}
|
||||
|
||||
func (b ScalingScheduleApplyConfiguration) IsApplyConfiguration() {}
|
||||
|
||||
// WithKind sets the Kind field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Kind field is set to the value of the last call.
|
||||
func (b *ScalingScheduleApplyConfiguration) WithKind(value string) *ScalingScheduleApplyConfiguration {
|
||||
b.TypeMetaApplyConfiguration.Kind = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the APIVersion field is set to the value of the last call.
|
||||
func (b *ScalingScheduleApplyConfiguration) WithAPIVersion(value string) *ScalingScheduleApplyConfiguration {
|
||||
b.TypeMetaApplyConfiguration.APIVersion = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithName sets the Name field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Name field is set to the value of the last call.
|
||||
func (b *ScalingScheduleApplyConfiguration) WithName(value string) *ScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.Name = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithGenerateName sets the GenerateName field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the GenerateName field is set to the value of the last call.
|
||||
func (b *ScalingScheduleApplyConfiguration) WithGenerateName(value string) *ScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.GenerateName = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithNamespace sets the Namespace field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Namespace field is set to the value of the last call.
|
||||
func (b *ScalingScheduleApplyConfiguration) WithNamespace(value string) *ScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.Namespace = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithUID sets the UID field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the UID field is set to the value of the last call.
|
||||
func (b *ScalingScheduleApplyConfiguration) WithUID(value types.UID) *ScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.UID = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the ResourceVersion field is set to the value of the last call.
|
||||
func (b *ScalingScheduleApplyConfiguration) WithResourceVersion(value string) *ScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.ResourceVersion = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithGeneration sets the Generation field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Generation field is set to the value of the last call.
|
||||
func (b *ScalingScheduleApplyConfiguration) WithGeneration(value int64) *ScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.Generation = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the CreationTimestamp field is set to the value of the last call.
|
||||
func (b *ScalingScheduleApplyConfiguration) WithCreationTimestamp(value apismetav1.Time) *ScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.CreationTimestamp = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the DeletionTimestamp field is set to the value of the last call.
|
||||
func (b *ScalingScheduleApplyConfiguration) WithDeletionTimestamp(value apismetav1.Time) *ScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call.
|
||||
func (b *ScalingScheduleApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithLabels puts the entries into the Labels field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, the entries provided by each call will be put on the Labels field,
|
||||
// overwriting an existing map entries in Labels field with the same key.
|
||||
func (b *ScalingScheduleApplyConfiguration) WithLabels(entries map[string]string) *ScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 {
|
||||
b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries))
|
||||
}
|
||||
for k, v := range entries {
|
||||
b.ObjectMetaApplyConfiguration.Labels[k] = v
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// WithAnnotations puts the entries into the Annotations field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, the entries provided by each call will be put on the Annotations field,
|
||||
// overwriting an existing map entries in Annotations field with the same key.
|
||||
func (b *ScalingScheduleApplyConfiguration) WithAnnotations(entries map[string]string) *ScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 {
|
||||
b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries))
|
||||
}
|
||||
for k, v := range entries {
|
||||
b.ObjectMetaApplyConfiguration.Annotations[k] = v
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, values provided by each call will be appended to the OwnerReferences field.
|
||||
func (b *ScalingScheduleApplyConfiguration) WithOwnerReferences(values ...*metav1.OwnerReferenceApplyConfiguration) *ScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
for i := range values {
|
||||
if values[i] == nil {
|
||||
panic("nil value passed to WithOwnerReferences")
|
||||
}
|
||||
b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i])
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// WithFinalizers adds the given value to the Finalizers field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, values provided by each call will be appended to the Finalizers field.
|
||||
func (b *ScalingScheduleApplyConfiguration) WithFinalizers(values ...string) *ScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
for i := range values {
|
||||
b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i])
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func (b *ScalingScheduleApplyConfiguration) ensureObjectMetaApplyConfigurationExists() {
|
||||
if b.ObjectMetaApplyConfiguration == nil {
|
||||
b.ObjectMetaApplyConfiguration = &metav1.ObjectMetaApplyConfiguration{}
|
||||
}
|
||||
}
|
||||
|
||||
// WithSpec sets the Spec field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Spec field is set to the value of the last call.
|
||||
func (b *ScalingScheduleApplyConfiguration) WithSpec(value *ScalingScheduleSpecApplyConfiguration) *ScalingScheduleApplyConfiguration {
|
||||
b.Spec = value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithStatus sets the Status field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Status field is set to the value of the last call.
|
||||
func (b *ScalingScheduleApplyConfiguration) WithStatus(value *ScalingScheduleStatusApplyConfiguration) *ScalingScheduleApplyConfiguration {
|
||||
b.Status = value
|
||||
return b
|
||||
}
|
||||
|
||||
// GetKind retrieves the value of the Kind field in the declarative configuration.
|
||||
func (b *ScalingScheduleApplyConfiguration) GetKind() *string {
|
||||
return b.TypeMetaApplyConfiguration.Kind
|
||||
}
|
||||
|
||||
// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration.
|
||||
func (b *ScalingScheduleApplyConfiguration) GetAPIVersion() *string {
|
||||
return b.TypeMetaApplyConfiguration.APIVersion
|
||||
}
|
||||
|
||||
// GetName retrieves the value of the Name field in the declarative configuration.
|
||||
func (b *ScalingScheduleApplyConfiguration) GetName() *string {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
return b.ObjectMetaApplyConfiguration.Name
|
||||
}
|
||||
|
||||
// GetNamespace retrieves the value of the Namespace field in the declarative configuration.
|
||||
func (b *ScalingScheduleApplyConfiguration) GetNamespace() *string {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
return b.ObjectMetaApplyConfiguration.Namespace
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
// ScalingScheduleSpecApplyConfiguration represents a declarative configuration of the ScalingScheduleSpec type for use
|
||||
// with apply.
|
||||
//
|
||||
// ScalingScheduleSpec is the spec part of the ScalingSchedule.
|
||||
type ScalingScheduleSpecApplyConfiguration struct {
|
||||
// Fade the scheduled values in and out over this many minutes. If unset, the default per-cluster value will be used.
|
||||
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
|
||||
// resource.
|
||||
Schedules []ScheduleApplyConfiguration `json:"schedules,omitempty"`
|
||||
}
|
||||
|
||||
// ScalingScheduleSpecApplyConfiguration constructs a declarative configuration of the ScalingScheduleSpec type for use with
|
||||
// apply.
|
||||
func ScalingScheduleSpec() *ScalingScheduleSpecApplyConfiguration {
|
||||
return &ScalingScheduleSpecApplyConfiguration{}
|
||||
}
|
||||
|
||||
// WithScalingWindowDurationMinutes sets the ScalingWindowDurationMinutes field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the ScalingWindowDurationMinutes field is set to the value of the last call.
|
||||
func (b *ScalingScheduleSpecApplyConfiguration) WithScalingWindowDurationMinutes(value int64) *ScalingScheduleSpecApplyConfiguration {
|
||||
b.ScalingWindowDurationMinutes = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithSchedules adds the given value to the Schedules field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, values provided by each call will be appended to the Schedules field.
|
||||
func (b *ScalingScheduleSpecApplyConfiguration) WithSchedules(values ...*ScheduleApplyConfiguration) *ScalingScheduleSpecApplyConfiguration {
|
||||
for i := range values {
|
||||
if values[i] == nil {
|
||||
panic("nil value passed to WithSchedules")
|
||||
}
|
||||
b.Schedules = append(b.Schedules, *values[i])
|
||||
}
|
||||
return b
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
// ScalingScheduleStatusApplyConfiguration represents a declarative configuration of the ScalingScheduleStatus type for use
|
||||
// with apply.
|
||||
//
|
||||
// ScalingScheduleStatus is the status section of the ScalingSchedule.
|
||||
type ScalingScheduleStatusApplyConfiguration struct {
|
||||
// Active is true if at least one of the schedules defined in the
|
||||
// scaling schedule is currently active.
|
||||
Active *bool `json:"active,omitempty"`
|
||||
}
|
||||
|
||||
// ScalingScheduleStatusApplyConfiguration constructs a declarative configuration of the ScalingScheduleStatus type for use with
|
||||
// apply.
|
||||
func ScalingScheduleStatus() *ScalingScheduleStatusApplyConfiguration {
|
||||
return &ScalingScheduleStatusApplyConfiguration{}
|
||||
}
|
||||
|
||||
// WithActive sets the Active field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Active field is set to the value of the last call.
|
||||
func (b *ScalingScheduleStatusApplyConfiguration) WithActive(value bool) *ScalingScheduleStatusApplyConfiguration {
|
||||
b.Active = &value
|
||||
return b
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
zalandoorgv1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/apis/zalando.org/v1"
|
||||
)
|
||||
|
||||
// ScheduleApplyConfiguration represents a declarative configuration of the Schedule type for use
|
||||
// with apply.
|
||||
//
|
||||
// Schedule is the schedule details to be used inside a ScalingSchedule.
|
||||
type ScheduleApplyConfiguration struct {
|
||||
Type *zalandoorgv1.ScheduleType `json:"type,omitempty"`
|
||||
// Defines the details of a Repeating schedule.
|
||||
Period *SchedulePeriodApplyConfiguration `json:"period,omitempty"`
|
||||
// Defines the starting date of a OneTime schedule. It has to
|
||||
// be a RFC3339 formatted date.
|
||||
Date *zalandoorgv1.ScheduleDate `json:"date,omitempty"`
|
||||
// Defines the ending date of a OneTime schedule. It must be
|
||||
// a RFC3339 formatted date.
|
||||
EndDate *zalandoorgv1.ScheduleDate `json:"endDate,omitempty"`
|
||||
// The duration in minutes (default 0) that the configured value will be
|
||||
// returned for the defined schedule.
|
||||
DurationMinutes *int `json:"durationMinutes,omitempty"`
|
||||
// The metric value that will be returned for the defined schedule.
|
||||
Value *int64 `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
// ScheduleApplyConfiguration constructs a declarative configuration of the Schedule type for use with
|
||||
// apply.
|
||||
func Schedule() *ScheduleApplyConfiguration {
|
||||
return &ScheduleApplyConfiguration{}
|
||||
}
|
||||
|
||||
// WithType sets the Type field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Type field is set to the value of the last call.
|
||||
func (b *ScheduleApplyConfiguration) WithType(value zalandoorgv1.ScheduleType) *ScheduleApplyConfiguration {
|
||||
b.Type = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithPeriod sets the Period field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Period field is set to the value of the last call.
|
||||
func (b *ScheduleApplyConfiguration) WithPeriod(value *SchedulePeriodApplyConfiguration) *ScheduleApplyConfiguration {
|
||||
b.Period = value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithDate sets the Date field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Date field is set to the value of the last call.
|
||||
func (b *ScheduleApplyConfiguration) WithDate(value zalandoorgv1.ScheduleDate) *ScheduleApplyConfiguration {
|
||||
b.Date = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithEndDate sets the EndDate field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the EndDate field is set to the value of the last call.
|
||||
func (b *ScheduleApplyConfiguration) WithEndDate(value zalandoorgv1.ScheduleDate) *ScheduleApplyConfiguration {
|
||||
b.EndDate = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithDurationMinutes sets the DurationMinutes field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the DurationMinutes field is set to the value of the last call.
|
||||
func (b *ScheduleApplyConfiguration) WithDurationMinutes(value int) *ScheduleApplyConfiguration {
|
||||
b.DurationMinutes = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithValue sets the Value field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Value field is set to the value of the last call.
|
||||
func (b *ScheduleApplyConfiguration) WithValue(value int64) *ScheduleApplyConfiguration {
|
||||
b.Value = &value
|
||||
return b
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
zalandoorgv1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/apis/zalando.org/v1"
|
||||
)
|
||||
|
||||
// SchedulePeriodApplyConfiguration represents a declarative configuration of the SchedulePeriod type for use
|
||||
// with apply.
|
||||
//
|
||||
// SchedulePeriod is the details to be used for a Schedule of the
|
||||
// Repeating type.
|
||||
type SchedulePeriodApplyConfiguration struct {
|
||||
// The startTime has the format HH:MM
|
||||
StartTime *string `json:"startTime,omitempty"`
|
||||
// The endTime has the format HH:MM
|
||||
EndTime *string `json:"endTime,omitempty"`
|
||||
// The days that this schedule will be active.
|
||||
Days []zalandoorgv1.ScheduleDay `json:"days,omitempty"`
|
||||
// The location name corresponding to a file in the IANA
|
||||
// Time Zone database, like Europe/Berlin.
|
||||
Timezone *string `json:"timezone,omitempty"`
|
||||
}
|
||||
|
||||
// SchedulePeriodApplyConfiguration constructs a declarative configuration of the SchedulePeriod type for use with
|
||||
// apply.
|
||||
func SchedulePeriod() *SchedulePeriodApplyConfiguration {
|
||||
return &SchedulePeriodApplyConfiguration{}
|
||||
}
|
||||
|
||||
// WithStartTime sets the StartTime field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the StartTime field is set to the value of the last call.
|
||||
func (b *SchedulePeriodApplyConfiguration) WithStartTime(value string) *SchedulePeriodApplyConfiguration {
|
||||
b.StartTime = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithEndTime sets the EndTime field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the EndTime field is set to the value of the last call.
|
||||
func (b *SchedulePeriodApplyConfiguration) WithEndTime(value string) *SchedulePeriodApplyConfiguration {
|
||||
b.EndTime = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithDays adds the given value to the Days field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, values provided by each call will be appended to the Days field.
|
||||
func (b *SchedulePeriodApplyConfiguration) WithDays(values ...zalandoorgv1.ScheduleDay) *SchedulePeriodApplyConfiguration {
|
||||
for i := range values {
|
||||
b.Days = append(b.Days, values[i])
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// WithTimezone sets the Timezone field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Timezone field is set to the value of the last call.
|
||||
func (b *SchedulePeriodApplyConfiguration) WithTimezone(value string) *SchedulePeriodApplyConfiguration {
|
||||
b.Timezone = &value
|
||||
return b
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user