mirror of
https://github.com/zalando-incubator/kube-metrics-adapter.git
synced 2026-05-30 08:15:25 +00:00
Compare commits
116 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 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 | |||
| e03222b12b | |||
| 063d3de6d2 | |||
| 9c8837c8ff | |||
| ec55cda1f8 | |||
| f7dfe8aedf | |||
| e0a1ca5de6 | |||
| 876074ab75 | |||
| 5da796fc9a | |||
| 5f6a683d64 | |||
| d416441688 | |||
| 4204daa44f | |||
| f02956ea35 | |||
| e580c5b5f5 | |||
| 58000627d6 | |||
| 8fefda5935 | |||
| 26baf4baed | |||
| 4168dae7dd | |||
| 6c95e44756 | |||
| 9f26d4b2ed | |||
| c26604c36b | |||
| ca9031228b | |||
| 48f0df44d9 | |||
| 964c4ecf04 | |||
| 498f85e7b1 | |||
| bdb374c4c1 | |||
| 802bf08508 | |||
| ffe65bf915 | |||
| 9ff49a9b5f | |||
| 68fcf9bd2d | |||
| b4447316c1 | |||
| 477f9fd9b9 | |||
| 24e7b2439c | |||
| cd133b0781 | |||
| bf1a0b4631 | |||
| b371621159 | |||
| 0e88d4f910 | |||
| 81e28c98eb | |||
| 527a5fcde7 | |||
| 17d91ad77d | |||
| 45ea288963 | |||
| b0f2f2ce47 | |||
| a3bf15429c | |||
| 4d4dfe07b2 | |||
| 79918e0525 | |||
| 06e0010ce3 | |||
| 52d0261ab9 | |||
| 5863416214 | |||
| 108b45ed79 | |||
| f90c0a1455 | |||
| 42f93ea557 | |||
| c4123ff203 | |||
| 853addb5ab | |||
| 99a20bb7f6 | |||
| 9ca418320b | |||
| b8c79becde | |||
| 8245fbe772 | |||
| 8cfc92e81c | |||
| f9489767ed | |||
| a7007d6924 |
+17
-2
@@ -3,12 +3,27 @@ updates:
|
|||||||
- package-ecosystem: gomod
|
- package-ecosystem: gomod
|
||||||
directory: "/"
|
directory: "/"
|
||||||
schedule:
|
schedule:
|
||||||
interval: monthly
|
interval: weekly
|
||||||
time: "07:00"
|
|
||||||
open-pull-requests-limit: 10
|
open-pull-requests-limit: 10
|
||||||
|
groups:
|
||||||
|
all-go-mod-patch-and-minor:
|
||||||
|
patterns: ["*"]
|
||||||
|
update-types: ["patch", "minor"]
|
||||||
|
ignore:
|
||||||
|
# Ignore k8s and its transitives modules as they are upgraded manually
|
||||||
|
- dependency-name: "k8s.io/*"
|
||||||
|
update-types: [ "version-update:semver-major", "version-update:semver-minor" ]
|
||||||
- package-ecosystem: docker
|
- package-ecosystem: docker
|
||||||
directory: "/"
|
directory: "/"
|
||||||
schedule:
|
schedule:
|
||||||
interval: monthly
|
interval: monthly
|
||||||
time: "07:00"
|
time: "07:00"
|
||||||
open-pull-requests-limit: 10
|
open-pull-requests-limit: 10
|
||||||
|
- package-ecosystem: "github-actions"
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: "monthly"
|
||||||
|
groups:
|
||||||
|
github-actions:
|
||||||
|
patterns:
|
||||||
|
- "*"
|
||||||
|
|||||||
@@ -10,10 +10,10 @@ jobs:
|
|||||||
tests:
|
tests:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v5
|
||||||
- uses: actions/setup-go@v2
|
- uses: actions/setup-go@v6.0.0
|
||||||
with:
|
with:
|
||||||
go-version: '^1.19'
|
go-version: '^1.25'
|
||||||
- run: go version
|
- run: go version
|
||||||
- run: go install github.com/mattn/goveralls@latest
|
- run: go install github.com/mattn/goveralls@latest
|
||||||
- run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
|
- run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
|
||||||
|
|||||||
@@ -38,12 +38,12 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
- name: setup go
|
- name: setup go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v6.0.0
|
||||||
with:
|
with:
|
||||||
go-version: '1.22'
|
go-version: '1.25'
|
||||||
|
|
||||||
# Initializes the CodeQL tools for scanning.
|
# Initializes the CodeQL tools for scanning.
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
|
|||||||
@@ -25,15 +25,15 @@ jobs:
|
|||||||
packages: write # to push packages
|
packages: write # to push packages
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
|
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493
|
||||||
|
|
||||||
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753
|
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00
|
||||||
with:
|
with:
|
||||||
# https://www.npmjs.com/package/semver#caret-ranges-123-025-004
|
# 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
|
- name: Login to Github Container Registry
|
||||||
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc
|
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1
|
||||||
with:
|
with:
|
||||||
registry: ${{ env.REGISTRY }}
|
registry: ${{ env.REGISTRY }}
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
@@ -47,21 +47,21 @@ jobs:
|
|||||||
make build.linux.amd64 build.linux.arm64
|
make build.linux.amd64 build.linux.arm64
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@2b82ce82d56a2a04d2637cd93a637ae1b359c0a7
|
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@4c0219f9ac95b02789c1075625400b2acbff50b1
|
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435
|
||||||
|
|
||||||
- name: Login to GitHub Container Registry
|
- name: Login to GitHub Container Registry
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc
|
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Docker meta
|
- name: Docker meta
|
||||||
uses: docker/metadata-action@818d4b7b91585d195f67373fd9cb0332e31a7175
|
uses: docker/metadata-action@c1e51972afc2121e065aed6d45c65596fe445f3f
|
||||||
id: meta
|
id: meta
|
||||||
with:
|
with:
|
||||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||||
@@ -70,10 +70,10 @@ jobs:
|
|||||||
type=semver,pattern=v{{major}}.{{minor}}
|
type=semver,pattern=v{{major}}.{{minor}}
|
||||||
|
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825
|
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
build-args: BASE_IMAGE=alpine:3
|
build-args: BASE_IMAGE=gcr.io/distroless/static-debian12
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
push: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/v') }}
|
push: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/v') }}
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
@@ -81,10 +81,10 @@ jobs:
|
|||||||
|
|
||||||
# Build and push latest tag
|
# Build and push latest tag
|
||||||
- name: Build and push latest
|
- name: Build and push latest
|
||||||
uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825
|
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
build-args: BASE_IMAGE=alpine:3
|
build-args: BASE_IMAGE=gcr.io/distroless/static-debian12
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v5
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ jobs:
|
|||||||
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
|
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
|
||||||
|
|
||||||
- name: Run chart-releaser
|
- name: Run chart-releaser
|
||||||
uses: helm/chart-releaser-action@v1.4.0
|
uses: helm/chart-releaser-action@v1.7.0
|
||||||
with:
|
with:
|
||||||
charts_dir: docs
|
charts_dir: docs
|
||||||
env:
|
env:
|
||||||
|
|||||||
@@ -42,11 +42,21 @@ $(OPENAPI): go.mod
|
|||||||
go run k8s.io/kube-openapi/cmd/openapi-gen \
|
go run k8s.io/kube-openapi/cmd/openapi-gen \
|
||||||
--go-header-file hack/boilerplate.go.txt \
|
--go-header-file hack/boilerplate.go.txt \
|
||||||
--logtostderr \
|
--logtostderr \
|
||||||
-i k8s.io/metrics/pkg/apis/custom_metrics,k8s.io/metrics/pkg/apis/custom_metrics/v1beta1,k8s.io/metrics/pkg/apis/custom_metrics/v1beta2,k8s.io/metrics/pkg/apis/external_metrics,k8s.io/metrics/pkg/apis/external_metrics/v1beta1,k8s.io/metrics/pkg/apis/metrics,k8s.io/metrics/pkg/apis/metrics/v1beta1,k8s.io/apimachinery/pkg/apis/meta/v1,k8s.io/apimachinery/pkg/api/resource,k8s.io/apimachinery/pkg/version,k8s.io/api/core/v1 \
|
--output-dir pkg/api/generated/openapi \
|
||||||
-p pkg/api/generated/openapi \
|
--output-pkg github.com/zalando-incubator/kube-metrics-adapter/pkg/api/generated/openapi \
|
||||||
-o . \
|
--output-file zz_generated.openapi.go \
|
||||||
-O zz_generated.openapi \
|
-r /dev/null \
|
||||||
-r /dev/null
|
k8s.io/metrics/pkg/apis/custom_metrics \
|
||||||
|
k8s.io/metrics/pkg/apis/custom_metrics/v1beta1 \
|
||||||
|
k8s.io/metrics/pkg/apis/custom_metrics/v1beta2 \
|
||||||
|
k8s.io/metrics/pkg/apis/external_metrics \
|
||||||
|
k8s.io/metrics/pkg/apis/external_metrics/v1beta1 \
|
||||||
|
k8s.io/metrics/pkg/apis/metrics \
|
||||||
|
k8s.io/metrics/pkg/apis/metrics/v1beta1 \
|
||||||
|
k8s.io/apimachinery/pkg/apis/meta/v1 \
|
||||||
|
k8s.io/apimachinery/pkg/api/resource \
|
||||||
|
k8s.io/apimachinery/pkg/version \
|
||||||
|
k8s.io/api/core/v1
|
||||||
|
|
||||||
build.local: build/$(BINARY) $(GENERATED_CRDS)
|
build.local: build/$(BINARY) $(GENERATED_CRDS)
|
||||||
build.linux: build/linux/$(BINARY)
|
build.linux: build/linux/$(BINARY)
|
||||||
|
|||||||
@@ -116,6 +116,7 @@ metadata:
|
|||||||
annotations:
|
annotations:
|
||||||
# metric-config.<metricType>.<metricName>.<collectorType>/<configKey>
|
# metric-config.<metricType>.<metricName>.<collectorType>/<configKey>
|
||||||
metric-config.pods.requests-per-second.json-path/json-key: "$.http_server.rps"
|
metric-config.pods.requests-per-second.json-path/json-key: "$.http_server.rps"
|
||||||
|
metric-config.pods.requests-per-second.json-path/json-eval: "ceil($['active processes'] / $['total processes'] * 100)" # cannot use both json-eval and json-key
|
||||||
metric-config.pods.requests-per-second.json-path/path: /metrics
|
metric-config.pods.requests-per-second.json-path/path: /metrics
|
||||||
metric-config.pods.requests-per-second.json-path/port: "9090"
|
metric-config.pods.requests-per-second.json-path/port: "9090"
|
||||||
metric-config.pods.requests-per-second.json-path/scheme: "https"
|
metric-config.pods.requests-per-second.json-path/scheme: "https"
|
||||||
@@ -158,6 +159,10 @@ The json-path query support depends on the
|
|||||||
See the README for possible queries. It's expected that the metric you query
|
See the README for possible queries. It's expected that the metric you query
|
||||||
returns something that can be turned into a `float64`.
|
returns something that can be turned into a `float64`.
|
||||||
|
|
||||||
|
The `json-eval` configuration option allows for more complex calculations to be
|
||||||
|
performed on the extracted metric. The `json-eval` expression is evaluated using
|
||||||
|
[ajson's script engine](https://github.com/spyzhov/ajson?tab=readme-ov-file#script-engine).
|
||||||
|
|
||||||
The other configuration options `path`, `port` and `scheme` specify where the metrics
|
The other configuration options `path`, `port` and `scheme` specify where the metrics
|
||||||
endpoint is exposed on the pod. The `path` and `port` options do not have default values
|
endpoint is exposed on the pod. The `path` and `port` options do not have default values
|
||||||
so they must be defined. The `scheme` is optional and defaults to `http`.
|
so they must be defined. The `scheme` is optional and defaults to `http`.
|
||||||
@@ -238,6 +243,10 @@ metadata:
|
|||||||
# If specified, then this prometheus server is used,
|
# If specified, then this prometheus server is used,
|
||||||
# instead of the prometheus server specified as the CLI argument `--prometheus-server`.
|
# 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
|
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.<metricType>.<metricName>.<collectorType>/<configKey>
|
||||||
metric-config.external.processed-events-per-second.prometheus/query: |
|
metric-config.external.processed-events-per-second.prometheus/query: |
|
||||||
scalar(sum(rate(event-service_events_count{application="event-service",processed="true"}[1m])))
|
scalar(sum(rate(event-service_events_count{application="event-service",processed="true"}[1m])))
|
||||||
@@ -746,12 +755,12 @@ spec:
|
|||||||
- type: External
|
- type: External
|
||||||
external:
|
external:
|
||||||
metric:
|
metric:
|
||||||
name: my-nakadi-consumer
|
name: my-nakadi-consumer
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
type: nakadi
|
type: nakadi
|
||||||
subscription-id: "708095f6-cece-4d02-840e-ee488d710b29"
|
subscription-id: "708095f6-cece-4d02-840e-ee488d710b29"
|
||||||
metric-type: "consumer-lag-seconds|unconsumed-events"
|
metric-type: "consumer-lag-seconds|unconsumed-events"
|
||||||
target:
|
target:
|
||||||
# value is compatible with the consumer-lag-seconds metric type.
|
# value is compatible with the consumer-lag-seconds metric type.
|
||||||
# It describes the amount of consumer lag in seconds before scaling
|
# It describes the amount of consumer lag in seconds before scaling
|
||||||
@@ -800,6 +809,27 @@ with more consumers.
|
|||||||
For this case you should also account for the average time for processing an
|
For this case you should also account for the average time for processing an
|
||||||
event when defining the target.
|
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
|
## HTTP Collector
|
||||||
|
|
||||||
@@ -825,6 +855,7 @@ metadata:
|
|||||||
annotations:
|
annotations:
|
||||||
# metric-config.<metricType>.<metricName>.<collectorType>/<configKey>
|
# metric-config.<metricType>.<metricName>.<collectorType>/<configKey>
|
||||||
metric-config.external.unique-metric-name.json-path/json-key: "$.some-metric.value"
|
metric-config.external.unique-metric-name.json-path/json-key: "$.some-metric.value"
|
||||||
|
metric-config.external.unique-metric-name.json-path/json-eval: ceil($['active processes'] / $['total processes'] * 100) # cannot use both json-eval and json-key
|
||||||
metric-config.external.unique-metric-name.json-path/endpoint: "http://metric-source.app-namespace:8080/metrics"
|
metric-config.external.unique-metric-name.json-path/endpoint: "http://metric-source.app-namespace:8080/metrics"
|
||||||
metric-config.external.unique-metric-name.json-path/aggregator: "max"
|
metric-config.external.unique-metric-name.json-path/aggregator: "max"
|
||||||
metric-config.external.unique-metric-name.json-path/interval: "60s" # optional
|
metric-config.external.unique-metric-name.json-path/interval: "60s" # optional
|
||||||
@@ -852,6 +883,8 @@ The HTTP collector similar to the Pod Metrics collector. The following
|
|||||||
configuration values are supported:
|
configuration values are supported:
|
||||||
|
|
||||||
- `json-key` to specify the JSON path of the metric to be queried
|
- `json-key` to specify the JSON path of the metric to be queried
|
||||||
|
- `json-eval` to specify an evaluate string to [evaluate on the script engine](https://github.com/spyzhov/ajson?tab=readme-ov-file#script-engine),
|
||||||
|
cannot be used in conjunction with `json-key`
|
||||||
- `endpoint` the fully formed path to query for the metric. In the above example a Kubernetes _Service_
|
- `endpoint` the fully formed path to query for the metric. In the above example a Kubernetes _Service_
|
||||||
in the namespace `app-namespace` is called.
|
in the namespace `app-namespace` is called.
|
||||||
- `aggregator` is only required if the metric is an array of values and specifies how the values
|
- `aggregator` is only required if the metric is an array of values and specifies how the values
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
|
|||||||
kind: CustomResourceDefinition
|
kind: CustomResourceDefinition
|
||||||
metadata:
|
metadata:
|
||||||
annotations:
|
annotations:
|
||||||
controller-gen.kubebuilder.io/version: v0.14.0
|
controller-gen.kubebuilder.io/version: v0.19.0
|
||||||
name: clusterscalingschedules.zalando.org
|
name: clusterscalingschedules.zalando.org
|
||||||
spec:
|
spec:
|
||||||
group: zalando.org
|
group: zalando.org
|
||||||
@@ -11,6 +11,10 @@ spec:
|
|||||||
kind: ClusterScalingSchedule
|
kind: ClusterScalingSchedule
|
||||||
listKind: ClusterScalingScheduleList
|
listKind: ClusterScalingScheduleList
|
||||||
plural: clusterscalingschedules
|
plural: clusterscalingschedules
|
||||||
|
shortNames:
|
||||||
|
- css
|
||||||
|
- clustersched
|
||||||
|
- clusterschedule
|
||||||
singular: clusterscalingschedule
|
singular: clusterscalingschedule
|
||||||
scope: Cluster
|
scope: Cluster
|
||||||
versions:
|
versions:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
apiVersion: v2
|
apiVersion: v2
|
||||||
name: kube-metrics-adapter
|
name: kube-metrics-adapter
|
||||||
version: 0.2.2
|
version: 0.2.6
|
||||||
description: kube-metrics-adapter helm chart
|
description: kube-metrics-adapter helm chart
|
||||||
home: https://github.com/zalando-incubator/kube-metrics-adapter
|
home: https://github.com/zalando-incubator/kube-metrics-adapter
|
||||||
maintainers:
|
maintainers:
|
||||||
|
|||||||
@@ -39,170 +39,179 @@ spec:
|
|||||||
args:
|
args:
|
||||||
{{- if .Values.addDirectoryHeader }}
|
{{- if .Values.addDirectoryHeader }}
|
||||||
- --add_dir_header={{ .Values.addDirectoryHeader }}
|
- --add_dir_header={{ .Values.addDirectoryHeader }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.log.alsoToStderr }}
|
{{- if .Values.log.alsoToStderr }}
|
||||||
- --alsologtostderr={{ .Values.log.alsoToStderr }}
|
- --alsologtostderr={{ .Values.log.alsoToStderr }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.authentication.kubeConfig }}
|
{{- if .Values.authentication.kubeConfig }}
|
||||||
- --authentication-kubeconfig={{ .Values.authentication.kubeConfig }}
|
- --authentication-kubeconfig={{ .Values.authentication.kubeConfig }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.authentication.skipLookup }}
|
{{- if .Values.authentication.skipLookup }}
|
||||||
- --authentication-skip-lookup={{ .Values.authentication.skipLookup }}
|
- --authentication-skip-lookup={{ .Values.authentication.skipLookup }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.authentication.tokenWebhookCacheTtl }}
|
{{- if .Values.authentication.tokenWebhookCacheTtl }}
|
||||||
- --authentication-token-webhook-cache-ttl={{ .Values.authentication.tokenWebhookCacheTtl }}
|
- --authentication-token-webhook-cache-ttl={{ .Values.authentication.tokenWebhookCacheTtl }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.authentication.tolerateLookupFailure }}
|
{{- if .Values.authentication.tolerateLookupFailure }}
|
||||||
- --authentication-tolerate-lookup-failure={{ .Values.authentication.tolerateLookupFailure }}
|
- --authentication-tolerate-lookup-failure={{ .Values.authentication.tolerateLookupFailure }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.authorization.alwaysAllowPaths }}
|
{{- if .Values.authorization.alwaysAllowPaths }}
|
||||||
- --authorization-always-allow-paths={{ .Values.authorization.alwaysAllowPaths }}
|
- --authorization-always-allow-paths={{ .Values.authorization.alwaysAllowPaths }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.authorization.kubeConfig }}
|
{{- if .Values.authorization.kubeConfig }}
|
||||||
- --authorization-kubeconfig={{ .Values.authorization.kubeConfig }}
|
- --authorization-kubeconfig={{ .Values.authorization.kubeConfig }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.authorization.webhookCache.authorizedTtl }}
|
{{- if .Values.authorization.webhookCache.authorizedTtl }}
|
||||||
- --authorization-webhook-cache-authorized-ttl={{ .Values.authorization.webhookCache.authorizedTtl }}
|
- --authorization-webhook-cache-authorized-ttl={{ .Values.authorization.webhookCache.authorizedTtl }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.authorization.webhookCache.unauthorizedTtl }}
|
{{- if .Values.authorization.webhookCache.unauthorizedTtl }}
|
||||||
- --authorization-webhook-cache-unauthorized-ttl={{ .Values.authorization.webhookCache.unauthorizedTtl }}
|
- --authorization-webhook-cache-unauthorized-ttl={{ .Values.authorization.webhookCache.unauthorizedTtl }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.aws.externalMetrics }}
|
{{- if .Values.aws.externalMetrics }}
|
||||||
- --aws-external-metrics={{ .Values.aws.externalMetrics }}
|
- --aws-external-metrics={{ .Values.aws.externalMetrics }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.aws.region }}
|
{{- if .Values.aws.region }}
|
||||||
- --aws-region={{ .Values.aws.region }}
|
- --aws-region={{ .Values.aws.region }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.tls.certificateDirectory }}
|
{{- if .Values.tls.certificateDirectory }}
|
||||||
- --cert-dir={{ .Values.tls.certificateDirectory }}
|
- --cert-dir={{ .Values.tls.certificateDirectory }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.tls.clientCaFile }}
|
{{- if .Values.tls.clientCaFile }}
|
||||||
- --client-ca-file={{ .Values.tls.clientCaFile }}
|
- --client-ca-file={{ .Values.tls.clientCaFile }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.contentionProfiling }}
|
{{- if .Values.contentionProfiling }}
|
||||||
- --contention-profiling={{ .Values.contentionProfiling }}
|
- --contention-profiling={{ .Values.contentionProfiling }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.credentialsDirectory }}
|
{{- if .Values.credentialsDirectory }}
|
||||||
- --credentials-dir={{ .Values.credentialsDirectory }}
|
- --credentials-dir={{ .Values.credentialsDirectory }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.disregardIncompatibleHPAs }}
|
{{- if .Values.disregardIncompatibleHPAs }}
|
||||||
- --disregard-incompatible-hpas={{ .Values.disregardIncompatibleHPAs }}
|
- --disregard-incompatible-hpas={{ .Values.disregardIncompatibleHPAs }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.enableCustomMetricsApi }}
|
{{- if .Values.enableCustomMetricsApi }}
|
||||||
- --enable-custom-metrics-api={{ .Values.enableCustomMetricsApi }}
|
- --enable-custom-metrics-api={{ .Values.enableCustomMetricsApi }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.enableExternalMetricsApi }}
|
{{- if .Values.enableExternalMetricsApi }}
|
||||||
- --enable-external-metrics-api={{ .Values.enableExternalMetricsApi }}
|
- --enable-external-metrics-api={{ .Values.enableExternalMetricsApi }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.http2MaxStreamsPerConnection }}
|
{{- if .Values.http2MaxStreamsPerConnection }}
|
||||||
- --http2-max-streams-per-connection={{ .Values.http2MaxStreamsPerConnection }}
|
- --http2-max-streams-per-connection={{ .Values.http2MaxStreamsPerConnection }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.influxDB.address }}
|
{{- if .Values.influxDB.address }}
|
||||||
- --influxdb-address={{ .Values.influxDB.address }}
|
- --influxdb-address={{ .Values.influxDB.address }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.influxDB.organization }}
|
{{- if .Values.influxDB.organization }}
|
||||||
- --influxdb-org={{ .Values.influxDB.organization }}
|
- --influxdb-org={{ .Values.influxDB.organization }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.influxDB.token }}
|
{{- if .Values.influxDB.token }}
|
||||||
- --influxdb-token={{ .Values.influxDB.token }}
|
- --influxdb-token={{ .Values.influxDB.token }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.listerKubeConfig }}
|
{{- if .Values.listerKubeConfig }}
|
||||||
- --lister-kubeconfig={{ .Values.listerKubeConfig }}
|
- --lister-kubeconfig={{ .Values.listerKubeConfig }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.log.flushFrequency }}
|
{{- if .Values.log.flushFrequency }}
|
||||||
- --log-flush-frequency={{ .Values.log.flushFrequency }}
|
- --log-flush-frequency={{ .Values.log.flushFrequency }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.log.backtraceAtTraceLocation }}
|
{{- if .Values.log.backtraceAtTraceLocation }}
|
||||||
- --log_backtrace_at={{ .Values.log.backtraceAtTraceLocation }}
|
- --log_backtrace_at={{ .Values.log.backtraceAtTraceLocation }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.log.directory }}
|
{{- if .Values.log.directory }}
|
||||||
- --log_dir={{ .Values.log.directory }}
|
- --log_dir={{ .Values.log.directory }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.log.file }}
|
{{- if .Values.log.file }}
|
||||||
- --log_file={{ .Values.log.file }}
|
- --log_file={{ .Values.log.file }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.log.fileMaxSize }}
|
{{- if .Values.log.fileMaxSize }}
|
||||||
- --log_file_max_size={{ .Values.log.fileMaxSize }}
|
- --log_file_max_size={{ .Values.log.fileMaxSize }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.log.toStderr }}
|
{{- if .Values.log.toStderr }}
|
||||||
- --logtostderr={{ .Values.log.toStderr }}
|
- --logtostderr={{ .Values.log.toStderr }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.prometheus.metricsAddress }}
|
{{- if .Values.prometheus.metricsAddress }}
|
||||||
- --metrics-address={{ .Values.prometheus.metricsAddress }}
|
- --metrics-address={{ .Values.prometheus.metricsAddress }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.profiling }}
|
{{- if .Values.profiling }}
|
||||||
- --profiling={{ .Values.profiling }}
|
- --profiling={{ .Values.profiling }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.prometheus.server }}
|
{{- if .Values.prometheus.server }}
|
||||||
- --prometheus-server={{ .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 }}
|
{{- if .Values.requestHeader.allowedNames }}
|
||||||
- --requestheader-allowed-names={{ .Values.requestHeader.allowedNames }}
|
- --requestheader-allowed-names={{ .Values.requestHeader.allowedNames }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.requestHeader.clientCaFile }}
|
{{- if .Values.requestHeader.clientCaFile }}
|
||||||
- --requestheader-client-ca-file={{ .Values.requestHeader.clientCaFile }}
|
- --requestheader-client-ca-file={{ .Values.requestHeader.clientCaFile }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.requestHeader.extraHeadersPrefix }}
|
{{- if .Values.requestHeader.extraHeadersPrefix }}
|
||||||
- --requestheader-extra-headers-prefix={{ .Values.requestHeader.extraHeadersPrefix }}
|
- --requestheader-extra-headers-prefix={{ .Values.requestHeader.extraHeadersPrefix }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.requestHeader.groupHeaders }}
|
{{- if .Values.requestHeader.groupHeaders }}
|
||||||
- --requestheader-group-headers={{ .Values.requestHeader.groupHeaders }}
|
- --requestheader-group-headers={{ .Values.requestHeader.groupHeaders }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.requestHeader.usernameHeaders }}
|
{{- if .Values.requestHeader.usernameHeaders }}
|
||||||
- --requestheader-username-headers={{ .Values.requestHeader.usernameHeaders }}
|
- --requestheader-username-headers={{ .Values.requestHeader.usernameHeaders }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
- --secure-port={{ .Values.service.internalPort }}
|
- --secure-port={{ .Values.service.internalPort }}
|
||||||
{{- if .Values.log.skipHeaders }}
|
{{- if .Values.log.skipHeaders }}
|
||||||
- --skip_headers={{ .Values.log.skipHeaders }}
|
- --skip_headers={{ .Values.log.skipHeaders }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.log.skipLogHeaders }}
|
{{- if .Values.log.skipLogHeaders }}
|
||||||
- --skip_log_headers={{ .Values.log.skipLogHeaders }}
|
- --skip_log_headers={{ .Values.log.skipLogHeaders }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.skipperBackendsAnnotation }}
|
{{- if .Values.skipperBackendsAnnotation }}
|
||||||
- --skipper-backends-annotation={{ .Values.skipperBackendsAnnotation }}
|
- --skipper-backends-annotation={{ .Values.skipperBackendsAnnotation }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.skipperIngressMetrics }}
|
{{- if .Values.skipperIngressMetrics }}
|
||||||
- --skipper-ingress-metrics={{ .Values.skipperIngressMetrics }}
|
- --skipper-ingress-metrics={{ .Values.skipperIngressMetrics }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.skipperRouteGroupMetrics }}
|
{{- if .Values.skipperRouteGroupMetrics }}
|
||||||
- --skipper-routegroup-metrics={{ .Values.skipperRouteGroupMetrics }}
|
- --skipper-routegroup-metrics={{ .Values.skipperRouteGroupMetrics }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.log.stderrThreshold }}
|
{{- if .Values.log.stderrThreshold }}
|
||||||
- --stderrthreshold={{ .Values.log.stderrThreshold }}
|
- --stderrthreshold={{ .Values.log.stderrThreshold }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.tls.certFile }}
|
{{- if .Values.tls.certFile }}
|
||||||
- --tls-cert-file={{ .Values.tls.certFile }}
|
- --tls-cert-file={{ .Values.tls.certFile }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.tls.cipherSuites }}
|
{{- if .Values.tls.cipherSuites }}
|
||||||
- --tls-cipher-suites={{ .Values.tls.cipherSuites }}
|
- --tls-cipher-suites={{ .Values.tls.cipherSuites }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.tls.minVersion }}
|
{{- if .Values.tls.minVersion }}
|
||||||
- --tls-min-version={{ .Values.tls.minVersion }}
|
- --tls-min-version={{ .Values.tls.minVersion }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.tls.privateKeyFile }}
|
{{- if .Values.tls.privateKeyFile }}
|
||||||
- --tls-private-key-file={{ .Values.tls.privateKeyFile }}
|
- --tls-private-key-file={{ .Values.tls.privateKeyFile }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.tls.sniCertKey }}
|
{{- if .Values.tls.sniCertKey }}
|
||||||
- --tls-sni-cert-key={{ .Values.tls.sniCertKey }}
|
- --tls-sni-cert-key={{ .Values.tls.sniCertKey }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.token }}
|
{{- if .Values.token }}
|
||||||
- --token={{ .Values.token }}
|
- --token={{ .Values.token }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.log.level }}
|
{{- if .Values.log.level }}
|
||||||
- --v={{ .Values.log.level }}
|
- --v={{ .Values.log.level }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.vmodule }}
|
{{- if .Values.vmodule }}
|
||||||
- --vmodule={{ .Values.vmodule }}
|
- --vmodule={{ .Values.vmodule }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.zmon.kariosdbEndpoint }}
|
{{- if .Values.zmon.kariosdbEndpoint }}
|
||||||
- --zmon-kariosdb-endpoint={{ .Values.zmon.kariosdbEndpoint }}
|
- --zmon-kariosdb-endpoint={{ .Values.zmon.kariosdbEndpoint }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.zmon.tokenName }}
|
{{- if .Values.zmon.tokenName }}
|
||||||
- --zmon-token-name={{ .Values.zmon.tokenName }}
|
- --zmon-token-name={{ .Values.zmon.tokenName }}
|
||||||
{{- end}}
|
{{- end }}
|
||||||
{{- if .Values.scalingSchedule.enabled }}
|
{{- if .Values.scalingSchedule.enabled }}
|
||||||
- --scaling-schedule
|
- --scaling-schedule
|
||||||
{{- end}}
|
{{- end }}
|
||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
cpu: {{ .Values.resources.limits.cpu }}
|
cpu: {{ .Values.resources.limits.cpu }}
|
||||||
@@ -210,3 +219,9 @@ spec:
|
|||||||
requests:
|
requests:
|
||||||
cpu: {{ .Values.resources.requests.cpu }}
|
cpu: {{ .Values.resources.requests.cpu }}
|
||||||
memory: {{ .Values.resources.requests.memory }}
|
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,3 +3,4 @@ apiVersion: v1
|
|||||||
metadata:
|
metadata:
|
||||||
name: kube-metrics-adapter
|
name: kube-metrics-adapter
|
||||||
namespace: {{ .Values.namespace }}
|
namespace: {{ .Values.namespace }}
|
||||||
|
annotations: {{- toYaml .Values.serviceAccountAnnotations | nindent 4 }}
|
||||||
|
|||||||
+11
-2
@@ -3,8 +3,8 @@ namespace: kube-system
|
|||||||
replicas: 1
|
replicas: 1
|
||||||
|
|
||||||
registry:
|
registry:
|
||||||
image: registry.opensource.zalan.do/teapot/kube-metrics-adapter
|
image: ghcr.io/zalando-incubator/kube-metrics-adapter
|
||||||
imageTag: v0.2.2
|
imageTag: v0.2.6
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
|
|
||||||
service:
|
service:
|
||||||
@@ -63,6 +63,9 @@ log:
|
|||||||
|
|
||||||
prometheus:
|
prometheus:
|
||||||
server: http://prometheus.kube-system.svc.cluster.local
|
server: http://prometheus.kube-system.svc.cluster.local
|
||||||
|
serverTokenFile:
|
||||||
|
additionalServers: {}
|
||||||
|
additionalServerTokenFiles: {}
|
||||||
metricsAddress:
|
metricsAddress:
|
||||||
|
|
||||||
requestHeader:
|
requestHeader:
|
||||||
@@ -107,3 +110,9 @@ affinity: {}
|
|||||||
priorityClassName: ""
|
priorityClassName: ""
|
||||||
|
|
||||||
podAnnotations: {}
|
podAnnotations: {}
|
||||||
|
|
||||||
|
serviceAccountAnnotations: {}
|
||||||
|
|
||||||
|
volumes: []
|
||||||
|
|
||||||
|
volumeMounts: []
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
|
|||||||
kind: CustomResourceDefinition
|
kind: CustomResourceDefinition
|
||||||
metadata:
|
metadata:
|
||||||
annotations:
|
annotations:
|
||||||
controller-gen.kubebuilder.io/version: v0.14.0
|
controller-gen.kubebuilder.io/version: v0.19.0
|
||||||
name: scalingschedules.zalando.org
|
name: scalingschedules.zalando.org
|
||||||
spec:
|
spec:
|
||||||
group: zalando.org
|
group: zalando.org
|
||||||
@@ -13,6 +13,9 @@ spec:
|
|||||||
kind: ScalingSchedule
|
kind: ScalingSchedule
|
||||||
listKind: ScalingScheduleList
|
listKind: ScalingScheduleList
|
||||||
plural: scalingschedules
|
plural: scalingschedules
|
||||||
|
shortNames:
|
||||||
|
- sched
|
||||||
|
- schedule
|
||||||
singular: scalingschedule
|
singular: scalingschedule
|
||||||
scope: Namespaced
|
scope: Namespaced
|
||||||
versions:
|
versions:
|
||||||
|
|||||||
+12
-23
@@ -24,51 +24,40 @@ CUSTOM_RESOURCE_NAME="zalando.org"
|
|||||||
CUSTOM_RESOURCE_VERSION="v1"
|
CUSTOM_RESOURCE_VERSION="v1"
|
||||||
|
|
||||||
SCRIPT_ROOT="$(dirname "${BASH_SOURCE[0]}")/.."
|
SCRIPT_ROOT="$(dirname "${BASH_SOURCE[0]}")/.."
|
||||||
OUTPUT_BASE="$(dirname "${BASH_SOURCE[0]}")/"
|
|
||||||
|
|
||||||
# generate the code with:
|
OUTPUT_DIR="pkg/client"
|
||||||
# --output-base because this script should also be able to run inside the vendor dir of
|
OUTPUT_PKG="${GOPKG}/${OUTPUT_DIR}"
|
||||||
# k8s.io/kubernetes. The output-base is needed for the generators to output into the vendor dir
|
|
||||||
# instead of the $GOPATH directly. For normal projects this can be dropped.
|
|
||||||
|
|
||||||
OUTPUT_PKG="${GOPKG}/pkg/client"
|
|
||||||
APIS_PKG="${GOPKG}/pkg/apis"
|
APIS_PKG="${GOPKG}/pkg/apis"
|
||||||
GROUPS_WITH_VERSIONS="${CUSTOM_RESOURCE_NAME}:${CUSTOM_RESOURCE_VERSION}"
|
GROUPS_WITH_VERSIONS="${CUSTOM_RESOURCE_NAME}:${CUSTOM_RESOURCE_VERSION}"
|
||||||
|
|
||||||
echo "Generating deepcopy funcs"
|
echo "Generating deepcopy funcs"
|
||||||
go run k8s.io/code-generator/cmd/deepcopy-gen \
|
go run k8s.io/code-generator/cmd/deepcopy-gen \
|
||||||
--input-dirs "${APIS_PKG}/${CUSTOM_RESOURCE_NAME}/${CUSTOM_RESOURCE_VERSION}" \
|
--output-file zz_generated.deepcopy.go \
|
||||||
-O zz_generated.deepcopy \
|
|
||||||
--bounding-dirs "${APIS_PKG}" \
|
--bounding-dirs "${APIS_PKG}" \
|
||||||
--go-header-file "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \
|
--go-header-file "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \
|
||||||
--output-base "$OUTPUT_BASE"
|
"${APIS_PKG}/${CUSTOM_RESOURCE_NAME}/${CUSTOM_RESOURCE_VERSION}"
|
||||||
|
|
||||||
echo "Generating clientset for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/${CLIENTSET_PKG_NAME:-clientset}"
|
echo "Generating clientset for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/${CLIENTSET_PKG_NAME:-clientset}"
|
||||||
go run k8s.io/code-generator/cmd/client-gen \
|
go run k8s.io/code-generator/cmd/client-gen \
|
||||||
--clientset-name versioned \
|
--clientset-name versioned \
|
||||||
--input-base "" \
|
--input-base "" \
|
||||||
--input "${APIS_PKG}/${CUSTOM_RESOURCE_NAME}/${CUSTOM_RESOURCE_VERSION}" \
|
--input "${APIS_PKG}/${CUSTOM_RESOURCE_NAME}/${CUSTOM_RESOURCE_VERSION}" \
|
||||||
--output-package "${OUTPUT_PKG}/clientset" \
|
--output-pkg "${OUTPUT_PKG}/clientset" \
|
||||||
--go-header-file "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \
|
--go-header-file "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \
|
||||||
--output-base "$OUTPUT_BASE"
|
--output-dir "${OUTPUT_DIR}/clientset"
|
||||||
|
|
||||||
echo "Generating listers for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/listers"
|
echo "Generating listers for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/listers"
|
||||||
go run k8s.io/code-generator/cmd/lister-gen \
|
go run k8s.io/code-generator/cmd/lister-gen \
|
||||||
--input-dirs "${APIS_PKG}/${CUSTOM_RESOURCE_NAME}/${CUSTOM_RESOURCE_VERSION}" \
|
--output-pkg "${OUTPUT_PKG}/listers" \
|
||||||
--output-package "${OUTPUT_PKG}/listers" \
|
|
||||||
--go-header-file "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \
|
--go-header-file "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \
|
||||||
--output-base "$OUTPUT_BASE"
|
--output-dir "${OUTPUT_DIR}/listers" \
|
||||||
|
"${APIS_PKG}/${CUSTOM_RESOURCE_NAME}/${CUSTOM_RESOURCE_VERSION}"
|
||||||
|
|
||||||
echo "Generating informers for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/informers"
|
echo "Generating informers for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/informers"
|
||||||
go run k8s.io/code-generator/cmd/informer-gen \
|
go run k8s.io/code-generator/cmd/informer-gen \
|
||||||
--input-dirs "${APIS_PKG}/${CUSTOM_RESOURCE_NAME}/${CUSTOM_RESOURCE_VERSION}" \
|
|
||||||
--versioned-clientset-package "${OUTPUT_PKG}/${CLIENTSET_PKG_NAME:-clientset}/${CLIENTSET_NAME_VERSIONED:-versioned}" \
|
--versioned-clientset-package "${OUTPUT_PKG}/${CLIENTSET_PKG_NAME:-clientset}/${CLIENTSET_NAME_VERSIONED:-versioned}" \
|
||||||
--listers-package "${OUTPUT_PKG}/listers" \
|
--listers-package "${OUTPUT_PKG}/listers" \
|
||||||
--output-package "${OUTPUT_PKG}/informers" \
|
--output-pkg "${OUTPUT_PKG}/informers" \
|
||||||
--go-header-file "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \
|
--go-header-file "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \
|
||||||
--output-base "$OUTPUT_BASE"
|
--output-dir "${OUTPUT_DIR}/informers" \
|
||||||
|
"${APIS_PKG}/${CUSTOM_RESOURCE_NAME}/${CUSTOM_RESOURCE_VERSION}"
|
||||||
# hack to make the generated code work with Go module based projects
|
|
||||||
cp -r "$OUTPUT_BASE/$GOPKG/pkg/apis" ./pkg
|
|
||||||
cp -r "$OUTPUT_BASE/$GOPKG/pkg/client" ./pkg
|
|
||||||
rm -rf "${OUTPUT_BASE:?}${SRC}"
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -6,6 +6,13 @@ import (
|
|||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// ScalingScheduler is an interface that represents a ScalingSchedule resource,
|
||||||
|
// namespaced or cluster wide.
|
||||||
|
type ScalingScheduler interface {
|
||||||
|
Identifier() string
|
||||||
|
ResourceSpec() ScalingScheduleSpec
|
||||||
|
}
|
||||||
|
|
||||||
// +genclient
|
// +genclient
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
// +kubebuilder:object:root=true
|
// +kubebuilder:object:root=true
|
||||||
@@ -13,7 +20,7 @@ import (
|
|||||||
// ScalingSchedule describes a namespaced time based metric to be used
|
// ScalingSchedule describes a namespaced time based metric to be used
|
||||||
// in autoscaling operations.
|
// in autoscaling operations.
|
||||||
// +k8s:deepcopy-gen=true
|
// +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:printcolumn:name="Active",type=boolean,JSONPath=`.status.active`,description="Whether one or more schedules are currently active."
|
||||||
// +kubebuilder:subresource:status
|
// +kubebuilder:subresource:status
|
||||||
type ScalingSchedule struct {
|
type ScalingSchedule struct {
|
||||||
@@ -25,6 +32,17 @@ type ScalingSchedule struct {
|
|||||||
Status ScalingScheduleStatus `json:"status"`
|
Status ScalingScheduleStatus `json:"status"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Identifier returns the namespaced scalingScale Identifier in the format
|
||||||
|
// `<namespace>/<name>`.
|
||||||
|
func (s *ScalingSchedule) Identifier() string {
|
||||||
|
return s.ObjectMeta.Namespace + "/" + s.ObjectMeta.Name
|
||||||
|
}
|
||||||
|
|
||||||
|
// ResourceSpec returns the ScalingScheduleSpec of the ScalingSchedule.
|
||||||
|
func (s *ScalingSchedule) ResourceSpec() ScalingScheduleSpec {
|
||||||
|
return s.Spec
|
||||||
|
}
|
||||||
|
|
||||||
// +genclient
|
// +genclient
|
||||||
// +genclient:nonNamespaced
|
// +genclient:nonNamespaced
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
@@ -33,10 +51,9 @@ type ScalingSchedule struct {
|
|||||||
// ClusterScalingSchedule describes a cluster scoped time based metric
|
// ClusterScalingSchedule describes a cluster scoped time based metric
|
||||||
// to be used in autoscaling operations.
|
// to be used in autoscaling operations.
|
||||||
// +k8s:deepcopy-gen=true
|
// +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:printcolumn:name="Active",type=boolean,JSONPath=`.status.active`,description="Whether one or more schedules are currently active."
|
||||||
// +kubebuilder:subresource:status
|
// +kubebuilder:subresource:status
|
||||||
// +kubebuilder:resource:scope=Cluster
|
|
||||||
type ClusterScalingSchedule struct {
|
type ClusterScalingSchedule struct {
|
||||||
metav1.TypeMeta `json:",inline"`
|
metav1.TypeMeta `json:",inline"`
|
||||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||||
@@ -46,6 +63,17 @@ type ClusterScalingSchedule struct {
|
|||||||
Status ScalingScheduleStatus `json:"status"`
|
Status ScalingScheduleStatus `json:"status"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Identifier returns the cluster scalingScale Identifier in the format
|
||||||
|
// `<name>`.
|
||||||
|
func (s *ClusterScalingSchedule) Identifier() string {
|
||||||
|
return s.ObjectMeta.Name
|
||||||
|
}
|
||||||
|
|
||||||
|
// ResourceSpec returns the ScalingScheduleSpec of the ClusterScalingSchedule.
|
||||||
|
func (s *ClusterScalingSchedule) ResourceSpec() ScalingScheduleSpec {
|
||||||
|
return s.Spec
|
||||||
|
}
|
||||||
|
|
||||||
// ScalingScheduleSpec is the spec part of the ScalingSchedule.
|
// ScalingScheduleSpec is the spec part of the ScalingSchedule.
|
||||||
// +k8s:deepcopy-gen=true
|
// +k8s:deepcopy-gen=true
|
||||||
type ScalingScheduleSpec struct {
|
type ScalingScheduleSpec struct {
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ limitations under the License.
|
|||||||
package versioned
|
package versioned
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
fmt "fmt"
|
||||||
"net/http"
|
http "net/http"
|
||||||
|
|
||||||
zalandov1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/client/clientset/versioned/typed/zalando.org/v1"
|
zalandov1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/client/clientset/versioned/typed/zalando.org/v1"
|
||||||
discovery "k8s.io/client-go/discovery"
|
discovery "k8s.io/client-go/discovery"
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import (
|
|||||||
clientset "github.com/zalando-incubator/kube-metrics-adapter/pkg/client/clientset/versioned"
|
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"
|
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"
|
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/runtime"
|
||||||
"k8s.io/apimachinery/pkg/watch"
|
"k8s.io/apimachinery/pkg/watch"
|
||||||
"k8s.io/client-go/discovery"
|
"k8s.io/client-go/discovery"
|
||||||
@@ -31,8 +32,12 @@ import (
|
|||||||
|
|
||||||
// NewSimpleClientset returns a clientset that will respond with the provided objects.
|
// NewSimpleClientset returns a clientset that will respond with the provided objects.
|
||||||
// It's backed by a very simple object tracker that processes creates, updates and deletions as-is,
|
// It's backed by a very simple object tracker that processes creates, updates and deletions as-is,
|
||||||
// without applying any validations and/or defaults. It shouldn't be considered a replacement
|
// without applying any field management, validations and/or defaults. It shouldn't be considered a replacement
|
||||||
// for a real clientset and is mostly useful in simple unit tests.
|
// for a real clientset and is mostly useful in simple unit tests.
|
||||||
|
//
|
||||||
|
// DEPRECATED: NewClientset replaces this with support for field management, which significantly improves
|
||||||
|
// server side apply testing. NewClientset is only available when apply configurations are generated (e.g.
|
||||||
|
// via --with-applyconfig).
|
||||||
func NewSimpleClientset(objects ...runtime.Object) *Clientset {
|
func NewSimpleClientset(objects ...runtime.Object) *Clientset {
|
||||||
o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder())
|
o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder())
|
||||||
for _, obj := range objects {
|
for _, obj := range objects {
|
||||||
@@ -45,9 +50,13 @@ func NewSimpleClientset(objects ...runtime.Object) *Clientset {
|
|||||||
cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake}
|
cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake}
|
||||||
cs.AddReactor("*", "*", testing.ObjectReaction(o))
|
cs.AddReactor("*", "*", testing.ObjectReaction(o))
|
||||||
cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) {
|
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()
|
gvr := action.GetResource()
|
||||||
ns := action.GetNamespace()
|
ns := action.GetNamespace()
|
||||||
watch, err := o.Watch(gvr, ns)
|
watch, err := o.Watch(gvr, ns, opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, nil, err
|
return false, nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,15 +19,14 @@ limitations under the License.
|
|||||||
package v1
|
package v1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
context "context"
|
||||||
"time"
|
|
||||||
|
|
||||||
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"
|
scheme "github.com/zalando-incubator/kube-metrics-adapter/pkg/client/clientset/versioned/scheme"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
types "k8s.io/apimachinery/pkg/types"
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
watch "k8s.io/apimachinery/pkg/watch"
|
watch "k8s.io/apimachinery/pkg/watch"
|
||||||
rest "k8s.io/client-go/rest"
|
gentype "k8s.io/client-go/gentype"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ClusterScalingSchedulesGetter has a method to return a ClusterScalingScheduleInterface.
|
// ClusterScalingSchedulesGetter has a method to return a ClusterScalingScheduleInterface.
|
||||||
@@ -38,147 +37,34 @@ type ClusterScalingSchedulesGetter interface {
|
|||||||
|
|
||||||
// ClusterScalingScheduleInterface has methods to work with ClusterScalingSchedule resources.
|
// ClusterScalingScheduleInterface has methods to work with ClusterScalingSchedule resources.
|
||||||
type ClusterScalingScheduleInterface interface {
|
type ClusterScalingScheduleInterface interface {
|
||||||
Create(ctx context.Context, clusterScalingSchedule *v1.ClusterScalingSchedule, opts metav1.CreateOptions) (*v1.ClusterScalingSchedule, error)
|
Create(ctx context.Context, clusterScalingSchedule *zalandoorgv1.ClusterScalingSchedule, opts metav1.CreateOptions) (*zalandoorgv1.ClusterScalingSchedule, error)
|
||||||
Update(ctx context.Context, clusterScalingSchedule *v1.ClusterScalingSchedule, opts metav1.UpdateOptions) (*v1.ClusterScalingSchedule, error)
|
Update(ctx context.Context, clusterScalingSchedule *zalandoorgv1.ClusterScalingSchedule, opts metav1.UpdateOptions) (*zalandoorgv1.ClusterScalingSchedule, error)
|
||||||
UpdateStatus(ctx context.Context, clusterScalingSchedule *v1.ClusterScalingSchedule, opts metav1.UpdateOptions) (*v1.ClusterScalingSchedule, error)
|
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||||
|
UpdateStatus(ctx context.Context, clusterScalingSchedule *zalandoorgv1.ClusterScalingSchedule, opts metav1.UpdateOptions) (*zalandoorgv1.ClusterScalingSchedule, error)
|
||||||
Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error
|
Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error
|
||||||
DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error
|
DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error
|
||||||
Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.ClusterScalingSchedule, error)
|
Get(ctx context.Context, name string, opts metav1.GetOptions) (*zalandoorgv1.ClusterScalingSchedule, error)
|
||||||
List(ctx context.Context, opts metav1.ListOptions) (*v1.ClusterScalingScheduleList, error)
|
List(ctx context.Context, opts metav1.ListOptions) (*zalandoorgv1.ClusterScalingScheduleList, error)
|
||||||
Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, 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
|
ClusterScalingScheduleExpansion
|
||||||
}
|
}
|
||||||
|
|
||||||
// clusterScalingSchedules implements ClusterScalingScheduleInterface
|
// clusterScalingSchedules implements ClusterScalingScheduleInterface
|
||||||
type clusterScalingSchedules struct {
|
type clusterScalingSchedules struct {
|
||||||
client rest.Interface
|
*gentype.ClientWithList[*zalandoorgv1.ClusterScalingSchedule, *zalandoorgv1.ClusterScalingScheduleList]
|
||||||
}
|
}
|
||||||
|
|
||||||
// newClusterScalingSchedules returns a ClusterScalingSchedules
|
// newClusterScalingSchedules returns a ClusterScalingSchedules
|
||||||
func newClusterScalingSchedules(c *ZalandoV1Client) *clusterScalingSchedules {
|
func newClusterScalingSchedules(c *ZalandoV1Client) *clusterScalingSchedules {
|
||||||
return &clusterScalingSchedules{
|
return &clusterScalingSchedules{
|
||||||
client: c.RESTClient(),
|
gentype.NewClientWithList[*zalandoorgv1.ClusterScalingSchedule, *zalandoorgv1.ClusterScalingScheduleList](
|
||||||
|
"clusterscalingschedules",
|
||||||
|
c.RESTClient(),
|
||||||
|
scheme.ParameterCodec,
|
||||||
|
"",
|
||||||
|
func() *zalandoorgv1.ClusterScalingSchedule { return &zalandoorgv1.ClusterScalingSchedule{} },
|
||||||
|
func() *zalandoorgv1.ClusterScalingScheduleList { return &zalandoorgv1.ClusterScalingScheduleList{} },
|
||||||
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get takes name of the clusterScalingSchedule, and returns the corresponding clusterScalingSchedule object, and an error if there is any.
|
|
||||||
func (c *clusterScalingSchedules) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ClusterScalingSchedule, err error) {
|
|
||||||
result = &v1.ClusterScalingSchedule{}
|
|
||||||
err = c.client.Get().
|
|
||||||
Resource("clusterscalingschedules").
|
|
||||||
Name(name).
|
|
||||||
VersionedParams(&options, scheme.ParameterCodec).
|
|
||||||
Do(ctx).
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// List takes label and field selectors, and returns the list of ClusterScalingSchedules that match those selectors.
|
|
||||||
func (c *clusterScalingSchedules) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ClusterScalingScheduleList, err error) {
|
|
||||||
var timeout time.Duration
|
|
||||||
if opts.TimeoutSeconds != nil {
|
|
||||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
|
||||||
}
|
|
||||||
result = &v1.ClusterScalingScheduleList{}
|
|
||||||
err = c.client.Get().
|
|
||||||
Resource("clusterscalingschedules").
|
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
|
||||||
Timeout(timeout).
|
|
||||||
Do(ctx).
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Watch returns a watch.Interface that watches the requested clusterScalingSchedules.
|
|
||||||
func (c *clusterScalingSchedules) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
|
|
||||||
var timeout time.Duration
|
|
||||||
if opts.TimeoutSeconds != nil {
|
|
||||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
|
||||||
}
|
|
||||||
opts.Watch = true
|
|
||||||
return c.client.Get().
|
|
||||||
Resource("clusterscalingschedules").
|
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
|
||||||
Timeout(timeout).
|
|
||||||
Watch(ctx)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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 *clusterScalingSchedules) Create(ctx context.Context, clusterScalingSchedule *v1.ClusterScalingSchedule, opts metav1.CreateOptions) (result *v1.ClusterScalingSchedule, err error) {
|
|
||||||
result = &v1.ClusterScalingSchedule{}
|
|
||||||
err = c.client.Post().
|
|
||||||
Resource("clusterscalingschedules").
|
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
|
||||||
Body(clusterScalingSchedule).
|
|
||||||
Do(ctx).
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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 *clusterScalingSchedules) Update(ctx context.Context, clusterScalingSchedule *v1.ClusterScalingSchedule, opts metav1.UpdateOptions) (result *v1.ClusterScalingSchedule, err error) {
|
|
||||||
result = &v1.ClusterScalingSchedule{}
|
|
||||||
err = c.client.Put().
|
|
||||||
Resource("clusterscalingschedules").
|
|
||||||
Name(clusterScalingSchedule.Name).
|
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
|
||||||
Body(clusterScalingSchedule).
|
|
||||||
Do(ctx).
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// UpdateStatus was generated because the type contains a Status member.
|
|
||||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
|
||||||
func (c *clusterScalingSchedules) UpdateStatus(ctx context.Context, clusterScalingSchedule *v1.ClusterScalingSchedule, opts metav1.UpdateOptions) (result *v1.ClusterScalingSchedule, err error) {
|
|
||||||
result = &v1.ClusterScalingSchedule{}
|
|
||||||
err = c.client.Put().
|
|
||||||
Resource("clusterscalingschedules").
|
|
||||||
Name(clusterScalingSchedule.Name).
|
|
||||||
SubResource("status").
|
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
|
||||||
Body(clusterScalingSchedule).
|
|
||||||
Do(ctx).
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delete takes name of the clusterScalingSchedule and deletes it. Returns an error if one occurs.
|
|
||||||
func (c *clusterScalingSchedules) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
|
|
||||||
return c.client.Delete().
|
|
||||||
Resource("clusterscalingschedules").
|
|
||||||
Name(name).
|
|
||||||
Body(&opts).
|
|
||||||
Do(ctx).
|
|
||||||
Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteCollection deletes a collection of objects.
|
|
||||||
func (c *clusterScalingSchedules) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
|
|
||||||
var timeout time.Duration
|
|
||||||
if listOpts.TimeoutSeconds != nil {
|
|
||||||
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
|
|
||||||
}
|
|
||||||
return c.client.Delete().
|
|
||||||
Resource("clusterscalingschedules").
|
|
||||||
VersionedParams(&listOpts, scheme.ParameterCodec).
|
|
||||||
Timeout(timeout).
|
|
||||||
Body(&opts).
|
|
||||||
Do(ctx).
|
|
||||||
Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Patch applies the patch and returns the patched clusterScalingSchedule.
|
|
||||||
func (c *clusterScalingSchedules) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ClusterScalingSchedule, err error) {
|
|
||||||
result = &v1.ClusterScalingSchedule{}
|
|
||||||
err = c.client.Patch(pt).
|
|
||||||
Resource("clusterscalingschedules").
|
|
||||||
Name(name).
|
|
||||||
SubResource(subresources...).
|
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
|
||||||
Body(data).
|
|
||||||
Do(ctx).
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|||||||
+23
-103
@@ -19,114 +19,34 @@ limitations under the License.
|
|||||||
package fake
|
package fake
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
|
|
||||||
v1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/apis/zalando.org/v1"
|
v1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/apis/zalando.org/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
zalandoorgv1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/client/clientset/versioned/typed/zalando.org/v1"
|
||||||
labels "k8s.io/apimachinery/pkg/labels"
|
gentype "k8s.io/client-go/gentype"
|
||||||
types "k8s.io/apimachinery/pkg/types"
|
|
||||||
watch "k8s.io/apimachinery/pkg/watch"
|
|
||||||
testing "k8s.io/client-go/testing"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// FakeClusterScalingSchedules implements ClusterScalingScheduleInterface
|
// fakeClusterScalingSchedules implements ClusterScalingScheduleInterface
|
||||||
type FakeClusterScalingSchedules struct {
|
type fakeClusterScalingSchedules struct {
|
||||||
|
*gentype.FakeClientWithList[*v1.ClusterScalingSchedule, *v1.ClusterScalingScheduleList]
|
||||||
Fake *FakeZalandoV1
|
Fake *FakeZalandoV1
|
||||||
}
|
}
|
||||||
|
|
||||||
var clusterscalingschedulesResource = v1.SchemeGroupVersion.WithResource("clusterscalingschedules")
|
func newFakeClusterScalingSchedules(fake *FakeZalandoV1) zalandoorgv1.ClusterScalingScheduleInterface {
|
||||||
|
return &fakeClusterScalingSchedules{
|
||||||
var clusterscalingschedulesKind = v1.SchemeGroupVersion.WithKind("ClusterScalingSchedule")
|
gentype.NewFakeClientWithList[*v1.ClusterScalingSchedule, *v1.ClusterScalingScheduleList](
|
||||||
|
fake.Fake,
|
||||||
// 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) {
|
v1.SchemeGroupVersion.WithResource("clusterscalingschedules"),
|
||||||
obj, err := c.Fake.
|
v1.SchemeGroupVersion.WithKind("ClusterScalingSchedule"),
|
||||||
Invokes(testing.NewRootGetAction(clusterscalingschedulesResource, name), &v1.ClusterScalingSchedule{})
|
func() *v1.ClusterScalingSchedule { return &v1.ClusterScalingSchedule{} },
|
||||||
if obj == nil {
|
func() *v1.ClusterScalingScheduleList { return &v1.ClusterScalingScheduleList{} },
|
||||||
return nil, err
|
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) {
|
|
||||||
obj, err := c.Fake.
|
|
||||||
Invokes(testing.NewRootListAction(clusterscalingschedulesResource, clusterscalingschedulesKind, opts), &v1.ClusterScalingScheduleList{})
|
|
||||||
if obj == nil {
|
|
||||||
return nil, 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.NewRootWatchAction(clusterscalingschedulesResource, opts))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create takes the representation of a clusterScalingSchedule and creates it. Returns the server's representation of the clusterScalingSchedule, and an error, if there is any.
|
|
||||||
func (c *FakeClusterScalingSchedules) Create(ctx context.Context, clusterScalingSchedule *v1.ClusterScalingSchedule, opts metav1.CreateOptions) (result *v1.ClusterScalingSchedule, err error) {
|
|
||||||
obj, err := c.Fake.
|
|
||||||
Invokes(testing.NewRootCreateAction(clusterscalingschedulesResource, clusterScalingSchedule), &v1.ClusterScalingSchedule{})
|
|
||||||
if obj == nil {
|
|
||||||
return nil, 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) {
|
|
||||||
obj, err := c.Fake.
|
|
||||||
Invokes(testing.NewRootUpdateAction(clusterscalingschedulesResource, clusterScalingSchedule), &v1.ClusterScalingSchedule{})
|
|
||||||
if obj == nil {
|
|
||||||
return nil, 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) (*v1.ClusterScalingSchedule, error) {
|
|
||||||
obj, err := c.Fake.
|
|
||||||
Invokes(testing.NewRootUpdateSubresourceAction(clusterscalingschedulesResource, "status", clusterScalingSchedule), &v1.ClusterScalingSchedule{})
|
|
||||||
if obj == nil {
|
|
||||||
return nil, 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.NewRootDeleteCollectionAction(clusterscalingschedulesResource, 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) {
|
|
||||||
obj, err := c.Fake.
|
|
||||||
Invokes(testing.NewRootPatchSubresourceAction(clusterscalingschedulesResource, name, pt, data, subresources...), &v1.ClusterScalingSchedule{})
|
|
||||||
if obj == nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return obj.(*v1.ClusterScalingSchedule), err
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,123 +19,32 @@ limitations under the License.
|
|||||||
package fake
|
package fake
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
|
|
||||||
v1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/apis/zalando.org/v1"
|
v1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/apis/zalando.org/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
zalandoorgv1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/client/clientset/versioned/typed/zalando.org/v1"
|
||||||
labels "k8s.io/apimachinery/pkg/labels"
|
gentype "k8s.io/client-go/gentype"
|
||||||
types "k8s.io/apimachinery/pkg/types"
|
|
||||||
watch "k8s.io/apimachinery/pkg/watch"
|
|
||||||
testing "k8s.io/client-go/testing"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// FakeScalingSchedules implements ScalingScheduleInterface
|
// fakeScalingSchedules implements ScalingScheduleInterface
|
||||||
type FakeScalingSchedules struct {
|
type fakeScalingSchedules struct {
|
||||||
|
*gentype.FakeClientWithList[*v1.ScalingSchedule, *v1.ScalingScheduleList]
|
||||||
Fake *FakeZalandoV1
|
Fake *FakeZalandoV1
|
||||||
ns string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var scalingschedulesResource = v1.SchemeGroupVersion.WithResource("scalingschedules")
|
func newFakeScalingSchedules(fake *FakeZalandoV1, namespace string) zalandoorgv1.ScalingScheduleInterface {
|
||||||
|
return &fakeScalingSchedules{
|
||||||
var scalingschedulesKind = v1.SchemeGroupVersion.WithKind("ScalingSchedule")
|
gentype.NewFakeClientWithList[*v1.ScalingSchedule, *v1.ScalingScheduleList](
|
||||||
|
fake.Fake,
|
||||||
// Get takes name of the scalingSchedule, and returns the corresponding scalingSchedule object, and an error if there is any.
|
namespace,
|
||||||
func (c *FakeScalingSchedules) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ScalingSchedule, err error) {
|
v1.SchemeGroupVersion.WithResource("scalingschedules"),
|
||||||
obj, err := c.Fake.
|
v1.SchemeGroupVersion.WithKind("ScalingSchedule"),
|
||||||
Invokes(testing.NewGetAction(scalingschedulesResource, c.ns, name), &v1.ScalingSchedule{})
|
func() *v1.ScalingSchedule { return &v1.ScalingSchedule{} },
|
||||||
|
func() *v1.ScalingScheduleList { return &v1.ScalingScheduleList{} },
|
||||||
if obj == nil {
|
func(dst, src *v1.ScalingScheduleList) { dst.ListMeta = src.ListMeta },
|
||||||
return nil, err
|
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) {
|
|
||||||
obj, err := c.Fake.
|
|
||||||
Invokes(testing.NewListAction(scalingschedulesResource, scalingschedulesKind, c.ns, opts), &v1.ScalingScheduleList{})
|
|
||||||
|
|
||||||
if obj == nil {
|
|
||||||
return nil, 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.NewWatchAction(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) {
|
|
||||||
obj, err := c.Fake.
|
|
||||||
Invokes(testing.NewCreateAction(scalingschedulesResource, c.ns, scalingSchedule), &v1.ScalingSchedule{})
|
|
||||||
|
|
||||||
if obj == nil {
|
|
||||||
return nil, 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) {
|
|
||||||
obj, err := c.Fake.
|
|
||||||
Invokes(testing.NewUpdateAction(scalingschedulesResource, c.ns, scalingSchedule), &v1.ScalingSchedule{})
|
|
||||||
|
|
||||||
if obj == nil {
|
|
||||||
return nil, 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) (*v1.ScalingSchedule, error) {
|
|
||||||
obj, err := c.Fake.
|
|
||||||
Invokes(testing.NewUpdateSubresourceAction(scalingschedulesResource, "status", c.ns, scalingSchedule), &v1.ScalingSchedule{})
|
|
||||||
|
|
||||||
if obj == nil {
|
|
||||||
return nil, 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.NewDeleteCollectionAction(scalingschedulesResource, c.ns, 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) {
|
|
||||||
obj, err := c.Fake.
|
|
||||||
Invokes(testing.NewPatchSubresourceAction(scalingschedulesResource, c.ns, name, pt, data, subresources...), &v1.ScalingSchedule{})
|
|
||||||
|
|
||||||
if obj == nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return obj.(*v1.ScalingSchedule), err
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,11 +29,11 @@ type FakeZalandoV1 struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *FakeZalandoV1) ClusterScalingSchedules() v1.ClusterScalingScheduleInterface {
|
func (c *FakeZalandoV1) ClusterScalingSchedules() v1.ClusterScalingScheduleInterface {
|
||||||
return &FakeClusterScalingSchedules{c}
|
return newFakeClusterScalingSchedules(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FakeZalandoV1) ScalingSchedules(namespace string) v1.ScalingScheduleInterface {
|
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
|
// RESTClient returns a RESTClient that is used to communicate
|
||||||
|
|||||||
@@ -19,15 +19,14 @@ limitations under the License.
|
|||||||
package v1
|
package v1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
context "context"
|
||||||
"time"
|
|
||||||
|
|
||||||
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"
|
scheme "github.com/zalando-incubator/kube-metrics-adapter/pkg/client/clientset/versioned/scheme"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
types "k8s.io/apimachinery/pkg/types"
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
watch "k8s.io/apimachinery/pkg/watch"
|
watch "k8s.io/apimachinery/pkg/watch"
|
||||||
rest "k8s.io/client-go/rest"
|
gentype "k8s.io/client-go/gentype"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ScalingSchedulesGetter has a method to return a ScalingScheduleInterface.
|
// ScalingSchedulesGetter has a method to return a ScalingScheduleInterface.
|
||||||
@@ -38,158 +37,34 @@ type ScalingSchedulesGetter interface {
|
|||||||
|
|
||||||
// ScalingScheduleInterface has methods to work with ScalingSchedule resources.
|
// ScalingScheduleInterface has methods to work with ScalingSchedule resources.
|
||||||
type ScalingScheduleInterface interface {
|
type ScalingScheduleInterface interface {
|
||||||
Create(ctx context.Context, scalingSchedule *v1.ScalingSchedule, opts metav1.CreateOptions) (*v1.ScalingSchedule, error)
|
Create(ctx context.Context, scalingSchedule *zalandoorgv1.ScalingSchedule, opts metav1.CreateOptions) (*zalandoorgv1.ScalingSchedule, error)
|
||||||
Update(ctx context.Context, scalingSchedule *v1.ScalingSchedule, opts metav1.UpdateOptions) (*v1.ScalingSchedule, error)
|
Update(ctx context.Context, scalingSchedule *zalandoorgv1.ScalingSchedule, opts metav1.UpdateOptions) (*zalandoorgv1.ScalingSchedule, error)
|
||||||
UpdateStatus(ctx context.Context, scalingSchedule *v1.ScalingSchedule, opts metav1.UpdateOptions) (*v1.ScalingSchedule, error)
|
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||||
|
UpdateStatus(ctx context.Context, scalingSchedule *zalandoorgv1.ScalingSchedule, opts metav1.UpdateOptions) (*zalandoorgv1.ScalingSchedule, error)
|
||||||
Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error
|
Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error
|
||||||
DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error
|
DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error
|
||||||
Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.ScalingSchedule, error)
|
Get(ctx context.Context, name string, opts metav1.GetOptions) (*zalandoorgv1.ScalingSchedule, error)
|
||||||
List(ctx context.Context, opts metav1.ListOptions) (*v1.ScalingScheduleList, error)
|
List(ctx context.Context, opts metav1.ListOptions) (*zalandoorgv1.ScalingScheduleList, error)
|
||||||
Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, 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
|
ScalingScheduleExpansion
|
||||||
}
|
}
|
||||||
|
|
||||||
// scalingSchedules implements ScalingScheduleInterface
|
// scalingSchedules implements ScalingScheduleInterface
|
||||||
type scalingSchedules struct {
|
type scalingSchedules struct {
|
||||||
client rest.Interface
|
*gentype.ClientWithList[*zalandoorgv1.ScalingSchedule, *zalandoorgv1.ScalingScheduleList]
|
||||||
ns string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// newScalingSchedules returns a ScalingSchedules
|
// newScalingSchedules returns a ScalingSchedules
|
||||||
func newScalingSchedules(c *ZalandoV1Client, namespace string) *scalingSchedules {
|
func newScalingSchedules(c *ZalandoV1Client, namespace string) *scalingSchedules {
|
||||||
return &scalingSchedules{
|
return &scalingSchedules{
|
||||||
client: c.RESTClient(),
|
gentype.NewClientWithList[*zalandoorgv1.ScalingSchedule, *zalandoorgv1.ScalingScheduleList](
|
||||||
ns: namespace,
|
"scalingschedules",
|
||||||
|
c.RESTClient(),
|
||||||
|
scheme.ParameterCodec,
|
||||||
|
namespace,
|
||||||
|
func() *zalandoorgv1.ScalingSchedule { return &zalandoorgv1.ScalingSchedule{} },
|
||||||
|
func() *zalandoorgv1.ScalingScheduleList { return &zalandoorgv1.ScalingScheduleList{} },
|
||||||
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get takes name of the scalingSchedule, and returns the corresponding scalingSchedule object, and an error if there is any.
|
|
||||||
func (c *scalingSchedules) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ScalingSchedule, err error) {
|
|
||||||
result = &v1.ScalingSchedule{}
|
|
||||||
err = c.client.Get().
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("scalingschedules").
|
|
||||||
Name(name).
|
|
||||||
VersionedParams(&options, scheme.ParameterCodec).
|
|
||||||
Do(ctx).
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// List takes label and field selectors, and returns the list of ScalingSchedules that match those selectors.
|
|
||||||
func (c *scalingSchedules) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ScalingScheduleList, err error) {
|
|
||||||
var timeout time.Duration
|
|
||||||
if opts.TimeoutSeconds != nil {
|
|
||||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
|
||||||
}
|
|
||||||
result = &v1.ScalingScheduleList{}
|
|
||||||
err = c.client.Get().
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("scalingschedules").
|
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
|
||||||
Timeout(timeout).
|
|
||||||
Do(ctx).
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Watch returns a watch.Interface that watches the requested scalingSchedules.
|
|
||||||
func (c *scalingSchedules) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
|
|
||||||
var timeout time.Duration
|
|
||||||
if opts.TimeoutSeconds != nil {
|
|
||||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
|
||||||
}
|
|
||||||
opts.Watch = true
|
|
||||||
return c.client.Get().
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("scalingschedules").
|
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
|
||||||
Timeout(timeout).
|
|
||||||
Watch(ctx)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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 *scalingSchedules) Create(ctx context.Context, scalingSchedule *v1.ScalingSchedule, opts metav1.CreateOptions) (result *v1.ScalingSchedule, err error) {
|
|
||||||
result = &v1.ScalingSchedule{}
|
|
||||||
err = c.client.Post().
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("scalingschedules").
|
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
|
||||||
Body(scalingSchedule).
|
|
||||||
Do(ctx).
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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 *scalingSchedules) Update(ctx context.Context, scalingSchedule *v1.ScalingSchedule, opts metav1.UpdateOptions) (result *v1.ScalingSchedule, err error) {
|
|
||||||
result = &v1.ScalingSchedule{}
|
|
||||||
err = c.client.Put().
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("scalingschedules").
|
|
||||||
Name(scalingSchedule.Name).
|
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
|
||||||
Body(scalingSchedule).
|
|
||||||
Do(ctx).
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// UpdateStatus was generated because the type contains a Status member.
|
|
||||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
|
||||||
func (c *scalingSchedules) UpdateStatus(ctx context.Context, scalingSchedule *v1.ScalingSchedule, opts metav1.UpdateOptions) (result *v1.ScalingSchedule, err error) {
|
|
||||||
result = &v1.ScalingSchedule{}
|
|
||||||
err = c.client.Put().
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("scalingschedules").
|
|
||||||
Name(scalingSchedule.Name).
|
|
||||||
SubResource("status").
|
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
|
||||||
Body(scalingSchedule).
|
|
||||||
Do(ctx).
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delete takes name of the scalingSchedule and deletes it. Returns an error if one occurs.
|
|
||||||
func (c *scalingSchedules) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
|
|
||||||
return c.client.Delete().
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("scalingschedules").
|
|
||||||
Name(name).
|
|
||||||
Body(&opts).
|
|
||||||
Do(ctx).
|
|
||||||
Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteCollection deletes a collection of objects.
|
|
||||||
func (c *scalingSchedules) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
|
|
||||||
var timeout time.Duration
|
|
||||||
if listOpts.TimeoutSeconds != nil {
|
|
||||||
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
|
|
||||||
}
|
|
||||||
return c.client.Delete().
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("scalingschedules").
|
|
||||||
VersionedParams(&listOpts, scheme.ParameterCodec).
|
|
||||||
Timeout(timeout).
|
|
||||||
Body(&opts).
|
|
||||||
Do(ctx).
|
|
||||||
Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Patch applies the patch and returns the patched scalingSchedule.
|
|
||||||
func (c *scalingSchedules) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ScalingSchedule, err error) {
|
|
||||||
result = &v1.ScalingSchedule{}
|
|
||||||
err = c.client.Patch(pt).
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("scalingschedules").
|
|
||||||
Name(name).
|
|
||||||
SubResource(subresources...).
|
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
|
||||||
Body(data).
|
|
||||||
Do(ctx).
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -19,10 +19,10 @@ limitations under the License.
|
|||||||
package v1
|
package v1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
http "net/http"
|
||||||
|
|
||||||
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"
|
||||||
"github.com/zalando-incubator/kube-metrics-adapter/pkg/client/clientset/versioned/scheme"
|
scheme "github.com/zalando-incubator/kube-metrics-adapter/pkg/client/clientset/versioned/scheme"
|
||||||
rest "k8s.io/client-go/rest"
|
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).
|
// where httpClient was generated with rest.HTTPClientFor(c).
|
||||||
func NewForConfig(c *rest.Config) (*ZalandoV1Client, error) {
|
func NewForConfig(c *rest.Config) (*ZalandoV1Client, error) {
|
||||||
config := *c
|
config := *c
|
||||||
if err := setConfigDefaults(&config); err != nil {
|
setConfigDefaults(&config)
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
httpClient, err := rest.HTTPClientFor(&config)
|
httpClient, err := rest.HTTPClientFor(&config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
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.
|
// Note the http client provided takes precedence over the configured transport values.
|
||||||
func NewForConfigAndClient(c *rest.Config, h *http.Client) (*ZalandoV1Client, error) {
|
func NewForConfigAndClient(c *rest.Config, h *http.Client) (*ZalandoV1Client, error) {
|
||||||
config := *c
|
config := *c
|
||||||
if err := setConfigDefaults(&config); err != nil {
|
setConfigDefaults(&config)
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
client, err := rest.RESTClientForConfigAndClient(&config, h)
|
client, err := rest.RESTClientForConfigAndClient(&config, h)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -89,17 +85,15 @@ func New(c rest.Interface) *ZalandoV1Client {
|
|||||||
return &ZalandoV1Client{c}
|
return &ZalandoV1Client{c}
|
||||||
}
|
}
|
||||||
|
|
||||||
func setConfigDefaults(config *rest.Config) error {
|
func setConfigDefaults(config *rest.Config) {
|
||||||
gv := v1.SchemeGroupVersion
|
gv := zalandoorgv1.SchemeGroupVersion
|
||||||
config.GroupVersion = &gv
|
config.GroupVersion = &gv
|
||||||
config.APIPath = "/apis"
|
config.APIPath = "/apis"
|
||||||
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
|
config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion()
|
||||||
|
|
||||||
if config.UserAgent == "" {
|
if config.UserAgent == "" {
|
||||||
config.UserAgent = rest.DefaultKubernetesUserAgent()
|
config.UserAgent = rest.DefaultKubernetesUserAgent()
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// RESTClient returns a RESTClient that is used to communicate
|
// RESTClient returns a RESTClient that is used to communicate
|
||||||
|
|||||||
@@ -228,6 +228,7 @@ type SharedInformerFactory interface {
|
|||||||
|
|
||||||
// Start initializes all requested informers. They are handled in goroutines
|
// Start initializes all requested informers. They are handled in goroutines
|
||||||
// which run until the stop channel gets closed.
|
// which run until the stop channel gets closed.
|
||||||
|
// Warning: Start does not block. When run in a go-routine, it will race with a later WaitForCacheSync.
|
||||||
Start(stopCh <-chan struct{})
|
Start(stopCh <-chan struct{})
|
||||||
|
|
||||||
// Shutdown marks a factory as shutting down. At that point no new
|
// Shutdown marks a factory as shutting down. At that point no new
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ limitations under the License.
|
|||||||
package externalversions
|
package externalversions
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
fmt "fmt"
|
||||||
|
|
||||||
v1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/apis/zalando.org/v1"
|
v1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/apis/zalando.org/v1"
|
||||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
|
|||||||
@@ -19,13 +19,13 @@ limitations under the License.
|
|||||||
package v1
|
package v1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
context "context"
|
||||||
time "time"
|
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"
|
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"
|
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"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
watch "k8s.io/apimachinery/pkg/watch"
|
watch "k8s.io/apimachinery/pkg/watch"
|
||||||
@@ -36,7 +36,7 @@ import (
|
|||||||
// ClusterScalingSchedules.
|
// ClusterScalingSchedules.
|
||||||
type ClusterScalingScheduleInformer interface {
|
type ClusterScalingScheduleInformer interface {
|
||||||
Informer() cache.SharedIndexInformer
|
Informer() cache.SharedIndexInformer
|
||||||
Lister() v1.ClusterScalingScheduleLister
|
Lister() zalandoorgv1.ClusterScalingScheduleLister
|
||||||
}
|
}
|
||||||
|
|
||||||
type clusterScalingScheduleInformer struct {
|
type clusterScalingScheduleInformer struct {
|
||||||
@@ -61,16 +61,28 @@ func NewFilteredClusterScalingScheduleInformer(client versioned.Interface, resyn
|
|||||||
if tweakListOptions != nil {
|
if tweakListOptions != nil {
|
||||||
tweakListOptions(&options)
|
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) {
|
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
|
||||||
if tweakListOptions != nil {
|
if tweakListOptions != nil {
|
||||||
tweakListOptions(&options)
|
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,
|
resyncPeriod,
|
||||||
indexers,
|
indexers,
|
||||||
)
|
)
|
||||||
@@ -81,9 +93,9 @@ func (f *clusterScalingScheduleInformer) defaultInformer(client versioned.Interf
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (f *clusterScalingScheduleInformer) Informer() cache.SharedIndexInformer {
|
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 {
|
func (f *clusterScalingScheduleInformer) Lister() zalandoorgv1.ClusterScalingScheduleLister {
|
||||||
return v1.NewClusterScalingScheduleLister(f.Informer().GetIndexer())
|
return zalandoorgv1.NewClusterScalingScheduleLister(f.Informer().GetIndexer())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,13 +19,13 @@ limitations under the License.
|
|||||||
package v1
|
package v1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
context "context"
|
||||||
time "time"
|
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"
|
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"
|
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"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
watch "k8s.io/apimachinery/pkg/watch"
|
watch "k8s.io/apimachinery/pkg/watch"
|
||||||
@@ -36,7 +36,7 @@ import (
|
|||||||
// ScalingSchedules.
|
// ScalingSchedules.
|
||||||
type ScalingScheduleInformer interface {
|
type ScalingScheduleInformer interface {
|
||||||
Informer() cache.SharedIndexInformer
|
Informer() cache.SharedIndexInformer
|
||||||
Lister() v1.ScalingScheduleLister
|
Lister() zalandoorgv1.ScalingScheduleLister
|
||||||
}
|
}
|
||||||
|
|
||||||
type scalingScheduleInformer struct {
|
type scalingScheduleInformer struct {
|
||||||
@@ -62,16 +62,28 @@ func NewFilteredScalingScheduleInformer(client versioned.Interface, namespace st
|
|||||||
if tweakListOptions != nil {
|
if tweakListOptions != nil {
|
||||||
tweakListOptions(&options)
|
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) {
|
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
|
||||||
if tweakListOptions != nil {
|
if tweakListOptions != nil {
|
||||||
tweakListOptions(&options)
|
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,
|
resyncPeriod,
|
||||||
indexers,
|
indexers,
|
||||||
)
|
)
|
||||||
@@ -82,9 +94,9 @@ func (f *scalingScheduleInformer) defaultInformer(client versioned.Interface, re
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (f *scalingScheduleInformer) Informer() cache.SharedIndexInformer {
|
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 {
|
func (f *scalingScheduleInformer) Lister() zalandoorgv1.ScalingScheduleLister {
|
||||||
return v1.NewScalingScheduleLister(f.Informer().GetIndexer())
|
return zalandoorgv1.NewScalingScheduleLister(f.Informer().GetIndexer())
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user