mirror of
https://github.com/zalando-incubator/kube-metrics-adapter.git
synced 2026-05-20 10:26:16 +00:00
Compare commits
37 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5ed6fec37d | |||
| fa91142ee3 | |||
| 1acac49615 | |||
| 529fd3e059 | |||
| 55bb290076 | |||
| 70641827ce | |||
| 99ca95588e | |||
| cc9952d66e | |||
| 58c6a56cbf | |||
| 9e3a1760f1 | |||
| 0e52e076c1 | |||
| 18faf9c076 | |||
| 170faf8809 | |||
| 419f75cf18 | |||
| 0fe764be7c | |||
| 6a245b7e1e | |||
| 7a4d08cd77 | |||
| 1a9eaeedcb | |||
| 0227a3fa07 | |||
| 430b2382f6 | |||
| f64cfab5c9 | |||
| 19b1706f6c | |||
| 335dc1ff56 | |||
| 23f65af774 | |||
| a0263ae7f9 | |||
| 90a0e28490 | |||
| 724a613dda | |||
| 33db2b700c | |||
| 4bde6c3b98 | |||
| f295dfa4b6 | |||
| b9a1cf9a26 | |||
| adba88129b | |||
| 0a6f40369b | |||
| e263f964e9 | |||
| 88d8843e96 | |||
| ef298ca774 | |||
| bfd050e5b6 |
@@ -10,8 +10,8 @@ jobs:
|
||||
tests:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-go@v6.0.0
|
||||
- uses: actions/checkout@v6.0.2
|
||||
- uses: actions/setup-go@v6.2.0
|
||||
with:
|
||||
go-version: '^1.25'
|
||||
- run: go version
|
||||
|
||||
@@ -38,16 +38,16 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6.0.2
|
||||
|
||||
- name: setup go
|
||||
uses: actions/setup-go@v6.0.0
|
||||
uses: actions/setup-go@v6.2.0
|
||||
with:
|
||||
go-version: '1.25'
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v3
|
||||
uses: github/codeql-action/init@v4
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
@@ -61,7 +61,7 @@ jobs:
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v3
|
||||
uses: github/codeql-action/autobuild@v4
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
||||
@@ -74,4 +74,4 @@ jobs:
|
||||
# ./location_of_script_within_repo/buildscript.sh
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v3
|
||||
uses: github/codeql-action/analyze@v4
|
||||
|
||||
@@ -25,15 +25,15 @@ jobs:
|
||||
packages: write # to push packages
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493
|
||||
uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98
|
||||
|
||||
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00
|
||||
- uses: actions/setup-go@a5f9b05d2d216f63e13859e0d847461041025775
|
||||
with:
|
||||
# https://www.npmjs.com/package/semver#caret-ranges-123-025-004
|
||||
go-version: '^1.25'
|
||||
|
||||
- name: Login to Github Container Registry
|
||||
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1
|
||||
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
@@ -47,21 +47,21 @@ jobs:
|
||||
make build.linux.amd64 build.linux.arm64
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392
|
||||
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435
|
||||
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1
|
||||
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Docker meta
|
||||
uses: docker/metadata-action@c1e51972afc2121e065aed6d45c65596fe445f3f
|
||||
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051
|
||||
id: meta
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
|
||||
@@ -10,7 +10,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6.0.2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
|
||||
@@ -34,18 +34,19 @@ $(GENERATED): go.mod $(CRD_TYPE_SOURCE) $(OPENAPI)
|
||||
./hack/update-codegen.sh
|
||||
|
||||
$(GENERATED_CRDS): $(GENERATED) $(CRD_SOURCES)
|
||||
go run sigs.k8s.io/controller-tools/cmd/controller-gen crd:crdVersions=v1 paths=./pkg/apis/... output:crd:dir=docs
|
||||
go tool controller-gen crd:crdVersions=v1 paths=./pkg/apis/... output:crd:dir=docs
|
||||
mv docs/zalando.org_clusterscalingschedules.yaml docs/cluster_scaling_schedules_crd.yaml
|
||||
mv docs/zalando.org_scalingschedules.yaml docs/scaling_schedules_crd.yaml
|
||||
|
||||
$(OPENAPI): go.mod
|
||||
go run k8s.io/kube-openapi/cmd/openapi-gen \
|
||||
go tool openapi-gen \
|
||||
--go-header-file hack/boilerplate.go.txt \
|
||||
--logtostderr \
|
||||
--output-dir pkg/api/generated/openapi \
|
||||
--output-pkg github.com/zalando-incubator/kube-metrics-adapter/pkg/api/generated/openapi \
|
||||
--output-file zz_generated.openapi.go \
|
||||
-r /dev/null \
|
||||
github.com/zalando-incubator/kube-metrics-adapter/pkg/apis/zalando.org/v1 \
|
||||
k8s.io/metrics/pkg/apis/custom_metrics \
|
||||
k8s.io/metrics/pkg/apis/custom_metrics/v1beta1 \
|
||||
k8s.io/metrics/pkg/apis/custom_metrics/v1beta2 \
|
||||
|
||||
@@ -3,6 +3,13 @@ apiVersion: apiregistration.k8s.io/v1
|
||||
kind: APIService
|
||||
metadata:
|
||||
name: v1beta1.custom.metrics.k8s.io
|
||||
{{- with .Values.customMetricsApi.annotations }}
|
||||
annotations:
|
||||
{{- range $k, $v := . }}
|
||||
{{- $value := $v | quote }}
|
||||
{{- printf "%s: %s" (tpl $k $) (tpl $value $) | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
spec:
|
||||
service:
|
||||
name: kube-metrics-adapter
|
||||
@@ -13,3 +20,4 @@ spec:
|
||||
groupPriorityMinimum: 100
|
||||
versionPriority: 100
|
||||
{{- end}}
|
||||
""
|
||||
|
||||
@@ -3,6 +3,13 @@ apiVersion: apiregistration.k8s.io/v1
|
||||
kind: APIService
|
||||
metadata:
|
||||
name: v1beta1.external.metrics.k8s.io
|
||||
{{- with .Values.externalMetricsApi.annotations }}
|
||||
annotations:
|
||||
{{- range $k, $v := . }}
|
||||
{{- $value := $v | quote }}
|
||||
{{- printf "%s: %s" (tpl $k $) (tpl $value $) | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
spec:
|
||||
service:
|
||||
name: kube-metrics-adapter
|
||||
|
||||
@@ -15,7 +15,19 @@ addDirectoryHeader:
|
||||
contentionProfiling:
|
||||
profiling:
|
||||
enableCustomMetricsApi: true
|
||||
|
||||
# -- add annotations to the custom metrics apiservice resource, e.g.
|
||||
# cert-manager.io/inject-ca-from: {{.Release.Namespace}}/kube-metrics-adapter to inject the CA certificate form a cert-manager-issued cert used for the deployment
|
||||
customMetricsApi:
|
||||
annotations: {}
|
||||
|
||||
enableExternalMetricsApi: true
|
||||
|
||||
# -- add annotations to the custom metrics apiservice resource, e.g.
|
||||
# cert-manager.io/inject-ca-from: {{.Release.Namespace}}/kube-metrics-adapter to inject the CA certificate form a cert-manager-issued cert used for the deployment
|
||||
externalMetricsApi:
|
||||
annotations: {}
|
||||
|
||||
credentialsDirectory:
|
||||
disregardIncompatibleHPAs:
|
||||
http2MaxStreamsPerConnection:
|
||||
|
||||
+23
-5
@@ -31,30 +31,48 @@ APIS_PKG="${GOPKG}/pkg/apis"
|
||||
GROUPS_WITH_VERSIONS="${CUSTOM_RESOURCE_NAME}:${CUSTOM_RESOURCE_VERSION}"
|
||||
|
||||
echo "Generating deepcopy funcs"
|
||||
go run k8s.io/code-generator/cmd/deepcopy-gen \
|
||||
go tool deepcopy-gen \
|
||||
--output-file zz_generated.deepcopy.go \
|
||||
--bounding-dirs "${APIS_PKG}" \
|
||||
--go-header-file "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \
|
||||
"${APIS_PKG}/${CUSTOM_RESOURCE_NAME}/${CUSTOM_RESOURCE_VERSION}"
|
||||
|
||||
APPLYCONFIG_PKG="${OUTPUT_PKG}/applyconfiguration"
|
||||
|
||||
echo "Generating apply configurations for ${GROUPS_WITH_VERSIONS} at ${APPLYCONFIG_PKG}"
|
||||
|
||||
# Generate the OpenAPI schema JSON to use for applyconfiguration-gen
|
||||
OPENAPI_SCHEMA_FILE=$(mktemp -t "openapi-schema-XXXXXX.json")
|
||||
trap 'rm -f ${OPENAPI_SCHEMA_FILE}' EXIT
|
||||
echo "Extracting OpenAPI schema to ${OPENAPI_SCHEMA_FILE}"
|
||||
go tool models-schema >"${OPENAPI_SCHEMA_FILE}"
|
||||
|
||||
go tool applyconfiguration-gen \
|
||||
--output-pkg "${APPLYCONFIG_PKG}" \
|
||||
--go-header-file "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \
|
||||
--output-dir "${OUTPUT_DIR}/applyconfiguration" \
|
||||
--openapi-schema "${OPENAPI_SCHEMA_FILE}" \
|
||||
"${APIS_PKG}/${CUSTOM_RESOURCE_NAME}/${CUSTOM_RESOURCE_VERSION}"
|
||||
|
||||
echo "Generating clientset for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/${CLIENTSET_PKG_NAME:-clientset}"
|
||||
go run k8s.io/code-generator/cmd/client-gen \
|
||||
go tool client-gen \
|
||||
--clientset-name versioned \
|
||||
--input-base "" \
|
||||
--input "${APIS_PKG}/${CUSTOM_RESOURCE_NAME}/${CUSTOM_RESOURCE_VERSION}" \
|
||||
--output-pkg "${OUTPUT_PKG}/clientset" \
|
||||
--go-header-file "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \
|
||||
--output-dir "${OUTPUT_DIR}/clientset"
|
||||
--output-dir "${OUTPUT_DIR}/clientset" \
|
||||
--apply-configuration-package "${APPLYCONFIG_PKG}"
|
||||
|
||||
echo "Generating listers for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/listers"
|
||||
go run k8s.io/code-generator/cmd/lister-gen \
|
||||
go tool lister-gen \
|
||||
--output-pkg "${OUTPUT_PKG}/listers" \
|
||||
--go-header-file "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \
|
||||
--output-dir "${OUTPUT_DIR}/listers" \
|
||||
"${APIS_PKG}/${CUSTOM_RESOURCE_NAME}/${CUSTOM_RESOURCE_VERSION}"
|
||||
|
||||
echo "Generating informers for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/informers"
|
||||
go run k8s.io/code-generator/cmd/informer-gen \
|
||||
go tool informer-gen \
|
||||
--versioned-clientset-package "${OUTPUT_PKG}/${CLIENTSET_PKG_NAME:-clientset}/${CLIENTSET_NAME_VERSIONED:-versioned}" \
|
||||
--listers-package "${OUTPUT_PKG}/listers" \
|
||||
--output-pkg "${OUTPUT_PKG}/informers" \
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/zalando-incubator/kube-metrics-adapter/pkg/api/generated/openapi"
|
||||
"k8s.io/kube-openapi/pkg/common"
|
||||
"k8s.io/kube-openapi/pkg/validation/spec"
|
||||
)
|
||||
|
||||
// Outputs openAPI schema JSON containing the schema definitions in zz_generated.openapi.go.
|
||||
func main() {
|
||||
err := output()
|
||||
if err != nil {
|
||||
os.Stderr.WriteString(fmt.Sprintf("Failed: %v", err))
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
func output() error {
|
||||
refFunc := func(name string) spec.Ref {
|
||||
return spec.MustCreateRef(fmt.Sprintf("#/definitions/%s", name))
|
||||
}
|
||||
defs := openapi.GetOpenAPIDefinitions(refFunc)
|
||||
schemaDefs := make(map[string]spec.Schema, len(defs))
|
||||
for k, v := range defs {
|
||||
// Replace top-level schema with v2 if a v2 schema is embedded
|
||||
// so that the output of this program is always in OpenAPI v2.
|
||||
// This is done by looking up an extension that marks the embedded v2
|
||||
// schema, and, if the v2 schema is found, make it the resulting schema for
|
||||
// the type.
|
||||
if schema, ok := v.Schema.Extensions[common.ExtensionV2Schema]; ok {
|
||||
if v2Schema, isOpenAPISchema := schema.(spec.Schema); isOpenAPISchema {
|
||||
schemaDefs[k] = v2Schema
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
schemaDefs[k] = v.Schema
|
||||
}
|
||||
data, err := json.Marshal(&spec.Swagger{
|
||||
SwaggerProps: spec.SwaggerProps{
|
||||
Definitions: schemaDefs,
|
||||
Info: &spec.Info{
|
||||
InfoProps: spec.InfoProps{
|
||||
Title: "Kube Metrics Adapter",
|
||||
Version: "unversioned",
|
||||
},
|
||||
},
|
||||
Swagger: "2.0",
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("error serializing api definitions: %w", err)
|
||||
}
|
||||
os.Stdout.Write(data)
|
||||
return nil
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,11 +1,12 @@
|
||||
// +build tools
|
||||
|
||||
/*
|
||||
Copyright 2019 The Kubernetes Authors.
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@@ -13,11 +14,6 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// This package imports things required by build scripts, to force `go mod` to see them as dependencies
|
||||
package tools
|
||||
// +k8s:openapi-gen=true
|
||||
|
||||
import (
|
||||
_ "k8s.io/code-generator"
|
||||
_ "k8s.io/kube-openapi/cmd/openapi-gen"
|
||||
_ "sigs.k8s.io/controller-tools/cmd/controller-gen"
|
||||
)
|
||||
package v1
|
||||
@@ -1,5 +1,6 @@
|
||||
// Package v1 contains API Schema definitions for the zalando v1 API group
|
||||
// +kubebuilder:object:generate=true
|
||||
// +k8s:openapi-gen=true
|
||||
// +groupName=zalando.org
|
||||
package v1
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package v1
|
||||
|
||||
// +k8s:openapi-gen=true
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
fmt "fmt"
|
||||
sync "sync"
|
||||
|
||||
typed "sigs.k8s.io/structured-merge-diff/v6/typed"
|
||||
)
|
||||
|
||||
func Parser() *typed.Parser {
|
||||
parserOnce.Do(func() {
|
||||
var err error
|
||||
parser, err = typed.NewParser(schemaYAML)
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("Failed to parse schema: %v", err))
|
||||
}
|
||||
})
|
||||
return parser
|
||||
}
|
||||
|
||||
var parserOnce sync.Once
|
||||
var parser *typed.Parser
|
||||
var schemaYAML = typed.YAMLObject(`types:
|
||||
- name: com.github.zalando-incubator.kube-metrics-adapter.pkg.apis.zalando.org.v1.ClusterScalingSchedule
|
||||
scalar: untyped
|
||||
list:
|
||||
elementType:
|
||||
namedType: __untyped_atomic_
|
||||
elementRelationship: atomic
|
||||
map:
|
||||
elementType:
|
||||
namedType: __untyped_deduced_
|
||||
elementRelationship: separable
|
||||
- name: com.github.zalando-incubator.kube-metrics-adapter.pkg.apis.zalando.org.v1.ScalingSchedule
|
||||
scalar: untyped
|
||||
list:
|
||||
elementType:
|
||||
namedType: __untyped_atomic_
|
||||
elementRelationship: atomic
|
||||
map:
|
||||
elementType:
|
||||
namedType: __untyped_deduced_
|
||||
elementRelationship: separable
|
||||
- name: __untyped_atomic_
|
||||
scalar: untyped
|
||||
list:
|
||||
elementType:
|
||||
namedType: __untyped_atomic_
|
||||
elementRelationship: atomic
|
||||
map:
|
||||
elementType:
|
||||
namedType: __untyped_atomic_
|
||||
elementRelationship: atomic
|
||||
- name: __untyped_deduced_
|
||||
scalar: untyped
|
||||
list:
|
||||
elementType:
|
||||
namedType: __untyped_atomic_
|
||||
elementRelationship: atomic
|
||||
map:
|
||||
elementType:
|
||||
namedType: __untyped_deduced_
|
||||
elementRelationship: separable
|
||||
`)
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package applyconfiguration
|
||||
|
||||
import (
|
||||
v1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/apis/zalando.org/v1"
|
||||
internal "github.com/zalando-incubator/kube-metrics-adapter/pkg/client/applyconfiguration/internal"
|
||||
zalandoorgv1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/client/applyconfiguration/zalando.org/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
managedfields "k8s.io/apimachinery/pkg/util/managedfields"
|
||||
)
|
||||
|
||||
// ForKind returns an apply configuration type for the given GroupVersionKind, or nil if no
|
||||
// apply configuration type exists for the given GroupVersionKind.
|
||||
func ForKind(kind schema.GroupVersionKind) interface{} {
|
||||
switch kind {
|
||||
// Group=zalando.org, Version=v1
|
||||
case v1.SchemeGroupVersion.WithKind("ClusterScalingSchedule"):
|
||||
return &zalandoorgv1.ClusterScalingScheduleApplyConfiguration{}
|
||||
case v1.SchemeGroupVersion.WithKind("ScalingSchedule"):
|
||||
return &zalandoorgv1.ScalingScheduleApplyConfiguration{}
|
||||
case v1.SchemeGroupVersion.WithKind("ScalingScheduleSpec"):
|
||||
return &zalandoorgv1.ScalingScheduleSpecApplyConfiguration{}
|
||||
case v1.SchemeGroupVersion.WithKind("ScalingScheduleStatus"):
|
||||
return &zalandoorgv1.ScalingScheduleStatusApplyConfiguration{}
|
||||
case v1.SchemeGroupVersion.WithKind("Schedule"):
|
||||
return &zalandoorgv1.ScheduleApplyConfiguration{}
|
||||
case v1.SchemeGroupVersion.WithKind("SchedulePeriod"):
|
||||
return &zalandoorgv1.SchedulePeriodApplyConfiguration{}
|
||||
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewTypeConverter(scheme *runtime.Scheme) managedfields.TypeConverter {
|
||||
return managedfields.NewSchemeTypeConverter(scheme, internal.Parser())
|
||||
}
|
||||
@@ -0,0 +1,288 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
zalandoorgv1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/apis/zalando.org/v1"
|
||||
internal "github.com/zalando-incubator/kube-metrics-adapter/pkg/client/applyconfiguration/internal"
|
||||
apismetav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
managedfields "k8s.io/apimachinery/pkg/util/managedfields"
|
||||
metav1 "k8s.io/client-go/applyconfigurations/meta/v1"
|
||||
)
|
||||
|
||||
// ClusterScalingScheduleApplyConfiguration represents a declarative configuration of the ClusterScalingSchedule type for use
|
||||
// with apply.
|
||||
//
|
||||
// ClusterScalingSchedule describes a cluster scoped time based metric
|
||||
// to be used in autoscaling operations.
|
||||
type ClusterScalingScheduleApplyConfiguration struct {
|
||||
metav1.TypeMetaApplyConfiguration `json:",inline"`
|
||||
*metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
|
||||
Spec *ScalingScheduleSpecApplyConfiguration `json:"spec,omitempty"`
|
||||
Status *ScalingScheduleStatusApplyConfiguration `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// ClusterScalingSchedule constructs a declarative configuration of the ClusterScalingSchedule type for use with
|
||||
// apply.
|
||||
func ClusterScalingSchedule(name string) *ClusterScalingScheduleApplyConfiguration {
|
||||
b := &ClusterScalingScheduleApplyConfiguration{}
|
||||
b.WithName(name)
|
||||
b.WithKind("ClusterScalingSchedule")
|
||||
b.WithAPIVersion("zalando.org/v1")
|
||||
return b
|
||||
}
|
||||
|
||||
// ExtractClusterScalingScheduleFrom extracts the applied configuration owned by fieldManager from
|
||||
// clusterScalingSchedule for the specified subresource. Pass an empty string for subresource to extract
|
||||
// the main resource. Common subresources include "status", "scale", etc.
|
||||
// clusterScalingSchedule must be a unmodified ClusterScalingSchedule API object that was retrieved from the Kubernetes API.
|
||||
// ExtractClusterScalingScheduleFrom provides a way to perform a extract/modify-in-place/apply workflow.
|
||||
// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously
|
||||
// applied if another fieldManager has updated or force applied any of the previously applied fields.
|
||||
func ExtractClusterScalingScheduleFrom(clusterScalingSchedule *zalandoorgv1.ClusterScalingSchedule, fieldManager string, subresource string) (*ClusterScalingScheduleApplyConfiguration, error) {
|
||||
b := &ClusterScalingScheduleApplyConfiguration{}
|
||||
err := managedfields.ExtractInto(clusterScalingSchedule, internal.Parser().Type("com.github.zalando-incubator.kube-metrics-adapter.pkg.apis.zalando.org.v1.ClusterScalingSchedule"), fieldManager, b, subresource)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
b.WithName(clusterScalingSchedule.Name)
|
||||
|
||||
b.WithKind("ClusterScalingSchedule")
|
||||
b.WithAPIVersion("zalando.org/v1")
|
||||
return b, nil
|
||||
}
|
||||
|
||||
// ExtractClusterScalingSchedule extracts the applied configuration owned by fieldManager from
|
||||
// clusterScalingSchedule. If no managedFields are found in clusterScalingSchedule for fieldManager, a
|
||||
// ClusterScalingScheduleApplyConfiguration is returned with only the Name, Namespace (if applicable),
|
||||
// APIVersion and Kind populated. It is possible that no managed fields were found for because other
|
||||
// field managers have taken ownership of all the fields previously owned by fieldManager, or because
|
||||
// the fieldManager never owned fields any fields.
|
||||
// clusterScalingSchedule must be a unmodified ClusterScalingSchedule API object that was retrieved from the Kubernetes API.
|
||||
// ExtractClusterScalingSchedule provides a way to perform a extract/modify-in-place/apply workflow.
|
||||
// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously
|
||||
// applied if another fieldManager has updated or force applied any of the previously applied fields.
|
||||
func ExtractClusterScalingSchedule(clusterScalingSchedule *zalandoorgv1.ClusterScalingSchedule, fieldManager string) (*ClusterScalingScheduleApplyConfiguration, error) {
|
||||
return ExtractClusterScalingScheduleFrom(clusterScalingSchedule, fieldManager, "")
|
||||
}
|
||||
|
||||
// ExtractClusterScalingScheduleStatus extracts the applied configuration owned by fieldManager from
|
||||
// clusterScalingSchedule for the status subresource.
|
||||
func ExtractClusterScalingScheduleStatus(clusterScalingSchedule *zalandoorgv1.ClusterScalingSchedule, fieldManager string) (*ClusterScalingScheduleApplyConfiguration, error) {
|
||||
return ExtractClusterScalingScheduleFrom(clusterScalingSchedule, fieldManager, "status")
|
||||
}
|
||||
|
||||
func (b ClusterScalingScheduleApplyConfiguration) IsApplyConfiguration() {}
|
||||
|
||||
// WithKind sets the Kind field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Kind field is set to the value of the last call.
|
||||
func (b *ClusterScalingScheduleApplyConfiguration) WithKind(value string) *ClusterScalingScheduleApplyConfiguration {
|
||||
b.TypeMetaApplyConfiguration.Kind = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the APIVersion field is set to the value of the last call.
|
||||
func (b *ClusterScalingScheduleApplyConfiguration) WithAPIVersion(value string) *ClusterScalingScheduleApplyConfiguration {
|
||||
b.TypeMetaApplyConfiguration.APIVersion = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithName sets the Name field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Name field is set to the value of the last call.
|
||||
func (b *ClusterScalingScheduleApplyConfiguration) WithName(value string) *ClusterScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.Name = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithGenerateName sets the GenerateName field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the GenerateName field is set to the value of the last call.
|
||||
func (b *ClusterScalingScheduleApplyConfiguration) WithGenerateName(value string) *ClusterScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.GenerateName = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithNamespace sets the Namespace field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Namespace field is set to the value of the last call.
|
||||
func (b *ClusterScalingScheduleApplyConfiguration) WithNamespace(value string) *ClusterScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.Namespace = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithUID sets the UID field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the UID field is set to the value of the last call.
|
||||
func (b *ClusterScalingScheduleApplyConfiguration) WithUID(value types.UID) *ClusterScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.UID = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the ResourceVersion field is set to the value of the last call.
|
||||
func (b *ClusterScalingScheduleApplyConfiguration) WithResourceVersion(value string) *ClusterScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.ResourceVersion = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithGeneration sets the Generation field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Generation field is set to the value of the last call.
|
||||
func (b *ClusterScalingScheduleApplyConfiguration) WithGeneration(value int64) *ClusterScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.Generation = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the CreationTimestamp field is set to the value of the last call.
|
||||
func (b *ClusterScalingScheduleApplyConfiguration) WithCreationTimestamp(value apismetav1.Time) *ClusterScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.CreationTimestamp = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the DeletionTimestamp field is set to the value of the last call.
|
||||
func (b *ClusterScalingScheduleApplyConfiguration) WithDeletionTimestamp(value apismetav1.Time) *ClusterScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call.
|
||||
func (b *ClusterScalingScheduleApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ClusterScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithLabels puts the entries into the Labels field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, the entries provided by each call will be put on the Labels field,
|
||||
// overwriting an existing map entries in Labels field with the same key.
|
||||
func (b *ClusterScalingScheduleApplyConfiguration) WithLabels(entries map[string]string) *ClusterScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 {
|
||||
b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries))
|
||||
}
|
||||
for k, v := range entries {
|
||||
b.ObjectMetaApplyConfiguration.Labels[k] = v
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// WithAnnotations puts the entries into the Annotations field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, the entries provided by each call will be put on the Annotations field,
|
||||
// overwriting an existing map entries in Annotations field with the same key.
|
||||
func (b *ClusterScalingScheduleApplyConfiguration) WithAnnotations(entries map[string]string) *ClusterScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 {
|
||||
b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries))
|
||||
}
|
||||
for k, v := range entries {
|
||||
b.ObjectMetaApplyConfiguration.Annotations[k] = v
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, values provided by each call will be appended to the OwnerReferences field.
|
||||
func (b *ClusterScalingScheduleApplyConfiguration) WithOwnerReferences(values ...*metav1.OwnerReferenceApplyConfiguration) *ClusterScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
for i := range values {
|
||||
if values[i] == nil {
|
||||
panic("nil value passed to WithOwnerReferences")
|
||||
}
|
||||
b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i])
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// WithFinalizers adds the given value to the Finalizers field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, values provided by each call will be appended to the Finalizers field.
|
||||
func (b *ClusterScalingScheduleApplyConfiguration) WithFinalizers(values ...string) *ClusterScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
for i := range values {
|
||||
b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i])
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func (b *ClusterScalingScheduleApplyConfiguration) ensureObjectMetaApplyConfigurationExists() {
|
||||
if b.ObjectMetaApplyConfiguration == nil {
|
||||
b.ObjectMetaApplyConfiguration = &metav1.ObjectMetaApplyConfiguration{}
|
||||
}
|
||||
}
|
||||
|
||||
// WithSpec sets the Spec field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Spec field is set to the value of the last call.
|
||||
func (b *ClusterScalingScheduleApplyConfiguration) WithSpec(value *ScalingScheduleSpecApplyConfiguration) *ClusterScalingScheduleApplyConfiguration {
|
||||
b.Spec = value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithStatus sets the Status field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Status field is set to the value of the last call.
|
||||
func (b *ClusterScalingScheduleApplyConfiguration) WithStatus(value *ScalingScheduleStatusApplyConfiguration) *ClusterScalingScheduleApplyConfiguration {
|
||||
b.Status = value
|
||||
return b
|
||||
}
|
||||
|
||||
// GetKind retrieves the value of the Kind field in the declarative configuration.
|
||||
func (b *ClusterScalingScheduleApplyConfiguration) GetKind() *string {
|
||||
return b.TypeMetaApplyConfiguration.Kind
|
||||
}
|
||||
|
||||
// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration.
|
||||
func (b *ClusterScalingScheduleApplyConfiguration) GetAPIVersion() *string {
|
||||
return b.TypeMetaApplyConfiguration.APIVersion
|
||||
}
|
||||
|
||||
// GetName retrieves the value of the Name field in the declarative configuration.
|
||||
func (b *ClusterScalingScheduleApplyConfiguration) GetName() *string {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
return b.ObjectMetaApplyConfiguration.Name
|
||||
}
|
||||
|
||||
// GetNamespace retrieves the value of the Namespace field in the declarative configuration.
|
||||
func (b *ClusterScalingScheduleApplyConfiguration) GetNamespace() *string {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
return b.ObjectMetaApplyConfiguration.Namespace
|
||||
}
|
||||
@@ -0,0 +1,290 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
zalandoorgv1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/apis/zalando.org/v1"
|
||||
internal "github.com/zalando-incubator/kube-metrics-adapter/pkg/client/applyconfiguration/internal"
|
||||
apismetav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
managedfields "k8s.io/apimachinery/pkg/util/managedfields"
|
||||
metav1 "k8s.io/client-go/applyconfigurations/meta/v1"
|
||||
)
|
||||
|
||||
// ScalingScheduleApplyConfiguration represents a declarative configuration of the ScalingSchedule type for use
|
||||
// with apply.
|
||||
//
|
||||
// ScalingSchedule describes a namespaced time based metric to be used
|
||||
// in autoscaling operations.
|
||||
type ScalingScheduleApplyConfiguration struct {
|
||||
metav1.TypeMetaApplyConfiguration `json:",inline"`
|
||||
*metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
|
||||
Spec *ScalingScheduleSpecApplyConfiguration `json:"spec,omitempty"`
|
||||
Status *ScalingScheduleStatusApplyConfiguration `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// ScalingSchedule constructs a declarative configuration of the ScalingSchedule type for use with
|
||||
// apply.
|
||||
func ScalingSchedule(name, namespace string) *ScalingScheduleApplyConfiguration {
|
||||
b := &ScalingScheduleApplyConfiguration{}
|
||||
b.WithName(name)
|
||||
b.WithNamespace(namespace)
|
||||
b.WithKind("ScalingSchedule")
|
||||
b.WithAPIVersion("zalando.org/v1")
|
||||
return b
|
||||
}
|
||||
|
||||
// ExtractScalingScheduleFrom extracts the applied configuration owned by fieldManager from
|
||||
// scalingSchedule for the specified subresource. Pass an empty string for subresource to extract
|
||||
// the main resource. Common subresources include "status", "scale", etc.
|
||||
// scalingSchedule must be a unmodified ScalingSchedule API object that was retrieved from the Kubernetes API.
|
||||
// ExtractScalingScheduleFrom provides a way to perform a extract/modify-in-place/apply workflow.
|
||||
// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously
|
||||
// applied if another fieldManager has updated or force applied any of the previously applied fields.
|
||||
func ExtractScalingScheduleFrom(scalingSchedule *zalandoorgv1.ScalingSchedule, fieldManager string, subresource string) (*ScalingScheduleApplyConfiguration, error) {
|
||||
b := &ScalingScheduleApplyConfiguration{}
|
||||
err := managedfields.ExtractInto(scalingSchedule, internal.Parser().Type("com.github.zalando-incubator.kube-metrics-adapter.pkg.apis.zalando.org.v1.ScalingSchedule"), fieldManager, b, subresource)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
b.WithName(scalingSchedule.Name)
|
||||
b.WithNamespace(scalingSchedule.Namespace)
|
||||
|
||||
b.WithKind("ScalingSchedule")
|
||||
b.WithAPIVersion("zalando.org/v1")
|
||||
return b, nil
|
||||
}
|
||||
|
||||
// ExtractScalingSchedule extracts the applied configuration owned by fieldManager from
|
||||
// scalingSchedule. If no managedFields are found in scalingSchedule for fieldManager, a
|
||||
// ScalingScheduleApplyConfiguration is returned with only the Name, Namespace (if applicable),
|
||||
// APIVersion and Kind populated. It is possible that no managed fields were found for because other
|
||||
// field managers have taken ownership of all the fields previously owned by fieldManager, or because
|
||||
// the fieldManager never owned fields any fields.
|
||||
// scalingSchedule must be a unmodified ScalingSchedule API object that was retrieved from the Kubernetes API.
|
||||
// ExtractScalingSchedule provides a way to perform a extract/modify-in-place/apply workflow.
|
||||
// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously
|
||||
// applied if another fieldManager has updated or force applied any of the previously applied fields.
|
||||
func ExtractScalingSchedule(scalingSchedule *zalandoorgv1.ScalingSchedule, fieldManager string) (*ScalingScheduleApplyConfiguration, error) {
|
||||
return ExtractScalingScheduleFrom(scalingSchedule, fieldManager, "")
|
||||
}
|
||||
|
||||
// ExtractScalingScheduleStatus extracts the applied configuration owned by fieldManager from
|
||||
// scalingSchedule for the status subresource.
|
||||
func ExtractScalingScheduleStatus(scalingSchedule *zalandoorgv1.ScalingSchedule, fieldManager string) (*ScalingScheduleApplyConfiguration, error) {
|
||||
return ExtractScalingScheduleFrom(scalingSchedule, fieldManager, "status")
|
||||
}
|
||||
|
||||
func (b ScalingScheduleApplyConfiguration) IsApplyConfiguration() {}
|
||||
|
||||
// WithKind sets the Kind field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Kind field is set to the value of the last call.
|
||||
func (b *ScalingScheduleApplyConfiguration) WithKind(value string) *ScalingScheduleApplyConfiguration {
|
||||
b.TypeMetaApplyConfiguration.Kind = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the APIVersion field is set to the value of the last call.
|
||||
func (b *ScalingScheduleApplyConfiguration) WithAPIVersion(value string) *ScalingScheduleApplyConfiguration {
|
||||
b.TypeMetaApplyConfiguration.APIVersion = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithName sets the Name field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Name field is set to the value of the last call.
|
||||
func (b *ScalingScheduleApplyConfiguration) WithName(value string) *ScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.Name = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithGenerateName sets the GenerateName field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the GenerateName field is set to the value of the last call.
|
||||
func (b *ScalingScheduleApplyConfiguration) WithGenerateName(value string) *ScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.GenerateName = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithNamespace sets the Namespace field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Namespace field is set to the value of the last call.
|
||||
func (b *ScalingScheduleApplyConfiguration) WithNamespace(value string) *ScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.Namespace = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithUID sets the UID field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the UID field is set to the value of the last call.
|
||||
func (b *ScalingScheduleApplyConfiguration) WithUID(value types.UID) *ScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.UID = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the ResourceVersion field is set to the value of the last call.
|
||||
func (b *ScalingScheduleApplyConfiguration) WithResourceVersion(value string) *ScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.ResourceVersion = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithGeneration sets the Generation field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Generation field is set to the value of the last call.
|
||||
func (b *ScalingScheduleApplyConfiguration) WithGeneration(value int64) *ScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.Generation = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the CreationTimestamp field is set to the value of the last call.
|
||||
func (b *ScalingScheduleApplyConfiguration) WithCreationTimestamp(value apismetav1.Time) *ScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.CreationTimestamp = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the DeletionTimestamp field is set to the value of the last call.
|
||||
func (b *ScalingScheduleApplyConfiguration) WithDeletionTimestamp(value apismetav1.Time) *ScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call.
|
||||
func (b *ScalingScheduleApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithLabels puts the entries into the Labels field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, the entries provided by each call will be put on the Labels field,
|
||||
// overwriting an existing map entries in Labels field with the same key.
|
||||
func (b *ScalingScheduleApplyConfiguration) WithLabels(entries map[string]string) *ScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 {
|
||||
b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries))
|
||||
}
|
||||
for k, v := range entries {
|
||||
b.ObjectMetaApplyConfiguration.Labels[k] = v
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// WithAnnotations puts the entries into the Annotations field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, the entries provided by each call will be put on the Annotations field,
|
||||
// overwriting an existing map entries in Annotations field with the same key.
|
||||
func (b *ScalingScheduleApplyConfiguration) WithAnnotations(entries map[string]string) *ScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 {
|
||||
b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries))
|
||||
}
|
||||
for k, v := range entries {
|
||||
b.ObjectMetaApplyConfiguration.Annotations[k] = v
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, values provided by each call will be appended to the OwnerReferences field.
|
||||
func (b *ScalingScheduleApplyConfiguration) WithOwnerReferences(values ...*metav1.OwnerReferenceApplyConfiguration) *ScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
for i := range values {
|
||||
if values[i] == nil {
|
||||
panic("nil value passed to WithOwnerReferences")
|
||||
}
|
||||
b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i])
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// WithFinalizers adds the given value to the Finalizers field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, values provided by each call will be appended to the Finalizers field.
|
||||
func (b *ScalingScheduleApplyConfiguration) WithFinalizers(values ...string) *ScalingScheduleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
for i := range values {
|
||||
b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i])
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func (b *ScalingScheduleApplyConfiguration) ensureObjectMetaApplyConfigurationExists() {
|
||||
if b.ObjectMetaApplyConfiguration == nil {
|
||||
b.ObjectMetaApplyConfiguration = &metav1.ObjectMetaApplyConfiguration{}
|
||||
}
|
||||
}
|
||||
|
||||
// WithSpec sets the Spec field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Spec field is set to the value of the last call.
|
||||
func (b *ScalingScheduleApplyConfiguration) WithSpec(value *ScalingScheduleSpecApplyConfiguration) *ScalingScheduleApplyConfiguration {
|
||||
b.Spec = value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithStatus sets the Status field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Status field is set to the value of the last call.
|
||||
func (b *ScalingScheduleApplyConfiguration) WithStatus(value *ScalingScheduleStatusApplyConfiguration) *ScalingScheduleApplyConfiguration {
|
||||
b.Status = value
|
||||
return b
|
||||
}
|
||||
|
||||
// GetKind retrieves the value of the Kind field in the declarative configuration.
|
||||
func (b *ScalingScheduleApplyConfiguration) GetKind() *string {
|
||||
return b.TypeMetaApplyConfiguration.Kind
|
||||
}
|
||||
|
||||
// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration.
|
||||
func (b *ScalingScheduleApplyConfiguration) GetAPIVersion() *string {
|
||||
return b.TypeMetaApplyConfiguration.APIVersion
|
||||
}
|
||||
|
||||
// GetName retrieves the value of the Name field in the declarative configuration.
|
||||
func (b *ScalingScheduleApplyConfiguration) GetName() *string {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
return b.ObjectMetaApplyConfiguration.Name
|
||||
}
|
||||
|
||||
// GetNamespace retrieves the value of the Namespace field in the declarative configuration.
|
||||
func (b *ScalingScheduleApplyConfiguration) GetNamespace() *string {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
return b.ObjectMetaApplyConfiguration.Namespace
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
// ScalingScheduleSpecApplyConfiguration represents a declarative configuration of the ScalingScheduleSpec type for use
|
||||
// with apply.
|
||||
//
|
||||
// ScalingScheduleSpec is the spec part of the ScalingSchedule.
|
||||
type ScalingScheduleSpecApplyConfiguration struct {
|
||||
// Fade the scheduled values in and out over this many minutes. If unset, the default per-cluster value will be used.
|
||||
ScalingWindowDurationMinutes *int64 `json:"scalingWindowDurationMinutes,omitempty"`
|
||||
// Schedules is the list of schedules for this ScalingSchedule
|
||||
// resource. All the schedules defined here will result on the value
|
||||
// to the same metric. New metrics require a new ScalingSchedule
|
||||
// resource.
|
||||
Schedules []ScheduleApplyConfiguration `json:"schedules,omitempty"`
|
||||
}
|
||||
|
||||
// ScalingScheduleSpecApplyConfiguration constructs a declarative configuration of the ScalingScheduleSpec type for use with
|
||||
// apply.
|
||||
func ScalingScheduleSpec() *ScalingScheduleSpecApplyConfiguration {
|
||||
return &ScalingScheduleSpecApplyConfiguration{}
|
||||
}
|
||||
|
||||
// WithScalingWindowDurationMinutes sets the ScalingWindowDurationMinutes field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the ScalingWindowDurationMinutes field is set to the value of the last call.
|
||||
func (b *ScalingScheduleSpecApplyConfiguration) WithScalingWindowDurationMinutes(value int64) *ScalingScheduleSpecApplyConfiguration {
|
||||
b.ScalingWindowDurationMinutes = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithSchedules adds the given value to the Schedules field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, values provided by each call will be appended to the Schedules field.
|
||||
func (b *ScalingScheduleSpecApplyConfiguration) WithSchedules(values ...*ScheduleApplyConfiguration) *ScalingScheduleSpecApplyConfiguration {
|
||||
for i := range values {
|
||||
if values[i] == nil {
|
||||
panic("nil value passed to WithSchedules")
|
||||
}
|
||||
b.Schedules = append(b.Schedules, *values[i])
|
||||
}
|
||||
return b
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
// ScalingScheduleStatusApplyConfiguration represents a declarative configuration of the ScalingScheduleStatus type for use
|
||||
// with apply.
|
||||
//
|
||||
// ScalingScheduleStatus is the status section of the ScalingSchedule.
|
||||
type ScalingScheduleStatusApplyConfiguration struct {
|
||||
// Active is true if at least one of the schedules defined in the
|
||||
// scaling schedule is currently active.
|
||||
Active *bool `json:"active,omitempty"`
|
||||
}
|
||||
|
||||
// ScalingScheduleStatusApplyConfiguration constructs a declarative configuration of the ScalingScheduleStatus type for use with
|
||||
// apply.
|
||||
func ScalingScheduleStatus() *ScalingScheduleStatusApplyConfiguration {
|
||||
return &ScalingScheduleStatusApplyConfiguration{}
|
||||
}
|
||||
|
||||
// WithActive sets the Active field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Active field is set to the value of the last call.
|
||||
func (b *ScalingScheduleStatusApplyConfiguration) WithActive(value bool) *ScalingScheduleStatusApplyConfiguration {
|
||||
b.Active = &value
|
||||
return b
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
zalandoorgv1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/apis/zalando.org/v1"
|
||||
)
|
||||
|
||||
// ScheduleApplyConfiguration represents a declarative configuration of the Schedule type for use
|
||||
// with apply.
|
||||
//
|
||||
// Schedule is the schedule details to be used inside a ScalingSchedule.
|
||||
type ScheduleApplyConfiguration struct {
|
||||
Type *zalandoorgv1.ScheduleType `json:"type,omitempty"`
|
||||
// Defines the details of a Repeating schedule.
|
||||
Period *SchedulePeriodApplyConfiguration `json:"period,omitempty"`
|
||||
// Defines the starting date of a OneTime schedule. It has to
|
||||
// be a RFC3339 formatted date.
|
||||
Date *zalandoorgv1.ScheduleDate `json:"date,omitempty"`
|
||||
// Defines the ending date of a OneTime schedule. It must be
|
||||
// a RFC3339 formatted date.
|
||||
EndDate *zalandoorgv1.ScheduleDate `json:"endDate,omitempty"`
|
||||
// The duration in minutes (default 0) that the configured value will be
|
||||
// returned for the defined schedule.
|
||||
DurationMinutes *int `json:"durationMinutes,omitempty"`
|
||||
// The metric value that will be returned for the defined schedule.
|
||||
Value *int64 `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
// ScheduleApplyConfiguration constructs a declarative configuration of the Schedule type for use with
|
||||
// apply.
|
||||
func Schedule() *ScheduleApplyConfiguration {
|
||||
return &ScheduleApplyConfiguration{}
|
||||
}
|
||||
|
||||
// WithType sets the Type field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Type field is set to the value of the last call.
|
||||
func (b *ScheduleApplyConfiguration) WithType(value zalandoorgv1.ScheduleType) *ScheduleApplyConfiguration {
|
||||
b.Type = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithPeriod sets the Period field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Period field is set to the value of the last call.
|
||||
func (b *ScheduleApplyConfiguration) WithPeriod(value *SchedulePeriodApplyConfiguration) *ScheduleApplyConfiguration {
|
||||
b.Period = value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithDate sets the Date field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Date field is set to the value of the last call.
|
||||
func (b *ScheduleApplyConfiguration) WithDate(value zalandoorgv1.ScheduleDate) *ScheduleApplyConfiguration {
|
||||
b.Date = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithEndDate sets the EndDate field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the EndDate field is set to the value of the last call.
|
||||
func (b *ScheduleApplyConfiguration) WithEndDate(value zalandoorgv1.ScheduleDate) *ScheduleApplyConfiguration {
|
||||
b.EndDate = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithDurationMinutes sets the DurationMinutes field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the DurationMinutes field is set to the value of the last call.
|
||||
func (b *ScheduleApplyConfiguration) WithDurationMinutes(value int) *ScheduleApplyConfiguration {
|
||||
b.DurationMinutes = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithValue sets the Value field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Value field is set to the value of the last call.
|
||||
func (b *ScheduleApplyConfiguration) WithValue(value int64) *ScheduleApplyConfiguration {
|
||||
b.Value = &value
|
||||
return b
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
zalandoorgv1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/apis/zalando.org/v1"
|
||||
)
|
||||
|
||||
// SchedulePeriodApplyConfiguration represents a declarative configuration of the SchedulePeriod type for use
|
||||
// with apply.
|
||||
//
|
||||
// SchedulePeriod is the details to be used for a Schedule of the
|
||||
// Repeating type.
|
||||
type SchedulePeriodApplyConfiguration struct {
|
||||
// The startTime has the format HH:MM
|
||||
StartTime *string `json:"startTime,omitempty"`
|
||||
// The endTime has the format HH:MM
|
||||
EndTime *string `json:"endTime,omitempty"`
|
||||
// The days that this schedule will be active.
|
||||
Days []zalandoorgv1.ScheduleDay `json:"days,omitempty"`
|
||||
// The location name corresponding to a file in the IANA
|
||||
// Time Zone database, like Europe/Berlin.
|
||||
Timezone *string `json:"timezone,omitempty"`
|
||||
}
|
||||
|
||||
// SchedulePeriodApplyConfiguration constructs a declarative configuration of the SchedulePeriod type for use with
|
||||
// apply.
|
||||
func SchedulePeriod() *SchedulePeriodApplyConfiguration {
|
||||
return &SchedulePeriodApplyConfiguration{}
|
||||
}
|
||||
|
||||
// WithStartTime sets the StartTime field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the StartTime field is set to the value of the last call.
|
||||
func (b *SchedulePeriodApplyConfiguration) WithStartTime(value string) *SchedulePeriodApplyConfiguration {
|
||||
b.StartTime = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithEndTime sets the EndTime field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the EndTime field is set to the value of the last call.
|
||||
func (b *SchedulePeriodApplyConfiguration) WithEndTime(value string) *SchedulePeriodApplyConfiguration {
|
||||
b.EndTime = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithDays adds the given value to the Days field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, values provided by each call will be appended to the Days field.
|
||||
func (b *SchedulePeriodApplyConfiguration) WithDays(values ...zalandoorgv1.ScheduleDay) *SchedulePeriodApplyConfiguration {
|
||||
for i := range values {
|
||||
b.Days = append(b.Days, values[i])
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// WithTimezone sets the Timezone field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Timezone field is set to the value of the last call.
|
||||
func (b *SchedulePeriodApplyConfiguration) WithTimezone(value string) *SchedulePeriodApplyConfiguration {
|
||||
b.Timezone = &value
|
||||
return b
|
||||
}
|
||||
@@ -19,6 +19,7 @@ limitations under the License.
|
||||
package fake
|
||||
|
||||
import (
|
||||
applyconfiguration "github.com/zalando-incubator/kube-metrics-adapter/pkg/client/applyconfiguration"
|
||||
clientset "github.com/zalando-incubator/kube-metrics-adapter/pkg/client/clientset/versioned"
|
||||
zalandov1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/client/clientset/versioned/typed/zalando.org/v1"
|
||||
fakezalandov1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/client/clientset/versioned/typed/zalando.org/v1/fake"
|
||||
@@ -35,7 +36,7 @@ import (
|
||||
// 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.
|
||||
//
|
||||
// DEPRECATED: NewClientset replaces this with support for field management, which significantly improves
|
||||
// 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 {
|
||||
@@ -51,8 +52,8 @@ func NewSimpleClientset(objects ...runtime.Object) *Clientset {
|
||||
cs.AddReactor("*", "*", testing.ObjectReaction(o))
|
||||
cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) {
|
||||
var opts metav1.ListOptions
|
||||
if watchActcion, ok := action.(testing.WatchActionImpl); ok {
|
||||
opts = watchActcion.ListOptions
|
||||
if watchAction, ok := action.(testing.WatchActionImpl); ok {
|
||||
opts = watchAction.ListOptions
|
||||
}
|
||||
gvr := action.GetResource()
|
||||
ns := action.GetNamespace()
|
||||
@@ -83,6 +84,53 @@ func (c *Clientset) Tracker() testing.ObjectTracker {
|
||||
return c.tracker
|
||||
}
|
||||
|
||||
// IsWatchListSemanticsSupported informs the reflector that this client
|
||||
// doesn't support WatchList semantics.
|
||||
//
|
||||
// This is a synthetic method whose sole purpose is to satisfy the optional
|
||||
// interface check performed by the reflector.
|
||||
// Returning true signals that WatchList can NOT be used.
|
||||
// No additional logic is implemented here.
|
||||
func (c *Clientset) IsWatchListSemanticsUnSupported() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// NewClientset 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,
|
||||
// without applying any validations and/or defaults. It shouldn't be considered a replacement
|
||||
// for a real clientset and is mostly useful in simple unit tests.
|
||||
func NewClientset(objects ...runtime.Object) *Clientset {
|
||||
o := testing.NewFieldManagedObjectTracker(
|
||||
scheme,
|
||||
codecs.UniversalDecoder(),
|
||||
applyconfiguration.NewTypeConverter(scheme),
|
||||
)
|
||||
for _, obj := range objects {
|
||||
if err := o.Add(obj); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
cs := &Clientset{tracker: o}
|
||||
cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake}
|
||||
cs.AddReactor("*", "*", testing.ObjectReaction(o))
|
||||
cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) {
|
||||
var opts metav1.ListOptions
|
||||
if watchAction, ok := action.(testing.WatchActionImpl); ok {
|
||||
opts = watchAction.ListOptions
|
||||
}
|
||||
gvr := action.GetResource()
|
||||
ns := action.GetNamespace()
|
||||
watch, err := o.Watch(gvr, ns, opts)
|
||||
if err != nil {
|
||||
return false, nil, err
|
||||
}
|
||||
return true, watch, nil
|
||||
})
|
||||
|
||||
return cs
|
||||
}
|
||||
|
||||
var (
|
||||
_ clientset.Interface = &Clientset{}
|
||||
_ testing.FakeClient = &Clientset{}
|
||||
|
||||
@@ -22,6 +22,7 @@ import (
|
||||
context "context"
|
||||
|
||||
zalandoorgv1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/apis/zalando.org/v1"
|
||||
applyconfigurationzalandoorgv1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/client/applyconfiguration/zalando.org/v1"
|
||||
scheme "github.com/zalando-incubator/kube-metrics-adapter/pkg/client/clientset/versioned/scheme"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
@@ -47,18 +48,21 @@ type ClusterScalingScheduleInterface interface {
|
||||
List(ctx context.Context, opts metav1.ListOptions) (*zalandoorgv1.ClusterScalingScheduleList, error)
|
||||
Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)
|
||||
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *zalandoorgv1.ClusterScalingSchedule, err error)
|
||||
Apply(ctx context.Context, clusterScalingSchedule *applyconfigurationzalandoorgv1.ClusterScalingScheduleApplyConfiguration, opts metav1.ApplyOptions) (result *zalandoorgv1.ClusterScalingSchedule, err error)
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
|
||||
ApplyStatus(ctx context.Context, clusterScalingSchedule *applyconfigurationzalandoorgv1.ClusterScalingScheduleApplyConfiguration, opts metav1.ApplyOptions) (result *zalandoorgv1.ClusterScalingSchedule, err error)
|
||||
ClusterScalingScheduleExpansion
|
||||
}
|
||||
|
||||
// clusterScalingSchedules implements ClusterScalingScheduleInterface
|
||||
type clusterScalingSchedules struct {
|
||||
*gentype.ClientWithList[*zalandoorgv1.ClusterScalingSchedule, *zalandoorgv1.ClusterScalingScheduleList]
|
||||
*gentype.ClientWithListAndApply[*zalandoorgv1.ClusterScalingSchedule, *zalandoorgv1.ClusterScalingScheduleList, *applyconfigurationzalandoorgv1.ClusterScalingScheduleApplyConfiguration]
|
||||
}
|
||||
|
||||
// newClusterScalingSchedules returns a ClusterScalingSchedules
|
||||
func newClusterScalingSchedules(c *ZalandoV1Client) *clusterScalingSchedules {
|
||||
return &clusterScalingSchedules{
|
||||
gentype.NewClientWithList[*zalandoorgv1.ClusterScalingSchedule, *zalandoorgv1.ClusterScalingScheduleList](
|
||||
gentype.NewClientWithListAndApply[*zalandoorgv1.ClusterScalingSchedule, *zalandoorgv1.ClusterScalingScheduleList, *applyconfigurationzalandoorgv1.ClusterScalingScheduleApplyConfiguration](
|
||||
"clusterscalingschedules",
|
||||
c.RESTClient(),
|
||||
scheme.ParameterCodec,
|
||||
|
||||
+5
-4
@@ -20,19 +20,20 @@ package fake
|
||||
|
||||
import (
|
||||
v1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/apis/zalando.org/v1"
|
||||
zalandoorgv1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/client/clientset/versioned/typed/zalando.org/v1"
|
||||
zalandoorgv1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/client/applyconfiguration/zalando.org/v1"
|
||||
typedzalandoorgv1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/client/clientset/versioned/typed/zalando.org/v1"
|
||||
gentype "k8s.io/client-go/gentype"
|
||||
)
|
||||
|
||||
// fakeClusterScalingSchedules implements ClusterScalingScheduleInterface
|
||||
type fakeClusterScalingSchedules struct {
|
||||
*gentype.FakeClientWithList[*v1.ClusterScalingSchedule, *v1.ClusterScalingScheduleList]
|
||||
*gentype.FakeClientWithListAndApply[*v1.ClusterScalingSchedule, *v1.ClusterScalingScheduleList, *zalandoorgv1.ClusterScalingScheduleApplyConfiguration]
|
||||
Fake *FakeZalandoV1
|
||||
}
|
||||
|
||||
func newFakeClusterScalingSchedules(fake *FakeZalandoV1) zalandoorgv1.ClusterScalingScheduleInterface {
|
||||
func newFakeClusterScalingSchedules(fake *FakeZalandoV1) typedzalandoorgv1.ClusterScalingScheduleInterface {
|
||||
return &fakeClusterScalingSchedules{
|
||||
gentype.NewFakeClientWithList[*v1.ClusterScalingSchedule, *v1.ClusterScalingScheduleList](
|
||||
gentype.NewFakeClientWithListAndApply[*v1.ClusterScalingSchedule, *v1.ClusterScalingScheduleList, *zalandoorgv1.ClusterScalingScheduleApplyConfiguration](
|
||||
fake.Fake,
|
||||
"",
|
||||
v1.SchemeGroupVersion.WithResource("clusterscalingschedules"),
|
||||
|
||||
@@ -20,19 +20,20 @@ package fake
|
||||
|
||||
import (
|
||||
v1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/apis/zalando.org/v1"
|
||||
zalandoorgv1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/client/clientset/versioned/typed/zalando.org/v1"
|
||||
zalandoorgv1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/client/applyconfiguration/zalando.org/v1"
|
||||
typedzalandoorgv1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/client/clientset/versioned/typed/zalando.org/v1"
|
||||
gentype "k8s.io/client-go/gentype"
|
||||
)
|
||||
|
||||
// fakeScalingSchedules implements ScalingScheduleInterface
|
||||
type fakeScalingSchedules struct {
|
||||
*gentype.FakeClientWithList[*v1.ScalingSchedule, *v1.ScalingScheduleList]
|
||||
*gentype.FakeClientWithListAndApply[*v1.ScalingSchedule, *v1.ScalingScheduleList, *zalandoorgv1.ScalingScheduleApplyConfiguration]
|
||||
Fake *FakeZalandoV1
|
||||
}
|
||||
|
||||
func newFakeScalingSchedules(fake *FakeZalandoV1, namespace string) zalandoorgv1.ScalingScheduleInterface {
|
||||
func newFakeScalingSchedules(fake *FakeZalandoV1, namespace string) typedzalandoorgv1.ScalingScheduleInterface {
|
||||
return &fakeScalingSchedules{
|
||||
gentype.NewFakeClientWithList[*v1.ScalingSchedule, *v1.ScalingScheduleList](
|
||||
gentype.NewFakeClientWithListAndApply[*v1.ScalingSchedule, *v1.ScalingScheduleList, *zalandoorgv1.ScalingScheduleApplyConfiguration](
|
||||
fake.Fake,
|
||||
namespace,
|
||||
v1.SchemeGroupVersion.WithResource("scalingschedules"),
|
||||
|
||||
@@ -22,6 +22,7 @@ import (
|
||||
context "context"
|
||||
|
||||
zalandoorgv1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/apis/zalando.org/v1"
|
||||
applyconfigurationzalandoorgv1 "github.com/zalando-incubator/kube-metrics-adapter/pkg/client/applyconfiguration/zalando.org/v1"
|
||||
scheme "github.com/zalando-incubator/kube-metrics-adapter/pkg/client/clientset/versioned/scheme"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
@@ -47,18 +48,21 @@ type ScalingScheduleInterface interface {
|
||||
List(ctx context.Context, opts metav1.ListOptions) (*zalandoorgv1.ScalingScheduleList, error)
|
||||
Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)
|
||||
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *zalandoorgv1.ScalingSchedule, err error)
|
||||
Apply(ctx context.Context, scalingSchedule *applyconfigurationzalandoorgv1.ScalingScheduleApplyConfiguration, opts metav1.ApplyOptions) (result *zalandoorgv1.ScalingSchedule, err error)
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
|
||||
ApplyStatus(ctx context.Context, scalingSchedule *applyconfigurationzalandoorgv1.ScalingScheduleApplyConfiguration, opts metav1.ApplyOptions) (result *zalandoorgv1.ScalingSchedule, err error)
|
||||
ScalingScheduleExpansion
|
||||
}
|
||||
|
||||
// scalingSchedules implements ScalingScheduleInterface
|
||||
type scalingSchedules struct {
|
||||
*gentype.ClientWithList[*zalandoorgv1.ScalingSchedule, *zalandoorgv1.ScalingScheduleList]
|
||||
*gentype.ClientWithListAndApply[*zalandoorgv1.ScalingSchedule, *zalandoorgv1.ScalingScheduleList, *applyconfigurationzalandoorgv1.ScalingScheduleApplyConfiguration]
|
||||
}
|
||||
|
||||
// newScalingSchedules returns a ScalingSchedules
|
||||
func newScalingSchedules(c *ZalandoV1Client, namespace string) *scalingSchedules {
|
||||
return &scalingSchedules{
|
||||
gentype.NewClientWithList[*zalandoorgv1.ScalingSchedule, *zalandoorgv1.ScalingScheduleList](
|
||||
gentype.NewClientWithListAndApply[*zalandoorgv1.ScalingSchedule, *zalandoorgv1.ScalingScheduleList, *applyconfigurationzalandoorgv1.ScalingScheduleApplyConfiguration](
|
||||
"scalingschedules",
|
||||
c.RESTClient(),
|
||||
scheme.ParameterCodec,
|
||||
|
||||
@@ -97,6 +97,7 @@ func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Dur
|
||||
// NewFilteredSharedInformerFactory constructs a new instance of sharedInformerFactory.
|
||||
// Listers obtained via this SharedInformerFactory will be subject to the same filters
|
||||
// as specified here.
|
||||
//
|
||||
// Deprecated: Please use NewSharedInformerFactoryWithOptions instead
|
||||
func NewFilteredSharedInformerFactory(client versioned.Interface, defaultResync time.Duration, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerFactory {
|
||||
return NewSharedInformerFactoryWithOptions(client, defaultResync, WithNamespace(namespace), WithTweakListOptions(tweakListOptions))
|
||||
@@ -204,7 +205,7 @@ func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internal
|
||||
//
|
||||
// It is typically used like this:
|
||||
//
|
||||
// ctx, cancel := context.Background()
|
||||
// ctx, cancel := context.WithCancel(context.Background())
|
||||
// defer cancel()
|
||||
// factory := NewSharedInformerFactory(client, resyncPeriod)
|
||||
// defer factory.WaitForStop() // Returns immediately if nothing was started.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user