diff --git a/Gopkg.lock b/Gopkg.lock index 1bb91e4de5..a7bbf83bc9 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -33,6 +33,17 @@ pruneopts = "NT" revision = "3a771d992973f24aa725d07868b467d1ddfceafb" +[[projects]] + digest = "1:c76b0c1220b358995e3b5e340ff0ebae2ed9170e4ec56e1f2f896ed93da767f8" + name = "github.com/coreos/prometheus-operator" + packages = [ + "pkg/apis/monitoring", + "pkg/apis/monitoring/v1", + ] + pruneopts = "NT" + revision = "174c9bf17bec78b055e8e63c6ae3a3dc9bb0a3a8" + version = "v0.27.0" + [[projects]] digest = "1:4b8b5811da6970495e04d1f4e98bb89518cc3cfc3b3f456bdb876ed7b6c74049" name = "github.com/davecgh/go-spew" @@ -109,12 +120,12 @@ version = "v0.18.0" [[projects]] + branch = "master" digest = "1:4da4ea0a664ba528965683d350f602d0f11464e6bb2e17aad0914723bc25d163" name = "github.com/go-openapi/spec" packages = ["."] pruneopts = "NT" revision = "5b6cdde3200976e3ecceb2868706ee39b6aff3e4" - version = "v0.18.0" [[projects]] digest = "1:dc0f590770e5a6c70ea086232324f7b7dc4857c60eca63ab8ff78e0a5cfcdbf3" @@ -990,8 +1001,7 @@ version = "v0.1.0" [[projects]] - branch = "master" - digest = "1:9ac2fdede4a8304e3b00ea3b36526536339f306d0306e320fc74f6cefeead18e" + digest = "1:c48a795cd7048bb1888273bc604b6e69b22f9b8089c3df65f77cc527757b515c" name = "k8s.io/kube-openapi" packages = [ "cmd/openapi-gen/args", @@ -1002,7 +1012,7 @@ "pkg/util/sets", ] pruneopts = "NT" - revision = "0317810137be915b9cf888946c6e115c1bfac693" + revision = "0cf8f7e6ed1d2e3d47d02e3b6e559369af24d803" [[projects]] digest = "1:e03ddaf9f31bccbbb8c33eabad2c85025a95ca98905649fd744e0a54c630a064" @@ -1044,6 +1054,7 @@ analyzer-name = "dep" analyzer-version = 1 input-imports = [ + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1", "github.com/fatih/structs", "github.com/jpillora/backoff", "github.com/knative/eventing/pkg/apis/eventing/v1alpha1", diff --git a/Gopkg.toml b/Gopkg.toml index 7fad7ee8e1..f39e82ff98 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -52,3 +52,7 @@ required = [ [[prune.project]] name = "k8s.io/code-generator" non-go = false + +[[constraint]] + name = "github.com/coreos/prometheus-operator" + version = "0.27.0" diff --git a/docs/traits.adoc b/docs/traits.adoc index 5e638a2613..fc86524648 100644 --- a/docs/traits.adoc +++ b/docs/traits.adoc @@ -151,6 +151,21 @@ The following is a list of common traits that can be configured by the end users + It's disabled by default. +| prometheus +| Kubernetes, OpenShift +| Exposes the integration with a Service and a ServiceMonitor resources so that the Prometheus endpoint can be scraped. + + + + + It's disabled by default. + +[cols="m,"] +!=== + +! prometheus.port +! To configure a different Prometheus endpoint port (default `9778`). + +!=== + |======================= diff --git a/pkg/apis/addtoscheme_monitoring.go b/pkg/apis/addtoscheme_monitoring.go new file mode 100644 index 0000000000..5eb2ddabb9 --- /dev/null +++ b/pkg/apis/addtoscheme_monitoring.go @@ -0,0 +1,8 @@ +package apis + +import "github.com/apache/camel-k/pkg/util/monitoring" + +func init() { + // Register the types with the Scheme so the components can map objects to GroupVersionKinds and back + AddToSchemes = append(AddToSchemes, monitoring.AddToScheme) +} diff --git a/pkg/trait/catalog.go b/pkg/trait/catalog.go index 3714eb7909..b5f3fa7361 100644 --- a/pkg/trait/catalog.go +++ b/pkg/trait/catalog.go @@ -38,6 +38,7 @@ type Catalog struct { tService Trait tRoute Trait tIngress Trait + tPrometheus Trait tOwner Trait tImages Trait tBuilder Trait @@ -60,6 +61,7 @@ func NewCatalog(ctx context.Context, c client.Client) *Catalog { tService: newServiceTrait(), tRoute: newRouteTrait(), tIngress: newIngressTrait(), + tPrometheus: newPrometheusTrait(), tOwner: newOwnerTrait(), tImages: newImagesTrait(), tBuilder: newBuilderTrait(), @@ -91,6 +93,7 @@ func (c *Catalog) allTraits() []Trait { c.tService, c.tRoute, c.tIngress, + c.tPrometheus, c.tOwner, c.tImages, c.tBuilder, @@ -116,6 +119,7 @@ func (c *Catalog) traitsFor(environment *Environment) []Trait { c.tDeployment, c.tService, c.tRoute, + c.tPrometheus, c.tOwner, } case v1alpha1.TraitProfileKubernetes: @@ -131,6 +135,7 @@ func (c *Catalog) traitsFor(environment *Environment) []Trait { c.tDeployment, c.tService, c.tIngress, + c.tPrometheus, c.tOwner, } case v1alpha1.TraitProfileKnative: diff --git a/pkg/trait/prometheus.go b/pkg/trait/prometheus.go new file mode 100644 index 0000000000..08efd88c57 --- /dev/null +++ b/pkg/trait/prometheus.go @@ -0,0 +1,122 @@ +/* +Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You 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 trait + +import ( + "github.com/apache/camel-k/pkg/apis/camel/v1alpha1" + monitoringv1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +type prometheusTrait struct { + BaseTrait `property:",squash"` + + Port int `property:"port"` +} + +func newPrometheusTrait() *prometheusTrait { + return &prometheusTrait{ + BaseTrait: BaseTrait{ + id: ID("prometheus"), + }, + Port: 9779, + } +} + +func (t *prometheusTrait) Configure(e *Environment) (bool, error) { + if t.Enabled == nil || !*t.Enabled { + return false, nil + } + + if !e.IntegrationInPhase(v1alpha1.IntegrationPhaseDeploying) { + return false, nil + } + + return true, nil +} + +func (t *prometheusTrait) Apply(e *Environment) (err error) { + // TODO: update the existing integration service instead of + // creating an extra service dedicated to Prometheus + svc := t.getServiceFor(e) + e.Resources.Add(svc) + smt := t.getServiceMonitorFor(e) + e.Resources.Add(smt) + return nil +} + +func (t *prometheusTrait) getServiceFor(e *Environment) *corev1.Service { + svc := corev1.Service{ + TypeMeta: metav1.TypeMeta{ + Kind: "Service", + APIVersion: "v1", + }, + ObjectMeta: metav1.ObjectMeta{ + Name: e.Integration.Name + "-prometheus", + Namespace: e.Integration.Namespace, + Labels: map[string]string{ + "camel.apache.org/integration": e.Integration.Name, + }, + }, + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{ + { + Name: "prometheus", + Port: int32(t.Port), + Protocol: corev1.ProtocolTCP, + }, + }, + Selector: map[string]string{ + "camel.apache.org/integration": e.Integration.Name, + }, + }, + } + + return &svc +} + +func (t *prometheusTrait) getServiceMonitorFor(e *Environment) *monitoringv1.ServiceMonitor { + smt := monitoringv1.ServiceMonitor{ + TypeMeta: metav1.TypeMeta{ + Kind: "ServiceMonitor", + APIVersion: "monitoring.coreos.com/v1", + }, + ObjectMeta: metav1.ObjectMeta{ + Name: e.Integration.Name + "-prometheus", + Namespace: e.Integration.Namespace, + Labels: map[string]string{ + // TODO: add the ability to configure additional labels + "camel.apache.org/integration": e.Integration.Name, + }, + }, + Spec: monitoringv1.ServiceMonitorSpec{ + Selector: metav1.LabelSelector{ + MatchLabels: map[string]string{ + "camel.apache.org/integration": e.Integration.Name, + }, + }, + Endpoints: []monitoringv1.Endpoint{ + monitoringv1.Endpoint{ + Port: "prometheus", + }, + }, + }, + } + return &smt +} diff --git a/pkg/util/monitoring/register.go b/pkg/util/monitoring/register.go new file mode 100644 index 0000000000..f18ba06b8d --- /dev/null +++ b/pkg/util/monitoring/register.go @@ -0,0 +1,47 @@ +/* +Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You 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 monitoring + +import ( + monitoringv1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + "github.com/sirupsen/logrus" + "k8s.io/apimachinery/pkg/runtime" +) + +type registerFunction func(*runtime.Scheme) error + +// AddToScheme adds monitoring types to the scheme +func AddToScheme(scheme *runtime.Scheme) error { + var err error + + err = doAdd(monitoringv1.AddToScheme, scheme, err) + + return err +} + +func doAdd(addToScheme registerFunction, scheme *runtime.Scheme, err error) error { + callErr := addToScheme(scheme) + if callErr != nil { + logrus.Error("Error while registering monitoring types", callErr) + } + + if err == nil { + return callErr + } + return err +} diff --git a/vendor/github.com/coreos/prometheus-operator/LICENSE b/vendor/github.com/coreos/prometheus-operator/LICENSE new file mode 100644 index 0000000000..e06d208186 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/LICENSE @@ -0,0 +1,202 @@ +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + 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. + diff --git a/vendor/github.com/coreos/prometheus-operator/NOTICE b/vendor/github.com/coreos/prometheus-operator/NOTICE new file mode 100644 index 0000000000..e520005cdd --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/NOTICE @@ -0,0 +1,5 @@ +CoreOS Project +Copyright 2015 CoreOS, Inc + +This product includes software developed at CoreOS, Inc. +(http://www.coreos.com/). diff --git a/vendor/github.com/coreos/prometheus-operator/cmd/operator/main.go b/vendor/github.com/coreos/prometheus-operator/cmd/operator/main.go new file mode 100644 index 0000000000..a2e73d4831 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/cmd/operator/main.go @@ -0,0 +1,262 @@ +// Copyright 2016 The prometheus-operator 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 ( + "context" + "errors" + "flag" + "fmt" + "net" + "net/http" + "net/http/pprof" + "os" + "os/signal" + "strings" + "syscall" + + alertmanagercontroller "github.com/coreos/prometheus-operator/pkg/alertmanager" + "github.com/coreos/prometheus-operator/pkg/api" + monitoring "github.com/coreos/prometheus-operator/pkg/apis/monitoring" + monitoringv1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + prometheuscontroller "github.com/coreos/prometheus-operator/pkg/prometheus" + "github.com/coreos/prometheus-operator/pkg/version" + + "github.com/go-kit/kit/log" + "github.com/go-kit/kit/log/level" + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/client_golang/prometheus/promhttp" + "golang.org/x/sync/errgroup" + "k8s.io/api/core/v1" +) + +const ( + logLevelAll = "all" + logLevelDebug = "debug" + logLevelInfo = "info" + logLevelWarn = "warn" + logLevelError = "error" + logLevelNone = "none" +) + +const ( + logFormatLogfmt = "logfmt" + logFormatJson = "json" +) + +var ( + ns = namespaces{} +) + +type namespaces map[string]struct{} + +// Set implements the flagset.Value interface. +func (n namespaces) Set(value string) error { + if n == nil { + return errors.New("expected n of type namespaces to be initialized") + } + ns := strings.Split(value, ",") + for i := range ns { + n[ns[i]] = struct{}{} + } + return nil +} + +// String implements the flagset.Value interface. +func (n namespaces) String() string { + return strings.Join(n.asSlice(), ",") +} + +func (n namespaces) asSlice() []string { + var ns []string + for k := range n { + ns = append(ns, k) + } + if len(ns) == 0 { + ns = append(ns, v1.NamespaceAll) + } + return ns +} + +var ( + cfg prometheuscontroller.Config + availableLogLevels = []string{ + logLevelAll, + logLevelDebug, + logLevelInfo, + logLevelWarn, + logLevelError, + logLevelNone, + } + availableLogFormats = []string{ + logFormatLogfmt, + logFormatJson, + } +) + +func init() { + cfg.CrdKinds = monitoringv1.DefaultCrdKinds + flagset := flag.CommandLine + flagset.StringVar(&cfg.Host, "apiserver", "", "API Server addr, e.g. ' - NOT RECOMMENDED FOR PRODUCTION - http://127.0.0.1:8080'. Omit parameter to run in on-cluster mode and utilize the service account token.") + flagset.StringVar(&cfg.TLSConfig.CertFile, "cert-file", "", " - NOT RECOMMENDED FOR PRODUCTION - Path to public TLS certificate file.") + flagset.StringVar(&cfg.TLSConfig.KeyFile, "key-file", "", "- NOT RECOMMENDED FOR PRODUCTION - Path to private TLS certificate file.") + flagset.StringVar(&cfg.TLSConfig.CAFile, "ca-file", "", "- NOT RECOMMENDED FOR PRODUCTION - Path to TLS CA file.") + flagset.StringVar(&cfg.KubeletObject, "kubelet-service", "", "Service/Endpoints object to write kubelets into in format \"namespace/name\"") + flagset.BoolVar(&cfg.TLSInsecure, "tls-insecure", false, "- NOT RECOMMENDED FOR PRODUCTION - Don't verify API server's CA certificate.") + // The Prometheus config reloader image is released along with the + // Prometheus Operator image, tagged with the same semver version. Default to + // the Prometheus Operator version if no Prometheus config reloader image is + // specified. + flagset.StringVar(&cfg.PrometheusConfigReloader, "prometheus-config-reloader", fmt.Sprintf("quay.io/coreos/prometheus-config-reloader:v%v", version.Version), "Prometheus config reloader image") + flagset.StringVar(&cfg.ConfigReloaderImage, "config-reloader-image", "quay.io/coreos/configmap-reload:v0.0.1", "Reload Image") + flagset.StringVar(&cfg.AlertmanagerDefaultBaseImage, "alertmanager-default-base-image", "quay.io/prometheus/alertmanager", "Alertmanager default base image") + flagset.StringVar(&cfg.PrometheusDefaultBaseImage, "prometheus-default-base-image", "quay.io/prometheus/prometheus", "Prometheus default base image") + flagset.StringVar(&cfg.ThanosDefaultBaseImage, "thanos-default-base-image", "improbable/thanos", "Thanos default base image") + flagset.Var(ns, "namespaces", "Namespaces to scope the interaction of the Prometheus Operator and the apiserver.") + flagset.Var(&cfg.Labels, "labels", "Labels to be add to all resources created by the operator") + flagset.StringVar(&cfg.CrdGroup, "crd-apigroup", monitoring.GroupName, "prometheus CRD API group name") + flagset.Var(&cfg.CrdKinds, "crd-kinds", " - EXPERIMENTAL (could be removed in future releases) - customize CRD kind names") + flagset.BoolVar(&cfg.EnableValidation, "with-validation", true, "Include the validation spec in the CRD") + flagset.StringVar(&cfg.LocalHost, "localhost", "localhost", "EXPERIMENTAL (could be removed in future releases) - Host used to communicate between local services on a pod. Fixes issues where localhost resolves incorrectly.") + flagset.StringVar(&cfg.LogLevel, "log-level", logLevelInfo, fmt.Sprintf("Log level to use. Possible values: %s", strings.Join(availableLogLevels, ", "))) + flagset.StringVar(&cfg.LogFormat, "log-format", logFormatLogfmt, fmt.Sprintf("Log format to use. Possible values: %s", strings.Join(availableLogFormats, ", "))) + flagset.BoolVar(&cfg.ManageCRDs, "manage-crds", true, "Manage all CRDs with the Prometheus Operator.") + flagset.Parse(os.Args[1:]) + cfg.Namespaces = ns.asSlice() +} + +func Main() int { + logger := log.NewLogfmtLogger(log.NewSyncWriter(os.Stdout)) + if cfg.LogFormat == logFormatJson { + logger = log.NewJSONLogger(log.NewSyncWriter(os.Stdout)) + } + switch cfg.LogLevel { + case logLevelAll: + logger = level.NewFilter(logger, level.AllowAll()) + case logLevelDebug: + logger = level.NewFilter(logger, level.AllowDebug()) + case logLevelInfo: + logger = level.NewFilter(logger, level.AllowInfo()) + case logLevelWarn: + logger = level.NewFilter(logger, level.AllowWarn()) + case logLevelError: + logger = level.NewFilter(logger, level.AllowError()) + case logLevelNone: + logger = level.NewFilter(logger, level.AllowNone()) + default: + fmt.Fprintf(os.Stderr, "log level %v unknown, %v are possible values", cfg.LogLevel, availableLogLevels) + return 1 + } + logger = log.With(logger, "ts", log.DefaultTimestampUTC) + logger = log.With(logger, "caller", log.DefaultCaller) + + logger.Log("msg", fmt.Sprintf("Starting Prometheus Operator version '%v'.", version.Version)) + + po, err := prometheuscontroller.New(cfg, log.With(logger, "component", "prometheusoperator")) + if err != nil { + fmt.Fprint(os.Stderr, "instantiating prometheus controller failed: ", err) + return 1 + } + + ao, err := alertmanagercontroller.New(cfg, log.With(logger, "component", "alertmanageroperator")) + if err != nil { + fmt.Fprint(os.Stderr, "instantiating alertmanager controller failed: ", err) + return 1 + } + + mux := http.NewServeMux() + web, err := api.New(cfg, log.With(logger, "component", "api")) + if err != nil { + fmt.Fprint(os.Stderr, "instantiating api failed: ", err) + return 1 + } + + web.Register(mux) + l, err := net.Listen("tcp", ":8080") + if err != nil { + fmt.Fprint(os.Stderr, "listening port 8080 failed", err) + return 1 + } + + reconcileErrorsCounter := prometheus.NewCounterVec(prometheus.CounterOpts{ + Name: "prometheus_operator_reconcile_errors_total", + Help: "Number of errors that occurred while reconciling the alertmanager statefulset", + }, []string{"controller"}) + + triggerByCounter := prometheus.NewCounterVec(prometheus.CounterOpts{ + Name: "prometheus_operator_triggered_total", + Help: "Number of times a Kubernetes object add, delete or update event" + + " triggered the Prometheus Operator to reconcile an object", + }, []string{"controller", "triggered_by", "action"}) + + r := prometheus.NewRegistry() + r.MustRegister( + prometheus.NewGoCollector(), + prometheus.NewProcessCollector(prometheus.ProcessCollectorOpts{}), + reconcileErrorsCounter, + triggerByCounter, + ) + + prometheusLabels := prometheus.Labels{"controller": "prometheus"} + po.RegisterMetrics( + prometheus.WrapRegistererWith(prometheusLabels, r), + reconcileErrorsCounter.MustCurryWith(prometheusLabels), + triggerByCounter.MustCurryWith(prometheusLabels), + ) + + alertmanagerLabels := prometheus.Labels{"controller": "alertmanager"} + ao.RegisterMetrics( + prometheus.WrapRegistererWith(alertmanagerLabels, r), + reconcileErrorsCounter.MustCurryWith(alertmanagerLabels), + triggerByCounter.MustCurryWith(alertmanagerLabels), + ) + + mux.Handle("/metrics", promhttp.HandlerFor(r, promhttp.HandlerOpts{})) + mux.Handle("/debug/pprof/", http.HandlerFunc(pprof.Index)) + mux.Handle("/debug/pprof/cmdline", http.HandlerFunc(pprof.Cmdline)) + mux.Handle("/debug/pprof/profile", http.HandlerFunc(pprof.Profile)) + mux.Handle("/debug/pprof/symbol", http.HandlerFunc(pprof.Symbol)) + mux.Handle("/debug/pprof/trace", http.HandlerFunc(pprof.Trace)) + + ctx, cancel := context.WithCancel(context.Background()) + wg, ctx := errgroup.WithContext(ctx) + + wg.Go(func() error { return po.Run(ctx.Done()) }) + wg.Go(func() error { return ao.Run(ctx.Done()) }) + + srv := &http.Server{Handler: mux} + go srv.Serve(l) + + term := make(chan os.Signal) + signal.Notify(term, os.Interrupt, syscall.SIGTERM) + + select { + case <-term: + logger.Log("msg", "Received SIGTERM, exiting gracefully...") + case <-ctx.Done(): + } + + cancel() + if err := wg.Wait(); err != nil { + logger.Log("msg", "Unhandled error received. Exiting...", "err", err) + return 1 + } + + return 0 +} + +func main() { + os.Exit(Main()) +} diff --git a/vendor/github.com/coreos/prometheus-operator/cmd/po-crdgen/main.go b/vendor/github.com/coreos/prometheus-operator/cmd/po-crdgen/main.go new file mode 100644 index 0000000000..747260b7b6 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/cmd/po-crdgen/main.go @@ -0,0 +1,83 @@ +// Copyright 2018 The prometheus-operator 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 ( + "flag" + "fmt" + "os" + + monitoring "github.com/coreos/prometheus-operator/pkg/apis/monitoring" + monitoringv1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + k8sutil "github.com/coreos/prometheus-operator/pkg/k8sutil" + + crdutils "github.com/ant31/crd-validation/pkg" + extensionsobj "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" +) + +var ( + cfg crdutils.Config +) + +func initFlags(crdkind monitoringv1.CrdKind, flagset *flag.FlagSet) *flag.FlagSet { + flagset.Var(&cfg.Labels, "labels", "Labels") + flagset.Var(&cfg.Annotations, "annotations", "Annotations") + flagset.BoolVar(&cfg.EnableValidation, "with-validation", true, "Add CRD validation field, default: true") + flagset.StringVar(&cfg.Group, "apigroup", monitoring.GroupName, "CRD api group") + flagset.StringVar(&cfg.SpecDefinitionName, "spec-name", crdkind.SpecName, "CRD spec definition name") + flagset.StringVar(&cfg.OutputFormat, "output", "yaml", "output format: json|yaml") + flagset.StringVar(&cfg.Kind, "kind", crdkind.Kind, "CRD Kind") + flagset.StringVar(&cfg.ResourceScope, "scope", string(extensionsobj.NamespaceScoped), "CRD scope: 'Namespaced' | 'Cluster'. Default: Namespaced") + flagset.StringVar(&cfg.Version, "version", monitoringv1.Version, "CRD version, default: 'v1'") + flagset.StringVar(&cfg.Plural, "plural", crdkind.Plural, "CRD plural name") + return flagset +} + +func init() { + var command *flag.FlagSet + if len(os.Args) == 1 { + fmt.Println("usage: po-crdgen [prometheus | alertmanager | servicemonitor | prometheusrule] []") + os.Exit(1) + } + switch os.Args[1] { + case "prometheus": + command = initFlags(monitoringv1.DefaultCrdKinds.Prometheus, flag.NewFlagSet("prometheus", flag.ExitOnError)) + case "servicemonitor": + command = initFlags(monitoringv1.DefaultCrdKinds.ServiceMonitor, flag.NewFlagSet("servicemonitor", flag.ExitOnError)) + case "alertmanager": + command = initFlags(monitoringv1.DefaultCrdKinds.Alertmanager, flag.NewFlagSet("alertmanager", flag.ExitOnError)) + case "prometheusrule": + command = initFlags(monitoringv1.DefaultCrdKinds.PrometheusRule, flag.NewFlagSet("prometheusrule", flag.ExitOnError)) + default: + fmt.Printf("%q is not valid command.\n choices: [prometheus, alertmanager, servicemonitor, prometheusrule]", os.Args[1]) + os.Exit(2) + } + command.Parse(os.Args[2:]) +} + +func main() { + crd := k8sutil.NewCustomResourceDefinition( + monitoringv1.CrdKind{Plural: cfg.Plural, + Kind: cfg.Kind, + SpecName: cfg.SpecDefinitionName}, + cfg.Group, cfg.Labels.LabelsMap, cfg.EnableValidation) + + err := crdutils.MarshallCrd(crd, cfg.OutputFormat) + if err != nil { + fmt.Println("Error: ", err) + os.Exit(1) + } + os.Exit(0) +} diff --git a/vendor/github.com/coreos/prometheus-operator/cmd/po-docgen/api.go b/vendor/github.com/coreos/prometheus-operator/cmd/po-docgen/api.go new file mode 100644 index 0000000000..e9b1f3e42c --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/cmd/po-docgen/api.go @@ -0,0 +1,263 @@ +// Copyright 2016 The prometheus-operator 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 ( + "bytes" + "fmt" + "go/ast" + "go/doc" + "go/parser" + "go/token" + "reflect" + "strings" +) + +const ( + firstParagraph = `
+ + +# API Docs + +This Document documents the types introduced by the Prometheus Operator to be consumed by users. + +> Note this document is generated from code comments. When contributing a change to this document please do so by changing the code comments.` +) + +var ( + links = map[string]string{ + "metav1.ObjectMeta": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.11/#objectmeta-v1-meta", + "metav1.ListMeta": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.11/#listmeta-v1-meta", + "metav1.LabelSelector": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.11/#labelselector-v1-meta", + "v1.ResourceRequirements": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.11/#resourcerequirements-v1-core", + "v1.LocalObjectReference": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.11/#localobjectreference-v1-core", + "v1.SecretKeySelector": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.11/#secretkeyselector-v1-core", + "v1.PersistentVolumeClaim": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.11/#persistentvolumeclaim-v1-core", + "v1.EmptyDirVolumeSource": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.11/#emptydirvolumesource-v1-core", + } + + selfLinks = map[string]string{} +) + +func toSectionLink(name string) string { + name = strings.ToLower(name) + name = strings.Replace(name, " ", "-", -1) + return name +} + +func printTOC(types []KubeTypes) { + fmt.Printf("\n## Table of Contents\n") + for _, t := range types { + strukt := t[0] + fmt.Printf("* [%s](#%s)\n", strukt.Name, toSectionLink(strukt.Name)) + } +} + +func printAPIDocs(path string) { + fmt.Println(firstParagraph) + + types := ParseDocumentationFrom(path) + for _, t := range types { + strukt := t[0] + selfLinks[strukt.Name] = "#" + strings.ToLower(strukt.Name) + } + + // we need to parse once more to now add the self links + types = ParseDocumentationFrom(path) + + printTOC(types) + + for _, t := range types { + strukt := t[0] + fmt.Printf("\n## %s\n\n%s\n\n", strukt.Name, strukt.Doc) + + fmt.Println("| Field | Description | Scheme | Required |") + fmt.Println("| ----- | ----------- | ------ | -------- |") + fields := t[1:(len(t))] + for _, f := range fields { + fmt.Println("|", f.Name, "|", f.Doc, "|", f.Type, "|", f.Mandatory, "|") + } + fmt.Println("") + fmt.Println("[Back to TOC](#table-of-contents)") + } +} + +// Pair of strings. We keed the name of fields and the doc +type Pair struct { + Name, Doc, Type string + Mandatory bool +} + +// KubeTypes is an array to represent all available types in a parsed file. [0] is for the type itself +type KubeTypes []Pair + +// ParseDocumentationFrom gets all types' documentation and returns them as an +// array. Each type is again represented as an array (we have to use arrays as we +// need to be sure for the order of the fields). This function returns fields and +// struct definitions that have no documentation as {name, ""}. +func ParseDocumentationFrom(src string) []KubeTypes { + var docForTypes []KubeTypes + + pkg := astFrom(src) + + for _, kubType := range pkg.Types { + if structType, ok := kubType.Decl.Specs[0].(*ast.TypeSpec).Type.(*ast.StructType); ok { + var ks KubeTypes + ks = append(ks, Pair{kubType.Name, fmtRawDoc(kubType.Doc), "", false}) + + for _, field := range structType.Fields.List { + typeString := fieldType(field.Type) + fieldMandatory := fieldRequired(field) + if n := fieldName(field); n != "-" { + fieldDoc := fmtRawDoc(field.Doc.Text()) + ks = append(ks, Pair{n, fieldDoc, typeString, fieldMandatory}) + } + } + docForTypes = append(docForTypes, ks) + } + } + + return docForTypes +} + +func astFrom(filePath string) *doc.Package { + fset := token.NewFileSet() + m := make(map[string]*ast.File) + + f, err := parser.ParseFile(fset, filePath, nil, parser.ParseComments) + if err != nil { + fmt.Println(err) + return nil + } + + m[filePath] = f + apkg, _ := ast.NewPackage(fset, m, nil, nil) + + return doc.New(apkg, "", 0) +} + +func fmtRawDoc(rawDoc string) string { + var buffer bytes.Buffer + delPrevChar := func() { + if buffer.Len() > 0 { + buffer.Truncate(buffer.Len() - 1) // Delete the last " " or "\n" + } + } + + // Ignore all lines after --- + rawDoc = strings.Split(rawDoc, "---")[0] + + for _, line := range strings.Split(rawDoc, "\n") { + line = strings.TrimRight(line, " ") + leading := strings.TrimLeft(line, " ") + switch { + case len(line) == 0: // Keep paragraphs + delPrevChar() + buffer.WriteString("\n\n") + case strings.HasPrefix(leading, "TODO"): // Ignore one line TODOs + case strings.HasPrefix(leading, "+"): // Ignore instructions to go2idl + default: + if strings.HasPrefix(line, " ") || strings.HasPrefix(line, "\t") { + delPrevChar() + line = "\n" + line + "\n" // Replace it with newline. This is useful when we have a line with: "Example:\n\tJSON-someting..." + } else { + line += " " + } + buffer.WriteString(line) + } + } + + postDoc := strings.TrimRight(buffer.String(), "\n") + postDoc = strings.Replace(postDoc, "\\\"", "\"", -1) // replace user's \" to " + postDoc = strings.Replace(postDoc, "\"", "\\\"", -1) // Escape " + postDoc = strings.Replace(postDoc, "\n", "\\n", -1) + postDoc = strings.Replace(postDoc, "\t", "\\t", -1) + postDoc = strings.Replace(postDoc, "|", "\\|", -1) + + return postDoc +} + +func toLink(typeName string) string { + selfLink, hasSelfLink := selfLinks[typeName] + if hasSelfLink { + return wrapInLink(typeName, selfLink) + } + + link, hasLink := links[typeName] + if hasLink { + return wrapInLink(typeName, link) + } + + return typeName +} + +func wrapInLink(text, link string) string { + return fmt.Sprintf("[%s](%s)", text, link) +} + +// fieldName returns the name of the field as it should appear in JSON format +// "-" indicates that this field is not part of the JSON representation +func fieldName(field *ast.Field) string { + jsonTag := "" + if field.Tag != nil { + jsonTag = reflect.StructTag(field.Tag.Value[1 : len(field.Tag.Value)-1]).Get("json") // Delete first and last quotation + if strings.Contains(jsonTag, "inline") { + return "-" + } + } + + jsonTag = strings.Split(jsonTag, ",")[0] // This can return "-" + if jsonTag == "" { + if field.Names != nil { + return field.Names[0].Name + } + return field.Type.(*ast.Ident).Name + } + return jsonTag +} + +// fieldRequired returns whether a field is a required field. +func fieldRequired(field *ast.Field) bool { + jsonTag := "" + if field.Tag != nil { + jsonTag = reflect.StructTag(field.Tag.Value[1 : len(field.Tag.Value)-1]).Get("json") // Delete first and last quotation + return !strings.Contains(jsonTag, "omitempty") + } + + return false +} + +func fieldType(typ ast.Expr) string { + switch typ.(type) { + case *ast.Ident: + return toLink(typ.(*ast.Ident).Name) + case *ast.StarExpr: + return "*" + toLink(fieldType(typ.(*ast.StarExpr).X)) + case *ast.SelectorExpr: + e := typ.(*ast.SelectorExpr) + pkg := e.X.(*ast.Ident) + t := e.Sel + return toLink(pkg.Name + "." + t.Name) + case *ast.ArrayType: + return "[]" + toLink(fieldType(typ.(*ast.ArrayType).Elt)) + case *ast.MapType: + mapType := typ.(*ast.MapType) + return "map[" + toLink(fieldType(mapType.Key)) + "]" + toLink(fieldType(mapType.Value)) + default: + return "" + } +} diff --git a/vendor/github.com/coreos/prometheus-operator/cmd/po-docgen/compatibility.go b/vendor/github.com/coreos/prometheus-operator/cmd/po-docgen/compatibility.go new file mode 100644 index 0000000000..7b99f190d2 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/cmd/po-docgen/compatibility.go @@ -0,0 +1,47 @@ +// Copyright 2016 The prometheus-operator 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 ( + "fmt" + + "github.com/coreos/prometheus-operator/pkg/prometheus" +) + +func printCompatMatrixDocs() { + fmt.Println(`
+ + +# Compatibility + +The Prometheus Operator supports a number of Kubernetes and Prometheus releases. + +## Kubernetes + +The Prometheus Operator uses client-go to communicate with Kubernetes clusters. The supported Kubernetes cluster version is determined by client-go. The compatibility matrix for client-go and Kubernetes clusters can be found [here](https://github.com/kubernetes/client-go#compatibility-matrix). All additional compatibility is only best effort, or happens to still/already be supported. The currently used client-go version is "v4.0.0-beta.0". + +Due to the use of CustomResourceDefinitions Kubernetes >= v1.7.0 is required. + +## Prometheus + +The versions of Prometheus compatible to be run with the Prometheus Operator are:`) + fmt.Println("") + + for _, v := range prometheus.CompatibilityMatrix { + fmt.Printf("* %s\n", v) + } +} diff --git a/vendor/github.com/coreos/prometheus-operator/cmd/po-docgen/main.go b/vendor/github.com/coreos/prometheus-operator/cmd/po-docgen/main.go new file mode 100644 index 0000000000..37824ab594 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/cmd/po-docgen/main.go @@ -0,0 +1,28 @@ +// Copyright 2016 The prometheus-operator 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 ( + "os" +) + +func main() { + switch os.Args[1] { + case "api": + printAPIDocs(os.Args[2]) + case "compatibility": + printCompatMatrixDocs() + } +} diff --git a/vendor/github.com/coreos/prometheus-operator/cmd/po-rule-migration/main.go b/vendor/github.com/coreos/prometheus-operator/cmd/po-rule-migration/main.go new file mode 100644 index 0000000000..10bcb66bcc --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/cmd/po-rule-migration/main.go @@ -0,0 +1,125 @@ +// Copyright 2018 The prometheus-operator 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 ( + "bytes" + "flag" + "io/ioutil" + "log" + "os" + "path" + "path/filepath" + + monitoring "github.com/coreos/prometheus-operator/pkg/apis/monitoring" + monitoringv1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + + "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + k8sYAML "k8s.io/apimachinery/pkg/util/yaml" + + "github.com/ghodss/yaml" + "github.com/pkg/errors" +) + +func main() { + var ruleConfigMapName = flag.String("rule-config-map", "", "path to rule ConfigMap") + var ruleCRDSDestination = flag.String("rule-crds-destination", "", "destination new crds should be created in") + flag.Parse() + + if *ruleConfigMapName == "" { + log.Print("please specify 'rule-config-map' flag") + flag.PrintDefaults() + os.Exit(1) + } + + if *ruleCRDSDestination == "" { + log.Print("please specify 'rule-crds-destination' flag") + flag.PrintDefaults() + os.Exit(1) + } + + destPath, err := filepath.Abs(*ruleCRDSDestination) + if err != nil { + log.Fatalf("failed to get absolut path of '%v': %v", ruleCRDSDestination, err.Error()) + } + ruleCRDSDestination = &destPath + + file, err := os.Open(*ruleConfigMapName) + if err != nil { + log.Fatalf("failed to read file '%v': %v", ruleConfigMapName, err.Error()) + } + + configMap := v1.ConfigMap{} + + err = k8sYAML.NewYAMLOrJSONDecoder(file, 100).Decode(&configMap) + if err != nil { + log.Fatalf("failed to decode manifest: %v", err.Error()) + } + + ruleFiles, err := CMToRule(&configMap) + if err != nil { + log.Fatalf("failed to transform ConfigMap to rule file crds: %v", err.Error()) + } + + for _, ruleFile := range ruleFiles { + encodedRuleFile, err := yaml.Marshal(ruleFile) + if err != nil { + log.Fatalf("failed to encode ruleFile '%v': %v", ruleFile.Name, err.Error()) + } + + err = ioutil.WriteFile(path.Join(*ruleCRDSDestination, ruleFile.Name), encodedRuleFile, 0644) + if err != nil { + log.Fatalf("failed to write yaml manifest for rule file '%v': %v", ruleFile.Name, err.Error()) + } + } +} + +// CMToRule takes a rule ConfigMap and transforms it to possibly multiple +// rule file crds. It is used in `cmd/po-rule-cm-to-rule-file-crds`. Thereby it +// needs to be public. +func CMToRule(cm *v1.ConfigMap) ([]monitoringv1.PrometheusRule, error) { + rules := []monitoringv1.PrometheusRule{} + + for name, content := range cm.Data { + ruleSpec := monitoringv1.PrometheusRuleSpec{} + + if err := k8sYAML.NewYAMLOrJSONDecoder(bytes.NewBufferString(content), 1000).Decode(&ruleSpec); err != nil { + return []monitoringv1.PrometheusRule{}, errors.Wrapf( + err, + "unmarshal rules file %v in configmap '%v' in namespace '%v'", + name, cm.Name, cm.Namespace, + ) + } + + rule := monitoringv1.PrometheusRule{ + TypeMeta: metav1.TypeMeta{ + Kind: monitoringv1.PrometheusRuleKind, + APIVersion: monitoring.GroupName + "/" + monitoringv1.Version, + }, + + ObjectMeta: metav1.ObjectMeta{ + Name: cm.Name + "-" + name, + Namespace: cm.Namespace, + Labels: cm.Labels, + }, + Spec: ruleSpec, + } + + rules = append(rules, rule) + } + + return rules, nil +} diff --git a/vendor/github.com/coreos/prometheus-operator/cmd/prometheus-config-reloader/main.go b/vendor/github.com/coreos/prometheus-operator/cmd/prometheus-config-reloader/main.go new file mode 100644 index 0000000000..70addc0330 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/cmd/prometheus-config-reloader/main.go @@ -0,0 +1,95 @@ +// Copyright 2016 The prometheus-operator 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 ( + "context" + "fmt" + "os" + "strings" + + "github.com/coreos/prometheus-operator/pkg/version" + + "github.com/go-kit/kit/log" + "github.com/improbable-eng/thanos/pkg/reloader" + "github.com/oklog/run" + kingpin "gopkg.in/alecthomas/kingpin.v2" +) + +const ( + logFormatLogfmt = "logfmt" + logFormatJson = "json" +) + +var ( + availableLogFormats = []string{ + logFormatLogfmt, + logFormatJson, + } +) + +func main() { + app := kingpin.New("prometheus-config-reloader", "") + cfgFile := app.Flag("config-file", "config file watched by the reloader"). + String() + + cfgSubstFile := app.Flag("config-envsubst-file", "output file for environment variable substituted config file"). + String() + + logFormat := app.Flag("log-format", fmt.Sprintf("Log format to use. Possible values: %s", strings.Join(availableLogFormats, ", "))).Default(logFormatLogfmt).String() + + ruleDir := app.Flag("rule-dir", "rule directory for the reloader to refresh").String() + + reloadURL := app.Flag("reload-url", "reload URL to trigger Prometheus reload on"). + Default("http://127.0.0.1:9090/-/reload").URL() + + if _, err := app.Parse(os.Args[1:]); err != nil { + fmt.Fprintln(os.Stderr, err) + os.Exit(2) + } + + logger := log.NewLogfmtLogger(log.NewSyncWriter(os.Stdout)) + if *logFormat == logFormatJson { + logger = log.NewJSONLogger(log.NewSyncWriter(os.Stdout)) + } + logger = log.With(logger, "ts", log.DefaultTimestampUTC) + logger = log.With(logger, "caller", log.DefaultCaller) + + logger.Log("msg", fmt.Sprintf("Starting prometheus-config-reloader version '%v'.", version.Version)) + + if *ruleDir != "" { + if err := os.MkdirAll(*ruleDir, 0777); err != nil { + fmt.Fprintln(os.Stderr, err) + os.Exit(2) + } + } + + var g run.Group + { + ctx, cancel := context.WithCancel(context.Background()) + rel := reloader.New(logger, *reloadURL, *cfgFile, *cfgSubstFile, *ruleDir) + + g.Add(func() error { + return rel.Watch(ctx) + }, func(error) { + cancel() + }) + } + + if err := g.Run(); err != nil { + fmt.Fprintln(os.Stderr, err) + os.Exit(1) + } +} diff --git a/vendor/github.com/coreos/prometheus-operator/example/alertmanger-webhook/main.go b/vendor/github.com/coreos/prometheus-operator/example/alertmanger-webhook/main.go new file mode 100644 index 0000000000..cf54c11d23 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/example/alertmanger-webhook/main.go @@ -0,0 +1,26 @@ +// Copyright 2017 The prometheus-operator 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 ( + "fmt" + "net/http" +) + +func main() { + http.ListenAndServe(":5001", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + fmt.Println("Alertmanager Notification Payload Received") + })) +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/alertmanager/collector.go b/vendor/github.com/coreos/prometheus-operator/pkg/alertmanager/collector.go new file mode 100644 index 0000000000..18c09a5b66 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/alertmanager/collector.go @@ -0,0 +1,61 @@ +// Copyright 2016 The prometheus-operator 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 alertmanager + +import ( + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + + "github.com/prometheus/client_golang/prometheus" + "k8s.io/client-go/tools/cache" +) + +var ( + descAlertmanagerSpecReplicas = prometheus.NewDesc( + "prometheus_operator_spec_replicas", + "Number of expected replicas for the object.", + []string{ + "namespace", + "name", + }, nil, + ) +) + +type alertmanagerCollector struct { + store cache.Store +} + +func NewAlertmanagerCollector(s cache.Store) *alertmanagerCollector { + return &alertmanagerCollector{store: s} +} + +// Describe implements the prometheus.Collector interface. +func (c *alertmanagerCollector) Describe(ch chan<- *prometheus.Desc) { + ch <- descAlertmanagerSpecReplicas +} + +// Collect implements the prometheus.Collector interface. +func (c *alertmanagerCollector) Collect(ch chan<- prometheus.Metric) { + for _, p := range c.store.List() { + c.collectAlertmanager(ch, p.(*v1.Alertmanager)) + } +} + +func (c *alertmanagerCollector) collectAlertmanager(ch chan<- prometheus.Metric, a *v1.Alertmanager) { + replicas := float64(minReplicas) + if a.Spec.Replicas != nil { + replicas = float64(*a.Spec.Replicas) + } + ch <- prometheus.MustNewConstMetric(descAlertmanagerSpecReplicas, prometheus.GaugeValue, replicas, a.Namespace, a.Name) +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/alertmanager/operator.go b/vendor/github.com/coreos/prometheus-operator/pkg/alertmanager/operator.go new file mode 100644 index 0000000000..b67b4e7f03 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/alertmanager/operator.go @@ -0,0 +1,659 @@ +// Copyright 2016 The prometheus-operator 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 alertmanager + +import ( + "fmt" + "reflect" + "strings" + "time" + + monitoringv1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + monitoringclient "github.com/coreos/prometheus-operator/pkg/client/versioned" + "github.com/coreos/prometheus-operator/pkg/k8sutil" + "github.com/coreos/prometheus-operator/pkg/listwatch" + prometheusoperator "github.com/coreos/prometheus-operator/pkg/prometheus" + + "github.com/go-kit/kit/log" + "github.com/go-kit/kit/log/level" + "github.com/pkg/errors" + "github.com/prometheus/client_golang/prometheus" + appsv1 "k8s.io/api/apps/v1beta2" + "k8s.io/api/core/v1" + extensionsobj "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" + apiextensionsclient "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" + apierrors "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/api/meta" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/runtime" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" + "k8s.io/client-go/kubernetes" + "k8s.io/client-go/tools/cache" + "k8s.io/client-go/util/workqueue" +) + +const ( + resyncPeriod = 5 * time.Minute +) + +// Operator manages life cycle of Alertmanager deployments and +// monitoring configurations. +type Operator struct { + kclient kubernetes.Interface + mclient monitoringclient.Interface + crdclient apiextensionsclient.Interface + logger log.Logger + + alrtInf cache.SharedIndexInformer + ssetInf cache.SharedIndexInformer + + queue workqueue.RateLimitingInterface + + reconcileErrorsCounter *prometheus.CounterVec + triggerByCounter *prometheus.CounterVec + + config Config +} + +type Config struct { + Host string + LocalHost string + ConfigReloaderImage string + AlertmanagerDefaultBaseImage string + Namespaces []string + Labels prometheusoperator.Labels + CrdKinds monitoringv1.CrdKinds + CrdGroup string + EnableValidation bool + ManageCRDs bool +} + +// New creates a new controller. +func New(c prometheusoperator.Config, logger log.Logger) (*Operator, error) { + cfg, err := k8sutil.NewClusterConfig(c.Host, c.TLSInsecure, &c.TLSConfig) + if err != nil { + return nil, errors.Wrap(err, "instantiating cluster config failed") + } + + client, err := kubernetes.NewForConfig(cfg) + if err != nil { + return nil, errors.Wrap(err, "instantiating kubernetes client failed") + } + + mclient, err := monitoringclient.NewForConfig(cfg) + if err != nil { + return nil, errors.Wrap(err, "instantiating monitoring client failed") + } + + crdclient, err := apiextensionsclient.NewForConfig(cfg) + if err != nil { + return nil, errors.Wrap(err, "instantiating apiextensions client failed") + } + + o := &Operator{ + kclient: client, + mclient: mclient, + crdclient: crdclient, + logger: logger, + queue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "alertmanager"), + config: Config{ + Host: c.Host, + LocalHost: c.LocalHost, + ConfigReloaderImage: c.ConfigReloaderImage, + AlertmanagerDefaultBaseImage: c.AlertmanagerDefaultBaseImage, + Namespaces: c.Namespaces, + CrdGroup: c.CrdGroup, + CrdKinds: c.CrdKinds, + Labels: c.Labels, + EnableValidation: c.EnableValidation, + ManageCRDs: c.ManageCRDs, + }, + } + + o.alrtInf = cache.NewSharedIndexInformer( + listwatch.MultiNamespaceListerWatcher(o.config.Namespaces, func(namespace string) cache.ListerWatcher { + return &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + return o.mclient.MonitoringV1().Alertmanagers(namespace).List(options) + }, + WatchFunc: o.mclient.MonitoringV1().Alertmanagers(namespace).Watch, + } + }), + &monitoringv1.Alertmanager{}, resyncPeriod, cache.Indexers{}, + ) + o.ssetInf = cache.NewSharedIndexInformer( + listwatch.MultiNamespaceListerWatcher(o.config.Namespaces, func(namespace string) cache.ListerWatcher { + return cache.NewListWatchFromClient(o.kclient.AppsV1beta2().RESTClient(), "statefulsets", namespace, fields.Everything()) + }), + &appsv1.StatefulSet{}, resyncPeriod, cache.Indexers{}, + ) + + return o, nil +} + +func (c *Operator) RegisterMetrics(r prometheus.Registerer, reconcileErrorsCounter *prometheus.CounterVec, triggerByCounter *prometheus.CounterVec) { + c.reconcileErrorsCounter = reconcileErrorsCounter + c.triggerByCounter = triggerByCounter + + c.reconcileErrorsCounter.With(prometheus.Labels{}).Add(0) + + r.MustRegister( + NewAlertmanagerCollector(c.alrtInf.GetStore()), + ) +} + +// waitForCacheSync waits for the informers' caches to be synced. +func (c *Operator) waitForCacheSync(stopc <-chan struct{}) error { + ok := true + informers := []struct { + name string + informer cache.SharedIndexInformer + }{ + {"Alertmanager", c.alrtInf}, + {"StatefulSet", c.ssetInf}, + } + for _, inf := range informers { + if !cache.WaitForCacheSync(stopc, inf.informer.HasSynced) { + level.Error(c.logger).Log("msg", fmt.Sprintf("failed to sync %s cache", inf.name)) + ok = false + } else { + level.Debug(c.logger).Log("msg", fmt.Sprintf("successfully synced %s cache", inf.name)) + } + } + if !ok { + return errors.New("failed to sync caches") + } + level.Info(c.logger).Log("msg", "successfully synced all caches") + return nil +} + +// addHandlers adds the eventhandlers to the informers. +func (c *Operator) addHandlers() { + c.alrtInf.AddEventHandler(cache.ResourceEventHandlerFuncs{ + AddFunc: c.handleAlertmanagerAdd, + DeleteFunc: c.handleAlertmanagerDelete, + UpdateFunc: c.handleAlertmanagerUpdate, + }) + c.ssetInf.AddEventHandler(cache.ResourceEventHandlerFuncs{ + AddFunc: c.handleStatefulSetAdd, + DeleteFunc: c.handleStatefulSetDelete, + UpdateFunc: c.handleStatefulSetUpdate, + }) +} + +// Run the controller. +func (c *Operator) Run(stopc <-chan struct{}) error { + defer c.queue.ShutDown() + + errChan := make(chan error) + go func() { + v, err := c.kclient.Discovery().ServerVersion() + if err != nil { + errChan <- errors.Wrap(err, "communicating with server failed") + return + } + level.Info(c.logger).Log("msg", "connection established", "cluster-version", v) + + if c.config.ManageCRDs { + if err := c.createCRDs(); err != nil { + errChan <- err + return + } + } + errChan <- nil + }() + + select { + case err := <-errChan: + if err != nil { + return err + } + level.Info(c.logger).Log("msg", "CRD API endpoints ready") + case <-stopc: + return nil + } + + go c.worker() + + go c.alrtInf.Run(stopc) + go c.ssetInf.Run(stopc) + if err := c.waitForCacheSync(stopc); err != nil { + return err + } + c.addHandlers() + + <-stopc + return nil +} + +func (c *Operator) keyFunc(obj interface{}) (string, bool) { + k, err := cache.DeletionHandlingMetaNamespaceKeyFunc(obj) + if err != nil { + level.Error(c.logger).Log("msg", "creating key failed", "err", err) + return k, false + } + return k, true +} + +func (c *Operator) getObject(obj interface{}) (metav1.Object, bool) { + ts, ok := obj.(cache.DeletedFinalStateUnknown) + if ok { + obj = ts.Obj + } + + o, err := meta.Accessor(obj) + if err != nil { + level.Error(c.logger).Log("msg", "get object failed", "err", err) + return nil, false + } + return o, true +} + +// enqueue adds a key to the queue. If obj is a key already it gets added +// directly. Otherwise, the key is extracted via keyFunc. +func (c *Operator) enqueue(obj interface{}) { + if obj == nil { + return + } + + key, ok := obj.(string) + if !ok { + key, ok = c.keyFunc(obj) + if !ok { + return + } + } + + c.queue.Add(key) +} + +// enqueueForNamespace enqueues all Alertmanager object keys that belong to the +// given namespace. +func (c *Operator) enqueueForNamespace(ns string) { + cache.ListAll(c.alrtInf.GetStore(), labels.Everything(), func(obj interface{}) { + am := obj.(*monitoringv1.Alertmanager) + if am.Namespace == ns { + c.enqueue(am) + } + }) +} + +// worker runs a worker thread that just dequeues items, processes them +// and marks them done. It enforces that the syncHandler is never invoked +// concurrently with the same key. +func (c *Operator) worker() { + for c.processNextWorkItem() { + } +} + +func (c *Operator) processNextWorkItem() bool { + key, quit := c.queue.Get() + if quit { + return false + } + defer c.queue.Done(key) + + err := c.sync(key.(string)) + if err == nil { + c.queue.Forget(key) + return true + } + + c.reconcileErrorsCounter.With(prometheus.Labels{}).Inc() + utilruntime.HandleError(errors.Wrap(err, fmt.Sprintf("Sync %q failed", key))) + c.queue.AddRateLimited(key) + + return true +} + +func (c *Operator) alertmanagerForStatefulSet(sset interface{}) *monitoringv1.Alertmanager { + key, ok := c.keyFunc(sset) + if !ok { + return nil + } + + aKey := statefulSetKeyToAlertmanagerKey(key) + a, exists, err := c.alrtInf.GetStore().GetByKey(aKey) + if err != nil { + level.Error(c.logger).Log("msg", "Alertmanager lookup failed", "err", err) + return nil + } + if !exists { + return nil + } + return a.(*monitoringv1.Alertmanager) +} + +func alertmanagerNameFromStatefulSetName(name string) string { + return strings.TrimPrefix(name, "alertmanager-") +} + +func statefulSetNameFromAlertmanagerName(name string) string { + return "alertmanager-" + name +} + +func statefulSetKeyToAlertmanagerKey(key string) string { + keyParts := strings.Split(key, "/") + return keyParts[0] + "/" + strings.TrimPrefix(keyParts[1], "alertmanager-") +} + +func alertmanagerKeyToStatefulSetKey(key string) string { + keyParts := strings.Split(key, "/") + return keyParts[0] + "/alertmanager-" + keyParts[1] +} + +func (c *Operator) handleAlertmanagerAdd(obj interface{}) { + key, ok := c.keyFunc(obj) + if !ok { + return + } + + level.Debug(c.logger).Log("msg", "Alertmanager added", "key", key) + c.triggerByCounter.WithLabelValues(monitoringv1.AlertmanagersKind, "add").Inc() + c.enqueue(key) +} + +func (c *Operator) handleAlertmanagerDelete(obj interface{}) { + key, ok := c.keyFunc(obj) + if !ok { + return + } + + level.Debug(c.logger).Log("msg", "Alertmanager deleted", "key", key) + c.triggerByCounter.WithLabelValues(monitoringv1.AlertmanagersKind, "delete").Inc() + c.enqueue(key) +} + +func (c *Operator) handleAlertmanagerUpdate(old, cur interface{}) { + key, ok := c.keyFunc(cur) + if !ok { + return + } + + level.Debug(c.logger).Log("msg", "Alertmanager updated", "key", key) + c.triggerByCounter.WithLabelValues(monitoringv1.AlertmanagersKind, "update").Inc() + c.enqueue(key) +} + +func (c *Operator) handleStatefulSetDelete(obj interface{}) { + if a := c.alertmanagerForStatefulSet(obj); a != nil { + c.enqueue(a) + } +} + +func (c *Operator) handleStatefulSetAdd(obj interface{}) { + if a := c.alertmanagerForStatefulSet(obj); a != nil { + c.enqueue(a) + } +} + +func (c *Operator) handleStatefulSetUpdate(oldo, curo interface{}) { + old := oldo.(*appsv1.StatefulSet) + cur := curo.(*appsv1.StatefulSet) + + level.Debug(c.logger).Log("msg", "update handler", "old", old.ResourceVersion, "cur", cur.ResourceVersion) + + // Periodic resync may resend the deployment without changes in-between. + // Also breaks loops created by updating the resource ourselves. + if old.ResourceVersion == cur.ResourceVersion { + return + } + + // Wake up Alertmanager resource the deployment belongs to. + if a := c.alertmanagerForStatefulSet(cur); a != nil { + c.enqueue(a) + } +} + +func (c *Operator) sync(key string) error { + obj, exists, err := c.alrtInf.GetIndexer().GetByKey(key) + if err != nil { + return err + } + if !exists { + // TODO(fabxc): we want to do server side deletion due to the + // variety of resources we create. + // Doing so just based on the deletion event is not reliable, so + // we have to garbage collect the controller-created resources + // in some other way. + // + // Let's rely on the index key matching that of the created + // configmap and replica + // set for now. This does not work if we delete Alertmanager + // resources as the + // controller is not running – that could be solved via garbage + // collection later. + return c.destroyAlertmanager(key) + } + + am := obj.(*monitoringv1.Alertmanager) + am = am.DeepCopy() + am.APIVersion = monitoringv1.SchemeGroupVersion.String() + am.Kind = monitoringv1.AlertmanagersKind + + if am.Spec.Paused { + return nil + } + + level.Info(c.logger).Log("msg", "sync alertmanager", "key", key) + + // Create governing service if it doesn't exist. + svcClient := c.kclient.Core().Services(am.Namespace) + if err = k8sutil.CreateOrUpdateService(svcClient, makeStatefulSetService(am, c.config)); err != nil { + return errors.Wrap(err, "synchronizing governing service failed") + } + + ssetClient := c.kclient.AppsV1beta2().StatefulSets(am.Namespace) + // Ensure we have a StatefulSet running Alertmanager deployed. + obj, exists, err = c.ssetInf.GetIndexer().GetByKey(alertmanagerKeyToStatefulSetKey(key)) + if err != nil { + return errors.Wrap(err, "retrieving statefulset failed") + } + + if !exists { + sset, err := makeStatefulSet(am, nil, c.config) + if err != nil { + return errors.Wrap(err, "making the statefulset, to create, failed") + } + if _, err := ssetClient.Create(sset); err != nil { + return errors.Wrap(err, "creating statefulset failed") + } + return nil + } + + sset, err := makeStatefulSet(am, obj.(*appsv1.StatefulSet), c.config) + if err != nil { + return errors.Wrap(err, "making the statefulset, to update, failed") + } + + _, err = ssetClient.Update(sset) + sErr, ok := err.(*apierrors.StatusError) + + if ok && sErr.ErrStatus.Code == 422 && sErr.ErrStatus.Reason == metav1.StatusReasonInvalid { + level.Debug(c.logger).Log("msg", "resolving illegal update of Alertmanager StatefulSet") + propagationPolicy := metav1.DeletePropagationForeground + if err := ssetClient.Delete(sset.GetName(), &metav1.DeleteOptions{PropagationPolicy: &propagationPolicy}); err != nil { + return errors.Wrap(err, "failed to delete StatefulSet to avoid forbidden action") + } + return nil + } + + if err != nil { + return errors.Wrap(err, "updating StatefulSet failed") + } + + return nil +} + +func ListOptions(name string) metav1.ListOptions { + return metav1.ListOptions{ + LabelSelector: fields.SelectorFromSet(fields.Set(map[string]string{ + "app": "alertmanager", + "alertmanager": name, + })).String(), + } +} + +func AlertmanagerStatus(kclient kubernetes.Interface, a *monitoringv1.Alertmanager) (*monitoringv1.AlertmanagerStatus, []v1.Pod, error) { + res := &monitoringv1.AlertmanagerStatus{Paused: a.Spec.Paused} + + pods, err := kclient.Core().Pods(a.Namespace).List(ListOptions(a.Name)) + if err != nil { + return nil, nil, errors.Wrap(err, "retrieving pods of failed") + } + sset, err := kclient.AppsV1beta2().StatefulSets(a.Namespace).Get(statefulSetNameFromAlertmanagerName(a.Name), metav1.GetOptions{}) + if err != nil { + return nil, nil, errors.Wrap(err, "retrieving stateful set failed") + } + + res.Replicas = int32(len(pods.Items)) + + var oldPods []v1.Pod + for _, pod := range pods.Items { + ready, err := k8sutil.PodRunningAndReady(pod) + if err != nil { + return nil, nil, errors.Wrap(err, "cannot determine pod ready state") + } + if ready { + res.AvailableReplicas++ + // TODO(fabxc): detect other fields of the pod template + // that are mutable. + if needsUpdate(&pod, sset.Spec.Template) { + oldPods = append(oldPods, pod) + } else { + res.UpdatedReplicas++ + } + continue + } + res.UnavailableReplicas++ + } + + return res, oldPods, nil +} + +func needsUpdate(pod *v1.Pod, tmpl v1.PodTemplateSpec) bool { + c1 := pod.Spec.Containers[0] + c2 := tmpl.Spec.Containers[0] + + if c1.Image != c2.Image { + return true + } + + if !reflect.DeepEqual(c1.Args, c2.Args) { + return true + } + + return false +} + +// TODO(brancz): Remove this function once Kubernetes 1.7 compatibility is +// dropped. +// Starting with Kubernetes 1.8 OwnerReferences are properly handled for CRDs. +func (c *Operator) destroyAlertmanager(key string) error { + ssetKey := alertmanagerKeyToStatefulSetKey(key) + obj, exists, err := c.ssetInf.GetStore().GetByKey(ssetKey) + if err != nil { + return errors.Wrap(err, "retrieving statefulset from cache failed") + } + if !exists { + return nil + } + sset := obj.(*appsv1.StatefulSet) + *sset.Spec.Replicas = 0 + + // Update the replica count to 0 and wait for all pods to be deleted. + ssetClient := c.kclient.AppsV1beta2().StatefulSets(sset.Namespace) + + if _, err := ssetClient.Update(sset); err != nil { + return errors.Wrap(err, "updating statefulset for scale-down failed") + } + + podClient := c.kclient.Core().Pods(sset.Namespace) + + // TODO(fabxc): temporary solution until StatefulSet status provides + // necessary info to know whether scale-down completed. + for { + pods, err := podClient.List(ListOptions(alertmanagerNameFromStatefulSetName(sset.Name))) + if err != nil { + return errors.Wrap(err, "retrieving pods of statefulset failed") + } + if len(pods.Items) == 0 { + break + } + time.Sleep(50 * time.Millisecond) + } + + // StatefulSet scaled down, we can delete it. + if err := ssetClient.Delete(sset.Name, nil); err != nil { + return errors.Wrap(err, "deleting statefulset failed") + } + + return nil +} + +func (c *Operator) createCRDs() error { + crds := []*extensionsobj.CustomResourceDefinition{ + k8sutil.NewCustomResourceDefinition(c.config.CrdKinds.Alertmanager, c.config.CrdGroup, c.config.Labels.LabelsMap, c.config.EnableValidation), + } + + crdClient := c.crdclient.ApiextensionsV1beta1().CustomResourceDefinitions() + + for _, crd := range crds { + oldCRD, err := crdClient.Get(crd.Name, metav1.GetOptions{}) + if err != nil && !apierrors.IsNotFound(err) { + return errors.Wrapf(err, "getting CRD: %s", crd.Spec.Names.Kind) + } + if apierrors.IsNotFound(err) { + if _, err := crdClient.Create(crd); err != nil { + return errors.Wrapf(err, "creating CRD: %s", crd.Spec.Names.Kind) + } + level.Info(c.logger).Log("msg", "CRD created", "crd", crd.Spec.Names.Kind) + } + if err == nil { + crd.ResourceVersion = oldCRD.ResourceVersion + if _, err := crdClient.Update(crd); err != nil { + return errors.Wrapf(err, "creating CRD: %s", crd.Spec.Names.Kind) + } + level.Info(c.logger).Log("msg", "CRD updated", "crd", crd.Spec.Names.Kind) + } + } + + crdListFuncs := []struct { + name string + listFunc func(opts metav1.ListOptions) (runtime.Object, error) + }{ + { + "Alertmanager", + listwatch.MultiNamespaceListerWatcher(c.config.Namespaces, func(namespace string) cache.ListerWatcher { + return &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + return c.mclient.MonitoringV1().Alertmanagers(namespace).List(options) + }, + } + }).List, + }, + } + + for _, crdListFunc := range crdListFuncs { + err := k8sutil.WaitForCRDReady(crdListFunc.listFunc) + if err != nil { + return errors.Wrapf(err, "waiting for %v crd failed", crdListFunc.name) + } + } + + return nil +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/alertmanager/statefulset.go b/vendor/github.com/coreos/prometheus-operator/pkg/alertmanager/statefulset.go new file mode 100644 index 0000000000..2d2ae3578c --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/alertmanager/statefulset.go @@ -0,0 +1,509 @@ +// Copyright 2016 The prometheus-operator 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 alertmanager + +import ( + "fmt" + "net/url" + "path" + "strings" + + appsv1 "k8s.io/api/apps/v1beta2" + "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/resource" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/intstr" + + "github.com/blang/semver" + monitoringv1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + "github.com/coreos/prometheus-operator/pkg/k8sutil" + "github.com/pkg/errors" +) + +const ( + governingServiceName = "alertmanager-operated" + defaultVersion = "v0.15.3" + defaultRetention = "120h" + secretsDir = "/etc/alertmanager/secrets/" + configmapsDir = "/etc/alertmanager/configmaps/" + alertmanagerConfDir = "/etc/alertmanager/config" + alertmanagerConfFile = alertmanagerConfDir + "/alertmanager.yaml" + alertmanagerStorageDir = "/alertmanager" +) + +var ( + minReplicas int32 = 1 + probeTimeoutSeconds int32 = 3 +) + +func makeStatefulSet(am *monitoringv1.Alertmanager, old *appsv1.StatefulSet, config Config) (*appsv1.StatefulSet, error) { + // TODO(fabxc): is this the right point to inject defaults? + // Ideally we would do it before storing but that's currently not possible. + // Potentially an update handler on first insertion. + + if am.Spec.BaseImage == "" { + am.Spec.BaseImage = config.AlertmanagerDefaultBaseImage + } + if am.Spec.Version == "" { + am.Spec.Version = defaultVersion + } + if am.Spec.Replicas == nil { + am.Spec.Replicas = &minReplicas + } + intZero := int32(0) + if am.Spec.Replicas != nil && *am.Spec.Replicas < 0 { + am.Spec.Replicas = &intZero + } + if am.Spec.Retention == "" { + am.Spec.Retention = defaultRetention + } + if am.Spec.Resources.Requests == nil { + am.Spec.Resources.Requests = v1.ResourceList{} + } + if _, ok := am.Spec.Resources.Requests[v1.ResourceMemory]; !ok { + am.Spec.Resources.Requests[v1.ResourceMemory] = resource.MustParse("200Mi") + } + + spec, err := makeStatefulSetSpec(am, config) + if err != nil { + return nil, err + } + + boolTrue := true + statefulset := &appsv1.StatefulSet{ + ObjectMeta: metav1.ObjectMeta{ + Name: prefixedName(am.Name), + Labels: config.Labels.Merge(am.ObjectMeta.Labels), + Annotations: am.ObjectMeta.Annotations, + OwnerReferences: []metav1.OwnerReference{ + { + APIVersion: am.APIVersion, + BlockOwnerDeletion: &boolTrue, + Controller: &boolTrue, + Kind: am.Kind, + Name: am.Name, + UID: am.UID, + }, + }, + }, + Spec: *spec, + } + + if am.Spec.ImagePullSecrets != nil && len(am.Spec.ImagePullSecrets) > 0 { + statefulset.Spec.Template.Spec.ImagePullSecrets = am.Spec.ImagePullSecrets + } + + storageSpec := am.Spec.Storage + if storageSpec == nil { + statefulset.Spec.Template.Spec.Volumes = append(statefulset.Spec.Template.Spec.Volumes, v1.Volume{ + Name: volumeName(am.Name), + VolumeSource: v1.VolumeSource{ + EmptyDir: &v1.EmptyDirVolumeSource{}, + }, + }) + } else if storageSpec.EmptyDir != nil { + emptyDir := storageSpec.EmptyDir + statefulset.Spec.Template.Spec.Volumes = append(statefulset.Spec.Template.Spec.Volumes, v1.Volume{ + Name: volumeName(am.Name), + VolumeSource: v1.VolumeSource{ + EmptyDir: emptyDir, + }, + }) + } else { + pvcTemplate := storageSpec.VolumeClaimTemplate + if pvcTemplate.Name == "" { + pvcTemplate.Name = volumeName(am.Name) + } + pvcTemplate.Spec.AccessModes = []v1.PersistentVolumeAccessMode{v1.ReadWriteOnce} + pvcTemplate.Spec.Resources = storageSpec.VolumeClaimTemplate.Spec.Resources + pvcTemplate.Spec.Selector = storageSpec.VolumeClaimTemplate.Spec.Selector + statefulset.Spec.VolumeClaimTemplates = append(statefulset.Spec.VolumeClaimTemplates, pvcTemplate) + } + + if old != nil { + statefulset.Annotations = old.Annotations + } + + return statefulset, nil +} + +func makeStatefulSetService(p *monitoringv1.Alertmanager, config Config) *v1.Service { + svc := &v1.Service{ + ObjectMeta: metav1.ObjectMeta{ + Name: governingServiceName, + Labels: config.Labels.Merge(map[string]string{ + "operated-alertmanager": "true", + }), + OwnerReferences: []metav1.OwnerReference{ + metav1.OwnerReference{ + Name: p.GetName(), + Kind: p.Kind, + APIVersion: p.APIVersion, + UID: p.GetUID(), + }, + }, + }, + Spec: v1.ServiceSpec{ + ClusterIP: "None", + Ports: []v1.ServicePort{ + { + Name: "web", + Port: 9093, + TargetPort: intstr.FromInt(9093), + Protocol: v1.ProtocolTCP, + }, + { + Name: "mesh", + Port: 6783, + TargetPort: intstr.FromInt(6783), + Protocol: v1.ProtocolTCP, + }, + }, + Selector: map[string]string{ + "app": "alertmanager", + }, + }, + } + return svc +} + +func makeStatefulSetSpec(a *monitoringv1.Alertmanager, config Config) (*appsv1.StatefulSetSpec, error) { + // Before editing 'a' create deep copy, to prevent side effects. For more + // details see https://github.com/coreos/prometheus-operator/issues/1659 + a = a.DeepCopy() + + // Version is used by default. + // If the tag is specified, we use the tag to identify the container image. + // If the sha is specified, we use the sha to identify the container image, + // as it has even stronger immutable guarantees to identify the image. + image := fmt.Sprintf("%s:%s", a.Spec.BaseImage, a.Spec.Version) + if a.Spec.Tag != "" { + image = fmt.Sprintf("%s:%s", a.Spec.BaseImage, a.Spec.Tag) + } + if a.Spec.SHA != "" { + image = fmt.Sprintf("%s@sha256:%s", a.Spec.BaseImage, a.Spec.SHA) + } + if a.Spec.Image != nil && *a.Spec.Image != "" { + image = *a.Spec.Image + } + + versionStr := strings.TrimLeft(a.Spec.Version, "v") + + version, err := semver.Parse(versionStr) + if err != nil { + return nil, errors.Wrap(err, "failed to parse alertmanager version") + } + + amArgs := []string{ + fmt.Sprintf("--config.file=%s", alertmanagerConfFile), + fmt.Sprintf("--cluster.listen-address=[$(POD_IP)]:%d", 6783), + fmt.Sprintf("--storage.path=%s", alertmanagerStorageDir), + fmt.Sprintf("--data.retention=%s", a.Spec.Retention), + } + + if a.Spec.ListenLocal { + amArgs = append(amArgs, "--web.listen-address=127.0.0.1:9093") + } else { + amArgs = append(amArgs, "--web.listen-address=:9093") + } + + if a.Spec.ExternalURL != "" { + amArgs = append(amArgs, "--web.external-url="+a.Spec.ExternalURL) + } + + webRoutePrefix := "/" + if a.Spec.RoutePrefix != "" { + webRoutePrefix = a.Spec.RoutePrefix + } + amArgs = append(amArgs, fmt.Sprintf("--web.route-prefix=%v", webRoutePrefix)) + + if a.Spec.LogLevel != "" && a.Spec.LogLevel != "info" { + amArgs = append(amArgs, fmt.Sprintf("--log.level=%s", a.Spec.LogLevel)) + } + + localReloadURL := &url.URL{ + Scheme: "http", + Host: config.LocalHost + ":9093", + Path: path.Clean(webRoutePrefix + "/-/reload"), + } + + probeHandler := v1.Handler{ + HTTPGet: &v1.HTTPGetAction{ + Path: path.Clean(webRoutePrefix + "/api/v1/status"), + Port: intstr.FromString("web"), + }, + } + + var livenessProbe *v1.Probe + var readinessProbe *v1.Probe + if !a.Spec.ListenLocal { + livenessProbe = &v1.Probe{ + Handler: probeHandler, + TimeoutSeconds: probeTimeoutSeconds, + FailureThreshold: 10, + } + + readinessProbe = &v1.Probe{ + Handler: probeHandler, + InitialDelaySeconds: 3, + TimeoutSeconds: 3, + PeriodSeconds: 5, + FailureThreshold: 10, + } + } + + podAnnotations := map[string]string{} + podLabels := map[string]string{} + if a.Spec.PodMetadata != nil { + if a.Spec.PodMetadata.Labels != nil { + for k, v := range a.Spec.PodMetadata.Labels { + podLabels[k] = v + } + } + if a.Spec.PodMetadata.Annotations != nil { + for k, v := range a.Spec.PodMetadata.Annotations { + podAnnotations[k] = v + } + } + } + podLabels["app"] = "alertmanager" + podLabels["alertmanager"] = a.Name + + for i := int32(0); i < *a.Spec.Replicas; i++ { + amArgs = append(amArgs, fmt.Sprintf("--cluster.peer=%s-%d.%s.%s.svc:6783", prefixedName(a.Name), i, governingServiceName, a.Namespace)) + } + + for _, peer := range a.Spec.AdditionalPeers { + amArgs = append(amArgs, fmt.Sprintf("--cluster.peer=%s", peer)) + } + + ports := []v1.ContainerPort{ + { + Name: "mesh", + ContainerPort: 6783, + Protocol: v1.ProtocolTCP, + }, + } + if !a.Spec.ListenLocal { + ports = append([]v1.ContainerPort{ + { + Name: "web", + ContainerPort: 9093, + Protocol: v1.ProtocolTCP, + }, + }, ports...) + } + + var securityContext *v1.PodSecurityContext = nil + if a.Spec.SecurityContext != nil { + securityContext = a.Spec.SecurityContext + } + + // Adjust Alertmanager command line args to specified AM version + switch version.Major { + case 0: + if version.Minor < 15 { + for i := range amArgs { + // below Alertmanager v0.15.0 peer address port specification is not necessary + if strings.Contains(amArgs[i], "--cluster.peer") { + amArgs[i] = strings.TrimSuffix(amArgs[i], ":6783") + } + + // below Alertmanager v0.15.0 high availability flags are prefixed with 'mesh' instead of 'cluster' + amArgs[i] = strings.Replace(amArgs[i], "--cluster.", "--mesh.", 1) + } + } + if version.Minor < 13 { + for i := range amArgs { + // below Alertmanager v0.13.0 all flags are with single dash. + amArgs[i] = strings.Replace(amArgs[i], "--", "-", 1) + } + } + if version.Minor < 7 { + // below Alertmanager v0.7.0 the flag 'web.route-prefix' does not exist + amArgs = filter(amArgs, func(s string) bool { + return !strings.Contains(s, "web.route-prefix") + }) + } + default: + return nil, errors.Errorf("unsupported Alertmanager major version %s", version) + } + + volumes := []v1.Volume{ + { + Name: "config-volume", + VolumeSource: v1.VolumeSource{ + Secret: &v1.SecretVolumeSource{ + SecretName: configSecretName(a.Name), + }, + }, + }, + } + + volName := volumeName(a.Name) + if a.Spec.Storage != nil { + if a.Spec.Storage.VolumeClaimTemplate.Name != "" { + volName = a.Spec.Storage.VolumeClaimTemplate.Name + } + } + + amVolumeMounts := []v1.VolumeMount{ + { + Name: "config-volume", + MountPath: alertmanagerConfDir, + }, + { + Name: volName, + MountPath: alertmanagerStorageDir, + SubPath: subPathForStorage(a.Spec.Storage), + }, + } + + for _, s := range a.Spec.Secrets { + volumes = append(volumes, v1.Volume{ + Name: k8sutil.SanitizeVolumeName("secret-" + s), + VolumeSource: v1.VolumeSource{ + Secret: &v1.SecretVolumeSource{ + SecretName: s, + }, + }, + }) + amVolumeMounts = append(amVolumeMounts, v1.VolumeMount{ + Name: k8sutil.SanitizeVolumeName("secret-" + s), + ReadOnly: true, + MountPath: secretsDir + s, + }) + } + + for _, c := range a.Spec.ConfigMaps { + volumes = append(volumes, v1.Volume{ + Name: k8sutil.SanitizeVolumeName("configmap-" + c), + VolumeSource: v1.VolumeSource{ + ConfigMap: &v1.ConfigMapVolumeSource{ + LocalObjectReference: v1.LocalObjectReference{ + Name: c, + }, + }, + }, + }) + amVolumeMounts = append(amVolumeMounts, v1.VolumeMount{ + Name: k8sutil.SanitizeVolumeName("configmap-" + c), + ReadOnly: true, + MountPath: configmapsDir + c, + }) + } + + terminationGracePeriod := int64(0) + finalLabels := config.Labels.Merge(podLabels) + return &appsv1.StatefulSetSpec{ + ServiceName: governingServiceName, + Replicas: a.Spec.Replicas, + UpdateStrategy: appsv1.StatefulSetUpdateStrategy{ + Type: appsv1.RollingUpdateStatefulSetStrategyType, + }, + Selector: &metav1.LabelSelector{ + MatchLabels: finalLabels, + }, + Template: v1.PodTemplateSpec{ + ObjectMeta: metav1.ObjectMeta{ + Labels: finalLabels, + Annotations: podAnnotations, + }, + Spec: v1.PodSpec{ + NodeSelector: a.Spec.NodeSelector, + PriorityClassName: a.Spec.PriorityClassName, + TerminationGracePeriodSeconds: &terminationGracePeriod, + Containers: append([]v1.Container{ + { + Args: amArgs, + Name: "alertmanager", + Image: image, + Ports: ports, + VolumeMounts: amVolumeMounts, + LivenessProbe: livenessProbe, + ReadinessProbe: readinessProbe, + Resources: a.Spec.Resources, + Env: []v1.EnvVar{ + { + // Necessary for '--cluster.listen-address' flag + Name: "POD_IP", + ValueFrom: &v1.EnvVarSource{ + FieldRef: &v1.ObjectFieldSelector{ + FieldPath: "status.podIP", + }, + }, + }, + }, + }, { + Name: "config-reloader", + Image: config.ConfigReloaderImage, + Args: []string{ + fmt.Sprintf("-webhook-url=%s", localReloadURL), + fmt.Sprintf("-volume-dir=%s", alertmanagerConfDir), + }, + VolumeMounts: []v1.VolumeMount{ + { + Name: "config-volume", + ReadOnly: true, + MountPath: alertmanagerConfDir, + }, + }, + Resources: v1.ResourceRequirements{ + Limits: v1.ResourceList{ + v1.ResourceCPU: resource.MustParse("50m"), + v1.ResourceMemory: resource.MustParse("10Mi"), + }, + }, + }, + }, a.Spec.Containers...), + Volumes: volumes, + ServiceAccountName: a.Spec.ServiceAccountName, + SecurityContext: securityContext, + Tolerations: a.Spec.Tolerations, + Affinity: a.Spec.Affinity, + }, + }, + }, nil +} + +func configSecretName(name string) string { + return prefixedName(name) +} + +func volumeName(name string) string { + return fmt.Sprintf("%s-db", prefixedName(name)) +} + +func prefixedName(name string) string { + return fmt.Sprintf("alertmanager-%s", name) +} + +func subPathForStorage(s *monitoringv1.StorageSpec) string { + if s == nil { + return "" + } + + return "alertmanager-db" +} + +func filter(strings []string, f func(string) bool) []string { + filteredStrings := make([]string, 0) + for _, s := range strings { + if f(s) { + filteredStrings = append(filteredStrings, s) + } + } + return filteredStrings +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/api/api.go b/vendor/github.com/coreos/prometheus-operator/pkg/api/api.go new file mode 100644 index 0000000000..d29da40a43 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/api/api.go @@ -0,0 +1,123 @@ +// Copyright 2016 The prometheus-operator 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 api + +import ( + "encoding/json" + "net/http" + "regexp" + + "github.com/go-kit/kit/log" + "github.com/pkg/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/kubernetes" + + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + monitoringclient "github.com/coreos/prometheus-operator/pkg/client/versioned" + "github.com/coreos/prometheus-operator/pkg/k8sutil" + "github.com/coreos/prometheus-operator/pkg/prometheus" +) + +type API struct { + kclient *kubernetes.Clientset + mclient monitoringclient.Interface + logger log.Logger +} + +func New(conf prometheus.Config, l log.Logger) (*API, error) { + cfg, err := k8sutil.NewClusterConfig(conf.Host, conf.TLSInsecure, &conf.TLSConfig) + if err != nil { + return nil, errors.Wrap(err, "instantiating cluster config failed") + } + + kclient, err := kubernetes.NewForConfig(cfg) + if err != nil { + return nil, errors.Wrap(err, "instantiating kubernetes client failed") + } + + mclient, err := monitoringclient.NewForConfig(cfg) + if err != nil { + return nil, errors.Wrap(err, "instantiating monitoring client failed") + } + + return &API{ + kclient: kclient, + mclient: mclient, + logger: l, + }, nil +} + +var ( + prometheusRoute = regexp.MustCompile("/apis/monitoring.coreos.com/" + v1.Version + "/namespaces/(.*)/prometheuses/(.*)/status") +) + +func (api *API) Register(mux *http.ServeMux) { + mux.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) { + if prometheusRoute.MatchString(req.URL.Path) { + api.prometheusStatus(w, req) + } else { + w.WriteHeader(404) + } + }) +} + +type objectReference struct { + name string + namespace string +} + +func parsePrometheusStatusUrl(path string) objectReference { + matches := prometheusRoute.FindAllStringSubmatch(path, -1) + ns := "" + name := "" + if len(matches) == 1 { + if len(matches[0]) == 3 { + ns = matches[0][1] + name = matches[0][2] + } + } + + return objectReference{ + name: name, + namespace: ns, + } +} + +func (api *API) prometheusStatus(w http.ResponseWriter, req *http.Request) { + or := parsePrometheusStatusUrl(req.URL.Path) + + p, err := api.mclient.MonitoringV1().Prometheuses(or.namespace).Get(or.name, metav1.GetOptions{}) + if err != nil { + if k8sutil.IsResourceNotFoundError(err) { + w.WriteHeader(404) + } + api.logger.Log("error", err) + return + } + + p.Status, _, err = prometheus.PrometheusStatus(api.kclient, p) + if err != nil { + api.logger.Log("error", err) + } + + b, err := json.Marshal(p) + if err != nil { + api.logger.Log("error", err) + return + } + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(200) + w.Write(b) +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/apis/monitoring/register.go b/vendor/github.com/coreos/prometheus-operator/pkg/apis/monitoring/register.go new file mode 100644 index 0000000000..a9914fb1a8 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/apis/monitoring/register.go @@ -0,0 +1,19 @@ +// Copyright 2018 The prometheus-operator 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 monitoring + +const ( + GroupName = "monitoring.coreos.com" +) diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1/crd_kinds.go b/vendor/github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1/crd_kinds.go new file mode 100644 index 0000000000..8e3ab879e4 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1/crd_kinds.go @@ -0,0 +1,81 @@ +// Copyright 2018 The prometheus-operator 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 v1 + +import ( + "fmt" + "strings" +) + +type CrdKind struct { + Kind string + Plural string + SpecName string +} + +type CrdKinds struct { + KindsString string + Prometheus CrdKind + Alertmanager CrdKind + ServiceMonitor CrdKind + PrometheusRule CrdKind +} + +var DefaultCrdKinds = CrdKinds{ + KindsString: "", + Prometheus: CrdKind{Plural: PrometheusName, Kind: PrometheusesKind, SpecName: "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.Prometheus"}, + ServiceMonitor: CrdKind{Plural: ServiceMonitorName, Kind: ServiceMonitorsKind, SpecName: "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.ServiceMonitor"}, + Alertmanager: CrdKind{Plural: AlertmanagerName, Kind: AlertmanagersKind, SpecName: "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.Alertmanager"}, + PrometheusRule: CrdKind{Plural: PrometheusRuleName, Kind: PrometheusRuleKind, SpecName: "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.PrometheusRule"}, +} + +// Implement the flag.Value interface +func (crdkinds *CrdKinds) String() string { + return crdkinds.KindsString +} + +// Set Implement the flag.Set interface +func (crdkinds *CrdKinds) Set(value string) error { + *crdkinds = DefaultCrdKinds + if value == "" { + value = fmt.Sprintf("%s=%s:%s,%s=%s:%s,%s=%s:%s,%s=%s:%s", + PrometheusKindKey, PrometheusesKind, PrometheusName, + AlertManagerKindKey, AlertmanagersKind, AlertmanagerName, + ServiceMonitorKindKey, ServiceMonitorsKind, ServiceMonitorName, + PrometheusRuleKindKey, PrometheusRuleKind, PrometheusRuleName, + ) + } + splited := strings.Split(value, ",") + for _, pair := range splited { + sp := strings.Split(pair, "=") + kind := strings.Split(sp[1], ":") + crdKind := CrdKind{Plural: kind[1], Kind: kind[0]} + switch kindKey := sp[0]; kindKey { + case PrometheusKindKey: + (*crdkinds).Prometheus = crdKind + case ServiceMonitorKindKey: + (*crdkinds).ServiceMonitor = crdKind + case AlertManagerKindKey: + (*crdkinds).Alertmanager = crdKind + case PrometheusRuleKindKey: + (*crdkinds).PrometheusRule = crdKind + default: + fmt.Printf("Warning: unknown kind: %s... ignoring", kindKey) + } + + } + (*crdkinds).KindsString = value + return nil +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1/doc.go b/vendor/github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1/doc.go new file mode 100644 index 0000000000..64c4725273 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1/doc.go @@ -0,0 +1,18 @@ +// Copyright 2017 The prometheus-operator 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. + +// +k8s:deepcopy-gen=package +// +groupName=monitoring.coreos.com + +package v1 diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1/openapi_generated.go b/vendor/github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1/openapi_generated.go new file mode 100644 index 0000000000..bf4f6aeaf5 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1/openapi_generated.go @@ -0,0 +1,13802 @@ +// +build !ignore_autogenerated + +// Copyright 2018 The prometheus-operator 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 openapi-gen. DO NOT EDIT. + +// This file was autogenerated by openapi-gen. Do not edit it manually! + +package v1 + +import ( + spec "github.com/go-openapi/spec" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + common "k8s.io/kube-openapi/pkg/common" +) + +func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition { + return map[string]common.OpenAPIDefinition{ + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.APIServerConfig": schema_pkg_apis_monitoring_v1_APIServerConfig(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.AlertingSpec": schema_pkg_apis_monitoring_v1_AlertingSpec(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.Alertmanager": schema_pkg_apis_monitoring_v1_Alertmanager(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.AlertmanagerEndpoints": schema_pkg_apis_monitoring_v1_AlertmanagerEndpoints(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.AlertmanagerList": schema_pkg_apis_monitoring_v1_AlertmanagerList(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.AlertmanagerSpec": schema_pkg_apis_monitoring_v1_AlertmanagerSpec(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.AlertmanagerStatus": schema_pkg_apis_monitoring_v1_AlertmanagerStatus(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.BasicAuth": schema_pkg_apis_monitoring_v1_BasicAuth(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.Endpoint": schema_pkg_apis_monitoring_v1_Endpoint(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.NamespaceSelector": schema_pkg_apis_monitoring_v1_NamespaceSelector(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.Prometheus": schema_pkg_apis_monitoring_v1_Prometheus(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.PrometheusList": schema_pkg_apis_monitoring_v1_PrometheusList(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.PrometheusRule": schema_pkg_apis_monitoring_v1_PrometheusRule(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.PrometheusRuleList": schema_pkg_apis_monitoring_v1_PrometheusRuleList(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.PrometheusRuleSpec": schema_pkg_apis_monitoring_v1_PrometheusRuleSpec(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.PrometheusSpec": schema_pkg_apis_monitoring_v1_PrometheusSpec(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.PrometheusStatus": schema_pkg_apis_monitoring_v1_PrometheusStatus(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.QuerySpec": schema_pkg_apis_monitoring_v1_QuerySpec(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.QueueConfig": schema_pkg_apis_monitoring_v1_QueueConfig(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.RelabelConfig": schema_pkg_apis_monitoring_v1_RelabelConfig(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.RemoteReadSpec": schema_pkg_apis_monitoring_v1_RemoteReadSpec(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.RemoteWriteSpec": schema_pkg_apis_monitoring_v1_RemoteWriteSpec(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.Rule": schema_pkg_apis_monitoring_v1_Rule(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.RuleGroup": schema_pkg_apis_monitoring_v1_RuleGroup(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.ServiceMonitor": schema_pkg_apis_monitoring_v1_ServiceMonitor(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.ServiceMonitorList": schema_pkg_apis_monitoring_v1_ServiceMonitorList(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.ServiceMonitorSpec": schema_pkg_apis_monitoring_v1_ServiceMonitorSpec(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.StorageSpec": schema_pkg_apis_monitoring_v1_StorageSpec(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.TLSConfig": schema_pkg_apis_monitoring_v1_TLSConfig(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.ThanosGCSSpec": schema_pkg_apis_monitoring_v1_ThanosGCSSpec(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.ThanosS3Spec": schema_pkg_apis_monitoring_v1_ThanosS3Spec(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.ThanosSpec": schema_pkg_apis_monitoring_v1_ThanosSpec(ref), + "k8s.io/api/core/v1.AWSElasticBlockStoreVolumeSource": schema_k8sio_api_core_v1_AWSElasticBlockStoreVolumeSource(ref), + "k8s.io/api/core/v1.Affinity": schema_k8sio_api_core_v1_Affinity(ref), + "k8s.io/api/core/v1.AttachedVolume": schema_k8sio_api_core_v1_AttachedVolume(ref), + "k8s.io/api/core/v1.AvoidPods": schema_k8sio_api_core_v1_AvoidPods(ref), + "k8s.io/api/core/v1.AzureDiskVolumeSource": schema_k8sio_api_core_v1_AzureDiskVolumeSource(ref), + "k8s.io/api/core/v1.AzureFilePersistentVolumeSource": schema_k8sio_api_core_v1_AzureFilePersistentVolumeSource(ref), + "k8s.io/api/core/v1.AzureFileVolumeSource": schema_k8sio_api_core_v1_AzureFileVolumeSource(ref), + "k8s.io/api/core/v1.Binding": schema_k8sio_api_core_v1_Binding(ref), + "k8s.io/api/core/v1.CSIPersistentVolumeSource": schema_k8sio_api_core_v1_CSIPersistentVolumeSource(ref), + "k8s.io/api/core/v1.Capabilities": schema_k8sio_api_core_v1_Capabilities(ref), + "k8s.io/api/core/v1.CephFSPersistentVolumeSource": schema_k8sio_api_core_v1_CephFSPersistentVolumeSource(ref), + "k8s.io/api/core/v1.CephFSVolumeSource": schema_k8sio_api_core_v1_CephFSVolumeSource(ref), + "k8s.io/api/core/v1.CinderPersistentVolumeSource": schema_k8sio_api_core_v1_CinderPersistentVolumeSource(ref), + "k8s.io/api/core/v1.CinderVolumeSource": schema_k8sio_api_core_v1_CinderVolumeSource(ref), + "k8s.io/api/core/v1.ClientIPConfig": schema_k8sio_api_core_v1_ClientIPConfig(ref), + "k8s.io/api/core/v1.ComponentCondition": schema_k8sio_api_core_v1_ComponentCondition(ref), + "k8s.io/api/core/v1.ComponentStatus": schema_k8sio_api_core_v1_ComponentStatus(ref), + "k8s.io/api/core/v1.ComponentStatusList": schema_k8sio_api_core_v1_ComponentStatusList(ref), + "k8s.io/api/core/v1.ConfigMap": schema_k8sio_api_core_v1_ConfigMap(ref), + "k8s.io/api/core/v1.ConfigMapEnvSource": schema_k8sio_api_core_v1_ConfigMapEnvSource(ref), + "k8s.io/api/core/v1.ConfigMapKeySelector": schema_k8sio_api_core_v1_ConfigMapKeySelector(ref), + "k8s.io/api/core/v1.ConfigMapList": schema_k8sio_api_core_v1_ConfigMapList(ref), + "k8s.io/api/core/v1.ConfigMapNodeConfigSource": schema_k8sio_api_core_v1_ConfigMapNodeConfigSource(ref), + "k8s.io/api/core/v1.ConfigMapProjection": schema_k8sio_api_core_v1_ConfigMapProjection(ref), + "k8s.io/api/core/v1.ConfigMapVolumeSource": schema_k8sio_api_core_v1_ConfigMapVolumeSource(ref), + "k8s.io/api/core/v1.Container": schema_k8sio_api_core_v1_Container(ref), + "k8s.io/api/core/v1.ContainerImage": schema_k8sio_api_core_v1_ContainerImage(ref), + "k8s.io/api/core/v1.ContainerPort": schema_k8sio_api_core_v1_ContainerPort(ref), + "k8s.io/api/core/v1.ContainerState": schema_k8sio_api_core_v1_ContainerState(ref), + "k8s.io/api/core/v1.ContainerStateRunning": schema_k8sio_api_core_v1_ContainerStateRunning(ref), + "k8s.io/api/core/v1.ContainerStateTerminated": schema_k8sio_api_core_v1_ContainerStateTerminated(ref), + "k8s.io/api/core/v1.ContainerStateWaiting": schema_k8sio_api_core_v1_ContainerStateWaiting(ref), + "k8s.io/api/core/v1.ContainerStatus": schema_k8sio_api_core_v1_ContainerStatus(ref), + "k8s.io/api/core/v1.DaemonEndpoint": schema_k8sio_api_core_v1_DaemonEndpoint(ref), + "k8s.io/api/core/v1.DownwardAPIProjection": schema_k8sio_api_core_v1_DownwardAPIProjection(ref), + "k8s.io/api/core/v1.DownwardAPIVolumeFile": schema_k8sio_api_core_v1_DownwardAPIVolumeFile(ref), + "k8s.io/api/core/v1.DownwardAPIVolumeSource": schema_k8sio_api_core_v1_DownwardAPIVolumeSource(ref), + "k8s.io/api/core/v1.EmptyDirVolumeSource": schema_k8sio_api_core_v1_EmptyDirVolumeSource(ref), + "k8s.io/api/core/v1.EndpointAddress": schema_k8sio_api_core_v1_EndpointAddress(ref), + "k8s.io/api/core/v1.EndpointPort": schema_k8sio_api_core_v1_EndpointPort(ref), + "k8s.io/api/core/v1.EndpointSubset": schema_k8sio_api_core_v1_EndpointSubset(ref), + "k8s.io/api/core/v1.Endpoints": schema_k8sio_api_core_v1_Endpoints(ref), + "k8s.io/api/core/v1.EndpointsList": schema_k8sio_api_core_v1_EndpointsList(ref), + "k8s.io/api/core/v1.EnvFromSource": schema_k8sio_api_core_v1_EnvFromSource(ref), + "k8s.io/api/core/v1.EnvVar": schema_k8sio_api_core_v1_EnvVar(ref), + "k8s.io/api/core/v1.EnvVarSource": schema_k8sio_api_core_v1_EnvVarSource(ref), + "k8s.io/api/core/v1.Event": schema_k8sio_api_core_v1_Event(ref), + "k8s.io/api/core/v1.EventList": schema_k8sio_api_core_v1_EventList(ref), + "k8s.io/api/core/v1.EventSeries": schema_k8sio_api_core_v1_EventSeries(ref), + "k8s.io/api/core/v1.EventSource": schema_k8sio_api_core_v1_EventSource(ref), + "k8s.io/api/core/v1.ExecAction": schema_k8sio_api_core_v1_ExecAction(ref), + "k8s.io/api/core/v1.FCVolumeSource": schema_k8sio_api_core_v1_FCVolumeSource(ref), + "k8s.io/api/core/v1.FlexPersistentVolumeSource": schema_k8sio_api_core_v1_FlexPersistentVolumeSource(ref), + "k8s.io/api/core/v1.FlexVolumeSource": schema_k8sio_api_core_v1_FlexVolumeSource(ref), + "k8s.io/api/core/v1.FlockerVolumeSource": schema_k8sio_api_core_v1_FlockerVolumeSource(ref), + "k8s.io/api/core/v1.GCEPersistentDiskVolumeSource": schema_k8sio_api_core_v1_GCEPersistentDiskVolumeSource(ref), + "k8s.io/api/core/v1.GitRepoVolumeSource": schema_k8sio_api_core_v1_GitRepoVolumeSource(ref), + "k8s.io/api/core/v1.GlusterfsVolumeSource": schema_k8sio_api_core_v1_GlusterfsVolumeSource(ref), + "k8s.io/api/core/v1.HTTPGetAction": schema_k8sio_api_core_v1_HTTPGetAction(ref), + "k8s.io/api/core/v1.HTTPHeader": schema_k8sio_api_core_v1_HTTPHeader(ref), + "k8s.io/api/core/v1.Handler": schema_k8sio_api_core_v1_Handler(ref), + "k8s.io/api/core/v1.HostAlias": schema_k8sio_api_core_v1_HostAlias(ref), + "k8s.io/api/core/v1.HostPathVolumeSource": schema_k8sio_api_core_v1_HostPathVolumeSource(ref), + "k8s.io/api/core/v1.ISCSIPersistentVolumeSource": schema_k8sio_api_core_v1_ISCSIPersistentVolumeSource(ref), + "k8s.io/api/core/v1.ISCSIVolumeSource": schema_k8sio_api_core_v1_ISCSIVolumeSource(ref), + "k8s.io/api/core/v1.KeyToPath": schema_k8sio_api_core_v1_KeyToPath(ref), + "k8s.io/api/core/v1.Lifecycle": schema_k8sio_api_core_v1_Lifecycle(ref), + "k8s.io/api/core/v1.LimitRange": schema_k8sio_api_core_v1_LimitRange(ref), + "k8s.io/api/core/v1.LimitRangeItem": schema_k8sio_api_core_v1_LimitRangeItem(ref), + "k8s.io/api/core/v1.LimitRangeList": schema_k8sio_api_core_v1_LimitRangeList(ref), + "k8s.io/api/core/v1.LimitRangeSpec": schema_k8sio_api_core_v1_LimitRangeSpec(ref), + "k8s.io/api/core/v1.List": schema_k8sio_api_core_v1_List(ref), + "k8s.io/api/core/v1.LoadBalancerIngress": schema_k8sio_api_core_v1_LoadBalancerIngress(ref), + "k8s.io/api/core/v1.LoadBalancerStatus": schema_k8sio_api_core_v1_LoadBalancerStatus(ref), + "k8s.io/api/core/v1.LocalObjectReference": schema_k8sio_api_core_v1_LocalObjectReference(ref), + "k8s.io/api/core/v1.LocalVolumeSource": schema_k8sio_api_core_v1_LocalVolumeSource(ref), + "k8s.io/api/core/v1.NFSVolumeSource": schema_k8sio_api_core_v1_NFSVolumeSource(ref), + "k8s.io/api/core/v1.Namespace": schema_k8sio_api_core_v1_Namespace(ref), + "k8s.io/api/core/v1.NamespaceList": schema_k8sio_api_core_v1_NamespaceList(ref), + "k8s.io/api/core/v1.NamespaceSpec": schema_k8sio_api_core_v1_NamespaceSpec(ref), + "k8s.io/api/core/v1.NamespaceStatus": schema_k8sio_api_core_v1_NamespaceStatus(ref), + "k8s.io/api/core/v1.Node": schema_k8sio_api_core_v1_Node(ref), + "k8s.io/api/core/v1.NodeAddress": schema_k8sio_api_core_v1_NodeAddress(ref), + "k8s.io/api/core/v1.NodeAffinity": schema_k8sio_api_core_v1_NodeAffinity(ref), + "k8s.io/api/core/v1.NodeCondition": schema_k8sio_api_core_v1_NodeCondition(ref), + "k8s.io/api/core/v1.NodeConfigSource": schema_k8sio_api_core_v1_NodeConfigSource(ref), + "k8s.io/api/core/v1.NodeConfigStatus": schema_k8sio_api_core_v1_NodeConfigStatus(ref), + "k8s.io/api/core/v1.NodeDaemonEndpoints": schema_k8sio_api_core_v1_NodeDaemonEndpoints(ref), + "k8s.io/api/core/v1.NodeList": schema_k8sio_api_core_v1_NodeList(ref), + "k8s.io/api/core/v1.NodeProxyOptions": schema_k8sio_api_core_v1_NodeProxyOptions(ref), + "k8s.io/api/core/v1.NodeResources": schema_k8sio_api_core_v1_NodeResources(ref), + "k8s.io/api/core/v1.NodeSelector": schema_k8sio_api_core_v1_NodeSelector(ref), + "k8s.io/api/core/v1.NodeSelectorRequirement": schema_k8sio_api_core_v1_NodeSelectorRequirement(ref), + "k8s.io/api/core/v1.NodeSelectorTerm": schema_k8sio_api_core_v1_NodeSelectorTerm(ref), + "k8s.io/api/core/v1.NodeSpec": schema_k8sio_api_core_v1_NodeSpec(ref), + "k8s.io/api/core/v1.NodeStatus": schema_k8sio_api_core_v1_NodeStatus(ref), + "k8s.io/api/core/v1.NodeSystemInfo": schema_k8sio_api_core_v1_NodeSystemInfo(ref), + "k8s.io/api/core/v1.ObjectFieldSelector": schema_k8sio_api_core_v1_ObjectFieldSelector(ref), + "k8s.io/api/core/v1.ObjectReference": schema_k8sio_api_core_v1_ObjectReference(ref), + "k8s.io/api/core/v1.PersistentVolume": schema_k8sio_api_core_v1_PersistentVolume(ref), + "k8s.io/api/core/v1.PersistentVolumeClaim": schema_k8sio_api_core_v1_PersistentVolumeClaim(ref), + "k8s.io/api/core/v1.PersistentVolumeClaimCondition": schema_k8sio_api_core_v1_PersistentVolumeClaimCondition(ref), + "k8s.io/api/core/v1.PersistentVolumeClaimList": schema_k8sio_api_core_v1_PersistentVolumeClaimList(ref), + "k8s.io/api/core/v1.PersistentVolumeClaimSpec": schema_k8sio_api_core_v1_PersistentVolumeClaimSpec(ref), + "k8s.io/api/core/v1.PersistentVolumeClaimStatus": schema_k8sio_api_core_v1_PersistentVolumeClaimStatus(ref), + "k8s.io/api/core/v1.PersistentVolumeClaimVolumeSource": schema_k8sio_api_core_v1_PersistentVolumeClaimVolumeSource(ref), + "k8s.io/api/core/v1.PersistentVolumeList": schema_k8sio_api_core_v1_PersistentVolumeList(ref), + "k8s.io/api/core/v1.PersistentVolumeSource": schema_k8sio_api_core_v1_PersistentVolumeSource(ref), + "k8s.io/api/core/v1.PersistentVolumeSpec": schema_k8sio_api_core_v1_PersistentVolumeSpec(ref), + "k8s.io/api/core/v1.PersistentVolumeStatus": schema_k8sio_api_core_v1_PersistentVolumeStatus(ref), + "k8s.io/api/core/v1.PhotonPersistentDiskVolumeSource": schema_k8sio_api_core_v1_PhotonPersistentDiskVolumeSource(ref), + "k8s.io/api/core/v1.Pod": schema_k8sio_api_core_v1_Pod(ref), + "k8s.io/api/core/v1.PodAffinity": schema_k8sio_api_core_v1_PodAffinity(ref), + "k8s.io/api/core/v1.PodAffinityTerm": schema_k8sio_api_core_v1_PodAffinityTerm(ref), + "k8s.io/api/core/v1.PodAntiAffinity": schema_k8sio_api_core_v1_PodAntiAffinity(ref), + "k8s.io/api/core/v1.PodAttachOptions": schema_k8sio_api_core_v1_PodAttachOptions(ref), + "k8s.io/api/core/v1.PodCondition": schema_k8sio_api_core_v1_PodCondition(ref), + "k8s.io/api/core/v1.PodDNSConfig": schema_k8sio_api_core_v1_PodDNSConfig(ref), + "k8s.io/api/core/v1.PodDNSConfigOption": schema_k8sio_api_core_v1_PodDNSConfigOption(ref), + "k8s.io/api/core/v1.PodExecOptions": schema_k8sio_api_core_v1_PodExecOptions(ref), + "k8s.io/api/core/v1.PodList": schema_k8sio_api_core_v1_PodList(ref), + "k8s.io/api/core/v1.PodLogOptions": schema_k8sio_api_core_v1_PodLogOptions(ref), + "k8s.io/api/core/v1.PodPortForwardOptions": schema_k8sio_api_core_v1_PodPortForwardOptions(ref), + "k8s.io/api/core/v1.PodProxyOptions": schema_k8sio_api_core_v1_PodProxyOptions(ref), + "k8s.io/api/core/v1.PodReadinessGate": schema_k8sio_api_core_v1_PodReadinessGate(ref), + "k8s.io/api/core/v1.PodSecurityContext": schema_k8sio_api_core_v1_PodSecurityContext(ref), + "k8s.io/api/core/v1.PodSignature": schema_k8sio_api_core_v1_PodSignature(ref), + "k8s.io/api/core/v1.PodSpec": schema_k8sio_api_core_v1_PodSpec(ref), + "k8s.io/api/core/v1.PodStatus": schema_k8sio_api_core_v1_PodStatus(ref), + "k8s.io/api/core/v1.PodStatusResult": schema_k8sio_api_core_v1_PodStatusResult(ref), + "k8s.io/api/core/v1.PodTemplate": schema_k8sio_api_core_v1_PodTemplate(ref), + "k8s.io/api/core/v1.PodTemplateList": schema_k8sio_api_core_v1_PodTemplateList(ref), + "k8s.io/api/core/v1.PodTemplateSpec": schema_k8sio_api_core_v1_PodTemplateSpec(ref), + "k8s.io/api/core/v1.PortworxVolumeSource": schema_k8sio_api_core_v1_PortworxVolumeSource(ref), + "k8s.io/api/core/v1.PreferAvoidPodsEntry": schema_k8sio_api_core_v1_PreferAvoidPodsEntry(ref), + "k8s.io/api/core/v1.PreferredSchedulingTerm": schema_k8sio_api_core_v1_PreferredSchedulingTerm(ref), + "k8s.io/api/core/v1.Probe": schema_k8sio_api_core_v1_Probe(ref), + "k8s.io/api/core/v1.ProjectedVolumeSource": schema_k8sio_api_core_v1_ProjectedVolumeSource(ref), + "k8s.io/api/core/v1.QuobyteVolumeSource": schema_k8sio_api_core_v1_QuobyteVolumeSource(ref), + "k8s.io/api/core/v1.RBDPersistentVolumeSource": schema_k8sio_api_core_v1_RBDPersistentVolumeSource(ref), + "k8s.io/api/core/v1.RBDVolumeSource": schema_k8sio_api_core_v1_RBDVolumeSource(ref), + "k8s.io/api/core/v1.RangeAllocation": schema_k8sio_api_core_v1_RangeAllocation(ref), + "k8s.io/api/core/v1.ReplicationController": schema_k8sio_api_core_v1_ReplicationController(ref), + "k8s.io/api/core/v1.ReplicationControllerCondition": schema_k8sio_api_core_v1_ReplicationControllerCondition(ref), + "k8s.io/api/core/v1.ReplicationControllerList": schema_k8sio_api_core_v1_ReplicationControllerList(ref), + "k8s.io/api/core/v1.ReplicationControllerSpec": schema_k8sio_api_core_v1_ReplicationControllerSpec(ref), + "k8s.io/api/core/v1.ReplicationControllerStatus": schema_k8sio_api_core_v1_ReplicationControllerStatus(ref), + "k8s.io/api/core/v1.ResourceFieldSelector": schema_k8sio_api_core_v1_ResourceFieldSelector(ref), + "k8s.io/api/core/v1.ResourceQuota": schema_k8sio_api_core_v1_ResourceQuota(ref), + "k8s.io/api/core/v1.ResourceQuotaList": schema_k8sio_api_core_v1_ResourceQuotaList(ref), + "k8s.io/api/core/v1.ResourceQuotaSpec": schema_k8sio_api_core_v1_ResourceQuotaSpec(ref), + "k8s.io/api/core/v1.ResourceQuotaStatus": schema_k8sio_api_core_v1_ResourceQuotaStatus(ref), + "k8s.io/api/core/v1.ResourceRequirements": schema_k8sio_api_core_v1_ResourceRequirements(ref), + "k8s.io/api/core/v1.SELinuxOptions": schema_k8sio_api_core_v1_SELinuxOptions(ref), + "k8s.io/api/core/v1.ScaleIOPersistentVolumeSource": schema_k8sio_api_core_v1_ScaleIOPersistentVolumeSource(ref), + "k8s.io/api/core/v1.ScaleIOVolumeSource": schema_k8sio_api_core_v1_ScaleIOVolumeSource(ref), + "k8s.io/api/core/v1.ScopeSelector": schema_k8sio_api_core_v1_ScopeSelector(ref), + "k8s.io/api/core/v1.ScopedResourceSelectorRequirement": schema_k8sio_api_core_v1_ScopedResourceSelectorRequirement(ref), + "k8s.io/api/core/v1.Secret": schema_k8sio_api_core_v1_Secret(ref), + "k8s.io/api/core/v1.SecretEnvSource": schema_k8sio_api_core_v1_SecretEnvSource(ref), + "k8s.io/api/core/v1.SecretKeySelector": schema_k8sio_api_core_v1_SecretKeySelector(ref), + "k8s.io/api/core/v1.SecretList": schema_k8sio_api_core_v1_SecretList(ref), + "k8s.io/api/core/v1.SecretProjection": schema_k8sio_api_core_v1_SecretProjection(ref), + "k8s.io/api/core/v1.SecretReference": schema_k8sio_api_core_v1_SecretReference(ref), + "k8s.io/api/core/v1.SecretVolumeSource": schema_k8sio_api_core_v1_SecretVolumeSource(ref), + "k8s.io/api/core/v1.SecurityContext": schema_k8sio_api_core_v1_SecurityContext(ref), + "k8s.io/api/core/v1.SerializedReference": schema_k8sio_api_core_v1_SerializedReference(ref), + "k8s.io/api/core/v1.Service": schema_k8sio_api_core_v1_Service(ref), + "k8s.io/api/core/v1.ServiceAccount": schema_k8sio_api_core_v1_ServiceAccount(ref), + "k8s.io/api/core/v1.ServiceAccountList": schema_k8sio_api_core_v1_ServiceAccountList(ref), + "k8s.io/api/core/v1.ServiceAccountTokenProjection": schema_k8sio_api_core_v1_ServiceAccountTokenProjection(ref), + "k8s.io/api/core/v1.ServiceList": schema_k8sio_api_core_v1_ServiceList(ref), + "k8s.io/api/core/v1.ServicePort": schema_k8sio_api_core_v1_ServicePort(ref), + "k8s.io/api/core/v1.ServiceProxyOptions": schema_k8sio_api_core_v1_ServiceProxyOptions(ref), + "k8s.io/api/core/v1.ServiceSpec": schema_k8sio_api_core_v1_ServiceSpec(ref), + "k8s.io/api/core/v1.ServiceStatus": schema_k8sio_api_core_v1_ServiceStatus(ref), + "k8s.io/api/core/v1.SessionAffinityConfig": schema_k8sio_api_core_v1_SessionAffinityConfig(ref), + "k8s.io/api/core/v1.StorageOSPersistentVolumeSource": schema_k8sio_api_core_v1_StorageOSPersistentVolumeSource(ref), + "k8s.io/api/core/v1.StorageOSVolumeSource": schema_k8sio_api_core_v1_StorageOSVolumeSource(ref), + "k8s.io/api/core/v1.Sysctl": schema_k8sio_api_core_v1_Sysctl(ref), + "k8s.io/api/core/v1.TCPSocketAction": schema_k8sio_api_core_v1_TCPSocketAction(ref), + "k8s.io/api/core/v1.Taint": schema_k8sio_api_core_v1_Taint(ref), + "k8s.io/api/core/v1.Toleration": schema_k8sio_api_core_v1_Toleration(ref), + "k8s.io/api/core/v1.TopologySelectorLabelRequirement": schema_k8sio_api_core_v1_TopologySelectorLabelRequirement(ref), + "k8s.io/api/core/v1.TopologySelectorTerm": schema_k8sio_api_core_v1_TopologySelectorTerm(ref), + "k8s.io/api/core/v1.TypedLocalObjectReference": schema_k8sio_api_core_v1_TypedLocalObjectReference(ref), + "k8s.io/api/core/v1.Volume": schema_k8sio_api_core_v1_Volume(ref), + "k8s.io/api/core/v1.VolumeDevice": schema_k8sio_api_core_v1_VolumeDevice(ref), + "k8s.io/api/core/v1.VolumeMount": schema_k8sio_api_core_v1_VolumeMount(ref), + "k8s.io/api/core/v1.VolumeNodeAffinity": schema_k8sio_api_core_v1_VolumeNodeAffinity(ref), + "k8s.io/api/core/v1.VolumeProjection": schema_k8sio_api_core_v1_VolumeProjection(ref), + "k8s.io/api/core/v1.VolumeSource": schema_k8sio_api_core_v1_VolumeSource(ref), + "k8s.io/api/core/v1.VsphereVirtualDiskVolumeSource": schema_k8sio_api_core_v1_VsphereVirtualDiskVolumeSource(ref), + "k8s.io/api/core/v1.WeightedPodAffinityTerm": schema_k8sio_api_core_v1_WeightedPodAffinityTerm(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.APIGroup": schema_pkg_apis_meta_v1_APIGroup(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.APIGroupList": schema_pkg_apis_meta_v1_APIGroupList(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.APIResource": schema_pkg_apis_meta_v1_APIResource(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.APIResourceList": schema_pkg_apis_meta_v1_APIResourceList(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.APIVersions": schema_pkg_apis_meta_v1_APIVersions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.CreateOptions": schema_pkg_apis_meta_v1_CreateOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.DeleteOptions": schema_pkg_apis_meta_v1_DeleteOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Duration": schema_pkg_apis_meta_v1_Duration(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.ExportOptions": schema_pkg_apis_meta_v1_ExportOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GetOptions": schema_pkg_apis_meta_v1_GetOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupKind": schema_pkg_apis_meta_v1_GroupKind(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupResource": schema_pkg_apis_meta_v1_GroupResource(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersion": schema_pkg_apis_meta_v1_GroupVersion(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionForDiscovery": schema_pkg_apis_meta_v1_GroupVersionForDiscovery(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionKind": schema_pkg_apis_meta_v1_GroupVersionKind(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionResource": schema_pkg_apis_meta_v1_GroupVersionResource(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Initializer": schema_pkg_apis_meta_v1_Initializer(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Initializers": schema_pkg_apis_meta_v1_Initializers(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.InternalEvent": schema_pkg_apis_meta_v1_InternalEvent(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector": schema_pkg_apis_meta_v1_LabelSelector(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelectorRequirement": schema_pkg_apis_meta_v1_LabelSelectorRequirement(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.List": schema_pkg_apis_meta_v1_List(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta": schema_pkg_apis_meta_v1_ListMeta(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.ListOptions": schema_pkg_apis_meta_v1_ListOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.MicroTime": schema_pkg_apis_meta_v1_MicroTime(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta": schema_pkg_apis_meta_v1_ObjectMeta(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.OwnerReference": schema_pkg_apis_meta_v1_OwnerReference(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Patch": schema_pkg_apis_meta_v1_Patch(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Preconditions": schema_pkg_apis_meta_v1_Preconditions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.RootPaths": schema_pkg_apis_meta_v1_RootPaths(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.ServerAddressByClientCIDR": schema_pkg_apis_meta_v1_ServerAddressByClientCIDR(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Status": schema_pkg_apis_meta_v1_Status(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.StatusCause": schema_pkg_apis_meta_v1_StatusCause(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.StatusDetails": schema_pkg_apis_meta_v1_StatusDetails(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Time": schema_pkg_apis_meta_v1_Time(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Timestamp": schema_pkg_apis_meta_v1_Timestamp(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.TypeMeta": schema_pkg_apis_meta_v1_TypeMeta(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.UpdateOptions": schema_pkg_apis_meta_v1_UpdateOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.WatchEvent": schema_pkg_apis_meta_v1_WatchEvent(ref), + } +} + +func schema_pkg_apis_monitoring_v1_APIServerConfig(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "APIServerConfig defines a host and auth methods to access apiserver. More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#kubernetes_sd_config", + Properties: map[string]spec.Schema{ + "host": { + SchemaProps: spec.SchemaProps{ + Description: "Host of apiserver. A valid string consisting of a hostname or IP followed by an optional port number", + Type: []string{"string"}, + Format: "", + }, + }, + "basicAuth": { + SchemaProps: spec.SchemaProps{ + Description: "BasicAuth allow an endpoint to authenticate over basic authentication", + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.BasicAuth"), + }, + }, + "bearerToken": { + SchemaProps: spec.SchemaProps{ + Description: "Bearer token for accessing apiserver.", + Type: []string{"string"}, + Format: "", + }, + }, + "bearerTokenFile": { + SchemaProps: spec.SchemaProps{ + Description: "File to read bearer token for accessing apiserver.", + Type: []string{"string"}, + Format: "", + }, + }, + "tlsConfig": { + SchemaProps: spec.SchemaProps{ + Description: "TLS Config to use for accessing apiserver.", + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.TLSConfig"), + }, + }, + }, + Required: []string{"host"}, + }, + }, + Dependencies: []string{ + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.BasicAuth", "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.TLSConfig"}, + } +} + +func schema_pkg_apis_monitoring_v1_AlertingSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "AlertingSpec defines parameters for alerting configuration of Prometheus servers.", + Properties: map[string]spec.Schema{ + "alertmanagers": { + SchemaProps: spec.SchemaProps{ + Description: "AlertmanagerEndpoints Prometheus should fire alerts against.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.AlertmanagerEndpoints"), + }, + }, + }, + }, + }, + }, + Required: []string{"alertmanagers"}, + }, + }, + Dependencies: []string{ + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.AlertmanagerEndpoints"}, + } +} + +func schema_pkg_apis_monitoring_v1_Alertmanager(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Alertmanager describes an Alertmanager cluster.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Description: "Specification of the desired behavior of the Alertmanager cluster. More info: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status", + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.AlertmanagerSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Description: "Most recent observed status of the Alertmanager cluster. Read-only. Not included when requesting from the apiserver, only from the Prometheus Operator API itself. More info: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status", + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.AlertmanagerStatus"), + }, + }, + }, + Required: []string{"spec"}, + }, + }, + Dependencies: []string{ + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.AlertmanagerSpec", "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.AlertmanagerStatus"}, + } +} + +func schema_pkg_apis_monitoring_v1_AlertmanagerEndpoints(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "AlertmanagerEndpoints defines a selection of a single Endpoints object containing alertmanager IPs to fire alerts against.", + Properties: map[string]spec.Schema{ + "namespace": { + SchemaProps: spec.SchemaProps{ + Description: "Namespace of Endpoints object.", + Type: []string{"string"}, + Format: "", + }, + }, + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name of Endpoints object in Namespace.", + Type: []string{"string"}, + Format: "", + }, + }, + "port": { + SchemaProps: spec.SchemaProps{ + Description: "Port the Alertmanager API is exposed on.", + Ref: ref("k8s.io/apimachinery/pkg/util/intstr.IntOrString"), + }, + }, + "scheme": { + SchemaProps: spec.SchemaProps{ + Description: "Scheme to use when firing alerts.", + Type: []string{"string"}, + Format: "", + }, + }, + "pathPrefix": { + SchemaProps: spec.SchemaProps{ + Description: "Prefix for the HTTP path alerts are pushed to.", + Type: []string{"string"}, + Format: "", + }, + }, + "tlsConfig": { + SchemaProps: spec.SchemaProps{ + Description: "TLS Config to use for alertmanager connection.", + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.TLSConfig"), + }, + }, + "bearerTokenFile": { + SchemaProps: spec.SchemaProps{ + Description: "BearerTokenFile to read from filesystem to use when authenticating to Alertmanager.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"namespace", "name", "port"}, + }, + }, + Dependencies: []string{ + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.TLSConfig", "k8s.io/apimachinery/pkg/util/intstr.IntOrString"}, + } +} + +func schema_pkg_apis_monitoring_v1_AlertmanagerList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "AlertmanagerList is a list of Alertmanagers.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard list metadata More info: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Description: "List of Alertmanagers", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.Alertmanager"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.Alertmanager", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_pkg_apis_monitoring_v1_AlertmanagerSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "AlertmanagerSpec is a specification of the desired behavior of the Alertmanager cluster. More info: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status", + Properties: map[string]spec.Schema{ + "podMetadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard object’s metadata. More info: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata Metadata Labels and Annotations gets propagated to the prometheus pods.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "image": { + SchemaProps: spec.SchemaProps{ + Description: "Image if specified has precedence over baseImage, tag and sha combinations. Specifying the version is still necessary to ensure the Prometheus Operator knows what version of Alertmanager is being configured.", + Type: []string{"string"}, + Format: "", + }, + }, + "version": { + SchemaProps: spec.SchemaProps{ + Description: "Version the cluster should be on.", + Type: []string{"string"}, + Format: "", + }, + }, + "tag": { + SchemaProps: spec.SchemaProps{ + Description: "Tag of Alertmanager container image to be deployed. Defaults to the value of `version`. Version is ignored if Tag is set.", + Type: []string{"string"}, + Format: "", + }, + }, + "sha": { + SchemaProps: spec.SchemaProps{ + Description: "SHA of Alertmanager container image to be deployed. Defaults to the value of `version`. Similar to a tag, but the SHA explicitly deploys an immutable container image. Version and Tag are ignored if SHA is set.", + Type: []string{"string"}, + Format: "", + }, + }, + "baseImage": { + SchemaProps: spec.SchemaProps{ + Description: "Base image that is used to deploy pods, without tag.", + Type: []string{"string"}, + Format: "", + }, + }, + "imagePullSecrets": { + SchemaProps: spec.SchemaProps{ + Description: "An optional list of references to secrets in the same namespace to use for pulling prometheus and alertmanager images from registries see http://kubernetes.io/docs/user-guide/images#specifying-imagepullsecrets-on-a-pod", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.LocalObjectReference"), + }, + }, + }, + }, + }, + "secrets": { + SchemaProps: spec.SchemaProps{ + Description: "Secrets is a list of Secrets in the same namespace as the Alertmanager object, which shall be mounted into the Alertmanager Pods. The Secrets are mounted into /etc/alertmanager/secrets/.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "configMaps": { + SchemaProps: spec.SchemaProps{ + Description: "ConfigMaps is a list of ConfigMaps in the same namespace as the Alertmanager object, which shall be mounted into the Alertmanager Pods. The ConfigMaps are mounted into /etc/alertmanager/configmaps/.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "logLevel": { + SchemaProps: spec.SchemaProps{ + Description: "Log level for Alertmanager to be configured with.", + Type: []string{"string"}, + Format: "", + }, + }, + "replicas": { + SchemaProps: spec.SchemaProps{ + Description: "Size is the expected size of the alertmanager cluster. The controller will eventually make the size of the running cluster equal to the expected size.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "retention": { + SchemaProps: spec.SchemaProps{ + Description: "Time duration Alertmanager shall retain data for. Default is '120h', and must match the regular expression `[0-9]+(ms|s|m|h)` (milliseconds seconds minutes hours).", + Type: []string{"string"}, + Format: "", + }, + }, + "storage": { + SchemaProps: spec.SchemaProps{ + Description: "Storage is the definition of how storage will be used by the Alertmanager instances.", + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.StorageSpec"), + }, + }, + "externalUrl": { + SchemaProps: spec.SchemaProps{ + Description: "The external URL the Alertmanager instances will be available under. This is necessary to generate correct URLs. This is necessary if Alertmanager is not served from root of a DNS name.", + Type: []string{"string"}, + Format: "", + }, + }, + "routePrefix": { + SchemaProps: spec.SchemaProps{ + Description: "The route prefix Alertmanager registers HTTP handlers for. This is useful, if using ExternalURL and a proxy is rewriting HTTP routes of a request, and the actual ExternalURL is still true, but the server serves requests under a different route prefix. For example for use with `kubectl proxy`.", + Type: []string{"string"}, + Format: "", + }, + }, + "paused": { + SchemaProps: spec.SchemaProps{ + Description: "If set to true all actions on the underlaying managed objects are not goint to be performed, except for delete actions.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "nodeSelector": { + SchemaProps: spec.SchemaProps{ + Description: "Define which Nodes the Pods are scheduled on.", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "resources": { + SchemaProps: spec.SchemaProps{ + Description: "Define resources requests and limits for single Pods.", + Ref: ref("k8s.io/api/core/v1.ResourceRequirements"), + }, + }, + "affinity": { + SchemaProps: spec.SchemaProps{ + Description: "If specified, the pod's scheduling constraints.", + Ref: ref("k8s.io/api/core/v1.Affinity"), + }, + }, + "tolerations": { + SchemaProps: spec.SchemaProps{ + Description: "If specified, the pod's tolerations.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.Toleration"), + }, + }, + }, + }, + }, + "securityContext": { + SchemaProps: spec.SchemaProps{ + Description: "SecurityContext holds pod-level security attributes and common container settings. This defaults to non root user with uid 1000 and gid 2000.", + Ref: ref("k8s.io/api/core/v1.PodSecurityContext"), + }, + }, + "serviceAccountName": { + SchemaProps: spec.SchemaProps{ + Description: "ServiceAccountName is the name of the ServiceAccount to use to run the Prometheus Pods.", + Type: []string{"string"}, + Format: "", + }, + }, + "listenLocal": { + SchemaProps: spec.SchemaProps{ + Description: "ListenLocal makes the Alertmanager server listen on loopback, so that it does not bind against the Pod IP. Note this is only for the Alertmanager UI, not the gossip communication.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "containers": { + SchemaProps: spec.SchemaProps{ + Description: "Containers allows injecting additional containers. This is meant to allow adding an authentication proxy to an Alertmanager pod.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.Container"), + }, + }, + }, + }, + }, + "priorityClassName": { + SchemaProps: spec.SchemaProps{ + Description: "Priority class assigned to the Pods", + Type: []string{"string"}, + Format: "", + }, + }, + "additionalPeers": { + SchemaProps: spec.SchemaProps{ + Description: "AdditionalPeers allows injecting a set of additional Alertmanagers to peer with to form a highly available cluster.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.StorageSpec", "k8s.io/api/core/v1.Affinity", "k8s.io/api/core/v1.Container", "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/api/core/v1.PodSecurityContext", "k8s.io/api/core/v1.ResourceRequirements", "k8s.io/api/core/v1.Toleration", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_pkg_apis_monitoring_v1_AlertmanagerStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "AlertmanagerStatus is the most recent observed status of the Alertmanager cluster. Read-only. Not included when requesting from the apiserver, only from the Prometheus Operator API itself. More info: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status", + Properties: map[string]spec.Schema{ + "paused": { + SchemaProps: spec.SchemaProps{ + Description: "Represents whether any actions on the underlaying managed objects are being performed. Only delete actions will be performed.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "replicas": { + SchemaProps: spec.SchemaProps{ + Description: "Total number of non-terminated pods targeted by this Alertmanager cluster (their labels match the selector).", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "updatedReplicas": { + SchemaProps: spec.SchemaProps{ + Description: "Total number of non-terminated pods targeted by this Alertmanager cluster that have the desired version spec.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "availableReplicas": { + SchemaProps: spec.SchemaProps{ + Description: "Total number of available pods (ready for at least minReadySeconds) targeted by this Alertmanager cluster.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "unavailableReplicas": { + SchemaProps: spec.SchemaProps{ + Description: "Total number of unavailable pods targeted by this Alertmanager cluster.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + Required: []string{"paused", "replicas", "updatedReplicas", "availableReplicas", "unavailableReplicas"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_monitoring_v1_BasicAuth(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "BasicAuth allow an endpoint to authenticate over basic authentication More info: https://prometheus.io/docs/operating/configuration/#endpoints", + Properties: map[string]spec.Schema{ + "username": { + SchemaProps: spec.SchemaProps{ + Description: "The secret that contains the username for authenticate", + Ref: ref("k8s.io/api/core/v1.SecretKeySelector"), + }, + }, + "password": { + SchemaProps: spec.SchemaProps{ + Description: "The secret that contains the password for authenticate", + Ref: ref("k8s.io/api/core/v1.SecretKeySelector"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.SecretKeySelector"}, + } +} + +func schema_pkg_apis_monitoring_v1_Endpoint(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Endpoint defines a scrapeable endpoint serving Prometheus metrics.", + Properties: map[string]spec.Schema{ + "port": { + SchemaProps: spec.SchemaProps{ + Description: "Name of the service port this endpoint refers to. Mutually exclusive with targetPort.", + Type: []string{"string"}, + Format: "", + }, + }, + "targetPort": { + SchemaProps: spec.SchemaProps{ + Description: "Name or number of the target port of the endpoint. Mutually exclusive with port.", + Ref: ref("k8s.io/apimachinery/pkg/util/intstr.IntOrString"), + }, + }, + "path": { + SchemaProps: spec.SchemaProps{ + Description: "HTTP path to scrape for metrics.", + Type: []string{"string"}, + Format: "", + }, + }, + "scheme": { + SchemaProps: spec.SchemaProps{ + Description: "HTTP scheme to use for scraping.", + Type: []string{"string"}, + Format: "", + }, + }, + "params": { + SchemaProps: spec.SchemaProps{ + Description: "Optional HTTP URL parameters", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + }, + }, + "interval": { + SchemaProps: spec.SchemaProps{ + Description: "Interval at which metrics should be scraped", + Type: []string{"string"}, + Format: "", + }, + }, + "scrapeTimeout": { + SchemaProps: spec.SchemaProps{ + Description: "Timeout after which the scrape is ended", + Type: []string{"string"}, + Format: "", + }, + }, + "tlsConfig": { + SchemaProps: spec.SchemaProps{ + Description: "TLS configuration to use when scraping the endpoint", + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.TLSConfig"), + }, + }, + "bearerTokenFile": { + SchemaProps: spec.SchemaProps{ + Description: "File to read bearer token for scraping targets.", + Type: []string{"string"}, + Format: "", + }, + }, + "honorLabels": { + SchemaProps: spec.SchemaProps{ + Description: "HonorLabels chooses the metric's labels on collisions with target labels.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "basicAuth": { + SchemaProps: spec.SchemaProps{ + Description: "BasicAuth allow an endpoint to authenticate over basic authentication More info: https://prometheus.io/docs/operating/configuration/#endpoints", + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.BasicAuth"), + }, + }, + "metricRelabelings": { + SchemaProps: spec.SchemaProps{ + Description: "MetricRelabelConfigs to apply to samples before ingestion.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.RelabelConfig"), + }, + }, + }, + }, + }, + "relabelings": { + SchemaProps: spec.SchemaProps{ + Description: "RelabelConfigs to apply to samples before ingestion. More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.RelabelConfig"), + }, + }, + }, + }, + }, + "proxyUrl": { + SchemaProps: spec.SchemaProps{ + Description: "ProxyURL eg http://proxyserver:2195 Directs scrapes to proxy through this endpoint.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.BasicAuth", "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.RelabelConfig", "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.TLSConfig", "k8s.io/apimachinery/pkg/util/intstr.IntOrString"}, + } +} + +func schema_pkg_apis_monitoring_v1_NamespaceSelector(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "NamespaceSelector is a selector for selecting either all namespaces or a list of namespaces.", + Properties: map[string]spec.Schema{ + "any": { + SchemaProps: spec.SchemaProps{ + Description: "Boolean describing whether all namespaces are selected in contrast to a list restricting them.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "matchNames": { + SchemaProps: spec.SchemaProps{ + Description: "List of namespace names.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_monitoring_v1_Prometheus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Prometheus defines a Prometheus deployment.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Description: "Specification of the desired behavior of the Prometheus cluster. More info: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status", + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.PrometheusSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Description: "Most recent observed status of the Prometheus cluster. Read-only. Not included when requesting from the apiserver, only from the Prometheus Operator API itself. More info: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status", + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.PrometheusStatus"), + }, + }, + }, + Required: []string{"spec"}, + }, + }, + Dependencies: []string{ + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.PrometheusSpec", "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.PrometheusStatus"}, + } +} + +func schema_pkg_apis_monitoring_v1_PrometheusList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PrometheusList is a list of Prometheuses.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard list metadata More info: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Description: "List of Prometheuses", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.Prometheus"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.Prometheus", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_pkg_apis_monitoring_v1_PrometheusRule(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PrometheusRule defines alerting rules for a Prometheus instance", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard object’s metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Description: "Specification of desired alerting rule definitions for Prometheus.", + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.PrometheusRuleSpec"), + }, + }, + }, + Required: []string{"spec"}, + }, + }, + Dependencies: []string{ + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.PrometheusRuleSpec", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_pkg_apis_monitoring_v1_PrometheusRuleList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PrometheusRuleList is a list of PrometheusRules.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard list metadata More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Description: "List of Rules", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.PrometheusRule"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.PrometheusRule", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_pkg_apis_monitoring_v1_PrometheusRuleSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PrometheusRuleSpec contains specification parameters for a Rule.", + Properties: map[string]spec.Schema{ + "groups": { + SchemaProps: spec.SchemaProps{ + Description: "Content of Prometheus rule file", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.RuleGroup"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.RuleGroup"}, + } +} + +func schema_pkg_apis_monitoring_v1_PrometheusSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PrometheusSpec is a specification of the desired behavior of the Prometheus cluster. More info: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status", + Properties: map[string]spec.Schema{ + "podMetadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard object’s metadata. More info: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata Metadata Labels and Annotations gets propagated to the prometheus pods.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "serviceMonitorSelector": { + SchemaProps: spec.SchemaProps{ + Description: "ServiceMonitors to be selected for target discovery.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"), + }, + }, + "serviceMonitorNamespaceSelector": { + SchemaProps: spec.SchemaProps{ + Description: "Namespaces to be selected for ServiceMonitor discovery. If nil, only check own namespace.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"), + }, + }, + "version": { + SchemaProps: spec.SchemaProps{ + Description: "Version of Prometheus to be deployed.", + Type: []string{"string"}, + Format: "", + }, + }, + "tag": { + SchemaProps: spec.SchemaProps{ + Description: "Tag of Prometheus container image to be deployed. Defaults to the value of `version`. Version is ignored if Tag is set.", + Type: []string{"string"}, + Format: "", + }, + }, + "sha": { + SchemaProps: spec.SchemaProps{ + Description: "SHA of Prometheus container image to be deployed. Defaults to the value of `version`. Similar to a tag, but the SHA explicitly deploys an immutable container image. Version and Tag are ignored if SHA is set.", + Type: []string{"string"}, + Format: "", + }, + }, + "paused": { + SchemaProps: spec.SchemaProps{ + Description: "When a Prometheus deployment is paused, no actions except for deletion will be performed on the underlying objects.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "image": { + SchemaProps: spec.SchemaProps{ + Description: "Image if specified has precedence over baseImage, tag and sha combinations. Specifying the version is still necessary to ensure the Prometheus Operator knows what version of Prometheus is being configured.", + Type: []string{"string"}, + Format: "", + }, + }, + "baseImage": { + SchemaProps: spec.SchemaProps{ + Description: "Base image to use for a Prometheus deployment.", + Type: []string{"string"}, + Format: "", + }, + }, + "imagePullSecrets": { + SchemaProps: spec.SchemaProps{ + Description: "An optional list of references to secrets in the same namespace to use for pulling prometheus and alertmanager images from registries see http://kubernetes.io/docs/user-guide/images#specifying-imagepullsecrets-on-a-pod", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.LocalObjectReference"), + }, + }, + }, + }, + }, + "replicas": { + SchemaProps: spec.SchemaProps{ + Description: "Number of instances to deploy for a Prometheus deployment.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "retention": { + SchemaProps: spec.SchemaProps{ + Description: "Time duration Prometheus shall retain data for. Default is '24h', and must match the regular expression `[0-9]+(ms|s|m|h|d|w|y)` (milliseconds seconds minutes hours days weeks years).", + Type: []string{"string"}, + Format: "", + }, + }, + "logLevel": { + SchemaProps: spec.SchemaProps{ + Description: "Log level for Prometheus to be configured with.", + Type: []string{"string"}, + Format: "", + }, + }, + "scrapeInterval": { + SchemaProps: spec.SchemaProps{ + Description: "Interval between consecutive scrapes.", + Type: []string{"string"}, + Format: "", + }, + }, + "evaluationInterval": { + SchemaProps: spec.SchemaProps{ + Description: "Interval between consecutive evaluations.", + Type: []string{"string"}, + Format: "", + }, + }, + "externalLabels": { + SchemaProps: spec.SchemaProps{ + Description: "The labels to add to any time series or alerts when communicating with external systems (federation, remote storage, Alertmanager).", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "externalUrl": { + SchemaProps: spec.SchemaProps{ + Description: "The external URL the Prometheus instances will be available under. This is necessary to generate correct URLs. This is necessary if Prometheus is not served from root of a DNS name.", + Type: []string{"string"}, + Format: "", + }, + }, + "routePrefix": { + SchemaProps: spec.SchemaProps{ + Description: "The route prefix Prometheus registers HTTP handlers for. This is useful, if using ExternalURL and a proxy is rewriting HTTP routes of a request, and the actual ExternalURL is still true, but the server serves requests under a different route prefix. For example for use with `kubectl proxy`.", + Type: []string{"string"}, + Format: "", + }, + }, + "query": { + SchemaProps: spec.SchemaProps{ + Description: "QuerySpec defines the query command line flags when starting Prometheus.", + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.QuerySpec"), + }, + }, + "storage": { + SchemaProps: spec.SchemaProps{ + Description: "Storage spec to specify how storage shall be used.", + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.StorageSpec"), + }, + }, + "ruleSelector": { + SchemaProps: spec.SchemaProps{ + Description: "A selector to select which PrometheusRules to mount for loading alerting rules from. Until (excluding) Prometheus Operator v0.24.0 Prometheus Operator will migrate any legacy rule ConfigMaps to PrometheusRule custom resources selected by RuleSelector. Make sure it does not match any config maps that you do not want to be migrated.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"), + }, + }, + "ruleNamespaceSelector": { + SchemaProps: spec.SchemaProps{ + Description: "Namespaces to be selected for PrometheusRules discovery. If unspecified, only the same namespace as the Prometheus object is in is used.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"), + }, + }, + "alerting": { + SchemaProps: spec.SchemaProps{ + Description: "Define details regarding alerting.", + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.AlertingSpec"), + }, + }, + "resources": { + SchemaProps: spec.SchemaProps{ + Description: "Define resources requests and limits for single Pods.", + Ref: ref("k8s.io/api/core/v1.ResourceRequirements"), + }, + }, + "nodeSelector": { + SchemaProps: spec.SchemaProps{ + Description: "Define which Nodes the Pods are scheduled on.", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "serviceAccountName": { + SchemaProps: spec.SchemaProps{ + Description: "ServiceAccountName is the name of the ServiceAccount to use to run the Prometheus Pods.", + Type: []string{"string"}, + Format: "", + }, + }, + "secrets": { + SchemaProps: spec.SchemaProps{ + Description: "Secrets is a list of Secrets in the same namespace as the Prometheus object, which shall be mounted into the Prometheus Pods. The Secrets are mounted into /etc/prometheus/secrets/.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "configMaps": { + SchemaProps: spec.SchemaProps{ + Description: "ConfigMaps is a list of ConfigMaps in the same namespace as the Prometheus object, which shall be mounted into the Prometheus Pods. The ConfigMaps are mounted into /etc/prometheus/configmaps/.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "affinity": { + SchemaProps: spec.SchemaProps{ + Description: "If specified, the pod's scheduling constraints.", + Ref: ref("k8s.io/api/core/v1.Affinity"), + }, + }, + "tolerations": { + SchemaProps: spec.SchemaProps{ + Description: "If specified, the pod's tolerations.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.Toleration"), + }, + }, + }, + }, + }, + "remoteWrite": { + SchemaProps: spec.SchemaProps{ + Description: "If specified, the remote_write spec. This is an experimental feature, it may change in any upcoming release in a breaking way.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.RemoteWriteSpec"), + }, + }, + }, + }, + }, + "remoteRead": { + SchemaProps: spec.SchemaProps{ + Description: "If specified, the remote_read spec. This is an experimental feature, it may change in any upcoming release in a breaking way.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.RemoteReadSpec"), + }, + }, + }, + }, + }, + "securityContext": { + SchemaProps: spec.SchemaProps{ + Description: "SecurityContext holds pod-level security attributes and common container settings. This defaults to non root user with uid 1000 and gid 2000 for Prometheus >v2.0 and default PodSecurityContext for other versions.", + Ref: ref("k8s.io/api/core/v1.PodSecurityContext"), + }, + }, + "listenLocal": { + SchemaProps: spec.SchemaProps{ + Description: "ListenLocal makes the Prometheus server listen on loopback, so that it does not bind against the Pod IP.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "containers": { + SchemaProps: spec.SchemaProps{ + Description: "Containers allows injecting additional containers. This is meant to allow adding an authentication proxy to a Prometheus pod.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.Container"), + }, + }, + }, + }, + }, + "additionalScrapeConfigs": { + SchemaProps: spec.SchemaProps{ + Description: "AdditionalScrapeConfigs allows specifying a key of a Secret containing additional Prometheus scrape configurations. Scrape configurations specified are appended to the configurations generated by the Prometheus Operator. Job configurations specified must have the form as specified in the official Prometheus documentation: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#. As scrape configs are appended, the user is responsible to make sure it is valid. Note that using this feature may expose the possibility to break upgrades of Prometheus. It is advised to review Prometheus release notes to ensure that no incompatible scrape configs are going to break Prometheus after the upgrade.", + Ref: ref("k8s.io/api/core/v1.SecretKeySelector"), + }, + }, + "additionalAlertRelabelConfigs": { + SchemaProps: spec.SchemaProps{ + Description: "AdditionalAlertRelabelConfigs allows specifying a key of a Secret containing additional Prometheus alert relabel configurations. Alert relabel configurations specified are appended to the configurations generated by the Prometheus Operator. Alert relabel configurations specified must have the form as specified in the official Prometheus documentation: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#alert_relabel_configs. As alert relabel configs are appended, the user is responsible to make sure it is valid. Note that using this feature may expose the possibility to break upgrades of Prometheus. It is advised to review Prometheus release notes to ensure that no incompatible alert relabel configs are going to break Prometheus after the upgrade.", + Ref: ref("k8s.io/api/core/v1.SecretKeySelector"), + }, + }, + "additionalAlertManagerConfigs": { + SchemaProps: spec.SchemaProps{ + Description: "AdditionalAlertManagerConfigs allows specifying a key of a Secret containing additional Prometheus AlertManager configurations. AlertManager configurations specified are appended to the configurations generated by the Prometheus Operator. Job configurations specified must have the form as specified in the official Prometheus documentation: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#. As AlertManager configs are appended, the user is responsible to make sure it is valid. Note that using this feature may expose the possibility to break upgrades of Prometheus. It is advised to review Prometheus release notes to ensure that no incompatible AlertManager configs are going to break Prometheus after the upgrade.", + Ref: ref("k8s.io/api/core/v1.SecretKeySelector"), + }, + }, + "apiserverConfig": { + SchemaProps: spec.SchemaProps{ + Description: "APIServerConfig allows specifying a host and auth methods to access apiserver. If left empty, Prometheus is assumed to run inside of the cluster and will discover API servers automatically and use the pod's CA certificate and bearer token file at /var/run/secrets/kubernetes.io/serviceaccount/.", + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.APIServerConfig"), + }, + }, + "thanos": { + SchemaProps: spec.SchemaProps{ + Description: "Thanos configuration allows configuring various aspects of a Prometheus server in a Thanos environment.\n\nThis section is experimental, it may change significantly without deprecation notice in any release.\n\nThis is experimental and may change significantly without backward compatibility in any release.", + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.ThanosSpec"), + }, + }, + "priorityClassName": { + SchemaProps: spec.SchemaProps{ + Description: "Priority class assigned to the Pods", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.APIServerConfig", "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.AlertingSpec", "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.QuerySpec", "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.RemoteReadSpec", "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.RemoteWriteSpec", "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.StorageSpec", "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.ThanosSpec", "k8s.io/api/core/v1.Affinity", "k8s.io/api/core/v1.Container", "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/api/core/v1.PodSecurityContext", "k8s.io/api/core/v1.ResourceRequirements", "k8s.io/api/core/v1.SecretKeySelector", "k8s.io/api/core/v1.Toleration", "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_pkg_apis_monitoring_v1_PrometheusStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PrometheusStatus is the most recent observed status of the Prometheus cluster. Read-only. Not included when requesting from the apiserver, only from the Prometheus Operator API itself. More info: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status", + Properties: map[string]spec.Schema{ + "paused": { + SchemaProps: spec.SchemaProps{ + Description: "Represents whether any actions on the underlaying managed objects are being performed. Only delete actions will be performed.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "replicas": { + SchemaProps: spec.SchemaProps{ + Description: "Total number of non-terminated pods targeted by this Prometheus deployment (their labels match the selector).", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "updatedReplicas": { + SchemaProps: spec.SchemaProps{ + Description: "Total number of non-terminated pods targeted by this Prometheus deployment that have the desired version spec.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "availableReplicas": { + SchemaProps: spec.SchemaProps{ + Description: "Total number of available pods (ready for at least minReadySeconds) targeted by this Prometheus deployment.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "unavailableReplicas": { + SchemaProps: spec.SchemaProps{ + Description: "Total number of unavailable pods targeted by this Prometheus deployment.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + Required: []string{"paused", "replicas", "updatedReplicas", "availableReplicas", "unavailableReplicas"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_monitoring_v1_QuerySpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "QuerySpec defines the query command line flags when starting Prometheus.", + Properties: map[string]spec.Schema{ + "lookbackDelta": { + SchemaProps: spec.SchemaProps{ + Description: "The delta difference allowed for retrieving metrics during expression evaluations.", + Type: []string{"string"}, + Format: "", + }, + }, + "maxConcurrency": { + SchemaProps: spec.SchemaProps{ + Description: "Number of concurrent queries that can be run at once.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "timeout": { + SchemaProps: spec.SchemaProps{ + Description: "Maximum time a query may take before being aborted.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_monitoring_v1_QueueConfig(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "QueueConfig allows the tuning of remote_write queue_config parameters. This object is referenced in the RemoteWriteSpec object.", + Properties: map[string]spec.Schema{ + "capacity": { + SchemaProps: spec.SchemaProps{ + Description: "Capacity is the number of samples to buffer per shard before we start dropping them.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "maxShards": { + SchemaProps: spec.SchemaProps{ + Description: "MaxShards is the maximum number of shards, i.e. amount of concurrency.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "maxSamplesPerSend": { + SchemaProps: spec.SchemaProps{ + Description: "MaxSamplesPerSend is the maximum number of samples per send.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "batchSendDeadline": { + SchemaProps: spec.SchemaProps{ + Description: "BatchSendDeadline is the maximum time a sample will wait in buffer.", + Type: []string{"string"}, + Format: "", + }, + }, + "maxRetries": { + SchemaProps: spec.SchemaProps{ + Description: "MaxRetries is the maximum number of times to retry a batch on recoverable errors.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "minBackoff": { + SchemaProps: spec.SchemaProps{ + Description: "MinBackoff is the initial retry delay. Gets doubled for every retry.", + Type: []string{"string"}, + Format: "", + }, + }, + "maxBackoff": { + SchemaProps: spec.SchemaProps{ + Description: "MaxBackoff is the maximum retry delay.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_monitoring_v1_RelabelConfig(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "RelabelConfig allows dynamic rewriting of the label set, being applied to samples before ingestion. It defines ``-section of Prometheus configuration. More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs", + Properties: map[string]spec.Schema{ + "sourceLabels": { + SchemaProps: spec.SchemaProps{ + Description: "The source labels select values from existing labels. Their content is concatenated using the configured separator and matched against the configured regular expression for the replace, keep, and drop actions.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "separator": { + SchemaProps: spec.SchemaProps{ + Description: "Separator placed between concatenated source label values. default is ';'.", + Type: []string{"string"}, + Format: "", + }, + }, + "targetLabel": { + SchemaProps: spec.SchemaProps{ + Description: "Label to which the resulting value is written in a replace action. It is mandatory for replace actions. Regex capture groups are available.", + Type: []string{"string"}, + Format: "", + }, + }, + "regex": { + SchemaProps: spec.SchemaProps{ + Description: "Regular expression against which the extracted value is matched. defailt is '(.*)'", + Type: []string{"string"}, + Format: "", + }, + }, + "modulus": { + SchemaProps: spec.SchemaProps{ + Description: "Modulus to take of the hash of the source label values.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "replacement": { + SchemaProps: spec.SchemaProps{ + Description: "Replacement value against which a regex replace is performed if the regular expression matches. Regex capture groups are available. Default is '$1'", + Type: []string{"string"}, + Format: "", + }, + }, + "action": { + SchemaProps: spec.SchemaProps{ + Description: "Action to perform based on regex matching. Default is 'replace'", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_monitoring_v1_RemoteReadSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "RemoteReadSpec defines the remote_read configuration for prometheus.", + Properties: map[string]spec.Schema{ + "url": { + SchemaProps: spec.SchemaProps{ + Description: "The URL of the endpoint to send samples to.", + Type: []string{"string"}, + Format: "", + }, + }, + "requiredMatchers": { + SchemaProps: spec.SchemaProps{ + Description: "An optional list of equality matchers which have to be present in a selector to query the remote read endpoint.", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "remoteTimeout": { + SchemaProps: spec.SchemaProps{ + Description: "Timeout for requests to the remote read endpoint.", + Type: []string{"string"}, + Format: "", + }, + }, + "readRecent": { + SchemaProps: spec.SchemaProps{ + Description: "Whether reads should be made for queries for time ranges that the local storage should have complete data for.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "basicAuth": { + SchemaProps: spec.SchemaProps{ + Description: "BasicAuth for the URL.", + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.BasicAuth"), + }, + }, + "bearerToken": { + SchemaProps: spec.SchemaProps{ + Description: "bearer token for remote read.", + Type: []string{"string"}, + Format: "", + }, + }, + "bearerTokenFile": { + SchemaProps: spec.SchemaProps{ + Description: "File to read bearer token for remote read.", + Type: []string{"string"}, + Format: "", + }, + }, + "tlsConfig": { + SchemaProps: spec.SchemaProps{ + Description: "TLS Config to use for remote read.", + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.TLSConfig"), + }, + }, + "proxyUrl": { + SchemaProps: spec.SchemaProps{ + Description: "Optional ProxyURL", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"url"}, + }, + }, + Dependencies: []string{ + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.BasicAuth", "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.TLSConfig"}, + } +} + +func schema_pkg_apis_monitoring_v1_RemoteWriteSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "RemoteWriteSpec defines the remote_write configuration for prometheus.", + Properties: map[string]spec.Schema{ + "url": { + SchemaProps: spec.SchemaProps{ + Description: "The URL of the endpoint to send samples to.", + Type: []string{"string"}, + Format: "", + }, + }, + "remoteTimeout": { + SchemaProps: spec.SchemaProps{ + Description: "Timeout for requests to the remote write endpoint.", + Type: []string{"string"}, + Format: "", + }, + }, + "writeRelabelConfigs": { + SchemaProps: spec.SchemaProps{ + Description: "The list of remote write relabel configurations.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.RelabelConfig"), + }, + }, + }, + }, + }, + "basicAuth": { + SchemaProps: spec.SchemaProps{ + Description: "BasicAuth for the URL.", + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.BasicAuth"), + }, + }, + "bearerToken": { + SchemaProps: spec.SchemaProps{ + Description: "File to read bearer token for remote write.", + Type: []string{"string"}, + Format: "", + }, + }, + "bearerTokenFile": { + SchemaProps: spec.SchemaProps{ + Description: "File to read bearer token for remote write.", + Type: []string{"string"}, + Format: "", + }, + }, + "tlsConfig": { + SchemaProps: spec.SchemaProps{ + Description: "TLS Config to use for remote write.", + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.TLSConfig"), + }, + }, + "proxyUrl": { + SchemaProps: spec.SchemaProps{ + Description: "Optional ProxyURL", + Type: []string{"string"}, + Format: "", + }, + }, + "queueConfig": { + SchemaProps: spec.SchemaProps{ + Description: "QueueConfig allows tuning of the remote write queue parameters.", + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.QueueConfig"), + }, + }, + }, + Required: []string{"url"}, + }, + }, + Dependencies: []string{ + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.BasicAuth", "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.QueueConfig", "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.RelabelConfig", "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.TLSConfig"}, + } +} + +func schema_pkg_apis_monitoring_v1_Rule(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Rule describes an alerting or recording rule.", + Properties: map[string]spec.Schema{ + "record": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "alert": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "expr": { + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/util/intstr.IntOrString"), + }, + }, + "for": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "labels": { + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "annotations": { + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + Required: []string{"expr"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/util/intstr.IntOrString"}, + } +} + +func schema_pkg_apis_monitoring_v1_RuleGroup(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "RuleGroup is a list of sequentially evaluated recording and alerting rules.", + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "interval": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "rules": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.Rule"), + }, + }, + }, + }, + }, + }, + Required: []string{"name", "rules"}, + }, + }, + Dependencies: []string{ + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.Rule"}, + } +} + +func schema_pkg_apis_monitoring_v1_ServiceMonitor(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ServiceMonitor defines monitoring for a set of services.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Description: "Specification of desired Service selection for target discrovery by Prometheus.", + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.ServiceMonitorSpec"), + }, + }, + }, + Required: []string{"spec"}, + }, + }, + Dependencies: []string{ + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.ServiceMonitorSpec"}, + } +} + +func schema_pkg_apis_monitoring_v1_ServiceMonitorList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ServiceMonitorList is a list of ServiceMonitors.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard list metadata More info: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Description: "List of ServiceMonitors", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.ServiceMonitor"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.ServiceMonitor", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_pkg_apis_monitoring_v1_ServiceMonitorSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ServiceMonitorSpec contains specification parameters for a ServiceMonitor.", + Properties: map[string]spec.Schema{ + "jobLabel": { + SchemaProps: spec.SchemaProps{ + Description: "The label to use to retrieve the job name from.", + Type: []string{"string"}, + Format: "", + }, + }, + "targetLabels": { + SchemaProps: spec.SchemaProps{ + Description: "TargetLabels transfers labels on the Kubernetes Service onto the target.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "podTargetLabels": { + SchemaProps: spec.SchemaProps{ + Description: "PodTargetLabels transfers labels on the Kubernetes Pod onto the target.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "endpoints": { + SchemaProps: spec.SchemaProps{ + Description: "A list of endpoints allowed as part of this ServiceMonitor.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.Endpoint"), + }, + }, + }, + }, + }, + "selector": { + SchemaProps: spec.SchemaProps{ + Description: "Selector to select Endpoints objects.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"), + }, + }, + "namespaceSelector": { + SchemaProps: spec.SchemaProps{ + Description: "Selector to select which namespaces the Endpoints objects are discovered from.", + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.NamespaceSelector"), + }, + }, + "sampleLimit": { + SchemaProps: spec.SchemaProps{ + Description: "SampleLimit defines per-scrape limit on number of scraped samples that will be accepted.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + }, + Required: []string{"endpoints", "selector"}, + }, + }, + Dependencies: []string{ + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.Endpoint", "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.NamespaceSelector", "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"}, + } +} + +func schema_pkg_apis_monitoring_v1_StorageSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "StorageSpec defines the configured storage for a group Prometheus servers. If neither `emptyDir` nor `volumeClaimTemplate` is specified, then by default an [EmptyDir](https://kubernetes.io/docs/concepts/storage/volumes/#emptydir) will be used.", + Properties: map[string]spec.Schema{ + "emptyDir": { + SchemaProps: spec.SchemaProps{ + Description: "EmptyDirVolumeSource to be used by the Prometheus StatefulSets. If specified, used in place of any volumeClaimTemplate. More info: https://kubernetes.io/docs/concepts/storage/volumes/#emptydir", + Ref: ref("k8s.io/api/core/v1.EmptyDirVolumeSource"), + }, + }, + "volumeClaimTemplate": { + SchemaProps: spec.SchemaProps{ + Description: "A PVC spec to be used by the Prometheus StatefulSets.", + Ref: ref("k8s.io/api/core/v1.PersistentVolumeClaim"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.EmptyDirVolumeSource", "k8s.io/api/core/v1.PersistentVolumeClaim"}, + } +} + +func schema_pkg_apis_monitoring_v1_TLSConfig(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TLSConfig specifies TLS configuration parameters.", + Properties: map[string]spec.Schema{ + "caFile": { + SchemaProps: spec.SchemaProps{ + Description: "The CA cert to use for the targets.", + Type: []string{"string"}, + Format: "", + }, + }, + "certFile": { + SchemaProps: spec.SchemaProps{ + Description: "The client cert file for the targets.", + Type: []string{"string"}, + Format: "", + }, + }, + "keyFile": { + SchemaProps: spec.SchemaProps{ + Description: "The client key file for the targets.", + Type: []string{"string"}, + Format: "", + }, + }, + "serverName": { + SchemaProps: spec.SchemaProps{ + Description: "Used to verify the hostname for the targets.", + Type: []string{"string"}, + Format: "", + }, + }, + "insecureSkipVerify": { + SchemaProps: spec.SchemaProps{ + Description: "Disable target certificate validation.", + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_monitoring_v1_ThanosGCSSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ThanosGCSSpec defines parameters for use of Google Cloud Storage (GCS) with Thanos.", + Properties: map[string]spec.Schema{ + "bucket": { + SchemaProps: spec.SchemaProps{ + Description: "Google Cloud Storage bucket name for stored blocks. If empty it won't store any block inside Google Cloud Storage.", + Type: []string{"string"}, + Format: "", + }, + }, + "credentials": { + SchemaProps: spec.SchemaProps{ + Description: "Secret to access our Bucket.", + Ref: ref("k8s.io/api/core/v1.SecretKeySelector"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.SecretKeySelector"}, + } +} + +func schema_pkg_apis_monitoring_v1_ThanosS3Spec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ThanosS3Spec defines parameters for of AWS Simple Storage Service (S3) with Thanos. (S3 compatible services apply as well)", + Properties: map[string]spec.Schema{ + "bucket": { + SchemaProps: spec.SchemaProps{ + Description: "S3-Compatible API bucket name for stored blocks.", + Type: []string{"string"}, + Format: "", + }, + }, + "endpoint": { + SchemaProps: spec.SchemaProps{ + Description: "S3-Compatible API endpoint for stored blocks.", + Type: []string{"string"}, + Format: "", + }, + }, + "accessKey": { + SchemaProps: spec.SchemaProps{ + Description: "AccessKey for an S3-Compatible API.", + Ref: ref("k8s.io/api/core/v1.SecretKeySelector"), + }, + }, + "secretKey": { + SchemaProps: spec.SchemaProps{ + Description: "SecretKey for an S3-Compatible API.", + Ref: ref("k8s.io/api/core/v1.SecretKeySelector"), + }, + }, + "insecure": { + SchemaProps: spec.SchemaProps{ + Description: "Whether to use an insecure connection with an S3-Compatible API.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "signatureVersion2": { + SchemaProps: spec.SchemaProps{ + Description: "Whether to use S3 Signature Version 2; otherwise Signature Version 4 will be used.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "encryptsse": { + SchemaProps: spec.SchemaProps{ + Description: "Whether to use Server Side Encryption", + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.SecretKeySelector"}, + } +} + +func schema_pkg_apis_monitoring_v1_ThanosSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ThanosSpec defines parameters for a Prometheus server within a Thanos deployment.", + Properties: map[string]spec.Schema{ + "peers": { + SchemaProps: spec.SchemaProps{ + Description: "Peers is a DNS name for Thanos to discover peers through.", + Type: []string{"string"}, + Format: "", + }, + }, + "image": { + SchemaProps: spec.SchemaProps{ + Description: "Image if specified has precedence over baseImage, tag and sha combinations. Specifying the version is still necessary to ensure the Prometheus Operator knows what version of Thanos is being configured.", + Type: []string{"string"}, + Format: "", + }, + }, + "version": { + SchemaProps: spec.SchemaProps{ + Description: "Version describes the version of Thanos to use.", + Type: []string{"string"}, + Format: "", + }, + }, + "tag": { + SchemaProps: spec.SchemaProps{ + Description: "Tag of Thanos sidecar container image to be deployed. Defaults to the value of `version`. Version is ignored if Tag is set.", + Type: []string{"string"}, + Format: "", + }, + }, + "sha": { + SchemaProps: spec.SchemaProps{ + Description: "SHA of Thanos container image to be deployed. Defaults to the value of `version`. Similar to a tag, but the SHA explicitly deploys an immutable container image. Version and Tag are ignored if SHA is set.", + Type: []string{"string"}, + Format: "", + }, + }, + "baseImage": { + SchemaProps: spec.SchemaProps{ + Description: "Thanos base image if other than default.", + Type: []string{"string"}, + Format: "", + }, + }, + "resources": { + SchemaProps: spec.SchemaProps{ + Description: "Resources defines the resource requirements for the Thanos sidecar. If not provided, no requests/limits will be set", + Ref: ref("k8s.io/api/core/v1.ResourceRequirements"), + }, + }, + "gcs": { + SchemaProps: spec.SchemaProps{ + Description: "GCS configures use of GCS in Thanos.", + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.ThanosGCSSpec"), + }, + }, + "s3": { + SchemaProps: spec.SchemaProps{ + Description: "S3 configures use of S3 in Thanos.", + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.ThanosS3Spec"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.ThanosGCSSpec", "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.ThanosS3Spec", "k8s.io/api/core/v1.ResourceRequirements"}, + } +} + +func schema_k8sio_api_core_v1_AWSElasticBlockStoreVolumeSource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Represents a Persistent Disk resource in AWS.\n\nAn AWS EBS disk must exist before mounting to a container. The disk must also be in the same AWS zone as the kubelet. An AWS EBS disk can only be mounted as read/write once. AWS EBS volumes support ownership management and SELinux relabeling.", + Properties: map[string]spec.Schema{ + "volumeID": { + SchemaProps: spec.SchemaProps{ + Description: "Unique ID of the persistent disk resource in AWS (Amazon EBS volume). More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore", + Type: []string{"string"}, + Format: "", + }, + }, + "fsType": { + SchemaProps: spec.SchemaProps{ + Description: "Filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore", + Type: []string{"string"}, + Format: "", + }, + }, + "partition": { + SchemaProps: spec.SchemaProps{ + Description: "The partition in the volume that you want to mount. If omitted, the default is to mount by volume name. Examples: For volume /dev/sda1, you specify the partition as \"1\". Similarly, the volume partition for /dev/sda is \"0\" (or you can leave the property empty).", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "readOnly": { + SchemaProps: spec.SchemaProps{ + Description: "Specify \"true\" to force and set the ReadOnly property in VolumeMounts to \"true\". If omitted, the default is \"false\". More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore", + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + Required: []string{"volumeID"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_Affinity(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Affinity is a group of affinity scheduling rules.", + Properties: map[string]spec.Schema{ + "nodeAffinity": { + SchemaProps: spec.SchemaProps{ + Description: "Describes node affinity scheduling rules for the pod.", + Ref: ref("k8s.io/api/core/v1.NodeAffinity"), + }, + }, + "podAffinity": { + SchemaProps: spec.SchemaProps{ + Description: "Describes pod affinity scheduling rules (e.g. co-locate this pod in the same node, zone, etc. as some other pod(s)).", + Ref: ref("k8s.io/api/core/v1.PodAffinity"), + }, + }, + "podAntiAffinity": { + SchemaProps: spec.SchemaProps{ + Description: "Describes pod anti-affinity scheduling rules (e.g. avoid putting this pod in the same node, zone, etc. as some other pod(s)).", + Ref: ref("k8s.io/api/core/v1.PodAntiAffinity"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.NodeAffinity", "k8s.io/api/core/v1.PodAffinity", "k8s.io/api/core/v1.PodAntiAffinity"}, + } +} + +func schema_k8sio_api_core_v1_AttachedVolume(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "AttachedVolume describes a volume attached to a node", + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name of the attached volume", + Type: []string{"string"}, + Format: "", + }, + }, + "devicePath": { + SchemaProps: spec.SchemaProps{ + Description: "DevicePath represents the device path where the volume should be available", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"name", "devicePath"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_AvoidPods(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "AvoidPods describes pods that should avoid this node. This is the value for a Node annotation with key scheduler.alpha.kubernetes.io/preferAvoidPods and will eventually become a field of NodeStatus.", + Properties: map[string]spec.Schema{ + "preferAvoidPods": { + SchemaProps: spec.SchemaProps{ + Description: "Bounded-sized list of signatures of pods that should avoid this node, sorted in timestamp order from oldest to newest. Size of the slice is unspecified.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.PreferAvoidPodsEntry"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.PreferAvoidPodsEntry"}, + } +} + +func schema_k8sio_api_core_v1_AzureDiskVolumeSource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "AzureDisk represents an Azure Data Disk mount on the host and bind mount to the pod.", + Properties: map[string]spec.Schema{ + "diskName": { + SchemaProps: spec.SchemaProps{ + Description: "The Name of the data disk in the blob storage", + Type: []string{"string"}, + Format: "", + }, + }, + "diskURI": { + SchemaProps: spec.SchemaProps{ + Description: "The URI the data disk in the blob storage", + Type: []string{"string"}, + Format: "", + }, + }, + "cachingMode": { + SchemaProps: spec.SchemaProps{ + Description: "Host Caching mode: None, Read Only, Read Write.", + Type: []string{"string"}, + Format: "", + }, + }, + "fsType": { + SchemaProps: spec.SchemaProps{ + Description: "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified.", + Type: []string{"string"}, + Format: "", + }, + }, + "readOnly": { + SchemaProps: spec.SchemaProps{ + Description: "Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Expected values Shared: multiple blob disks per storage account Dedicated: single blob disk per storage account Managed: azure managed data disk (only in managed availability set). defaults to shared", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"diskName", "diskURI"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_AzureFilePersistentVolumeSource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "AzureFile represents an Azure File Service mount on the host and bind mount to the pod.", + Properties: map[string]spec.Schema{ + "secretName": { + SchemaProps: spec.SchemaProps{ + Description: "the name of secret that contains Azure Storage Account Name and Key", + Type: []string{"string"}, + Format: "", + }, + }, + "shareName": { + SchemaProps: spec.SchemaProps{ + Description: "Share Name", + Type: []string{"string"}, + Format: "", + }, + }, + "readOnly": { + SchemaProps: spec.SchemaProps{ + Description: "Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "secretNamespace": { + SchemaProps: spec.SchemaProps{ + Description: "the namespace of the secret that contains Azure Storage Account Name and Key default is the same as the Pod", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"secretName", "shareName"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_AzureFileVolumeSource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "AzureFile represents an Azure File Service mount on the host and bind mount to the pod.", + Properties: map[string]spec.Schema{ + "secretName": { + SchemaProps: spec.SchemaProps{ + Description: "the name of secret that contains Azure Storage Account Name and Key", + Type: []string{"string"}, + Format: "", + }, + }, + "shareName": { + SchemaProps: spec.SchemaProps{ + Description: "Share Name", + Type: []string{"string"}, + Format: "", + }, + }, + "readOnly": { + SchemaProps: spec.SchemaProps{ + Description: "Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.", + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + Required: []string{"secretName", "shareName"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_Binding(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Binding ties one object to another; for example, a pod is bound to a node by a scheduler. Deprecated in 1.7, please use the bindings subresource of pods instead.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "target": { + SchemaProps: spec.SchemaProps{ + Description: "The target object that you want to bind to the standard object.", + Ref: ref("k8s.io/api/core/v1.ObjectReference"), + }, + }, + }, + Required: []string{"target"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.ObjectReference", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_k8sio_api_core_v1_CSIPersistentVolumeSource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Represents storage that is managed by an external CSI volume driver (Beta feature)", + Properties: map[string]spec.Schema{ + "driver": { + SchemaProps: spec.SchemaProps{ + Description: "Driver is the name of the driver to use for this volume. Required.", + Type: []string{"string"}, + Format: "", + }, + }, + "volumeHandle": { + SchemaProps: spec.SchemaProps{ + Description: "VolumeHandle is the unique volume name returned by the CSI volume plugin’s CreateVolume to refer to the volume on all subsequent calls. Required.", + Type: []string{"string"}, + Format: "", + }, + }, + "readOnly": { + SchemaProps: spec.SchemaProps{ + Description: "Optional: The value to pass to ControllerPublishVolumeRequest. Defaults to false (read/write).", + Type: []string{"boolean"}, + Format: "", + }, + }, + "fsType": { + SchemaProps: spec.SchemaProps{ + Description: "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\".", + Type: []string{"string"}, + Format: "", + }, + }, + "volumeAttributes": { + SchemaProps: spec.SchemaProps{ + Description: "Attributes of the volume to publish.", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "controllerPublishSecretRef": { + SchemaProps: spec.SchemaProps{ + Description: "ControllerPublishSecretRef is a reference to the secret object containing sensitive information to pass to the CSI driver to complete the CSI ControllerPublishVolume and ControllerUnpublishVolume calls. This field is optional, and may be empty if no secret is required. If the secret object contains more than one secret, all secrets are passed.", + Ref: ref("k8s.io/api/core/v1.SecretReference"), + }, + }, + "nodeStageSecretRef": { + SchemaProps: spec.SchemaProps{ + Description: "NodeStageSecretRef is a reference to the secret object containing sensitive information to pass to the CSI driver to complete the CSI NodeStageVolume and NodeStageVolume and NodeUnstageVolume calls. This field is optional, and may be empty if no secret is required. If the secret object contains more than one secret, all secrets are passed.", + Ref: ref("k8s.io/api/core/v1.SecretReference"), + }, + }, + "nodePublishSecretRef": { + SchemaProps: spec.SchemaProps{ + Description: "NodePublishSecretRef is a reference to the secret object containing sensitive information to pass to the CSI driver to complete the CSI NodePublishVolume and NodeUnpublishVolume calls. This field is optional, and may be empty if no secret is required. If the secret object contains more than one secret, all secrets are passed.", + Ref: ref("k8s.io/api/core/v1.SecretReference"), + }, + }, + }, + Required: []string{"driver", "volumeHandle"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.SecretReference"}, + } +} + +func schema_k8sio_api_core_v1_Capabilities(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Adds and removes POSIX capabilities from running containers.", + Properties: map[string]spec.Schema{ + "add": { + SchemaProps: spec.SchemaProps{ + Description: "Added capabilities", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "drop": { + SchemaProps: spec.SchemaProps{ + Description: "Removed capabilities", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_CephFSPersistentVolumeSource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Represents a Ceph Filesystem mount that lasts the lifetime of a pod Cephfs volumes do not support ownership management or SELinux relabeling.", + Properties: map[string]spec.Schema{ + "monitors": { + SchemaProps: spec.SchemaProps{ + Description: "Required: Monitors is a collection of Ceph monitors More info: https://releases.k8s.io/HEAD/examples/volumes/cephfs/README.md#how-to-use-it", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "path": { + SchemaProps: spec.SchemaProps{ + Description: "Optional: Used as the mounted root, rather than the full Ceph tree, default is /", + Type: []string{"string"}, + Format: "", + }, + }, + "user": { + SchemaProps: spec.SchemaProps{ + Description: "Optional: User is the rados user name, default is admin More info: https://releases.k8s.io/HEAD/examples/volumes/cephfs/README.md#how-to-use-it", + Type: []string{"string"}, + Format: "", + }, + }, + "secretFile": { + SchemaProps: spec.SchemaProps{ + Description: "Optional: SecretFile is the path to key ring for User, default is /etc/ceph/user.secret More info: https://releases.k8s.io/HEAD/examples/volumes/cephfs/README.md#how-to-use-it", + Type: []string{"string"}, + Format: "", + }, + }, + "secretRef": { + SchemaProps: spec.SchemaProps{ + Description: "Optional: SecretRef is reference to the authentication secret for User, default is empty. More info: https://releases.k8s.io/HEAD/examples/volumes/cephfs/README.md#how-to-use-it", + Ref: ref("k8s.io/api/core/v1.SecretReference"), + }, + }, + "readOnly": { + SchemaProps: spec.SchemaProps{ + Description: "Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. More info: https://releases.k8s.io/HEAD/examples/volumes/cephfs/README.md#how-to-use-it", + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + Required: []string{"monitors"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.SecretReference"}, + } +} + +func schema_k8sio_api_core_v1_CephFSVolumeSource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Represents a Ceph Filesystem mount that lasts the lifetime of a pod Cephfs volumes do not support ownership management or SELinux relabeling.", + Properties: map[string]spec.Schema{ + "monitors": { + SchemaProps: spec.SchemaProps{ + Description: "Required: Monitors is a collection of Ceph monitors More info: https://releases.k8s.io/HEAD/examples/volumes/cephfs/README.md#how-to-use-it", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "path": { + SchemaProps: spec.SchemaProps{ + Description: "Optional: Used as the mounted root, rather than the full Ceph tree, default is /", + Type: []string{"string"}, + Format: "", + }, + }, + "user": { + SchemaProps: spec.SchemaProps{ + Description: "Optional: User is the rados user name, default is admin More info: https://releases.k8s.io/HEAD/examples/volumes/cephfs/README.md#how-to-use-it", + Type: []string{"string"}, + Format: "", + }, + }, + "secretFile": { + SchemaProps: spec.SchemaProps{ + Description: "Optional: SecretFile is the path to key ring for User, default is /etc/ceph/user.secret More info: https://releases.k8s.io/HEAD/examples/volumes/cephfs/README.md#how-to-use-it", + Type: []string{"string"}, + Format: "", + }, + }, + "secretRef": { + SchemaProps: spec.SchemaProps{ + Description: "Optional: SecretRef is reference to the authentication secret for User, default is empty. More info: https://releases.k8s.io/HEAD/examples/volumes/cephfs/README.md#how-to-use-it", + Ref: ref("k8s.io/api/core/v1.LocalObjectReference"), + }, + }, + "readOnly": { + SchemaProps: spec.SchemaProps{ + Description: "Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. More info: https://releases.k8s.io/HEAD/examples/volumes/cephfs/README.md#how-to-use-it", + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + Required: []string{"monitors"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.LocalObjectReference"}, + } +} + +func schema_k8sio_api_core_v1_CinderPersistentVolumeSource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Represents a cinder volume resource in Openstack. A Cinder volume must exist before mounting to a container. The volume must also be in the same region as the kubelet. Cinder volumes support ownership management and SELinux relabeling.", + Properties: map[string]spec.Schema{ + "volumeID": { + SchemaProps: spec.SchemaProps{ + Description: "volume id used to identify the volume in cinder More info: https://releases.k8s.io/HEAD/examples/mysql-cinder-pd/README.md", + Type: []string{"string"}, + Format: "", + }, + }, + "fsType": { + SchemaProps: spec.SchemaProps{ + Description: "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Examples: \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified. More info: https://releases.k8s.io/HEAD/examples/mysql-cinder-pd/README.md", + Type: []string{"string"}, + Format: "", + }, + }, + "readOnly": { + SchemaProps: spec.SchemaProps{ + Description: "Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. More info: https://releases.k8s.io/HEAD/examples/mysql-cinder-pd/README.md", + Type: []string{"boolean"}, + Format: "", + }, + }, + "secretRef": { + SchemaProps: spec.SchemaProps{ + Description: "Optional: points to a secret object containing parameters used to connect to OpenStack.", + Ref: ref("k8s.io/api/core/v1.SecretReference"), + }, + }, + }, + Required: []string{"volumeID"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.SecretReference"}, + } +} + +func schema_k8sio_api_core_v1_CinderVolumeSource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Represents a cinder volume resource in Openstack. A Cinder volume must exist before mounting to a container. The volume must also be in the same region as the kubelet. Cinder volumes support ownership management and SELinux relabeling.", + Properties: map[string]spec.Schema{ + "volumeID": { + SchemaProps: spec.SchemaProps{ + Description: "volume id used to identify the volume in cinder More info: https://releases.k8s.io/HEAD/examples/mysql-cinder-pd/README.md", + Type: []string{"string"}, + Format: "", + }, + }, + "fsType": { + SchemaProps: spec.SchemaProps{ + Description: "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Examples: \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified. More info: https://releases.k8s.io/HEAD/examples/mysql-cinder-pd/README.md", + Type: []string{"string"}, + Format: "", + }, + }, + "readOnly": { + SchemaProps: spec.SchemaProps{ + Description: "Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. More info: https://releases.k8s.io/HEAD/examples/mysql-cinder-pd/README.md", + Type: []string{"boolean"}, + Format: "", + }, + }, + "secretRef": { + SchemaProps: spec.SchemaProps{ + Description: "Optional: points to a secret object containing parameters used to connect to OpenStack.", + Ref: ref("k8s.io/api/core/v1.LocalObjectReference"), + }, + }, + }, + Required: []string{"volumeID"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.LocalObjectReference"}, + } +} + +func schema_k8sio_api_core_v1_ClientIPConfig(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ClientIPConfig represents the configurations of Client IP based session affinity.", + Properties: map[string]spec.Schema{ + "timeoutSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "timeoutSeconds specifies the seconds of ClientIP type session sticky time. The value must be >0 && <=86400(for 1 day) if ServiceAffinity == \"ClientIP\". Default value is 10800(for 3 hours).", + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_ComponentCondition(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Information about the condition of a component.", + Properties: map[string]spec.Schema{ + "type": { + SchemaProps: spec.SchemaProps{ + Description: "Type of condition for a component. Valid value: \"Healthy\"", + Type: []string{"string"}, + Format: "", + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Description: "Status of the condition for a component. Valid values for \"Healthy\": \"True\", \"False\", or \"Unknown\".", + Type: []string{"string"}, + Format: "", + }, + }, + "message": { + SchemaProps: spec.SchemaProps{ + Description: "Message about the condition for a component. For example, information about a health check.", + Type: []string{"string"}, + Format: "", + }, + }, + "error": { + SchemaProps: spec.SchemaProps{ + Description: "Condition error code for a component. For example, a health check error code.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"type", "status"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_ComponentStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ComponentStatus (and ComponentStatusList) holds the cluster validation info.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "conditions": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-patch-merge-key": "type", + "x-kubernetes-patch-strategy": "merge", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "List of component conditions observed", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.ComponentCondition"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.ComponentCondition", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_k8sio_api_core_v1_ComponentStatusList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Status of all the conditions for the component as a list of ComponentStatus objects.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Description: "List of ComponentStatus objects.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.ComponentStatus"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.ComponentStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_k8sio_api_core_v1_ConfigMap(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ConfigMap holds configuration data for pods to consume.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "data": { + SchemaProps: spec.SchemaProps{ + Description: "Data contains the configuration data. Each key must consist of alphanumeric characters, '-', '_' or '.'. Values with non-UTF-8 byte sequences must use the BinaryData field. The keys stored in Data must not overlap with the keys in the BinaryData field, this is enforced during validation process.", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "binaryData": { + SchemaProps: spec.SchemaProps{ + Description: "BinaryData contains the binary data. Each key must consist of alphanumeric characters, '-', '_' or '.'. BinaryData can contain byte sequences that are not in the UTF-8 range. The keys stored in BinaryData must not overlap with the ones in the Data field, this is enforced during validation process. Using this field will require 1.10+ apiserver and kubelet.", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "byte", + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_k8sio_api_core_v1_ConfigMapEnvSource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ConfigMapEnvSource selects a ConfigMap to populate the environment variables with.\n\nThe contents of the target ConfigMap's Data field will represent the key-value pairs as environment variables.", + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + Type: []string{"string"}, + Format: "", + }, + }, + "optional": { + SchemaProps: spec.SchemaProps{ + Description: "Specify whether the ConfigMap must be defined", + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_ConfigMapKeySelector(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Selects a key from a ConfigMap.", + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + Type: []string{"string"}, + Format: "", + }, + }, + "key": { + SchemaProps: spec.SchemaProps{ + Description: "The key to select.", + Type: []string{"string"}, + Format: "", + }, + }, + "optional": { + SchemaProps: spec.SchemaProps{ + Description: "Specify whether the ConfigMap or it's key must be defined", + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + Required: []string{"key"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_ConfigMapList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ConfigMapList is a resource containing a list of ConfigMap objects.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Description: "Items is the list of ConfigMaps.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.ConfigMap"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.ConfigMap", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_k8sio_api_core_v1_ConfigMapNodeConfigSource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ConfigMapNodeConfigSource contains the information to reference a ConfigMap as a config source for the Node.", + Properties: map[string]spec.Schema{ + "namespace": { + SchemaProps: spec.SchemaProps{ + Description: "Namespace is the metadata.namespace of the referenced ConfigMap. This field is required in all cases.", + Type: []string{"string"}, + Format: "", + }, + }, + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name is the metadata.name of the referenced ConfigMap. This field is required in all cases.", + Type: []string{"string"}, + Format: "", + }, + }, + "uid": { + SchemaProps: spec.SchemaProps{ + Description: "UID is the metadata.UID of the referenced ConfigMap. This field is forbidden in Node.Spec, and required in Node.Status.", + Type: []string{"string"}, + Format: "", + }, + }, + "resourceVersion": { + SchemaProps: spec.SchemaProps{ + Description: "ResourceVersion is the metadata.ResourceVersion of the referenced ConfigMap. This field is forbidden in Node.Spec, and required in Node.Status.", + Type: []string{"string"}, + Format: "", + }, + }, + "kubeletConfigKey": { + SchemaProps: spec.SchemaProps{ + Description: "KubeletConfigKey declares which key of the referenced ConfigMap corresponds to the KubeletConfiguration structure This field is required in all cases.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"namespace", "name", "kubeletConfigKey"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_ConfigMapProjection(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Adapts a ConfigMap into a projected volume.\n\nThe contents of the target ConfigMap's Data field will be presented in a projected volume as files using the keys in the Data field as the file names, unless the items element is populated with specific mappings of keys to paths. Note that this is identical to a configmap volume source without the default mode.", + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + Type: []string{"string"}, + Format: "", + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Description: "If unspecified, each key-value pair in the Data field of the referenced ConfigMap will be projected into the volume as a file whose name is the key and content is the value. If specified, the listed keys will be projected into the specified paths, and unlisted keys will not be present. If a key is specified which is not present in the ConfigMap, the volume setup will error unless it is marked optional. Paths must be relative and may not contain the '..' path or start with '..'.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.KeyToPath"), + }, + }, + }, + }, + }, + "optional": { + SchemaProps: spec.SchemaProps{ + Description: "Specify whether the ConfigMap or it's keys must be defined", + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.KeyToPath"}, + } +} + +func schema_k8sio_api_core_v1_ConfigMapVolumeSource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Adapts a ConfigMap into a volume.\n\nThe contents of the target ConfigMap's Data field will be presented in a volume as files using the keys in the Data field as the file names, unless the items element is populated with specific mappings of keys to paths. ConfigMap volumes support ownership management and SELinux relabeling.", + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + Type: []string{"string"}, + Format: "", + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Description: "If unspecified, each key-value pair in the Data field of the referenced ConfigMap will be projected into the volume as a file whose name is the key and content is the value. If specified, the listed keys will be projected into the specified paths, and unlisted keys will not be present. If a key is specified which is not present in the ConfigMap, the volume setup will error unless it is marked optional. Paths must be relative and may not contain the '..' path or start with '..'.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.KeyToPath"), + }, + }, + }, + }, + }, + "defaultMode": { + SchemaProps: spec.SchemaProps{ + Description: "Optional: mode bits to use on created files by default. Must be a value between 0 and 0777. Defaults to 0644. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "optional": { + SchemaProps: spec.SchemaProps{ + Description: "Specify whether the ConfigMap or it's keys must be defined", + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.KeyToPath"}, + } +} + +func schema_k8sio_api_core_v1_Container(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "A single application container that you want to run within a pod.", + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name of the container specified as a DNS_LABEL. Each container in a pod must have a unique name (DNS_LABEL). Cannot be updated.", + Type: []string{"string"}, + Format: "", + }, + }, + "image": { + SchemaProps: spec.SchemaProps{ + Description: "Docker image name. More info: https://kubernetes.io/docs/concepts/containers/images This field is optional to allow higher level config management to default or override container images in workload controllers like Deployments and StatefulSets.", + Type: []string{"string"}, + Format: "", + }, + }, + "command": { + SchemaProps: spec.SchemaProps{ + Description: "Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "args": { + SchemaProps: spec.SchemaProps{ + Description: "Arguments to the entrypoint. The docker image's CMD is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "workingDir": { + SchemaProps: spec.SchemaProps{ + Description: "Container's working directory. If not specified, the container runtime's default will be used, which might be configured in the container image. Cannot be updated.", + Type: []string{"string"}, + Format: "", + }, + }, + "ports": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-patch-merge-key": "containerPort", + "x-kubernetes-patch-strategy": "merge", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "List of ports to expose from the container. Exposing a port here gives the system additional information about the network connections a container uses, but is primarily informational. Not specifying a port here DOES NOT prevent that port from being exposed. Any port which is listening on the default \"0.0.0.0\" address inside a container will be accessible from the network. Cannot be updated.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.ContainerPort"), + }, + }, + }, + }, + }, + "envFrom": { + SchemaProps: spec.SchemaProps{ + Description: "List of sources to populate environment variables in the container. The keys defined within a source must be a C_IDENTIFIER. All invalid keys will be reported as an event when the container is starting. When a key exists in multiple sources, the value associated with the last source will take precedence. Values defined by an Env with a duplicate key will take precedence. Cannot be updated.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.EnvFromSource"), + }, + }, + }, + }, + }, + "env": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-patch-merge-key": "name", + "x-kubernetes-patch-strategy": "merge", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "List of environment variables to set in the container. Cannot be updated.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.EnvVar"), + }, + }, + }, + }, + }, + "resources": { + SchemaProps: spec.SchemaProps{ + Description: "Compute Resources required by this container. Cannot be updated. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/", + Ref: ref("k8s.io/api/core/v1.ResourceRequirements"), + }, + }, + "volumeMounts": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-patch-merge-key": "mountPath", + "x-kubernetes-patch-strategy": "merge", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "Pod volumes to mount into the container's filesystem. Cannot be updated.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.VolumeMount"), + }, + }, + }, + }, + }, + "volumeDevices": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-patch-merge-key": "devicePath", + "x-kubernetes-patch-strategy": "merge", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "volumeDevices is the list of block devices to be used by the container. This is an alpha feature and may change in the future.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.VolumeDevice"), + }, + }, + }, + }, + }, + "livenessProbe": { + SchemaProps: spec.SchemaProps{ + Description: "Periodic probe of container liveness. Container will be restarted if the probe fails. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes", + Ref: ref("k8s.io/api/core/v1.Probe"), + }, + }, + "readinessProbe": { + SchemaProps: spec.SchemaProps{ + Description: "Periodic probe of container service readiness. Container will be removed from service endpoints if the probe fails. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes", + Ref: ref("k8s.io/api/core/v1.Probe"), + }, + }, + "lifecycle": { + SchemaProps: spec.SchemaProps{ + Description: "Actions that the management system should take in response to container lifecycle events. Cannot be updated.", + Ref: ref("k8s.io/api/core/v1.Lifecycle"), + }, + }, + "terminationMessagePath": { + SchemaProps: spec.SchemaProps{ + Description: "Optional: Path at which the file to which the container's termination message will be written is mounted into the container's filesystem. Message written is intended to be brief final status, such as an assertion failure message. Will be truncated by the node if greater than 4096 bytes. The total message length across all containers will be limited to 12kb. Defaults to /dev/termination-log. Cannot be updated.", + Type: []string{"string"}, + Format: "", + }, + }, + "terminationMessagePolicy": { + SchemaProps: spec.SchemaProps{ + Description: "Indicate how the termination message should be populated. File will use the contents of terminationMessagePath to populate the container status message on both success and failure. FallbackToLogsOnError will use the last chunk of container log output if the termination message file is empty and the container exited with an error. The log output is limited to 2048 bytes or 80 lines, whichever is smaller. Defaults to File. Cannot be updated.", + Type: []string{"string"}, + Format: "", + }, + }, + "imagePullPolicy": { + SchemaProps: spec.SchemaProps{ + Description: "Image pull policy. One of Always, Never, IfNotPresent. Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. Cannot be updated. More info: https://kubernetes.io/docs/concepts/containers/images#updating-images", + Type: []string{"string"}, + Format: "", + }, + }, + "securityContext": { + SchemaProps: spec.SchemaProps{ + Description: "Security options the pod should run with. More info: https://kubernetes.io/docs/concepts/policy/security-context/ More info: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/", + Ref: ref("k8s.io/api/core/v1.SecurityContext"), + }, + }, + "stdin": { + SchemaProps: spec.SchemaProps{ + Description: "Whether this container should allocate a buffer for stdin in the container runtime. If this is not set, reads from stdin in the container will always result in EOF. Default is false.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "stdinOnce": { + SchemaProps: spec.SchemaProps{ + Description: "Whether the container runtime should close the stdin channel after it has been opened by a single attach. When stdin is true the stdin stream will remain open across multiple attach sessions. If stdinOnce is set to true, stdin is opened on container start, is empty until the first client attaches to stdin, and then remains open and accepts data until the client disconnects, at which time stdin is closed and remains closed until the container is restarted. If this flag is false, a container processes that reads from stdin will never receive an EOF. Default is false", + Type: []string{"boolean"}, + Format: "", + }, + }, + "tty": { + SchemaProps: spec.SchemaProps{ + Description: "Whether this container should allocate a TTY for itself, also requires 'stdin' to be true. Default is false.", + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + Required: []string{"name"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.ContainerPort", "k8s.io/api/core/v1.EnvFromSource", "k8s.io/api/core/v1.EnvVar", "k8s.io/api/core/v1.Lifecycle", "k8s.io/api/core/v1.Probe", "k8s.io/api/core/v1.ResourceRequirements", "k8s.io/api/core/v1.SecurityContext", "k8s.io/api/core/v1.VolumeDevice", "k8s.io/api/core/v1.VolumeMount"}, + } +} + +func schema_k8sio_api_core_v1_ContainerImage(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Describe a container image", + Properties: map[string]spec.Schema{ + "names": { + SchemaProps: spec.SchemaProps{ + Description: "Names by which this image is known. e.g. [\"k8s.gcr.io/hyperkube:v1.0.7\", \"dockerhub.io/google_containers/hyperkube:v1.0.7\"]", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "sizeBytes": { + SchemaProps: spec.SchemaProps{ + Description: "The size of the image in bytes.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + }, + Required: []string{"names"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_ContainerPort(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ContainerPort represents a network port in a single container.", + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "If specified, this must be an IANA_SVC_NAME and unique within the pod. Each named port in a pod must have a unique name. Name for the port that can be referred to by services.", + Type: []string{"string"}, + Format: "", + }, + }, + "hostPort": { + SchemaProps: spec.SchemaProps{ + Description: "Number of port to expose on the host. If specified, this must be a valid port number, 0 < x < 65536. If HostNetwork is specified, this must match ContainerPort. Most containers do not need this.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "containerPort": { + SchemaProps: spec.SchemaProps{ + Description: "Number of port to expose on the pod's IP address. This must be a valid port number, 0 < x < 65536.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "protocol": { + SchemaProps: spec.SchemaProps{ + Description: "Protocol for port. Must be UDP, TCP, or SCTP. Defaults to \"TCP\".", + Type: []string{"string"}, + Format: "", + }, + }, + "hostIP": { + SchemaProps: spec.SchemaProps{ + Description: "What host IP to bind the external port to.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"containerPort"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_ContainerState(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ContainerState holds a possible state of container. Only one of its members may be specified. If none of them is specified, the default one is ContainerStateWaiting.", + Properties: map[string]spec.Schema{ + "waiting": { + SchemaProps: spec.SchemaProps{ + Description: "Details about a waiting container", + Ref: ref("k8s.io/api/core/v1.ContainerStateWaiting"), + }, + }, + "running": { + SchemaProps: spec.SchemaProps{ + Description: "Details about a running container", + Ref: ref("k8s.io/api/core/v1.ContainerStateRunning"), + }, + }, + "terminated": { + SchemaProps: spec.SchemaProps{ + Description: "Details about a terminated container", + Ref: ref("k8s.io/api/core/v1.ContainerStateTerminated"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.ContainerStateRunning", "k8s.io/api/core/v1.ContainerStateTerminated", "k8s.io/api/core/v1.ContainerStateWaiting"}, + } +} + +func schema_k8sio_api_core_v1_ContainerStateRunning(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ContainerStateRunning is a running state of a container.", + Properties: map[string]spec.Schema{ + "startedAt": { + SchemaProps: spec.SchemaProps{ + Description: "Time at which the container was last (re-)started", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, + } +} + +func schema_k8sio_api_core_v1_ContainerStateTerminated(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ContainerStateTerminated is a terminated state of a container.", + Properties: map[string]spec.Schema{ + "exitCode": { + SchemaProps: spec.SchemaProps{ + Description: "Exit status from the last termination of the container", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "signal": { + SchemaProps: spec.SchemaProps{ + Description: "Signal from the last termination of the container", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "reason": { + SchemaProps: spec.SchemaProps{ + Description: "(brief) reason from the last termination of the container", + Type: []string{"string"}, + Format: "", + }, + }, + "message": { + SchemaProps: spec.SchemaProps{ + Description: "Message regarding the last termination of the container", + Type: []string{"string"}, + Format: "", + }, + }, + "startedAt": { + SchemaProps: spec.SchemaProps{ + Description: "Time at which previous execution of the container started", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, + "finishedAt": { + SchemaProps: spec.SchemaProps{ + Description: "Time at which the container last terminated", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, + "containerID": { + SchemaProps: spec.SchemaProps{ + Description: "Container's ID in the format 'docker://'", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"exitCode"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, + } +} + +func schema_k8sio_api_core_v1_ContainerStateWaiting(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ContainerStateWaiting is a waiting state of a container.", + Properties: map[string]spec.Schema{ + "reason": { + SchemaProps: spec.SchemaProps{ + Description: "(brief) reason the container is not yet running.", + Type: []string{"string"}, + Format: "", + }, + }, + "message": { + SchemaProps: spec.SchemaProps{ + Description: "Message regarding why the container is not yet running.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_ContainerStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ContainerStatus contains details for the current status of this container.", + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "This must be a DNS_LABEL. Each container in a pod must have a unique name. Cannot be updated.", + Type: []string{"string"}, + Format: "", + }, + }, + "state": { + SchemaProps: spec.SchemaProps{ + Description: "Details about the container's current condition.", + Ref: ref("k8s.io/api/core/v1.ContainerState"), + }, + }, + "lastState": { + SchemaProps: spec.SchemaProps{ + Description: "Details about the container's last termination condition.", + Ref: ref("k8s.io/api/core/v1.ContainerState"), + }, + }, + "ready": { + SchemaProps: spec.SchemaProps{ + Description: "Specifies whether the container has passed its readiness probe.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "restartCount": { + SchemaProps: spec.SchemaProps{ + Description: "The number of times the container has been restarted, currently based on the number of dead containers that have not yet been removed. Note that this is calculated from dead containers. But those containers are subject to garbage collection. This value will get capped at 5 by GC.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "image": { + SchemaProps: spec.SchemaProps{ + Description: "The image the container is running. More info: https://kubernetes.io/docs/concepts/containers/images", + Type: []string{"string"}, + Format: "", + }, + }, + "imageID": { + SchemaProps: spec.SchemaProps{ + Description: "ImageID of the container's image.", + Type: []string{"string"}, + Format: "", + }, + }, + "containerID": { + SchemaProps: spec.SchemaProps{ + Description: "Container's ID in the format 'docker://'.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"name", "ready", "restartCount", "image", "imageID"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.ContainerState"}, + } +} + +func schema_k8sio_api_core_v1_DaemonEndpoint(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "DaemonEndpoint contains information about a single Daemon endpoint.", + Properties: map[string]spec.Schema{ + "Port": { + SchemaProps: spec.SchemaProps{ + Description: "Port number of the given endpoint.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + Required: []string{"Port"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_DownwardAPIProjection(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Represents downward API info for projecting into a projected volume. Note that this is identical to a downwardAPI volume source without the default mode.", + Properties: map[string]spec.Schema{ + "items": { + SchemaProps: spec.SchemaProps{ + Description: "Items is a list of DownwardAPIVolume file", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.DownwardAPIVolumeFile"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.DownwardAPIVolumeFile"}, + } +} + +func schema_k8sio_api_core_v1_DownwardAPIVolumeFile(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "DownwardAPIVolumeFile represents information to create the file containing the pod field", + Properties: map[string]spec.Schema{ + "path": { + SchemaProps: spec.SchemaProps{ + Description: "Required: Path is the relative path name of the file to be created. Must not be absolute or contain the '..' path. Must be utf-8 encoded. The first item of the relative path must not start with '..'", + Type: []string{"string"}, + Format: "", + }, + }, + "fieldRef": { + SchemaProps: spec.SchemaProps{ + Description: "Required: Selects a field of the pod: only annotations, labels, name and namespace are supported.", + Ref: ref("k8s.io/api/core/v1.ObjectFieldSelector"), + }, + }, + "resourceFieldRef": { + SchemaProps: spec.SchemaProps{ + Description: "Selects a resource of the container: only resources limits and requests (limits.cpu, limits.memory, requests.cpu and requests.memory) are currently supported.", + Ref: ref("k8s.io/api/core/v1.ResourceFieldSelector"), + }, + }, + "mode": { + SchemaProps: spec.SchemaProps{ + Description: "Optional: mode bits to use on this file, must be a value between 0 and 0777. If not specified, the volume defaultMode will be used. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + Required: []string{"path"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.ObjectFieldSelector", "k8s.io/api/core/v1.ResourceFieldSelector"}, + } +} + +func schema_k8sio_api_core_v1_DownwardAPIVolumeSource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "DownwardAPIVolumeSource represents a volume containing downward API info. Downward API volumes support ownership management and SELinux relabeling.", + Properties: map[string]spec.Schema{ + "items": { + SchemaProps: spec.SchemaProps{ + Description: "Items is a list of downward API volume file", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.DownwardAPIVolumeFile"), + }, + }, + }, + }, + }, + "defaultMode": { + SchemaProps: spec.SchemaProps{ + Description: "Optional: mode bits to use on created files by default. Must be a value between 0 and 0777. Defaults to 0644. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.DownwardAPIVolumeFile"}, + } +} + +func schema_k8sio_api_core_v1_EmptyDirVolumeSource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Represents an empty directory for a pod. Empty directory volumes support ownership management and SELinux relabeling.", + Properties: map[string]spec.Schema{ + "medium": { + SchemaProps: spec.SchemaProps{ + Description: "What type of storage medium should back this directory. The default is \"\" which means to use the node's default medium. Must be an empty string (default) or Memory. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir", + Type: []string{"string"}, + Format: "", + }, + }, + "sizeLimit": { + SchemaProps: spec.SchemaProps{ + Description: "Total amount of local storage required for this EmptyDir volume. The size limit is also applicable for memory medium. The maximum usage on memory medium EmptyDir would be the minimum value between the SizeLimit specified here and the sum of memory limits of all containers in a pod. The default is nil which means that the limit is undefined. More info: http://kubernetes.io/docs/user-guide/volumes#emptydir", + Ref: ref("k8s.io/apimachinery/pkg/api/resource.Quantity"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/api/resource.Quantity"}, + } +} + +func schema_k8sio_api_core_v1_EndpointAddress(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "EndpointAddress is a tuple that describes single IP address.", + Properties: map[string]spec.Schema{ + "ip": { + SchemaProps: spec.SchemaProps{ + Description: "The IP of this endpoint. May not be loopback (127.0.0.0/8), link-local (169.254.0.0/16), or link-local multicast ((224.0.0.0/24). IPv6 is also accepted but not fully supported on all platforms. Also, certain kubernetes components, like kube-proxy, are not IPv6 ready.", + Type: []string{"string"}, + Format: "", + }, + }, + "hostname": { + SchemaProps: spec.SchemaProps{ + Description: "The Hostname of this endpoint", + Type: []string{"string"}, + Format: "", + }, + }, + "nodeName": { + SchemaProps: spec.SchemaProps{ + Description: "Optional: Node hosting this endpoint. This can be used to determine endpoints local to a node.", + Type: []string{"string"}, + Format: "", + }, + }, + "targetRef": { + SchemaProps: spec.SchemaProps{ + Description: "Reference to object providing the endpoint.", + Ref: ref("k8s.io/api/core/v1.ObjectReference"), + }, + }, + }, + Required: []string{"ip"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.ObjectReference"}, + } +} + +func schema_k8sio_api_core_v1_EndpointPort(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "EndpointPort is a tuple that describes a single port.", + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "The name of this port (corresponds to ServicePort.Name). Must be a DNS_LABEL. Optional only if one port is defined.", + Type: []string{"string"}, + Format: "", + }, + }, + "port": { + SchemaProps: spec.SchemaProps{ + Description: "The port number of the endpoint.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "protocol": { + SchemaProps: spec.SchemaProps{ + Description: "The IP protocol for this port. Must be UDP, TCP, or SCTP. Default is TCP.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"port"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_EndpointSubset(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "EndpointSubset is a group of addresses with a common set of ports. The expanded set of endpoints is the Cartesian product of Addresses x Ports. For example, given:\n {\n Addresses: [{\"ip\": \"10.10.1.1\"}, {\"ip\": \"10.10.2.2\"}],\n Ports: [{\"name\": \"a\", \"port\": 8675}, {\"name\": \"b\", \"port\": 309}]\n }\nThe resulting set of endpoints can be viewed as:\n a: [ 10.10.1.1:8675, 10.10.2.2:8675 ],\n b: [ 10.10.1.1:309, 10.10.2.2:309 ]", + Properties: map[string]spec.Schema{ + "addresses": { + SchemaProps: spec.SchemaProps{ + Description: "IP addresses which offer the related ports that are marked as ready. These endpoints should be considered safe for load balancers and clients to utilize.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.EndpointAddress"), + }, + }, + }, + }, + }, + "notReadyAddresses": { + SchemaProps: spec.SchemaProps{ + Description: "IP addresses which offer the related ports but are not currently marked as ready because they have not yet finished starting, have recently failed a readiness check, or have recently failed a liveness check.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.EndpointAddress"), + }, + }, + }, + }, + }, + "ports": { + SchemaProps: spec.SchemaProps{ + Description: "Port numbers available on the related IP addresses.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.EndpointPort"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.EndpointAddress", "k8s.io/api/core/v1.EndpointPort"}, + } +} + +func schema_k8sio_api_core_v1_Endpoints(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Endpoints is a collection of endpoints that implement the actual service. Example:\n Name: \"mysvc\",\n Subsets: [\n {\n Addresses: [{\"ip\": \"10.10.1.1\"}, {\"ip\": \"10.10.2.2\"}],\n Ports: [{\"name\": \"a\", \"port\": 8675}, {\"name\": \"b\", \"port\": 309}]\n },\n {\n Addresses: [{\"ip\": \"10.10.3.3\"}],\n Ports: [{\"name\": \"a\", \"port\": 93}, {\"name\": \"b\", \"port\": 76}]\n },\n ]", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "subsets": { + SchemaProps: spec.SchemaProps{ + Description: "The set of all endpoints is the union of all subsets. Addresses are placed into subsets according to the IPs they share. A single address with multiple ports, some of which are ready and some of which are not (because they come from different containers) will result in the address being displayed in different subsets for the different ports. No address will appear in both Addresses and NotReadyAddresses in the same subset. Sets of addresses and ports that comprise a service.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.EndpointSubset"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.EndpointSubset", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_k8sio_api_core_v1_EndpointsList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "EndpointsList is a list of endpoints.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Description: "List of endpoints.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.Endpoints"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.Endpoints", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_k8sio_api_core_v1_EnvFromSource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "EnvFromSource represents the source of a set of ConfigMaps", + Properties: map[string]spec.Schema{ + "prefix": { + SchemaProps: spec.SchemaProps{ + Description: "An optional identifier to prepend to each key in the ConfigMap. Must be a C_IDENTIFIER.", + Type: []string{"string"}, + Format: "", + }, + }, + "configMapRef": { + SchemaProps: spec.SchemaProps{ + Description: "The ConfigMap to select from", + Ref: ref("k8s.io/api/core/v1.ConfigMapEnvSource"), + }, + }, + "secretRef": { + SchemaProps: spec.SchemaProps{ + Description: "The Secret to select from", + Ref: ref("k8s.io/api/core/v1.SecretEnvSource"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.ConfigMapEnvSource", "k8s.io/api/core/v1.SecretEnvSource"}, + } +} + +func schema_k8sio_api_core_v1_EnvVar(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "EnvVar represents an environment variable present in a Container.", + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name of the environment variable. Must be a C_IDENTIFIER.", + Type: []string{"string"}, + Format: "", + }, + }, + "value": { + SchemaProps: spec.SchemaProps{ + Description: "Variable references $(VAR_NAME) are expanded using the previous defined environment variables in the container and any service environment variables. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Defaults to \"\".", + Type: []string{"string"}, + Format: "", + }, + }, + "valueFrom": { + SchemaProps: spec.SchemaProps{ + Description: "Source for the environment variable's value. Cannot be used if value is not empty.", + Ref: ref("k8s.io/api/core/v1.EnvVarSource"), + }, + }, + }, + Required: []string{"name"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.EnvVarSource"}, + } +} + +func schema_k8sio_api_core_v1_EnvVarSource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "EnvVarSource represents a source for the value of an EnvVar.", + Properties: map[string]spec.Schema{ + "fieldRef": { + SchemaProps: spec.SchemaProps{ + Description: "Selects a field of the pod: supports metadata.name, metadata.namespace, metadata.labels, metadata.annotations, spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP.", + Ref: ref("k8s.io/api/core/v1.ObjectFieldSelector"), + }, + }, + "resourceFieldRef": { + SchemaProps: spec.SchemaProps{ + Description: "Selects a resource of the container: only resources limits and requests (limits.cpu, limits.memory, limits.ephemeral-storage, requests.cpu, requests.memory and requests.ephemeral-storage) are currently supported.", + Ref: ref("k8s.io/api/core/v1.ResourceFieldSelector"), + }, + }, + "configMapKeyRef": { + SchemaProps: spec.SchemaProps{ + Description: "Selects a key of a ConfigMap.", + Ref: ref("k8s.io/api/core/v1.ConfigMapKeySelector"), + }, + }, + "secretKeyRef": { + SchemaProps: spec.SchemaProps{ + Description: "Selects a key of a secret in the pod's namespace", + Ref: ref("k8s.io/api/core/v1.SecretKeySelector"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.ConfigMapKeySelector", "k8s.io/api/core/v1.ObjectFieldSelector", "k8s.io/api/core/v1.ResourceFieldSelector", "k8s.io/api/core/v1.SecretKeySelector"}, + } +} + +func schema_k8sio_api_core_v1_Event(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Event is a report of an event somewhere in the cluster.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "involvedObject": { + SchemaProps: spec.SchemaProps{ + Description: "The object that this event is about.", + Ref: ref("k8s.io/api/core/v1.ObjectReference"), + }, + }, + "reason": { + SchemaProps: spec.SchemaProps{ + Description: "This should be a short, machine understandable string that gives the reason for the transition into the object's current status.", + Type: []string{"string"}, + Format: "", + }, + }, + "message": { + SchemaProps: spec.SchemaProps{ + Description: "A human-readable description of the status of this operation.", + Type: []string{"string"}, + Format: "", + }, + }, + "source": { + SchemaProps: spec.SchemaProps{ + Description: "The component reporting this event. Should be a short machine understandable string.", + Ref: ref("k8s.io/api/core/v1.EventSource"), + }, + }, + "firstTimestamp": { + SchemaProps: spec.SchemaProps{ + Description: "The time at which the event was first recorded. (Time of server receipt is in TypeMeta.)", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, + "lastTimestamp": { + SchemaProps: spec.SchemaProps{ + Description: "The time at which the most recent occurrence of this event was recorded.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, + "count": { + SchemaProps: spec.SchemaProps{ + Description: "The number of times this event has occurred.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "type": { + SchemaProps: spec.SchemaProps{ + Description: "Type of this event (Normal, Warning), new types could be added in the future", + Type: []string{"string"}, + Format: "", + }, + }, + "eventTime": { + SchemaProps: spec.SchemaProps{ + Description: "Time when this Event was first observed.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.MicroTime"), + }, + }, + "series": { + SchemaProps: spec.SchemaProps{ + Description: "Data about the Event series this event represents or nil if it's a singleton Event.", + Ref: ref("k8s.io/api/core/v1.EventSeries"), + }, + }, + "action": { + SchemaProps: spec.SchemaProps{ + Description: "What action was taken/failed regarding to the Regarding object.", + Type: []string{"string"}, + Format: "", + }, + }, + "related": { + SchemaProps: spec.SchemaProps{ + Description: "Optional secondary object for more complex actions.", + Ref: ref("k8s.io/api/core/v1.ObjectReference"), + }, + }, + "reportingComponent": { + SchemaProps: spec.SchemaProps{ + Description: "Name of the controller that emitted this Event, e.g. `kubernetes.io/kubelet`.", + Type: []string{"string"}, + Format: "", + }, + }, + "reportingInstance": { + SchemaProps: spec.SchemaProps{ + Description: "ID of the controller instance, e.g. `kubelet-xyzf`.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"metadata", "involvedObject"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.EventSeries", "k8s.io/api/core/v1.EventSource", "k8s.io/api/core/v1.ObjectReference", "k8s.io/apimachinery/pkg/apis/meta/v1.MicroTime", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta", "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, + } +} + +func schema_k8sio_api_core_v1_EventList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "EventList is a list of events.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Description: "List of events", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.Event"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.Event", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_k8sio_api_core_v1_EventSeries(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "EventSeries contain information on series of events, i.e. thing that was/is happening continuously for some time.", + Properties: map[string]spec.Schema{ + "count": { + SchemaProps: spec.SchemaProps{ + Description: "Number of occurrences in this series up to the last heartbeat time", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "lastObservedTime": { + SchemaProps: spec.SchemaProps{ + Description: "Time of the last occurrence observed", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.MicroTime"), + }, + }, + "state": { + SchemaProps: spec.SchemaProps{ + Description: "State of this Series: Ongoing or Finished", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.MicroTime"}, + } +} + +func schema_k8sio_api_core_v1_EventSource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "EventSource contains information for an event.", + Properties: map[string]spec.Schema{ + "component": { + SchemaProps: spec.SchemaProps{ + Description: "Component from which the event is generated.", + Type: []string{"string"}, + Format: "", + }, + }, + "host": { + SchemaProps: spec.SchemaProps{ + Description: "Node name on which the event is generated.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_ExecAction(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ExecAction describes a \"run in container\" action.", + Properties: map[string]spec.Schema{ + "command": { + SchemaProps: spec.SchemaProps{ + Description: "Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_FCVolumeSource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Represents a Fibre Channel volume. Fibre Channel volumes can only be mounted as read/write once. Fibre Channel volumes support ownership management and SELinux relabeling.", + Properties: map[string]spec.Schema{ + "targetWWNs": { + SchemaProps: spec.SchemaProps{ + Description: "Optional: FC target worldwide names (WWNs)", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "lun": { + SchemaProps: spec.SchemaProps{ + Description: "Optional: FC target lun number", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "fsType": { + SchemaProps: spec.SchemaProps{ + Description: "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified.", + Type: []string{"string"}, + Format: "", + }, + }, + "readOnly": { + SchemaProps: spec.SchemaProps{ + Description: "Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "wwids": { + SchemaProps: spec.SchemaProps{ + Description: "Optional: FC volume world wide identifiers (wwids) Either wwids or combination of targetWWNs and lun must be set, but not both simultaneously.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_FlexPersistentVolumeSource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "FlexPersistentVolumeSource represents a generic persistent volume resource that is provisioned/attached using an exec based plugin.", + Properties: map[string]spec.Schema{ + "driver": { + SchemaProps: spec.SchemaProps{ + Description: "Driver is the name of the driver to use for this volume.", + Type: []string{"string"}, + Format: "", + }, + }, + "fsType": { + SchemaProps: spec.SchemaProps{ + Description: "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". The default filesystem depends on FlexVolume script.", + Type: []string{"string"}, + Format: "", + }, + }, + "secretRef": { + SchemaProps: spec.SchemaProps{ + Description: "Optional: SecretRef is reference to the secret object containing sensitive information to pass to the plugin scripts. This may be empty if no secret object is specified. If the secret object contains more than one secret, all secrets are passed to the plugin scripts.", + Ref: ref("k8s.io/api/core/v1.SecretReference"), + }, + }, + "readOnly": { + SchemaProps: spec.SchemaProps{ + Description: "Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "options": { + SchemaProps: spec.SchemaProps{ + Description: "Optional: Extra command options if any.", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + Required: []string{"driver"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.SecretReference"}, + } +} + +func schema_k8sio_api_core_v1_FlexVolumeSource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "FlexVolume represents a generic volume resource that is provisioned/attached using an exec based plugin.", + Properties: map[string]spec.Schema{ + "driver": { + SchemaProps: spec.SchemaProps{ + Description: "Driver is the name of the driver to use for this volume.", + Type: []string{"string"}, + Format: "", + }, + }, + "fsType": { + SchemaProps: spec.SchemaProps{ + Description: "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". The default filesystem depends on FlexVolume script.", + Type: []string{"string"}, + Format: "", + }, + }, + "secretRef": { + SchemaProps: spec.SchemaProps{ + Description: "Optional: SecretRef is reference to the secret object containing sensitive information to pass to the plugin scripts. This may be empty if no secret object is specified. If the secret object contains more than one secret, all secrets are passed to the plugin scripts.", + Ref: ref("k8s.io/api/core/v1.LocalObjectReference"), + }, + }, + "readOnly": { + SchemaProps: spec.SchemaProps{ + Description: "Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "options": { + SchemaProps: spec.SchemaProps{ + Description: "Optional: Extra command options if any.", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + Required: []string{"driver"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.LocalObjectReference"}, + } +} + +func schema_k8sio_api_core_v1_FlockerVolumeSource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Represents a Flocker volume mounted by the Flocker agent. One and only one of datasetName and datasetUUID should be set. Flocker volumes do not support ownership management or SELinux relabeling.", + Properties: map[string]spec.Schema{ + "datasetName": { + SchemaProps: spec.SchemaProps{ + Description: "Name of the dataset stored as metadata -> name on the dataset for Flocker should be considered as deprecated", + Type: []string{"string"}, + Format: "", + }, + }, + "datasetUUID": { + SchemaProps: spec.SchemaProps{ + Description: "UUID of the dataset. This is unique identifier of a Flocker dataset", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_GCEPersistentDiskVolumeSource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Represents a Persistent Disk resource in Google Compute Engine.\n\nA GCE PD must exist before mounting to a container. The disk must also be in the same GCE project and zone as the kubelet. A GCE PD can only be mounted as read/write once or read-only many times. GCE PDs support ownership management and SELinux relabeling.", + Properties: map[string]spec.Schema{ + "pdName": { + SchemaProps: spec.SchemaProps{ + Description: "Unique name of the PD resource in GCE. Used to identify the disk in GCE. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk", + Type: []string{"string"}, + Format: "", + }, + }, + "fsType": { + SchemaProps: spec.SchemaProps{ + Description: "Filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk", + Type: []string{"string"}, + Format: "", + }, + }, + "partition": { + SchemaProps: spec.SchemaProps{ + Description: "The partition in the volume that you want to mount. If omitted, the default is to mount by volume name. Examples: For volume /dev/sda1, you specify the partition as \"1\". Similarly, the volume partition for /dev/sda is \"0\" (or you can leave the property empty). More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "readOnly": { + SchemaProps: spec.SchemaProps{ + Description: "ReadOnly here will force the ReadOnly setting in VolumeMounts. Defaults to false. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk", + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + Required: []string{"pdName"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_GitRepoVolumeSource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Represents a volume that is populated with the contents of a git repository. Git repo volumes do not support ownership management. Git repo volumes support SELinux relabeling.\n\nDEPRECATED: GitRepo is deprecated. To provision a container with a git repo, mount an EmptyDir into an InitContainer that clones the repo using git, then mount the EmptyDir into the Pod's container.", + Properties: map[string]spec.Schema{ + "repository": { + SchemaProps: spec.SchemaProps{ + Description: "Repository URL", + Type: []string{"string"}, + Format: "", + }, + }, + "revision": { + SchemaProps: spec.SchemaProps{ + Description: "Commit hash for the specified revision.", + Type: []string{"string"}, + Format: "", + }, + }, + "directory": { + SchemaProps: spec.SchemaProps{ + Description: "Target directory name. Must not contain or start with '..'. If '.' is supplied, the volume directory will be the git repository. Otherwise, if specified, the volume will contain the git repository in the subdirectory with the given name.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"repository"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_GlusterfsVolumeSource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Represents a Glusterfs mount that lasts the lifetime of a pod. Glusterfs volumes do not support ownership management or SELinux relabeling.", + Properties: map[string]spec.Schema{ + "endpoints": { + SchemaProps: spec.SchemaProps{ + Description: "EndpointsName is the endpoint name that details Glusterfs topology. More info: https://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md#create-a-pod", + Type: []string{"string"}, + Format: "", + }, + }, + "path": { + SchemaProps: spec.SchemaProps{ + Description: "Path is the Glusterfs volume path. More info: https://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md#create-a-pod", + Type: []string{"string"}, + Format: "", + }, + }, + "readOnly": { + SchemaProps: spec.SchemaProps{ + Description: "ReadOnly here will force the Glusterfs volume to be mounted with read-only permissions. Defaults to false. More info: https://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md#create-a-pod", + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + Required: []string{"endpoints", "path"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_HTTPGetAction(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "HTTPGetAction describes an action based on HTTP Get requests.", + Properties: map[string]spec.Schema{ + "path": { + SchemaProps: spec.SchemaProps{ + Description: "Path to access on the HTTP server.", + Type: []string{"string"}, + Format: "", + }, + }, + "port": { + SchemaProps: spec.SchemaProps{ + Description: "Name or number of the port to access on the container. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME.", + Ref: ref("k8s.io/apimachinery/pkg/util/intstr.IntOrString"), + }, + }, + "host": { + SchemaProps: spec.SchemaProps{ + Description: "Host name to connect to, defaults to the pod IP. You probably want to set \"Host\" in httpHeaders instead.", + Type: []string{"string"}, + Format: "", + }, + }, + "scheme": { + SchemaProps: spec.SchemaProps{ + Description: "Scheme to use for connecting to the host. Defaults to HTTP.", + Type: []string{"string"}, + Format: "", + }, + }, + "httpHeaders": { + SchemaProps: spec.SchemaProps{ + Description: "Custom headers to set in the request. HTTP allows repeated headers.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.HTTPHeader"), + }, + }, + }, + }, + }, + }, + Required: []string{"port"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.HTTPHeader", "k8s.io/apimachinery/pkg/util/intstr.IntOrString"}, + } +} + +func schema_k8sio_api_core_v1_HTTPHeader(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "HTTPHeader describes a custom header to be used in HTTP probes", + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "The header field name", + Type: []string{"string"}, + Format: "", + }, + }, + "value": { + SchemaProps: spec.SchemaProps{ + Description: "The header field value", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"name", "value"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_Handler(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Handler defines a specific action that should be taken", + Properties: map[string]spec.Schema{ + "exec": { + SchemaProps: spec.SchemaProps{ + Description: "One and only one of the following should be specified. Exec specifies the action to take.", + Ref: ref("k8s.io/api/core/v1.ExecAction"), + }, + }, + "httpGet": { + SchemaProps: spec.SchemaProps{ + Description: "HTTPGet specifies the http request to perform.", + Ref: ref("k8s.io/api/core/v1.HTTPGetAction"), + }, + }, + "tcpSocket": { + SchemaProps: spec.SchemaProps{ + Description: "TCPSocket specifies an action involving a TCP port. TCP hooks not yet supported", + Ref: ref("k8s.io/api/core/v1.TCPSocketAction"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.ExecAction", "k8s.io/api/core/v1.HTTPGetAction", "k8s.io/api/core/v1.TCPSocketAction"}, + } +} + +func schema_k8sio_api_core_v1_HostAlias(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the pod's hosts file.", + Properties: map[string]spec.Schema{ + "ip": { + SchemaProps: spec.SchemaProps{ + Description: "IP address of the host file entry.", + Type: []string{"string"}, + Format: "", + }, + }, + "hostnames": { + SchemaProps: spec.SchemaProps{ + Description: "Hostnames for the above IP address.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_HostPathVolumeSource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Represents a host path mapped into a pod. Host path volumes do not support ownership management or SELinux relabeling.", + Properties: map[string]spec.Schema{ + "path": { + SchemaProps: spec.SchemaProps{ + Description: "Path of the directory on the host. If the path is a symlink, it will follow the link to the real path. More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath", + Type: []string{"string"}, + Format: "", + }, + }, + "type": { + SchemaProps: spec.SchemaProps{ + Description: "Type for HostPath Volume Defaults to \"\" More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"path"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_ISCSIPersistentVolumeSource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ISCSIPersistentVolumeSource represents an ISCSI disk. ISCSI volumes can only be mounted as read/write once. ISCSI volumes support ownership management and SELinux relabeling.", + Properties: map[string]spec.Schema{ + "targetPortal": { + SchemaProps: spec.SchemaProps{ + Description: "iSCSI Target Portal. The Portal is either an IP or ip_addr:port if the port is other than default (typically TCP ports 860 and 3260).", + Type: []string{"string"}, + Format: "", + }, + }, + "iqn": { + SchemaProps: spec.SchemaProps{ + Description: "Target iSCSI Qualified Name.", + Type: []string{"string"}, + Format: "", + }, + }, + "lun": { + SchemaProps: spec.SchemaProps{ + Description: "iSCSI Target Lun number.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "iscsiInterface": { + SchemaProps: spec.SchemaProps{ + Description: "iSCSI Interface Name that uses an iSCSI transport. Defaults to 'default' (tcp).", + Type: []string{"string"}, + Format: "", + }, + }, + "fsType": { + SchemaProps: spec.SchemaProps{ + Description: "Filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#iscsi", + Type: []string{"string"}, + Format: "", + }, + }, + "readOnly": { + SchemaProps: spec.SchemaProps{ + Description: "ReadOnly here will force the ReadOnly setting in VolumeMounts. Defaults to false.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "portals": { + SchemaProps: spec.SchemaProps{ + Description: "iSCSI Target Portal List. The Portal is either an IP or ip_addr:port if the port is other than default (typically TCP ports 860 and 3260).", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "chapAuthDiscovery": { + SchemaProps: spec.SchemaProps{ + Description: "whether support iSCSI Discovery CHAP authentication", + Type: []string{"boolean"}, + Format: "", + }, + }, + "chapAuthSession": { + SchemaProps: spec.SchemaProps{ + Description: "whether support iSCSI Session CHAP authentication", + Type: []string{"boolean"}, + Format: "", + }, + }, + "secretRef": { + SchemaProps: spec.SchemaProps{ + Description: "CHAP Secret for iSCSI target and initiator authentication", + Ref: ref("k8s.io/api/core/v1.SecretReference"), + }, + }, + "initiatorName": { + SchemaProps: spec.SchemaProps{ + Description: "Custom iSCSI Initiator Name. If initiatorName is specified with iscsiInterface simultaneously, new iSCSI interface : will be created for the connection.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"targetPortal", "iqn", "lun"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.SecretReference"}, + } +} + +func schema_k8sio_api_core_v1_ISCSIVolumeSource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Represents an ISCSI disk. ISCSI volumes can only be mounted as read/write once. ISCSI volumes support ownership management and SELinux relabeling.", + Properties: map[string]spec.Schema{ + "targetPortal": { + SchemaProps: spec.SchemaProps{ + Description: "iSCSI Target Portal. The Portal is either an IP or ip_addr:port if the port is other than default (typically TCP ports 860 and 3260).", + Type: []string{"string"}, + Format: "", + }, + }, + "iqn": { + SchemaProps: spec.SchemaProps{ + Description: "Target iSCSI Qualified Name.", + Type: []string{"string"}, + Format: "", + }, + }, + "lun": { + SchemaProps: spec.SchemaProps{ + Description: "iSCSI Target Lun number.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "iscsiInterface": { + SchemaProps: spec.SchemaProps{ + Description: "iSCSI Interface Name that uses an iSCSI transport. Defaults to 'default' (tcp).", + Type: []string{"string"}, + Format: "", + }, + }, + "fsType": { + SchemaProps: spec.SchemaProps{ + Description: "Filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#iscsi", + Type: []string{"string"}, + Format: "", + }, + }, + "readOnly": { + SchemaProps: spec.SchemaProps{ + Description: "ReadOnly here will force the ReadOnly setting in VolumeMounts. Defaults to false.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "portals": { + SchemaProps: spec.SchemaProps{ + Description: "iSCSI Target Portal List. The portal is either an IP or ip_addr:port if the port is other than default (typically TCP ports 860 and 3260).", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "chapAuthDiscovery": { + SchemaProps: spec.SchemaProps{ + Description: "whether support iSCSI Discovery CHAP authentication", + Type: []string{"boolean"}, + Format: "", + }, + }, + "chapAuthSession": { + SchemaProps: spec.SchemaProps{ + Description: "whether support iSCSI Session CHAP authentication", + Type: []string{"boolean"}, + Format: "", + }, + }, + "secretRef": { + SchemaProps: spec.SchemaProps{ + Description: "CHAP Secret for iSCSI target and initiator authentication", + Ref: ref("k8s.io/api/core/v1.LocalObjectReference"), + }, + }, + "initiatorName": { + SchemaProps: spec.SchemaProps{ + Description: "Custom iSCSI Initiator Name. If initiatorName is specified with iscsiInterface simultaneously, new iSCSI interface : will be created for the connection.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"targetPortal", "iqn", "lun"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.LocalObjectReference"}, + } +} + +func schema_k8sio_api_core_v1_KeyToPath(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Maps a string key to a path within a volume.", + Properties: map[string]spec.Schema{ + "key": { + SchemaProps: spec.SchemaProps{ + Description: "The key to project.", + Type: []string{"string"}, + Format: "", + }, + }, + "path": { + SchemaProps: spec.SchemaProps{ + Description: "The relative path of the file to map the key to. May not be an absolute path. May not contain the path element '..'. May not start with the string '..'.", + Type: []string{"string"}, + Format: "", + }, + }, + "mode": { + SchemaProps: spec.SchemaProps{ + Description: "Optional: mode bits to use on this file, must be a value between 0 and 0777. If not specified, the volume defaultMode will be used. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + Required: []string{"key", "path"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_Lifecycle(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Lifecycle describes actions that the management system should take in response to container lifecycle events. For the PostStart and PreStop lifecycle handlers, management of the container blocks until the action is complete, unless the container process fails, in which case the handler is aborted.", + Properties: map[string]spec.Schema{ + "postStart": { + SchemaProps: spec.SchemaProps{ + Description: "PostStart is called immediately after a container is created. If the handler fails, the container is terminated and restarted according to its restart policy. Other management of the container blocks until the hook completes. More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks", + Ref: ref("k8s.io/api/core/v1.Handler"), + }, + }, + "preStop": { + SchemaProps: spec.SchemaProps{ + Description: "PreStop is called immediately before a container is terminated. The container is terminated after the handler completes. The reason for termination is passed to the handler. Regardless of the outcome of the handler, the container is eventually terminated. Other management of the container blocks until the hook completes. More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks", + Ref: ref("k8s.io/api/core/v1.Handler"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.Handler"}, + } +} + +func schema_k8sio_api_core_v1_LimitRange(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "LimitRange sets resource usage limits for each kind of resource in a Namespace.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Description: "Spec defines the limits enforced. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status", + Ref: ref("k8s.io/api/core/v1.LimitRangeSpec"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.LimitRangeSpec", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_k8sio_api_core_v1_LimitRangeItem(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "LimitRangeItem defines a min/max usage limit for any resource that matches on kind.", + Properties: map[string]spec.Schema{ + "type": { + SchemaProps: spec.SchemaProps{ + Description: "Type of resource that this limit applies to.", + Type: []string{"string"}, + Format: "", + }, + }, + "max": { + SchemaProps: spec.SchemaProps{ + Description: "Max usage constraints on this kind by resource name.", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/api/resource.Quantity"), + }, + }, + }, + }, + }, + "min": { + SchemaProps: spec.SchemaProps{ + Description: "Min usage constraints on this kind by resource name.", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/api/resource.Quantity"), + }, + }, + }, + }, + }, + "default": { + SchemaProps: spec.SchemaProps{ + Description: "Default resource requirement limit value by resource name if resource limit is omitted.", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/api/resource.Quantity"), + }, + }, + }, + }, + }, + "defaultRequest": { + SchemaProps: spec.SchemaProps{ + Description: "DefaultRequest is the default resource requirement request value by resource name if resource request is omitted.", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/api/resource.Quantity"), + }, + }, + }, + }, + }, + "maxLimitRequestRatio": { + SchemaProps: spec.SchemaProps{ + Description: "MaxLimitRequestRatio if specified, the named resource must have a request and limit that are both non-zero where limit divided by request is less than or equal to the enumerated value; this represents the max burst for the named resource.", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/api/resource.Quantity"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/api/resource.Quantity"}, + } +} + +func schema_k8sio_api_core_v1_LimitRangeList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "LimitRangeList is a list of LimitRange items.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Description: "Items is a list of LimitRange objects. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.LimitRange"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.LimitRange", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_k8sio_api_core_v1_LimitRangeSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "LimitRangeSpec defines a min/max usage limit for resources that match on kind.", + Properties: map[string]spec.Schema{ + "limits": { + SchemaProps: spec.SchemaProps{ + Description: "Limits is the list of LimitRangeItem objects that are enforced.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.LimitRangeItem"), + }, + }, + }, + }, + }, + }, + Required: []string{"limits"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.LimitRangeItem"}, + } +} + +func schema_k8sio_api_core_v1_List(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "List holds a list of objects, which may not be known by the server.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Description: "List of objects", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/runtime.RawExtension"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta", "k8s.io/apimachinery/pkg/runtime.RawExtension"}, + } +} + +func schema_k8sio_api_core_v1_LoadBalancerIngress(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "LoadBalancerIngress represents the status of a load-balancer ingress point: traffic intended for the service should be sent to an ingress point.", + Properties: map[string]spec.Schema{ + "ip": { + SchemaProps: spec.SchemaProps{ + Description: "IP is set for load-balancer ingress points that are IP based (typically GCE or OpenStack load-balancers)", + Type: []string{"string"}, + Format: "", + }, + }, + "hostname": { + SchemaProps: spec.SchemaProps{ + Description: "Hostname is set for load-balancer ingress points that are DNS based (typically AWS load-balancers)", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_LoadBalancerStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "LoadBalancerStatus represents the status of a load-balancer.", + Properties: map[string]spec.Schema{ + "ingress": { + SchemaProps: spec.SchemaProps{ + Description: "Ingress is a list containing ingress points for the load-balancer. Traffic intended for the service should be sent to these ingress points.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.LoadBalancerIngress"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.LoadBalancerIngress"}, + } +} + +func schema_k8sio_api_core_v1_LocalObjectReference(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "LocalObjectReference contains enough information to let you locate the referenced object inside the same namespace.", + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_LocalVolumeSource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Local represents directly-attached storage with node affinity (Beta feature)", + Properties: map[string]spec.Schema{ + "path": { + SchemaProps: spec.SchemaProps{ + Description: "The full path to the volume on the node. It can be either a directory or block device (disk, partition, ...).", + Type: []string{"string"}, + Format: "", + }, + }, + "fsType": { + SchemaProps: spec.SchemaProps{ + Description: "Filesystem type to mount. It applies only when the Path is a block device. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". The default value is to auto-select a fileystem if unspecified.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"path"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_NFSVolumeSource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Represents an NFS mount that lasts the lifetime of a pod. NFS volumes do not support ownership management or SELinux relabeling.", + Properties: map[string]spec.Schema{ + "server": { + SchemaProps: spec.SchemaProps{ + Description: "Server is the hostname or IP address of the NFS server. More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs", + Type: []string{"string"}, + Format: "", + }, + }, + "path": { + SchemaProps: spec.SchemaProps{ + Description: "Path that is exported by the NFS server. More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs", + Type: []string{"string"}, + Format: "", + }, + }, + "readOnly": { + SchemaProps: spec.SchemaProps{ + Description: "ReadOnly here will force the NFS export to be mounted with read-only permissions. Defaults to false. More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs", + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + Required: []string{"server", "path"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_Namespace(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Namespace provides a scope for Names. Use of multiple namespaces is optional.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Description: "Spec defines the behavior of the Namespace. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status", + Ref: ref("k8s.io/api/core/v1.NamespaceSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Description: "Status describes the current status of a Namespace. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status", + Ref: ref("k8s.io/api/core/v1.NamespaceStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.NamespaceSpec", "k8s.io/api/core/v1.NamespaceStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_k8sio_api_core_v1_NamespaceList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "NamespaceList is a list of Namespaces.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Description: "Items is the list of Namespace objects in the list. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.Namespace"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.Namespace", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_k8sio_api_core_v1_NamespaceSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "NamespaceSpec describes the attributes on a Namespace.", + Properties: map[string]spec.Schema{ + "finalizers": { + SchemaProps: spec.SchemaProps{ + Description: "Finalizers is an opaque list of values that must be empty to permanently remove object from storage. More info: https://kubernetes.io/docs/tasks/administer-cluster/namespaces/", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_NamespaceStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "NamespaceStatus is information about the current status of a Namespace.", + Properties: map[string]spec.Schema{ + "phase": { + SchemaProps: spec.SchemaProps{ + Description: "Phase is the current lifecycle phase of the namespace. More info: https://kubernetes.io/docs/tasks/administer-cluster/namespaces/", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_Node(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Node is a worker node in Kubernetes. Each node will have a unique identifier in the cache (i.e. in etcd).", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Description: "Spec defines the behavior of a node. https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status", + Ref: ref("k8s.io/api/core/v1.NodeSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Description: "Most recently observed status of the node. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status", + Ref: ref("k8s.io/api/core/v1.NodeStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.NodeSpec", "k8s.io/api/core/v1.NodeStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_k8sio_api_core_v1_NodeAddress(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "NodeAddress contains information for the node's address.", + Properties: map[string]spec.Schema{ + "type": { + SchemaProps: spec.SchemaProps{ + Description: "Node address type, one of Hostname, ExternalIP or InternalIP.", + Type: []string{"string"}, + Format: "", + }, + }, + "address": { + SchemaProps: spec.SchemaProps{ + Description: "The node address.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"type", "address"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_NodeAffinity(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Node affinity is a group of node affinity scheduling rules.", + Properties: map[string]spec.Schema{ + "requiredDuringSchedulingIgnoredDuringExecution": { + SchemaProps: spec.SchemaProps{ + Description: "If the affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to an update), the system may or may not try to eventually evict the pod from its node.", + Ref: ref("k8s.io/api/core/v1.NodeSelector"), + }, + }, + "preferredDuringSchedulingIgnoredDuringExecution": { + SchemaProps: spec.SchemaProps{ + Description: "The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding \"weight\" to the sum if the node matches the corresponding matchExpressions; the node(s) with the highest sum are the most preferred.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.PreferredSchedulingTerm"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.NodeSelector", "k8s.io/api/core/v1.PreferredSchedulingTerm"}, + } +} + +func schema_k8sio_api_core_v1_NodeCondition(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "NodeCondition contains condition information for a node.", + Properties: map[string]spec.Schema{ + "type": { + SchemaProps: spec.SchemaProps{ + Description: "Type of node condition.", + Type: []string{"string"}, + Format: "", + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Description: "Status of the condition, one of True, False, Unknown.", + Type: []string{"string"}, + Format: "", + }, + }, + "lastHeartbeatTime": { + SchemaProps: spec.SchemaProps{ + Description: "Last time we got an update on a given condition.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, + "lastTransitionTime": { + SchemaProps: spec.SchemaProps{ + Description: "Last time the condition transit from one status to another.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, + "reason": { + SchemaProps: spec.SchemaProps{ + Description: "(brief) reason for the condition's last transition.", + Type: []string{"string"}, + Format: "", + }, + }, + "message": { + SchemaProps: spec.SchemaProps{ + Description: "Human readable message indicating details about last transition.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"type", "status"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, + } +} + +func schema_k8sio_api_core_v1_NodeConfigSource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "NodeConfigSource specifies a source of node configuration. Exactly one subfield (excluding metadata) must be non-nil.", + Properties: map[string]spec.Schema{ + "configMap": { + SchemaProps: spec.SchemaProps{ + Description: "ConfigMap is a reference to a Node's ConfigMap", + Ref: ref("k8s.io/api/core/v1.ConfigMapNodeConfigSource"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.ConfigMapNodeConfigSource"}, + } +} + +func schema_k8sio_api_core_v1_NodeConfigStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "NodeConfigStatus describes the status of the config assigned by Node.Spec.ConfigSource.", + Properties: map[string]spec.Schema{ + "assigned": { + SchemaProps: spec.SchemaProps{ + Description: "Assigned reports the checkpointed config the node will try to use. When Node.Spec.ConfigSource is updated, the node checkpoints the associated config payload to local disk, along with a record indicating intended config. The node refers to this record to choose its config checkpoint, and reports this record in Assigned. Assigned only updates in the status after the record has been checkpointed to disk. When the Kubelet is restarted, it tries to make the Assigned config the Active config by loading and validating the checkpointed payload identified by Assigned.", + Ref: ref("k8s.io/api/core/v1.NodeConfigSource"), + }, + }, + "active": { + SchemaProps: spec.SchemaProps{ + Description: "Active reports the checkpointed config the node is actively using. Active will represent either the current version of the Assigned config, or the current LastKnownGood config, depending on whether attempting to use the Assigned config results in an error.", + Ref: ref("k8s.io/api/core/v1.NodeConfigSource"), + }, + }, + "lastKnownGood": { + SchemaProps: spec.SchemaProps{ + Description: "LastKnownGood reports the checkpointed config the node will fall back to when it encounters an error attempting to use the Assigned config. The Assigned config becomes the LastKnownGood config when the node determines that the Assigned config is stable and correct. This is currently implemented as a 10-minute soak period starting when the local record of Assigned config is updated. If the Assigned config is Active at the end of this period, it becomes the LastKnownGood. Note that if Spec.ConfigSource is reset to nil (use local defaults), the LastKnownGood is also immediately reset to nil, because the local default config is always assumed good. You should not make assumptions about the node's method of determining config stability and correctness, as this may change or become configurable in the future.", + Ref: ref("k8s.io/api/core/v1.NodeConfigSource"), + }, + }, + "error": { + SchemaProps: spec.SchemaProps{ + Description: "Error describes any problems reconciling the Spec.ConfigSource to the Active config. Errors may occur, for example, attempting to checkpoint Spec.ConfigSource to the local Assigned record, attempting to checkpoint the payload associated with Spec.ConfigSource, attempting to load or validate the Assigned config, etc. Errors may occur at different points while syncing config. Earlier errors (e.g. download or checkpointing errors) will not result in a rollback to LastKnownGood, and may resolve across Kubelet retries. Later errors (e.g. loading or validating a checkpointed config) will result in a rollback to LastKnownGood. In the latter case, it is usually possible to resolve the error by fixing the config assigned in Spec.ConfigSource. You can find additional information for debugging by searching the error message in the Kubelet log. Error is a human-readable description of the error state; machines can check whether or not Error is empty, but should not rely on the stability of the Error text across Kubelet versions.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.NodeConfigSource"}, + } +} + +func schema_k8sio_api_core_v1_NodeDaemonEndpoints(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "NodeDaemonEndpoints lists ports opened by daemons running on the Node.", + Properties: map[string]spec.Schema{ + "kubeletEndpoint": { + SchemaProps: spec.SchemaProps{ + Description: "Endpoint on which Kubelet is listening.", + Ref: ref("k8s.io/api/core/v1.DaemonEndpoint"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.DaemonEndpoint"}, + } +} + +func schema_k8sio_api_core_v1_NodeList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "NodeList is the whole list of all Nodes which have been registered with master.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Description: "List of nodes", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.Node"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.Node", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_k8sio_api_core_v1_NodeProxyOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "NodeProxyOptions is the query options to a Node's proxy call.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "path": { + SchemaProps: spec.SchemaProps{ + Description: "Path is the URL path to use for the current proxy request to node.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_NodeResources(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "NodeResources is an object for conveying resource information about a node. see http://releases.k8s.io/HEAD/docs/design/resources.md for more details.", + Properties: map[string]spec.Schema{ + "Capacity": { + SchemaProps: spec.SchemaProps{ + Description: "Capacity represents the available resources of a node", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/api/resource.Quantity"), + }, + }, + }, + }, + }, + }, + Required: []string{"Capacity"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/api/resource.Quantity"}, + } +} + +func schema_k8sio_api_core_v1_NodeSelector(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "A node selector represents the union of the results of one or more label queries over a set of nodes; that is, it represents the OR of the selectors represented by the node selector terms.", + Properties: map[string]spec.Schema{ + "nodeSelectorTerms": { + SchemaProps: spec.SchemaProps{ + Description: "Required. A list of node selector terms. The terms are ORed.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.NodeSelectorTerm"), + }, + }, + }, + }, + }, + }, + Required: []string{"nodeSelectorTerms"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.NodeSelectorTerm"}, + } +} + +func schema_k8sio_api_core_v1_NodeSelectorRequirement(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values.", + Properties: map[string]spec.Schema{ + "key": { + SchemaProps: spec.SchemaProps{ + Description: "The label key that the selector applies to.", + Type: []string{"string"}, + Format: "", + }, + }, + "operator": { + SchemaProps: spec.SchemaProps{ + Description: "Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.", + Type: []string{"string"}, + Format: "", + }, + }, + "values": { + SchemaProps: spec.SchemaProps{ + Description: "An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + Required: []string{"key", "operator"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_NodeSelectorTerm(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "A null or empty node selector term matches no objects. The requirements of them are ANDed. The TopologySelectorTerm type implements a subset of the NodeSelectorTerm.", + Properties: map[string]spec.Schema{ + "matchExpressions": { + SchemaProps: spec.SchemaProps{ + Description: "A list of node selector requirements by node's labels.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.NodeSelectorRequirement"), + }, + }, + }, + }, + }, + "matchFields": { + SchemaProps: spec.SchemaProps{ + Description: "A list of node selector requirements by node's fields.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.NodeSelectorRequirement"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.NodeSelectorRequirement"}, + } +} + +func schema_k8sio_api_core_v1_NodeSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "NodeSpec describes the attributes that a node is created with.", + Properties: map[string]spec.Schema{ + "podCIDR": { + SchemaProps: spec.SchemaProps{ + Description: "PodCIDR represents the pod IP range assigned to the node.", + Type: []string{"string"}, + Format: "", + }, + }, + "providerID": { + SchemaProps: spec.SchemaProps{ + Description: "ID of the node assigned by the cloud provider in the format: ://", + Type: []string{"string"}, + Format: "", + }, + }, + "unschedulable": { + SchemaProps: spec.SchemaProps{ + Description: "Unschedulable controls node schedulability of new pods. By default, node is schedulable. More info: https://kubernetes.io/docs/concepts/nodes/node/#manual-node-administration", + Type: []string{"boolean"}, + Format: "", + }, + }, + "taints": { + SchemaProps: spec.SchemaProps{ + Description: "If specified, the node's taints.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.Taint"), + }, + }, + }, + }, + }, + "configSource": { + SchemaProps: spec.SchemaProps{ + Description: "If specified, the source to get node configuration from The DynamicKubeletConfig feature gate must be enabled for the Kubelet to use this field", + Ref: ref("k8s.io/api/core/v1.NodeConfigSource"), + }, + }, + "externalID": { + SchemaProps: spec.SchemaProps{ + Description: "Deprecated. Not all kubelets will set this field. Remove field after 1.13. see: https://issues.k8s.io/61966", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.NodeConfigSource", "k8s.io/api/core/v1.Taint"}, + } +} + +func schema_k8sio_api_core_v1_NodeStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "NodeStatus is information about the current status of a node.", + Properties: map[string]spec.Schema{ + "capacity": { + SchemaProps: spec.SchemaProps{ + Description: "Capacity represents the total resources of a node. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#capacity", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/api/resource.Quantity"), + }, + }, + }, + }, + }, + "allocatable": { + SchemaProps: spec.SchemaProps{ + Description: "Allocatable represents the resources of a node that are available for scheduling. Defaults to Capacity.", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/api/resource.Quantity"), + }, + }, + }, + }, + }, + "phase": { + SchemaProps: spec.SchemaProps{ + Description: "NodePhase is the recently observed lifecycle phase of the node. More info: https://kubernetes.io/docs/concepts/nodes/node/#phase The field is never populated, and now is deprecated.", + Type: []string{"string"}, + Format: "", + }, + }, + "conditions": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-patch-merge-key": "type", + "x-kubernetes-patch-strategy": "merge", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "Conditions is an array of current observed node conditions. More info: https://kubernetes.io/docs/concepts/nodes/node/#condition", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.NodeCondition"), + }, + }, + }, + }, + }, + "addresses": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-patch-merge-key": "type", + "x-kubernetes-patch-strategy": "merge", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "List of addresses reachable to the node. Queried from cloud provider, if available. More info: https://kubernetes.io/docs/concepts/nodes/node/#addresses", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.NodeAddress"), + }, + }, + }, + }, + }, + "daemonEndpoints": { + SchemaProps: spec.SchemaProps{ + Description: "Endpoints of daemons running on the Node.", + Ref: ref("k8s.io/api/core/v1.NodeDaemonEndpoints"), + }, + }, + "nodeInfo": { + SchemaProps: spec.SchemaProps{ + Description: "Set of ids/uuids to uniquely identify the node. More info: https://kubernetes.io/docs/concepts/nodes/node/#info", + Ref: ref("k8s.io/api/core/v1.NodeSystemInfo"), + }, + }, + "images": { + SchemaProps: spec.SchemaProps{ + Description: "List of container images on this node", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.ContainerImage"), + }, + }, + }, + }, + }, + "volumesInUse": { + SchemaProps: spec.SchemaProps{ + Description: "List of attachable volumes in use (mounted) by the node.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "volumesAttached": { + SchemaProps: spec.SchemaProps{ + Description: "List of volumes that are attached to the node.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.AttachedVolume"), + }, + }, + }, + }, + }, + "config": { + SchemaProps: spec.SchemaProps{ + Description: "Status of the config assigned to the node via the dynamic Kubelet config feature.", + Ref: ref("k8s.io/api/core/v1.NodeConfigStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.AttachedVolume", "k8s.io/api/core/v1.ContainerImage", "k8s.io/api/core/v1.NodeAddress", "k8s.io/api/core/v1.NodeCondition", "k8s.io/api/core/v1.NodeConfigStatus", "k8s.io/api/core/v1.NodeDaemonEndpoints", "k8s.io/api/core/v1.NodeSystemInfo", "k8s.io/apimachinery/pkg/api/resource.Quantity"}, + } +} + +func schema_k8sio_api_core_v1_NodeSystemInfo(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "NodeSystemInfo is a set of ids/uuids to uniquely identify the node.", + Properties: map[string]spec.Schema{ + "machineID": { + SchemaProps: spec.SchemaProps{ + Description: "MachineID reported by the node. For unique machine identification in the cluster this field is preferred. Learn more from man(5) machine-id: http://man7.org/linux/man-pages/man5/machine-id.5.html", + Type: []string{"string"}, + Format: "", + }, + }, + "systemUUID": { + SchemaProps: spec.SchemaProps{ + Description: "SystemUUID reported by the node. For unique machine identification MachineID is preferred. This field is specific to Red Hat hosts https://access.redhat.com/documentation/en-US/Red_Hat_Subscription_Management/1/html/RHSM/getting-system-uuid.html", + Type: []string{"string"}, + Format: "", + }, + }, + "bootID": { + SchemaProps: spec.SchemaProps{ + Description: "Boot ID reported by the node.", + Type: []string{"string"}, + Format: "", + }, + }, + "kernelVersion": { + SchemaProps: spec.SchemaProps{ + Description: "Kernel Version reported by the node from 'uname -r' (e.g. 3.16.0-0.bpo.4-amd64).", + Type: []string{"string"}, + Format: "", + }, + }, + "osImage": { + SchemaProps: spec.SchemaProps{ + Description: "OS Image reported by the node from /etc/os-release (e.g. Debian GNU/Linux 7 (wheezy)).", + Type: []string{"string"}, + Format: "", + }, + }, + "containerRuntimeVersion": { + SchemaProps: spec.SchemaProps{ + Description: "ContainerRuntime Version reported by the node through runtime remote API (e.g. docker://1.5.0).", + Type: []string{"string"}, + Format: "", + }, + }, + "kubeletVersion": { + SchemaProps: spec.SchemaProps{ + Description: "Kubelet Version reported by the node.", + Type: []string{"string"}, + Format: "", + }, + }, + "kubeProxyVersion": { + SchemaProps: spec.SchemaProps{ + Description: "KubeProxy Version reported by the node.", + Type: []string{"string"}, + Format: "", + }, + }, + "operatingSystem": { + SchemaProps: spec.SchemaProps{ + Description: "The Operating System reported by the node", + Type: []string{"string"}, + Format: "", + }, + }, + "architecture": { + SchemaProps: spec.SchemaProps{ + Description: "The Architecture reported by the node", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"machineID", "systemUUID", "bootID", "kernelVersion", "osImage", "containerRuntimeVersion", "kubeletVersion", "kubeProxyVersion", "operatingSystem", "architecture"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_ObjectFieldSelector(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ObjectFieldSelector selects an APIVersioned field of an object.", + Properties: map[string]spec.Schema{ + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "Version of the schema the FieldPath is written in terms of, defaults to \"v1\".", + Type: []string{"string"}, + Format: "", + }, + }, + "fieldPath": { + SchemaProps: spec.SchemaProps{ + Description: "Path of the field to select in the specified API version.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"fieldPath"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_ObjectReference(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ObjectReference contains enough information to let you inspect or modify the referred object.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "namespace": { + SchemaProps: spec.SchemaProps{ + Description: "Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/", + Type: []string{"string"}, + Format: "", + }, + }, + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + Type: []string{"string"}, + Format: "", + }, + }, + "uid": { + SchemaProps: spec.SchemaProps{ + Description: "UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "API version of the referent.", + Type: []string{"string"}, + Format: "", + }, + }, + "resourceVersion": { + SchemaProps: spec.SchemaProps{ + Description: "Specific resourceVersion to which this reference is made, if any. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#concurrency-control-and-consistency", + Type: []string{"string"}, + Format: "", + }, + }, + "fieldPath": { + SchemaProps: spec.SchemaProps{ + Description: "If referring to a piece of an object instead of an entire object, this string should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. For example, if the object reference is to a container within a pod, this would take on a value like: \"spec.containers{name}\" (where \"name\" refers to the name of the container that triggered the event) or if no container name is specified \"spec.containers[2]\" (container with index 2 in this pod). This syntax is chosen only to have some well-defined way of referencing a part of an object.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_PersistentVolume(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PersistentVolume (PV) is a storage resource provisioned by an administrator. It is analogous to a node. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Description: "Spec defines a specification of a persistent volume owned by the cluster. Provisioned by an administrator. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistent-volumes", + Ref: ref("k8s.io/api/core/v1.PersistentVolumeSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Description: "Status represents the current information/status for the persistent volume. Populated by the system. Read-only. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistent-volumes", + Ref: ref("k8s.io/api/core/v1.PersistentVolumeStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.PersistentVolumeSpec", "k8s.io/api/core/v1.PersistentVolumeStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_k8sio_api_core_v1_PersistentVolumeClaim(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PersistentVolumeClaim is a user's request for and claim to a persistent volume", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Description: "Spec defines the desired characteristics of a volume requested by a pod author. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims", + Ref: ref("k8s.io/api/core/v1.PersistentVolumeClaimSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Description: "Status represents the current information/status of a persistent volume claim. Read-only. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims", + Ref: ref("k8s.io/api/core/v1.PersistentVolumeClaimStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.PersistentVolumeClaimSpec", "k8s.io/api/core/v1.PersistentVolumeClaimStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_k8sio_api_core_v1_PersistentVolumeClaimCondition(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PersistentVolumeClaimCondition contails details about state of pvc", + Properties: map[string]spec.Schema{ + "type": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "lastProbeTime": { + SchemaProps: spec.SchemaProps{ + Description: "Last time we probed the condition.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, + "lastTransitionTime": { + SchemaProps: spec.SchemaProps{ + Description: "Last time the condition transitioned from one status to another.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, + "reason": { + SchemaProps: spec.SchemaProps{ + Description: "Unique, this should be a short, machine understandable string that gives the reason for condition's last transition. If it reports \"ResizeStarted\" that means the underlying persistent volume is being resized.", + Type: []string{"string"}, + Format: "", + }, + }, + "message": { + SchemaProps: spec.SchemaProps{ + Description: "Human-readable message indicating details about last transition.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"type", "status"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, + } +} + +func schema_k8sio_api_core_v1_PersistentVolumeClaimList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PersistentVolumeClaimList is a list of PersistentVolumeClaim items.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Description: "A list of persistent volume claims. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.PersistentVolumeClaim"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.PersistentVolumeClaim", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_k8sio_api_core_v1_PersistentVolumeClaimSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PersistentVolumeClaimSpec describes the common attributes of storage devices and allows a Source for provider-specific attributes", + Properties: map[string]spec.Schema{ + "accessModes": { + SchemaProps: spec.SchemaProps{ + Description: "AccessModes contains the desired access modes the volume should have. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "selector": { + SchemaProps: spec.SchemaProps{ + Description: "A label query over volumes to consider for binding.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"), + }, + }, + "resources": { + SchemaProps: spec.SchemaProps{ + Description: "Resources represents the minimum resources the volume should have. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources", + Ref: ref("k8s.io/api/core/v1.ResourceRequirements"), + }, + }, + "volumeName": { + SchemaProps: spec.SchemaProps{ + Description: "VolumeName is the binding reference to the PersistentVolume backing this claim.", + Type: []string{"string"}, + Format: "", + }, + }, + "storageClassName": { + SchemaProps: spec.SchemaProps{ + Description: "Name of the StorageClass required by the claim. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1", + Type: []string{"string"}, + Format: "", + }, + }, + "volumeMode": { + SchemaProps: spec.SchemaProps{ + Description: "volumeMode defines what type of volume is required by the claim. Value of Filesystem is implied when not included in claim spec. This is an alpha feature and may change in the future.", + Type: []string{"string"}, + Format: "", + }, + }, + "dataSource": { + SchemaProps: spec.SchemaProps{ + Description: "This field requires the VolumeSnapshotDataSource alpha feature gate to be enabled and currently VolumeSnapshot is the only supported data source. If the provisioner can support VolumeSnapshot data source, it will create a new volume and data will be restored to the volume at the same time. If the provisioner does not support VolumeSnapshot data source, volume will not be created and the failure will be reported as an event. In the future, we plan to support more data source types and the behavior of the provisioner may change.", + Ref: ref("k8s.io/api/core/v1.TypedLocalObjectReference"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.ResourceRequirements", "k8s.io/api/core/v1.TypedLocalObjectReference", "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"}, + } +} + +func schema_k8sio_api_core_v1_PersistentVolumeClaimStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PersistentVolumeClaimStatus is the current status of a persistent volume claim.", + Properties: map[string]spec.Schema{ + "phase": { + SchemaProps: spec.SchemaProps{ + Description: "Phase represents the current phase of PersistentVolumeClaim.", + Type: []string{"string"}, + Format: "", + }, + }, + "accessModes": { + SchemaProps: spec.SchemaProps{ + Description: "AccessModes contains the actual access modes the volume backing the PVC has. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "capacity": { + SchemaProps: spec.SchemaProps{ + Description: "Represents the actual resources of the underlying volume.", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/api/resource.Quantity"), + }, + }, + }, + }, + }, + "conditions": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-patch-merge-key": "type", + "x-kubernetes-patch-strategy": "merge", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "Current Condition of persistent volume claim. If underlying persistent volume is being resized then the Condition will be set to 'ResizeStarted'.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.PersistentVolumeClaimCondition"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.PersistentVolumeClaimCondition", "k8s.io/apimachinery/pkg/api/resource.Quantity"}, + } +} + +func schema_k8sio_api_core_v1_PersistentVolumeClaimVolumeSource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PersistentVolumeClaimVolumeSource references the user's PVC in the same namespace. This volume finds the bound PV and mounts that volume for the pod. A PersistentVolumeClaimVolumeSource is, essentially, a wrapper around another type of volume that is owned by someone else (the system).", + Properties: map[string]spec.Schema{ + "claimName": { + SchemaProps: spec.SchemaProps{ + Description: "ClaimName is the name of a PersistentVolumeClaim in the same namespace as the pod using this volume. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims", + Type: []string{"string"}, + Format: "", + }, + }, + "readOnly": { + SchemaProps: spec.SchemaProps{ + Description: "Will force the ReadOnly setting in VolumeMounts. Default false.", + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + Required: []string{"claimName"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_PersistentVolumeList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PersistentVolumeList is a list of PersistentVolume items.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Description: "List of persistent volumes. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.PersistentVolume"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.PersistentVolume", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_k8sio_api_core_v1_PersistentVolumeSource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PersistentVolumeSource is similar to VolumeSource but meant for the administrator who creates PVs. Exactly one of its members must be set.", + Properties: map[string]spec.Schema{ + "gcePersistentDisk": { + SchemaProps: spec.SchemaProps{ + Description: "GCEPersistentDisk represents a GCE Disk resource that is attached to a kubelet's host machine and then exposed to the pod. Provisioned by an admin. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk", + Ref: ref("k8s.io/api/core/v1.GCEPersistentDiskVolumeSource"), + }, + }, + "awsElasticBlockStore": { + SchemaProps: spec.SchemaProps{ + Description: "AWSElasticBlockStore represents an AWS Disk resource that is attached to a kubelet's host machine and then exposed to the pod. More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore", + Ref: ref("k8s.io/api/core/v1.AWSElasticBlockStoreVolumeSource"), + }, + }, + "hostPath": { + SchemaProps: spec.SchemaProps{ + Description: "HostPath represents a directory on the host. Provisioned by a developer or tester. This is useful for single-node development and testing only! On-host storage is not supported in any way and WILL NOT WORK in a multi-node cluster. More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath", + Ref: ref("k8s.io/api/core/v1.HostPathVolumeSource"), + }, + }, + "glusterfs": { + SchemaProps: spec.SchemaProps{ + Description: "Glusterfs represents a Glusterfs volume that is attached to a host and exposed to the pod. Provisioned by an admin. More info: https://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md", + Ref: ref("k8s.io/api/core/v1.GlusterfsVolumeSource"), + }, + }, + "nfs": { + SchemaProps: spec.SchemaProps{ + Description: "NFS represents an NFS mount on the host. Provisioned by an admin. More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs", + Ref: ref("k8s.io/api/core/v1.NFSVolumeSource"), + }, + }, + "rbd": { + SchemaProps: spec.SchemaProps{ + Description: "RBD represents a Rados Block Device mount on the host that shares a pod's lifetime. More info: https://releases.k8s.io/HEAD/examples/volumes/rbd/README.md", + Ref: ref("k8s.io/api/core/v1.RBDPersistentVolumeSource"), + }, + }, + "iscsi": { + SchemaProps: spec.SchemaProps{ + Description: "ISCSI represents an ISCSI Disk resource that is attached to a kubelet's host machine and then exposed to the pod. Provisioned by an admin.", + Ref: ref("k8s.io/api/core/v1.ISCSIPersistentVolumeSource"), + }, + }, + "cinder": { + SchemaProps: spec.SchemaProps{ + Description: "Cinder represents a cinder volume attached and mounted on kubelets host machine More info: https://releases.k8s.io/HEAD/examples/mysql-cinder-pd/README.md", + Ref: ref("k8s.io/api/core/v1.CinderPersistentVolumeSource"), + }, + }, + "cephfs": { + SchemaProps: spec.SchemaProps{ + Description: "CephFS represents a Ceph FS mount on the host that shares a pod's lifetime", + Ref: ref("k8s.io/api/core/v1.CephFSPersistentVolumeSource"), + }, + }, + "fc": { + SchemaProps: spec.SchemaProps{ + Description: "FC represents a Fibre Channel resource that is attached to a kubelet's host machine and then exposed to the pod.", + Ref: ref("k8s.io/api/core/v1.FCVolumeSource"), + }, + }, + "flocker": { + SchemaProps: spec.SchemaProps{ + Description: "Flocker represents a Flocker volume attached to a kubelet's host machine and exposed to the pod for its usage. This depends on the Flocker control service being running", + Ref: ref("k8s.io/api/core/v1.FlockerVolumeSource"), + }, + }, + "flexVolume": { + SchemaProps: spec.SchemaProps{ + Description: "FlexVolume represents a generic volume resource that is provisioned/attached using an exec based plugin.", + Ref: ref("k8s.io/api/core/v1.FlexPersistentVolumeSource"), + }, + }, + "azureFile": { + SchemaProps: spec.SchemaProps{ + Description: "AzureFile represents an Azure File Service mount on the host and bind mount to the pod.", + Ref: ref("k8s.io/api/core/v1.AzureFilePersistentVolumeSource"), + }, + }, + "vsphereVolume": { + SchemaProps: spec.SchemaProps{ + Description: "VsphereVolume represents a vSphere volume attached and mounted on kubelets host machine", + Ref: ref("k8s.io/api/core/v1.VsphereVirtualDiskVolumeSource"), + }, + }, + "quobyte": { + SchemaProps: spec.SchemaProps{ + Description: "Quobyte represents a Quobyte mount on the host that shares a pod's lifetime", + Ref: ref("k8s.io/api/core/v1.QuobyteVolumeSource"), + }, + }, + "azureDisk": { + SchemaProps: spec.SchemaProps{ + Description: "AzureDisk represents an Azure Data Disk mount on the host and bind mount to the pod.", + Ref: ref("k8s.io/api/core/v1.AzureDiskVolumeSource"), + }, + }, + "photonPersistentDisk": { + SchemaProps: spec.SchemaProps{ + Description: "PhotonPersistentDisk represents a PhotonController persistent disk attached and mounted on kubelets host machine", + Ref: ref("k8s.io/api/core/v1.PhotonPersistentDiskVolumeSource"), + }, + }, + "portworxVolume": { + SchemaProps: spec.SchemaProps{ + Description: "PortworxVolume represents a portworx volume attached and mounted on kubelets host machine", + Ref: ref("k8s.io/api/core/v1.PortworxVolumeSource"), + }, + }, + "scaleIO": { + SchemaProps: spec.SchemaProps{ + Description: "ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes.", + Ref: ref("k8s.io/api/core/v1.ScaleIOPersistentVolumeSource"), + }, + }, + "local": { + SchemaProps: spec.SchemaProps{ + Description: "Local represents directly-attached storage with node affinity", + Ref: ref("k8s.io/api/core/v1.LocalVolumeSource"), + }, + }, + "storageos": { + SchemaProps: spec.SchemaProps{ + Description: "StorageOS represents a StorageOS volume that is attached to the kubelet's host machine and mounted into the pod More info: https://releases.k8s.io/HEAD/examples/volumes/storageos/README.md", + Ref: ref("k8s.io/api/core/v1.StorageOSPersistentVolumeSource"), + }, + }, + "csi": { + SchemaProps: spec.SchemaProps{ + Description: "CSI represents storage that handled by an external CSI driver (Beta feature).", + Ref: ref("k8s.io/api/core/v1.CSIPersistentVolumeSource"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.AWSElasticBlockStoreVolumeSource", "k8s.io/api/core/v1.AzureDiskVolumeSource", "k8s.io/api/core/v1.AzureFilePersistentVolumeSource", "k8s.io/api/core/v1.CSIPersistentVolumeSource", "k8s.io/api/core/v1.CephFSPersistentVolumeSource", "k8s.io/api/core/v1.CinderPersistentVolumeSource", "k8s.io/api/core/v1.FCVolumeSource", "k8s.io/api/core/v1.FlexPersistentVolumeSource", "k8s.io/api/core/v1.FlockerVolumeSource", "k8s.io/api/core/v1.GCEPersistentDiskVolumeSource", "k8s.io/api/core/v1.GlusterfsVolumeSource", "k8s.io/api/core/v1.HostPathVolumeSource", "k8s.io/api/core/v1.ISCSIPersistentVolumeSource", "k8s.io/api/core/v1.LocalVolumeSource", "k8s.io/api/core/v1.NFSVolumeSource", "k8s.io/api/core/v1.PhotonPersistentDiskVolumeSource", "k8s.io/api/core/v1.PortworxVolumeSource", "k8s.io/api/core/v1.QuobyteVolumeSource", "k8s.io/api/core/v1.RBDPersistentVolumeSource", "k8s.io/api/core/v1.ScaleIOPersistentVolumeSource", "k8s.io/api/core/v1.StorageOSPersistentVolumeSource", "k8s.io/api/core/v1.VsphereVirtualDiskVolumeSource"}, + } +} + +func schema_k8sio_api_core_v1_PersistentVolumeSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PersistentVolumeSpec is the specification of a persistent volume.", + Properties: map[string]spec.Schema{ + "capacity": { + SchemaProps: spec.SchemaProps{ + Description: "A description of the persistent volume's resources and capacity. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#capacity", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/api/resource.Quantity"), + }, + }, + }, + }, + }, + "gcePersistentDisk": { + SchemaProps: spec.SchemaProps{ + Description: "GCEPersistentDisk represents a GCE Disk resource that is attached to a kubelet's host machine and then exposed to the pod. Provisioned by an admin. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk", + Ref: ref("k8s.io/api/core/v1.GCEPersistentDiskVolumeSource"), + }, + }, + "awsElasticBlockStore": { + SchemaProps: spec.SchemaProps{ + Description: "AWSElasticBlockStore represents an AWS Disk resource that is attached to a kubelet's host machine and then exposed to the pod. More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore", + Ref: ref("k8s.io/api/core/v1.AWSElasticBlockStoreVolumeSource"), + }, + }, + "hostPath": { + SchemaProps: spec.SchemaProps{ + Description: "HostPath represents a directory on the host. Provisioned by a developer or tester. This is useful for single-node development and testing only! On-host storage is not supported in any way and WILL NOT WORK in a multi-node cluster. More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath", + Ref: ref("k8s.io/api/core/v1.HostPathVolumeSource"), + }, + }, + "glusterfs": { + SchemaProps: spec.SchemaProps{ + Description: "Glusterfs represents a Glusterfs volume that is attached to a host and exposed to the pod. Provisioned by an admin. More info: https://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md", + Ref: ref("k8s.io/api/core/v1.GlusterfsVolumeSource"), + }, + }, + "nfs": { + SchemaProps: spec.SchemaProps{ + Description: "NFS represents an NFS mount on the host. Provisioned by an admin. More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs", + Ref: ref("k8s.io/api/core/v1.NFSVolumeSource"), + }, + }, + "rbd": { + SchemaProps: spec.SchemaProps{ + Description: "RBD represents a Rados Block Device mount on the host that shares a pod's lifetime. More info: https://releases.k8s.io/HEAD/examples/volumes/rbd/README.md", + Ref: ref("k8s.io/api/core/v1.RBDPersistentVolumeSource"), + }, + }, + "iscsi": { + SchemaProps: spec.SchemaProps{ + Description: "ISCSI represents an ISCSI Disk resource that is attached to a kubelet's host machine and then exposed to the pod. Provisioned by an admin.", + Ref: ref("k8s.io/api/core/v1.ISCSIPersistentVolumeSource"), + }, + }, + "cinder": { + SchemaProps: spec.SchemaProps{ + Description: "Cinder represents a cinder volume attached and mounted on kubelets host machine More info: https://releases.k8s.io/HEAD/examples/mysql-cinder-pd/README.md", + Ref: ref("k8s.io/api/core/v1.CinderPersistentVolumeSource"), + }, + }, + "cephfs": { + SchemaProps: spec.SchemaProps{ + Description: "CephFS represents a Ceph FS mount on the host that shares a pod's lifetime", + Ref: ref("k8s.io/api/core/v1.CephFSPersistentVolumeSource"), + }, + }, + "fc": { + SchemaProps: spec.SchemaProps{ + Description: "FC represents a Fibre Channel resource that is attached to a kubelet's host machine and then exposed to the pod.", + Ref: ref("k8s.io/api/core/v1.FCVolumeSource"), + }, + }, + "flocker": { + SchemaProps: spec.SchemaProps{ + Description: "Flocker represents a Flocker volume attached to a kubelet's host machine and exposed to the pod for its usage. This depends on the Flocker control service being running", + Ref: ref("k8s.io/api/core/v1.FlockerVolumeSource"), + }, + }, + "flexVolume": { + SchemaProps: spec.SchemaProps{ + Description: "FlexVolume represents a generic volume resource that is provisioned/attached using an exec based plugin.", + Ref: ref("k8s.io/api/core/v1.FlexPersistentVolumeSource"), + }, + }, + "azureFile": { + SchemaProps: spec.SchemaProps{ + Description: "AzureFile represents an Azure File Service mount on the host and bind mount to the pod.", + Ref: ref("k8s.io/api/core/v1.AzureFilePersistentVolumeSource"), + }, + }, + "vsphereVolume": { + SchemaProps: spec.SchemaProps{ + Description: "VsphereVolume represents a vSphere volume attached and mounted on kubelets host machine", + Ref: ref("k8s.io/api/core/v1.VsphereVirtualDiskVolumeSource"), + }, + }, + "quobyte": { + SchemaProps: spec.SchemaProps{ + Description: "Quobyte represents a Quobyte mount on the host that shares a pod's lifetime", + Ref: ref("k8s.io/api/core/v1.QuobyteVolumeSource"), + }, + }, + "azureDisk": { + SchemaProps: spec.SchemaProps{ + Description: "AzureDisk represents an Azure Data Disk mount on the host and bind mount to the pod.", + Ref: ref("k8s.io/api/core/v1.AzureDiskVolumeSource"), + }, + }, + "photonPersistentDisk": { + SchemaProps: spec.SchemaProps{ + Description: "PhotonPersistentDisk represents a PhotonController persistent disk attached and mounted on kubelets host machine", + Ref: ref("k8s.io/api/core/v1.PhotonPersistentDiskVolumeSource"), + }, + }, + "portworxVolume": { + SchemaProps: spec.SchemaProps{ + Description: "PortworxVolume represents a portworx volume attached and mounted on kubelets host machine", + Ref: ref("k8s.io/api/core/v1.PortworxVolumeSource"), + }, + }, + "scaleIO": { + SchemaProps: spec.SchemaProps{ + Description: "ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes.", + Ref: ref("k8s.io/api/core/v1.ScaleIOPersistentVolumeSource"), + }, + }, + "local": { + SchemaProps: spec.SchemaProps{ + Description: "Local represents directly-attached storage with node affinity", + Ref: ref("k8s.io/api/core/v1.LocalVolumeSource"), + }, + }, + "storageos": { + SchemaProps: spec.SchemaProps{ + Description: "StorageOS represents a StorageOS volume that is attached to the kubelet's host machine and mounted into the pod More info: https://releases.k8s.io/HEAD/examples/volumes/storageos/README.md", + Ref: ref("k8s.io/api/core/v1.StorageOSPersistentVolumeSource"), + }, + }, + "csi": { + SchemaProps: spec.SchemaProps{ + Description: "CSI represents storage that handled by an external CSI driver (Beta feature).", + Ref: ref("k8s.io/api/core/v1.CSIPersistentVolumeSource"), + }, + }, + "accessModes": { + SchemaProps: spec.SchemaProps{ + Description: "AccessModes contains all ways the volume can be mounted. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "claimRef": { + SchemaProps: spec.SchemaProps{ + Description: "ClaimRef is part of a bi-directional binding between PersistentVolume and PersistentVolumeClaim. Expected to be non-nil when bound. claim.VolumeName is the authoritative bind between PV and PVC. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#binding", + Ref: ref("k8s.io/api/core/v1.ObjectReference"), + }, + }, + "persistentVolumeReclaimPolicy": { + SchemaProps: spec.SchemaProps{ + Description: "What happens to a persistent volume when released from its claim. Valid options are Retain (default for manually created PersistentVolumes), Delete (default for dynamically provisioned PersistentVolumes), and Recycle (deprecated). Recycle must be supported by the volume plugin underlying this PersistentVolume. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#reclaiming", + Type: []string{"string"}, + Format: "", + }, + }, + "storageClassName": { + SchemaProps: spec.SchemaProps{ + Description: "Name of StorageClass to which this persistent volume belongs. Empty value means that this volume does not belong to any StorageClass.", + Type: []string{"string"}, + Format: "", + }, + }, + "mountOptions": { + SchemaProps: spec.SchemaProps{ + Description: "A list of mount options, e.g. [\"ro\", \"soft\"]. Not validated - mount will simply fail if one is invalid. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes/#mount-options", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "volumeMode": { + SchemaProps: spec.SchemaProps{ + Description: "volumeMode defines if a volume is intended to be used with a formatted filesystem or to remain in raw block state. Value of Filesystem is implied when not included in spec. This is an alpha feature and may change in the future.", + Type: []string{"string"}, + Format: "", + }, + }, + "nodeAffinity": { + SchemaProps: spec.SchemaProps{ + Description: "NodeAffinity defines constraints that limit what nodes this volume can be accessed from. This field influences the scheduling of pods that use this volume.", + Ref: ref("k8s.io/api/core/v1.VolumeNodeAffinity"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.AWSElasticBlockStoreVolumeSource", "k8s.io/api/core/v1.AzureDiskVolumeSource", "k8s.io/api/core/v1.AzureFilePersistentVolumeSource", "k8s.io/api/core/v1.CSIPersistentVolumeSource", "k8s.io/api/core/v1.CephFSPersistentVolumeSource", "k8s.io/api/core/v1.CinderPersistentVolumeSource", "k8s.io/api/core/v1.FCVolumeSource", "k8s.io/api/core/v1.FlexPersistentVolumeSource", "k8s.io/api/core/v1.FlockerVolumeSource", "k8s.io/api/core/v1.GCEPersistentDiskVolumeSource", "k8s.io/api/core/v1.GlusterfsVolumeSource", "k8s.io/api/core/v1.HostPathVolumeSource", "k8s.io/api/core/v1.ISCSIPersistentVolumeSource", "k8s.io/api/core/v1.LocalVolumeSource", "k8s.io/api/core/v1.NFSVolumeSource", "k8s.io/api/core/v1.ObjectReference", "k8s.io/api/core/v1.PhotonPersistentDiskVolumeSource", "k8s.io/api/core/v1.PortworxVolumeSource", "k8s.io/api/core/v1.QuobyteVolumeSource", "k8s.io/api/core/v1.RBDPersistentVolumeSource", "k8s.io/api/core/v1.ScaleIOPersistentVolumeSource", "k8s.io/api/core/v1.StorageOSPersistentVolumeSource", "k8s.io/api/core/v1.VolumeNodeAffinity", "k8s.io/api/core/v1.VsphereVirtualDiskVolumeSource", "k8s.io/apimachinery/pkg/api/resource.Quantity"}, + } +} + +func schema_k8sio_api_core_v1_PersistentVolumeStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PersistentVolumeStatus is the current status of a persistent volume.", + Properties: map[string]spec.Schema{ + "phase": { + SchemaProps: spec.SchemaProps{ + Description: "Phase indicates if a volume is available, bound to a claim, or released by a claim. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#phase", + Type: []string{"string"}, + Format: "", + }, + }, + "message": { + SchemaProps: spec.SchemaProps{ + Description: "A human-readable message indicating details about why the volume is in this state.", + Type: []string{"string"}, + Format: "", + }, + }, + "reason": { + SchemaProps: spec.SchemaProps{ + Description: "Reason is a brief CamelCase string that describes any failure and is meant for machine parsing and tidy display in the CLI.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_PhotonPersistentDiskVolumeSource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Represents a Photon Controller persistent disk resource.", + Properties: map[string]spec.Schema{ + "pdID": { + SchemaProps: spec.SchemaProps{ + Description: "ID that identifies Photon Controller persistent disk", + Type: []string{"string"}, + Format: "", + }, + }, + "fsType": { + SchemaProps: spec.SchemaProps{ + Description: "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"pdID"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_Pod(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Pod is a collection of containers that can run on a host. This resource is created by clients and scheduled onto hosts.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Description: "Specification of the desired behavior of the pod. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status", + Ref: ref("k8s.io/api/core/v1.PodSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Description: "Most recently observed status of the pod. This data may not be up to date. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status", + Ref: ref("k8s.io/api/core/v1.PodStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.PodSpec", "k8s.io/api/core/v1.PodStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_k8sio_api_core_v1_PodAffinity(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Pod affinity is a group of inter pod affinity scheduling rules.", + Properties: map[string]spec.Schema{ + "requiredDuringSchedulingIgnoredDuringExecution": { + SchemaProps: spec.SchemaProps{ + Description: "If the affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to a pod label update), the system may or may not try to eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding to each podAffinityTerm are intersected, i.e. all terms must be satisfied.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.PodAffinityTerm"), + }, + }, + }, + }, + }, + "preferredDuringSchedulingIgnoredDuringExecution": { + SchemaProps: spec.SchemaProps{ + Description: "The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding \"weight\" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.WeightedPodAffinityTerm"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.PodAffinityTerm", "k8s.io/api/core/v1.WeightedPodAffinityTerm"}, + } +} + +func schema_k8sio_api_core_v1_PodAffinityTerm(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Defines a set of pods (namely those matching the labelSelector relative to the given namespace(s)) that this pod should be co-located (affinity) or not co-located (anti-affinity) with, where co-located is defined as running on a node whose value of the label with key matches that of any node on which a pod of the set of pods is running", + Properties: map[string]spec.Schema{ + "labelSelector": { + SchemaProps: spec.SchemaProps{ + Description: "A label query over a set of resources, in this case pods.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"), + }, + }, + "namespaces": { + SchemaProps: spec.SchemaProps{ + Description: "namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means \"this pod's namespace\"", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "topologyKey": { + SchemaProps: spec.SchemaProps{ + Description: "This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching the labelSelector in the specified namespaces, where co-located is defined as running on a node whose value of the label with key topologyKey matches that of any node on which any of the selected pods is running. Empty topologyKey is not allowed.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"topologyKey"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"}, + } +} + +func schema_k8sio_api_core_v1_PodAntiAffinity(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Pod anti affinity is a group of inter pod anti affinity scheduling rules.", + Properties: map[string]spec.Schema{ + "requiredDuringSchedulingIgnoredDuringExecution": { + SchemaProps: spec.SchemaProps{ + Description: "If the anti-affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the anti-affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to a pod label update), the system may or may not try to eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding to each podAffinityTerm are intersected, i.e. all terms must be satisfied.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.PodAffinityTerm"), + }, + }, + }, + }, + }, + "preferredDuringSchedulingIgnoredDuringExecution": { + SchemaProps: spec.SchemaProps{ + Description: "The scheduler will prefer to schedule pods to nodes that satisfy the anti-affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling anti-affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding \"weight\" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.WeightedPodAffinityTerm"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.PodAffinityTerm", "k8s.io/api/core/v1.WeightedPodAffinityTerm"}, + } +} + +func schema_k8sio_api_core_v1_PodAttachOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PodAttachOptions is the query options to a Pod's remote attach call.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "stdin": { + SchemaProps: spec.SchemaProps{ + Description: "Stdin if true, redirects the standard input stream of the pod for this call. Defaults to false.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "stdout": { + SchemaProps: spec.SchemaProps{ + Description: "Stdout if true indicates that stdout is to be redirected for the attach call. Defaults to true.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "stderr": { + SchemaProps: spec.SchemaProps{ + Description: "Stderr if true indicates that stderr is to be redirected for the attach call. Defaults to true.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "tty": { + SchemaProps: spec.SchemaProps{ + Description: "TTY if true indicates that a tty will be allocated for the attach call. This is passed through the container runtime so the tty is allocated on the worker node by the container runtime. Defaults to false.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "container": { + SchemaProps: spec.SchemaProps{ + Description: "The container in which to execute the command. Defaults to only container if there is only one container in the pod.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_PodCondition(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PodCondition contains details for the current condition of this pod.", + Properties: map[string]spec.Schema{ + "type": { + SchemaProps: spec.SchemaProps{ + Description: "Type is the type of the condition. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions", + Type: []string{"string"}, + Format: "", + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Description: "Status is the status of the condition. Can be True, False, Unknown. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions", + Type: []string{"string"}, + Format: "", + }, + }, + "lastProbeTime": { + SchemaProps: spec.SchemaProps{ + Description: "Last time we probed the condition.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, + "lastTransitionTime": { + SchemaProps: spec.SchemaProps{ + Description: "Last time the condition transitioned from one status to another.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, + "reason": { + SchemaProps: spec.SchemaProps{ + Description: "Unique, one-word, CamelCase reason for the condition's last transition.", + Type: []string{"string"}, + Format: "", + }, + }, + "message": { + SchemaProps: spec.SchemaProps{ + Description: "Human-readable message indicating details about last transition.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"type", "status"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, + } +} + +func schema_k8sio_api_core_v1_PodDNSConfig(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PodDNSConfig defines the DNS parameters of a pod in addition to those generated from DNSPolicy.", + Properties: map[string]spec.Schema{ + "nameservers": { + SchemaProps: spec.SchemaProps{ + Description: "A list of DNS name server IP addresses. This will be appended to the base nameservers generated from DNSPolicy. Duplicated nameservers will be removed.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "searches": { + SchemaProps: spec.SchemaProps{ + Description: "A list of DNS search domains for host-name lookup. This will be appended to the base search paths generated from DNSPolicy. Duplicated search paths will be removed.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "options": { + SchemaProps: spec.SchemaProps{ + Description: "A list of DNS resolver options. This will be merged with the base options generated from DNSPolicy. Duplicated entries will be removed. Resolution options given in Options will override those that appear in the base DNSPolicy.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.PodDNSConfigOption"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.PodDNSConfigOption"}, + } +} + +func schema_k8sio_api_core_v1_PodDNSConfigOption(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PodDNSConfigOption defines DNS resolver options of a pod.", + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Required.", + Type: []string{"string"}, + Format: "", + }, + }, + "value": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_PodExecOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PodExecOptions is the query options to a Pod's remote exec call.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "stdin": { + SchemaProps: spec.SchemaProps{ + Description: "Redirect the standard input stream of the pod for this call. Defaults to false.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "stdout": { + SchemaProps: spec.SchemaProps{ + Description: "Redirect the standard output stream of the pod for this call. Defaults to true.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "stderr": { + SchemaProps: spec.SchemaProps{ + Description: "Redirect the standard error stream of the pod for this call. Defaults to true.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "tty": { + SchemaProps: spec.SchemaProps{ + Description: "TTY if true indicates that a tty will be allocated for the exec call. Defaults to false.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "container": { + SchemaProps: spec.SchemaProps{ + Description: "Container in which to execute the command. Defaults to only container if there is only one container in the pod.", + Type: []string{"string"}, + Format: "", + }, + }, + "command": { + SchemaProps: spec.SchemaProps{ + Description: "Command is the remote command to execute. argv array. Not executed within a shell.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + Required: []string{"command"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_PodList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PodList is a list of Pods.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Description: "List of pods. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.Pod"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.Pod", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_k8sio_api_core_v1_PodLogOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PodLogOptions is the query options for a Pod's logs REST call.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "container": { + SchemaProps: spec.SchemaProps{ + Description: "The container for which to stream logs. Defaults to only container if there is one container in the pod.", + Type: []string{"string"}, + Format: "", + }, + }, + "follow": { + SchemaProps: spec.SchemaProps{ + Description: "Follow the log stream of the pod. Defaults to false.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "previous": { + SchemaProps: spec.SchemaProps{ + Description: "Return previous terminated container logs. Defaults to false.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "sinceSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "A relative time in seconds before the current time from which to show logs. If this value precedes the time a pod was started, only logs since the pod start will be returned. If this value is in the future, no logs will be returned. Only one of sinceSeconds or sinceTime may be specified.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "sinceTime": { + SchemaProps: spec.SchemaProps{ + Description: "An RFC3339 timestamp from which to show logs. If this value precedes the time a pod was started, only logs since the pod start will be returned. If this value is in the future, no logs will be returned. Only one of sinceSeconds or sinceTime may be specified.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, + "timestamps": { + SchemaProps: spec.SchemaProps{ + Description: "If true, add an RFC3339 or RFC3339Nano timestamp at the beginning of every line of log output. Defaults to false.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "tailLines": { + SchemaProps: spec.SchemaProps{ + Description: "If set, the number of lines from the end of the logs to show. If not specified, logs are shown from the creation of the container or sinceSeconds or sinceTime", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "limitBytes": { + SchemaProps: spec.SchemaProps{ + Description: "If set, the number of bytes to read from the server before terminating the log output. This may not display a complete final line of logging, and may return slightly more or slightly less than the specified limit.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, + } +} + +func schema_k8sio_api_core_v1_PodPortForwardOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PodPortForwardOptions is the query options to a Pod's port forward call when using WebSockets. The `port` query parameter must specify the port or ports (comma separated) to forward over. Port forwarding over SPDY does not use these options. It requires the port to be passed in the `port` header as part of request.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "ports": { + SchemaProps: spec.SchemaProps{ + Description: "List of ports to forward Required when using WebSockets", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_PodProxyOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PodProxyOptions is the query options to a Pod's proxy call.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "path": { + SchemaProps: spec.SchemaProps{ + Description: "Path is the URL path to use for the current proxy request to pod.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_PodReadinessGate(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PodReadinessGate contains the reference to a pod condition", + Properties: map[string]spec.Schema{ + "conditionType": { + SchemaProps: spec.SchemaProps{ + Description: "ConditionType refers to a condition in the pod's condition list with matching type.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"conditionType"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_PodSecurityContext(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PodSecurityContext holds pod-level security attributes and common container settings. Some fields are also present in container.securityContext. Field values of container.securityContext take precedence over field values of PodSecurityContext.", + Properties: map[string]spec.Schema{ + "seLinuxOptions": { + SchemaProps: spec.SchemaProps{ + Description: "The SELinux context to be applied to all containers. If unspecified, the container runtime will allocate a random SELinux context for each container. May also be set in SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence for that container.", + Ref: ref("k8s.io/api/core/v1.SELinuxOptions"), + }, + }, + "runAsUser": { + SchemaProps: spec.SchemaProps{ + Description: "The UID to run the entrypoint of the container process. Defaults to user specified in image metadata if unspecified. May also be set in SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence for that container.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "runAsGroup": { + SchemaProps: spec.SchemaProps{ + Description: "The GID to run the entrypoint of the container process. Uses runtime default if unset. May also be set in SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence for that container.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "runAsNonRoot": { + SchemaProps: spec.SchemaProps{ + Description: "Indicates that the container must run as a non-root user. If true, the Kubelet will validate the image at runtime to ensure that it does not run as UID 0 (root) and fail to start the container if it does. If unset or false, no such validation will be performed. May also be set in SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "supplementalGroups": { + SchemaProps: spec.SchemaProps{ + Description: "A list of groups applied to the first process run in each container, in addition to the container's primary GID. If unspecified, no groups will be added to any container.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"integer"}, + Format: "int64", + }, + }, + }, + }, + }, + "fsGroup": { + SchemaProps: spec.SchemaProps{ + Description: "A special supplemental group that applies to all containers in a pod. Some volume types allow the Kubelet to change the ownership of that volume to be owned by the pod:\n\n1. The owning GID will be the FSGroup 2. The setgid bit is set (new files created in the volume will be owned by FSGroup) 3. The permission bits are OR'd with rw-rw----\n\nIf unset, the Kubelet will not modify the ownership and permissions of any volume.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "sysctls": { + SchemaProps: spec.SchemaProps{ + Description: "Sysctls hold a list of namespaced sysctls used for the pod. Pods with unsupported sysctls (by the container runtime) might fail to launch.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.Sysctl"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.SELinuxOptions", "k8s.io/api/core/v1.Sysctl"}, + } +} + +func schema_k8sio_api_core_v1_PodSignature(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Describes the class of pods that should avoid this node. Exactly one field should be set.", + Properties: map[string]spec.Schema{ + "podController": { + SchemaProps: spec.SchemaProps{ + Description: "Reference to controller whose pods should avoid this node.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.OwnerReference"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.OwnerReference"}, + } +} + +func schema_k8sio_api_core_v1_PodSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PodSpec is a description of a pod.", + Properties: map[string]spec.Schema{ + "volumes": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-patch-merge-key": "name", + "x-kubernetes-patch-strategy": "merge,retainKeys", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "List of volumes that can be mounted by containers belonging to the pod. More info: https://kubernetes.io/docs/concepts/storage/volumes", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.Volume"), + }, + }, + }, + }, + }, + "initContainers": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-patch-merge-key": "name", + "x-kubernetes-patch-strategy": "merge", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "List of initialization containers belonging to the pod. Init containers are executed in order prior to containers being started. If any init container fails, the pod is considered to have failed and is handled according to its restartPolicy. The name for an init container or normal container must be unique among all containers. Init containers may not have Lifecycle actions, Readiness probes, or Liveness probes. The resourceRequirements of an init container are taken into account during scheduling by finding the highest request/limit for each resource type, and then using the max of of that value or the sum of the normal containers. Limits are applied to init containers in a similar fashion. Init containers cannot currently be added or removed. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.Container"), + }, + }, + }, + }, + }, + "containers": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-patch-merge-key": "name", + "x-kubernetes-patch-strategy": "merge", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "List of containers belonging to the pod. Containers cannot currently be added or removed. There must be at least one container in a Pod. Cannot be updated.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.Container"), + }, + }, + }, + }, + }, + "restartPolicy": { + SchemaProps: spec.SchemaProps{ + Description: "Restart policy for all containers within the pod. One of Always, OnFailure, Never. Default to Always. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy", + Type: []string{"string"}, + Format: "", + }, + }, + "terminationGracePeriodSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "Optional duration in seconds the pod needs to terminate gracefully. May be decreased in delete request. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period will be used instead. The grace period is the duration in seconds after the processes running in the pod are sent a termination signal and the time when the processes are forcibly halted with a kill signal. Set this value longer than the expected cleanup time for your process. Defaults to 30 seconds.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "activeDeadlineSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "Optional duration in seconds the pod may be active on the node relative to StartTime before the system will actively try to mark it failed and kill associated containers. Value must be a positive integer.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "dnsPolicy": { + SchemaProps: spec.SchemaProps{ + Description: "Set DNS policy for the pod. Defaults to \"ClusterFirst\". Valid values are 'ClusterFirstWithHostNet', 'ClusterFirst', 'Default' or 'None'. DNS parameters given in DNSConfig will be merged with the policy selected with DNSPolicy. To have DNS options set along with hostNetwork, you have to specify DNS policy explicitly to 'ClusterFirstWithHostNet'.", + Type: []string{"string"}, + Format: "", + }, + }, + "nodeSelector": { + SchemaProps: spec.SchemaProps{ + Description: "NodeSelector is a selector which must be true for the pod to fit on a node. Selector which must match a node's labels for the pod to be scheduled on that node. More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "serviceAccountName": { + SchemaProps: spec.SchemaProps{ + Description: "ServiceAccountName is the name of the ServiceAccount to use to run this pod. More info: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", + Type: []string{"string"}, + Format: "", + }, + }, + "serviceAccount": { + SchemaProps: spec.SchemaProps{ + Description: "DeprecatedServiceAccount is a depreciated alias for ServiceAccountName. Deprecated: Use serviceAccountName instead.", + Type: []string{"string"}, + Format: "", + }, + }, + "automountServiceAccountToken": { + SchemaProps: spec.SchemaProps{ + Description: "AutomountServiceAccountToken indicates whether a service account token should be automatically mounted.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "nodeName": { + SchemaProps: spec.SchemaProps{ + Description: "NodeName is a request to schedule this pod onto a specific node. If it is non-empty, the scheduler simply schedules this pod onto that node, assuming that it fits resource requirements.", + Type: []string{"string"}, + Format: "", + }, + }, + "hostNetwork": { + SchemaProps: spec.SchemaProps{ + Description: "Host networking requested for this pod. Use the host's network namespace. If this option is set, the ports that will be used must be specified. Default to false.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "hostPID": { + SchemaProps: spec.SchemaProps{ + Description: "Use the host's pid namespace. Optional: Default to false.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "hostIPC": { + SchemaProps: spec.SchemaProps{ + Description: "Use the host's ipc namespace. Optional: Default to false.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "shareProcessNamespace": { + SchemaProps: spec.SchemaProps{ + Description: "Share a single process namespace between all of the containers in a pod. When this is set containers will be able to view and signal processes from other containers in the same pod, and the first process in each container will not be assigned PID 1. HostPID and ShareProcessNamespace cannot both be set. Optional: Default to false. This field is beta-level and may be disabled with the PodShareProcessNamespace feature.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "securityContext": { + SchemaProps: spec.SchemaProps{ + Description: "SecurityContext holds pod-level security attributes and common container settings. Optional: Defaults to empty. See type description for default values of each field.", + Ref: ref("k8s.io/api/core/v1.PodSecurityContext"), + }, + }, + "imagePullSecrets": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-patch-merge-key": "name", + "x-kubernetes-patch-strategy": "merge", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the images used by this PodSpec. If specified, these secrets will be passed to individual puller implementations for them to use. For example, in the case of docker, only DockerConfig type secrets are honored. More info: https://kubernetes.io/docs/concepts/containers/images#specifying-imagepullsecrets-on-a-pod", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.LocalObjectReference"), + }, + }, + }, + }, + }, + "hostname": { + SchemaProps: spec.SchemaProps{ + Description: "Specifies the hostname of the Pod If not specified, the pod's hostname will be set to a system-defined value.", + Type: []string{"string"}, + Format: "", + }, + }, + "subdomain": { + SchemaProps: spec.SchemaProps{ + Description: "If specified, the fully qualified Pod hostname will be \"...svc.\". If not specified, the pod will not have a domainname at all.", + Type: []string{"string"}, + Format: "", + }, + }, + "affinity": { + SchemaProps: spec.SchemaProps{ + Description: "If specified, the pod's scheduling constraints", + Ref: ref("k8s.io/api/core/v1.Affinity"), + }, + }, + "schedulerName": { + SchemaProps: spec.SchemaProps{ + Description: "If specified, the pod will be dispatched by specified scheduler. If not specified, the pod will be dispatched by default scheduler.", + Type: []string{"string"}, + Format: "", + }, + }, + "tolerations": { + SchemaProps: spec.SchemaProps{ + Description: "If specified, the pod's tolerations.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.Toleration"), + }, + }, + }, + }, + }, + "hostAliases": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-patch-merge-key": "ip", + "x-kubernetes-patch-strategy": "merge", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. This is only valid for non-hostNetwork pods.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.HostAlias"), + }, + }, + }, + }, + }, + "priorityClassName": { + SchemaProps: spec.SchemaProps{ + Description: "If specified, indicates the pod's priority. \"system-node-critical\" and \"system-cluster-critical\" are two special keywords which indicate the highest priorities with the former being the highest priority. Any other name must be defined by creating a PriorityClass object with that name. If not specified, the pod priority will be default or zero if there is no default.", + Type: []string{"string"}, + Format: "", + }, + }, + "priority": { + SchemaProps: spec.SchemaProps{ + Description: "The priority value. Various system components use this field to find the priority of the pod. When Priority Admission Controller is enabled, it prevents users from setting this field. The admission controller populates this field from PriorityClassName. The higher the value, the higher the priority.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "dnsConfig": { + SchemaProps: spec.SchemaProps{ + Description: "Specifies the DNS parameters of a pod. Parameters specified here will be merged to the generated DNS configuration based on DNSPolicy.", + Ref: ref("k8s.io/api/core/v1.PodDNSConfig"), + }, + }, + "readinessGates": { + SchemaProps: spec.SchemaProps{ + Description: "If specified, all readiness gates will be evaluated for pod readiness. A pod is ready when all its containers are ready AND all conditions specified in the readiness gates have status equal to \"True\" More info: https://github.com/kubernetes/community/blob/master/keps/sig-network/0007-pod-ready%2B%2B.md", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.PodReadinessGate"), + }, + }, + }, + }, + }, + "runtimeClassName": { + SchemaProps: spec.SchemaProps{ + Description: "RuntimeClassName refers to a RuntimeClass object in the node.k8s.io group, which should be used to run this pod. If no RuntimeClass resource matches the named class, the pod will not be run. If unset or empty, the \"legacy\" RuntimeClass will be used, which is an implicit class with an empty definition that uses the default runtime handler. More info: https://github.com/kubernetes/community/blob/master/keps/sig-node/0014-runtime-class.md This is an alpha feature and may change in the future.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"containers"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.Affinity", "k8s.io/api/core/v1.Container", "k8s.io/api/core/v1.HostAlias", "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/api/core/v1.PodDNSConfig", "k8s.io/api/core/v1.PodReadinessGate", "k8s.io/api/core/v1.PodSecurityContext", "k8s.io/api/core/v1.Toleration", "k8s.io/api/core/v1.Volume"}, + } +} + +func schema_k8sio_api_core_v1_PodStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PodStatus represents information about the status of a pod. Status may trail the actual state of a system, especially if the node that hosts the pod cannot contact the control plane.", + Properties: map[string]spec.Schema{ + "phase": { + SchemaProps: spec.SchemaProps{ + Description: "The phase of a Pod is a simple, high-level summary of where the Pod is in its lifecycle. The conditions array, the reason and message fields, and the individual container status arrays contain more detail about the pod's status. There are five possible phase values:\n\nPending: The pod has been accepted by the Kubernetes system, but one or more of the container images has not been created. This includes time before being scheduled as well as time spent downloading images over the network, which could take a while. Running: The pod has been bound to a node, and all of the containers have been created. At least one container is still running, or is in the process of starting or restarting. Succeeded: All containers in the pod have terminated in success, and will not be restarted. Failed: All containers in the pod have terminated, and at least one container has terminated in failure. The container either exited with non-zero status or was terminated by the system. Unknown: For some reason the state of the pod could not be obtained, typically due to an error in communicating with the host of the pod.\n\nMore info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-phase", + Type: []string{"string"}, + Format: "", + }, + }, + "conditions": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-patch-merge-key": "type", + "x-kubernetes-patch-strategy": "merge", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "Current service state of pod. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.PodCondition"), + }, + }, + }, + }, + }, + "message": { + SchemaProps: spec.SchemaProps{ + Description: "A human readable message indicating details about why the pod is in this condition.", + Type: []string{"string"}, + Format: "", + }, + }, + "reason": { + SchemaProps: spec.SchemaProps{ + Description: "A brief CamelCase message indicating details about why the pod is in this state. e.g. 'Evicted'", + Type: []string{"string"}, + Format: "", + }, + }, + "nominatedNodeName": { + SchemaProps: spec.SchemaProps{ + Description: "nominatedNodeName is set only when this pod preempts other pods on the node, but it cannot be scheduled right away as preemption victims receive their graceful termination periods. This field does not guarantee that the pod will be scheduled on this node. Scheduler may decide to place the pod elsewhere if other nodes become available sooner. Scheduler may also decide to give the resources on this node to a higher priority pod that is created after preemption. As a result, this field may be different than PodSpec.nodeName when the pod is scheduled.", + Type: []string{"string"}, + Format: "", + }, + }, + "hostIP": { + SchemaProps: spec.SchemaProps{ + Description: "IP address of the host to which the pod is assigned. Empty if not yet scheduled.", + Type: []string{"string"}, + Format: "", + }, + }, + "podIP": { + SchemaProps: spec.SchemaProps{ + Description: "IP address allocated to the pod. Routable at least within the cluster. Empty if not yet allocated.", + Type: []string{"string"}, + Format: "", + }, + }, + "startTime": { + SchemaProps: spec.SchemaProps{ + Description: "RFC 3339 date and time at which the object was acknowledged by the Kubelet. This is before the Kubelet pulled the container image(s) for the pod.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, + "initContainerStatuses": { + SchemaProps: spec.SchemaProps{ + Description: "The list has one entry per init container in the manifest. The most recent successful init container will have ready = true, the most recently started container will have startTime set. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-and-container-status", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.ContainerStatus"), + }, + }, + }, + }, + }, + "containerStatuses": { + SchemaProps: spec.SchemaProps{ + Description: "The list has one entry per container in the manifest. Each entry is currently the output of `docker inspect`. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-and-container-status", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.ContainerStatus"), + }, + }, + }, + }, + }, + "qosClass": { + SchemaProps: spec.SchemaProps{ + Description: "The Quality of Service (QOS) classification assigned to the pod based on resource requirements See PodQOSClass type for available QOS classes More info: https://git.k8s.io/community/contributors/design-proposals/node/resource-qos.md", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.ContainerStatus", "k8s.io/api/core/v1.PodCondition", "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, + } +} + +func schema_k8sio_api_core_v1_PodStatusResult(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PodStatusResult is a wrapper for PodStatus returned by kubelet that can be encode/decoded", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Description: "Most recently observed status of the pod. This data may not be up to date. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status", + Ref: ref("k8s.io/api/core/v1.PodStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.PodStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_k8sio_api_core_v1_PodTemplate(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PodTemplate describes a template for creating copies of a predefined pod.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "template": { + SchemaProps: spec.SchemaProps{ + Description: "Template defines the pods that will be created from this pod template. https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status", + Ref: ref("k8s.io/api/core/v1.PodTemplateSpec"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.PodTemplateSpec", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_k8sio_api_core_v1_PodTemplateList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PodTemplateList is a list of PodTemplates.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Description: "List of pod templates", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.PodTemplate"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.PodTemplate", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_k8sio_api_core_v1_PodTemplateSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PodTemplateSpec describes the data a pod should have when created from a template", + Properties: map[string]spec.Schema{ + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Description: "Specification of the desired behavior of the pod. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status", + Ref: ref("k8s.io/api/core/v1.PodSpec"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.PodSpec", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_k8sio_api_core_v1_PortworxVolumeSource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PortworxVolumeSource represents a Portworx volume resource.", + Properties: map[string]spec.Schema{ + "volumeID": { + SchemaProps: spec.SchemaProps{ + Description: "VolumeID uniquely identifies a Portworx volume", + Type: []string{"string"}, + Format: "", + }, + }, + "fsType": { + SchemaProps: spec.SchemaProps{ + Description: "FSType represents the filesystem type to mount Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\". Implicitly inferred to be \"ext4\" if unspecified.", + Type: []string{"string"}, + Format: "", + }, + }, + "readOnly": { + SchemaProps: spec.SchemaProps{ + Description: "Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.", + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + Required: []string{"volumeID"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_PreferAvoidPodsEntry(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Describes a class of pods that should avoid this node.", + Properties: map[string]spec.Schema{ + "podSignature": { + SchemaProps: spec.SchemaProps{ + Description: "The class of pods.", + Ref: ref("k8s.io/api/core/v1.PodSignature"), + }, + }, + "evictionTime": { + SchemaProps: spec.SchemaProps{ + Description: "Time at which this entry was added to the list.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, + "reason": { + SchemaProps: spec.SchemaProps{ + Description: "(brief) reason why this entry was added to the list.", + Type: []string{"string"}, + Format: "", + }, + }, + "message": { + SchemaProps: spec.SchemaProps{ + Description: "Human readable message indicating why this entry was added to the list.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"podSignature"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.PodSignature", "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, + } +} + +func schema_k8sio_api_core_v1_PreferredSchedulingTerm(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "An empty preferred scheduling term matches all objects with implicit weight 0 (i.e. it's a no-op). A null preferred scheduling term matches no objects (i.e. is also a no-op).", + Properties: map[string]spec.Schema{ + "weight": { + SchemaProps: spec.SchemaProps{ + Description: "Weight associated with matching the corresponding nodeSelectorTerm, in the range 1-100.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "preference": { + SchemaProps: spec.SchemaProps{ + Description: "A node selector term, associated with the corresponding weight.", + Ref: ref("k8s.io/api/core/v1.NodeSelectorTerm"), + }, + }, + }, + Required: []string{"weight", "preference"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.NodeSelectorTerm"}, + } +} + +func schema_k8sio_api_core_v1_Probe(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Probe describes a health check to be performed against a container to determine whether it is alive or ready to receive traffic.", + Properties: map[string]spec.Schema{ + "exec": { + SchemaProps: spec.SchemaProps{ + Description: "One and only one of the following should be specified. Exec specifies the action to take.", + Ref: ref("k8s.io/api/core/v1.ExecAction"), + }, + }, + "httpGet": { + SchemaProps: spec.SchemaProps{ + Description: "HTTPGet specifies the http request to perform.", + Ref: ref("k8s.io/api/core/v1.HTTPGetAction"), + }, + }, + "tcpSocket": { + SchemaProps: spec.SchemaProps{ + Description: "TCPSocket specifies an action involving a TCP port. TCP hooks not yet supported", + Ref: ref("k8s.io/api/core/v1.TCPSocketAction"), + }, + }, + "initialDelaySeconds": { + SchemaProps: spec.SchemaProps{ + Description: "Number of seconds after the container has started before liveness probes are initiated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "timeoutSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "Number of seconds after which the probe times out. Defaults to 1 second. Minimum value is 1. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "periodSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "successThreshold": { + SchemaProps: spec.SchemaProps{ + Description: "Minimum consecutive successes for the probe to be considered successful after having failed. Defaults to 1. Must be 1 for liveness. Minimum value is 1.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "failureThreshold": { + SchemaProps: spec.SchemaProps{ + Description: "Minimum consecutive failures for the probe to be considered failed after having succeeded. Defaults to 3. Minimum value is 1.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.ExecAction", "k8s.io/api/core/v1.HTTPGetAction", "k8s.io/api/core/v1.TCPSocketAction"}, + } +} + +func schema_k8sio_api_core_v1_ProjectedVolumeSource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Represents a projected volume source", + Properties: map[string]spec.Schema{ + "sources": { + SchemaProps: spec.SchemaProps{ + Description: "list of volume projections", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.VolumeProjection"), + }, + }, + }, + }, + }, + "defaultMode": { + SchemaProps: spec.SchemaProps{ + Description: "Mode bits to use on created files by default. Must be a value between 0 and 0777. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + Required: []string{"sources"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.VolumeProjection"}, + } +} + +func schema_k8sio_api_core_v1_QuobyteVolumeSource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Represents a Quobyte mount that lasts the lifetime of a pod. Quobyte volumes do not support ownership management or SELinux relabeling.", + Properties: map[string]spec.Schema{ + "registry": { + SchemaProps: spec.SchemaProps{ + Description: "Registry represents a single or multiple Quobyte Registry services specified as a string as host:port pair (multiple entries are separated with commas) which acts as the central registry for volumes", + Type: []string{"string"}, + Format: "", + }, + }, + "volume": { + SchemaProps: spec.SchemaProps{ + Description: "Volume is a string that references an already created Quobyte volume by name.", + Type: []string{"string"}, + Format: "", + }, + }, + "readOnly": { + SchemaProps: spec.SchemaProps{ + Description: "ReadOnly here will force the Quobyte volume to be mounted with read-only permissions. Defaults to false.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "user": { + SchemaProps: spec.SchemaProps{ + Description: "User to map volume access to Defaults to serivceaccount user", + Type: []string{"string"}, + Format: "", + }, + }, + "group": { + SchemaProps: spec.SchemaProps{ + Description: "Group to map volume access to Default is no group", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"registry", "volume"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_RBDPersistentVolumeSource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Represents a Rados Block Device mount that lasts the lifetime of a pod. RBD volumes support ownership management and SELinux relabeling.", + Properties: map[string]spec.Schema{ + "monitors": { + SchemaProps: spec.SchemaProps{ + Description: "A collection of Ceph monitors. More info: https://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "image": { + SchemaProps: spec.SchemaProps{ + Description: "The rados image name. More info: https://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it", + Type: []string{"string"}, + Format: "", + }, + }, + "fsType": { + SchemaProps: spec.SchemaProps{ + Description: "Filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#rbd", + Type: []string{"string"}, + Format: "", + }, + }, + "pool": { + SchemaProps: spec.SchemaProps{ + Description: "The rados pool name. Default is rbd. More info: https://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it", + Type: []string{"string"}, + Format: "", + }, + }, + "user": { + SchemaProps: spec.SchemaProps{ + Description: "The rados user name. Default is admin. More info: https://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it", + Type: []string{"string"}, + Format: "", + }, + }, + "keyring": { + SchemaProps: spec.SchemaProps{ + Description: "Keyring is the path to key ring for RBDUser. Default is /etc/ceph/keyring. More info: https://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it", + Type: []string{"string"}, + Format: "", + }, + }, + "secretRef": { + SchemaProps: spec.SchemaProps{ + Description: "SecretRef is name of the authentication secret for RBDUser. If provided overrides keyring. Default is nil. More info: https://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it", + Ref: ref("k8s.io/api/core/v1.SecretReference"), + }, + }, + "readOnly": { + SchemaProps: spec.SchemaProps{ + Description: "ReadOnly here will force the ReadOnly setting in VolumeMounts. Defaults to false. More info: https://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it", + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + Required: []string{"monitors", "image"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.SecretReference"}, + } +} + +func schema_k8sio_api_core_v1_RBDVolumeSource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Represents a Rados Block Device mount that lasts the lifetime of a pod. RBD volumes support ownership management and SELinux relabeling.", + Properties: map[string]spec.Schema{ + "monitors": { + SchemaProps: spec.SchemaProps{ + Description: "A collection of Ceph monitors. More info: https://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "image": { + SchemaProps: spec.SchemaProps{ + Description: "The rados image name. More info: https://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it", + Type: []string{"string"}, + Format: "", + }, + }, + "fsType": { + SchemaProps: spec.SchemaProps{ + Description: "Filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#rbd", + Type: []string{"string"}, + Format: "", + }, + }, + "pool": { + SchemaProps: spec.SchemaProps{ + Description: "The rados pool name. Default is rbd. More info: https://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it", + Type: []string{"string"}, + Format: "", + }, + }, + "user": { + SchemaProps: spec.SchemaProps{ + Description: "The rados user name. Default is admin. More info: https://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it", + Type: []string{"string"}, + Format: "", + }, + }, + "keyring": { + SchemaProps: spec.SchemaProps{ + Description: "Keyring is the path to key ring for RBDUser. Default is /etc/ceph/keyring. More info: https://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it", + Type: []string{"string"}, + Format: "", + }, + }, + "secretRef": { + SchemaProps: spec.SchemaProps{ + Description: "SecretRef is name of the authentication secret for RBDUser. If provided overrides keyring. Default is nil. More info: https://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it", + Ref: ref("k8s.io/api/core/v1.LocalObjectReference"), + }, + }, + "readOnly": { + SchemaProps: spec.SchemaProps{ + Description: "ReadOnly here will force the ReadOnly setting in VolumeMounts. Defaults to false. More info: https://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it", + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + Required: []string{"monitors", "image"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.LocalObjectReference"}, + } +} + +func schema_k8sio_api_core_v1_RangeAllocation(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "RangeAllocation is not a public type.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "range": { + SchemaProps: spec.SchemaProps{ + Description: "Range is string that identifies the range represented by 'data'.", + Type: []string{"string"}, + Format: "", + }, + }, + "data": { + SchemaProps: spec.SchemaProps{ + Description: "Data is a bit array containing all allocated addresses in the previous segment.", + Type: []string{"string"}, + Format: "byte", + }, + }, + }, + Required: []string{"range", "data"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_k8sio_api_core_v1_ReplicationController(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ReplicationController represents the configuration of a replication controller.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "If the Labels of a ReplicationController are empty, they are defaulted to be the same as the Pod(s) that the replication controller manages. Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Description: "Spec defines the specification of the desired behavior of the replication controller. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status", + Ref: ref("k8s.io/api/core/v1.ReplicationControllerSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Description: "Status is the most recently observed status of the replication controller. This data may be out of date by some window of time. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status", + Ref: ref("k8s.io/api/core/v1.ReplicationControllerStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.ReplicationControllerSpec", "k8s.io/api/core/v1.ReplicationControllerStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_k8sio_api_core_v1_ReplicationControllerCondition(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ReplicationControllerCondition describes the state of a replication controller at a certain point.", + Properties: map[string]spec.Schema{ + "type": { + SchemaProps: spec.SchemaProps{ + Description: "Type of replication controller condition.", + Type: []string{"string"}, + Format: "", + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Description: "Status of the condition, one of True, False, Unknown.", + Type: []string{"string"}, + Format: "", + }, + }, + "lastTransitionTime": { + SchemaProps: spec.SchemaProps{ + Description: "The last time the condition transitioned from one status to another.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, + "reason": { + SchemaProps: spec.SchemaProps{ + Description: "The reason for the condition's last transition.", + Type: []string{"string"}, + Format: "", + }, + }, + "message": { + SchemaProps: spec.SchemaProps{ + Description: "A human readable message indicating details about the transition.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"type", "status"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, + } +} + +func schema_k8sio_api_core_v1_ReplicationControllerList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ReplicationControllerList is a collection of replication controllers.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Description: "List of replication controllers. More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.ReplicationController"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.ReplicationController", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_k8sio_api_core_v1_ReplicationControllerSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ReplicationControllerSpec is the specification of a replication controller.", + Properties: map[string]spec.Schema{ + "replicas": { + SchemaProps: spec.SchemaProps{ + Description: "Replicas is the number of desired replicas. This is a pointer to distinguish between explicit zero and unspecified. Defaults to 1. More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#what-is-a-replicationcontroller", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "minReadySeconds": { + SchemaProps: spec.SchemaProps{ + Description: "Minimum number of seconds for which a newly created pod should be ready without any of its container crashing, for it to be considered available. Defaults to 0 (pod will be considered available as soon as it is ready)", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "selector": { + SchemaProps: spec.SchemaProps{ + Description: "Selector is a label query over pods that should match the Replicas count. If Selector is empty, it is defaulted to the labels present on the Pod template. Label keys and values that must match in order to be controlled by this replication controller, if empty defaulted to labels on Pod template. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "template": { + SchemaProps: spec.SchemaProps{ + Description: "Template is the object that describes the pod that will be created if insufficient replicas are detected. This takes precedence over a TemplateRef. More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#pod-template", + Ref: ref("k8s.io/api/core/v1.PodTemplateSpec"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.PodTemplateSpec"}, + } +} + +func schema_k8sio_api_core_v1_ReplicationControllerStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ReplicationControllerStatus represents the current status of a replication controller.", + Properties: map[string]spec.Schema{ + "replicas": { + SchemaProps: spec.SchemaProps{ + Description: "Replicas is the most recently oberved number of replicas. More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#what-is-a-replicationcontroller", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "fullyLabeledReplicas": { + SchemaProps: spec.SchemaProps{ + Description: "The number of pods that have labels matching the labels of the pod template of the replication controller.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "readyReplicas": { + SchemaProps: spec.SchemaProps{ + Description: "The number of ready replicas for this replication controller.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "availableReplicas": { + SchemaProps: spec.SchemaProps{ + Description: "The number of available replicas (ready for at least minReadySeconds) for this replication controller.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "observedGeneration": { + SchemaProps: spec.SchemaProps{ + Description: "ObservedGeneration reflects the generation of the most recently observed replication controller.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "conditions": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-patch-merge-key": "type", + "x-kubernetes-patch-strategy": "merge", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "Represents the latest available observations of a replication controller's current state.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.ReplicationControllerCondition"), + }, + }, + }, + }, + }, + }, + Required: []string{"replicas"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.ReplicationControllerCondition"}, + } +} + +func schema_k8sio_api_core_v1_ResourceFieldSelector(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ResourceFieldSelector represents container resources (cpu, memory) and their output format", + Properties: map[string]spec.Schema{ + "containerName": { + SchemaProps: spec.SchemaProps{ + Description: "Container name: required for volumes, optional for env vars", + Type: []string{"string"}, + Format: "", + }, + }, + "resource": { + SchemaProps: spec.SchemaProps{ + Description: "Required: resource to select", + Type: []string{"string"}, + Format: "", + }, + }, + "divisor": { + SchemaProps: spec.SchemaProps{ + Description: "Specifies the output format of the exposed resources, defaults to \"1\"", + Ref: ref("k8s.io/apimachinery/pkg/api/resource.Quantity"), + }, + }, + }, + Required: []string{"resource"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/api/resource.Quantity"}, + } +} + +func schema_k8sio_api_core_v1_ResourceQuota(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ResourceQuota sets aggregate quota restrictions enforced per namespace", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Description: "Spec defines the desired quota. https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status", + Ref: ref("k8s.io/api/core/v1.ResourceQuotaSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Description: "Status defines the actual enforced quota and its current usage. https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status", + Ref: ref("k8s.io/api/core/v1.ResourceQuotaStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.ResourceQuotaSpec", "k8s.io/api/core/v1.ResourceQuotaStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_k8sio_api_core_v1_ResourceQuotaList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ResourceQuotaList is a list of ResourceQuota items.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Description: "Items is a list of ResourceQuota objects. More info: https://kubernetes.io/docs/concepts/policy/resource-quotas/", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.ResourceQuota"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.ResourceQuota", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_k8sio_api_core_v1_ResourceQuotaSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ResourceQuotaSpec defines the desired hard limits to enforce for Quota.", + Properties: map[string]spec.Schema{ + "hard": { + SchemaProps: spec.SchemaProps{ + Description: "hard is the set of desired hard limits for each named resource. More info: https://kubernetes.io/docs/concepts/policy/resource-quotas/", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/api/resource.Quantity"), + }, + }, + }, + }, + }, + "scopes": { + SchemaProps: spec.SchemaProps{ + Description: "A collection of filters that must match each object tracked by a quota. If not specified, the quota matches all objects.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "scopeSelector": { + SchemaProps: spec.SchemaProps{ + Description: "scopeSelector is also a collection of filters like scopes that must match each object tracked by a quota but expressed using ScopeSelectorOperator in combination with possible values. For a resource to match, both scopes AND scopeSelector (if specified in spec), must be matched.", + Ref: ref("k8s.io/api/core/v1.ScopeSelector"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.ScopeSelector", "k8s.io/apimachinery/pkg/api/resource.Quantity"}, + } +} + +func schema_k8sio_api_core_v1_ResourceQuotaStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ResourceQuotaStatus defines the enforced hard limits and observed use.", + Properties: map[string]spec.Schema{ + "hard": { + SchemaProps: spec.SchemaProps{ + Description: "Hard is the set of enforced hard limits for each named resource. More info: https://kubernetes.io/docs/concepts/policy/resource-quotas/", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/api/resource.Quantity"), + }, + }, + }, + }, + }, + "used": { + SchemaProps: spec.SchemaProps{ + Description: "Used is the current observed total usage of the resource in the namespace.", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/api/resource.Quantity"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/api/resource.Quantity"}, + } +} + +func schema_k8sio_api_core_v1_ResourceRequirements(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ResourceRequirements describes the compute resource requirements.", + Properties: map[string]spec.Schema{ + "limits": { + SchemaProps: spec.SchemaProps{ + Description: "Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/api/resource.Quantity"), + }, + }, + }, + }, + }, + "requests": { + SchemaProps: spec.SchemaProps{ + Description: "Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/api/resource.Quantity"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/api/resource.Quantity"}, + } +} + +func schema_k8sio_api_core_v1_SELinuxOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "SELinuxOptions are the labels to be applied to the container", + Properties: map[string]spec.Schema{ + "user": { + SchemaProps: spec.SchemaProps{ + Description: "User is a SELinux user label that applies to the container.", + Type: []string{"string"}, + Format: "", + }, + }, + "role": { + SchemaProps: spec.SchemaProps{ + Description: "Role is a SELinux role label that applies to the container.", + Type: []string{"string"}, + Format: "", + }, + }, + "type": { + SchemaProps: spec.SchemaProps{ + Description: "Type is a SELinux type label that applies to the container.", + Type: []string{"string"}, + Format: "", + }, + }, + "level": { + SchemaProps: spec.SchemaProps{ + Description: "Level is SELinux level label that applies to the container.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_ScaleIOPersistentVolumeSource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ScaleIOPersistentVolumeSource represents a persistent ScaleIO volume", + Properties: map[string]spec.Schema{ + "gateway": { + SchemaProps: spec.SchemaProps{ + Description: "The host address of the ScaleIO API Gateway.", + Type: []string{"string"}, + Format: "", + }, + }, + "system": { + SchemaProps: spec.SchemaProps{ + Description: "The name of the storage system as configured in ScaleIO.", + Type: []string{"string"}, + Format: "", + }, + }, + "secretRef": { + SchemaProps: spec.SchemaProps{ + Description: "SecretRef references to the secret for ScaleIO user and other sensitive information. If this is not provided, Login operation will fail.", + Ref: ref("k8s.io/api/core/v1.SecretReference"), + }, + }, + "sslEnabled": { + SchemaProps: spec.SchemaProps{ + Description: "Flag to enable/disable SSL communication with Gateway, default false", + Type: []string{"boolean"}, + Format: "", + }, + }, + "protectionDomain": { + SchemaProps: spec.SchemaProps{ + Description: "The name of the ScaleIO Protection Domain for the configured storage.", + Type: []string{"string"}, + Format: "", + }, + }, + "storagePool": { + SchemaProps: spec.SchemaProps{ + Description: "The ScaleIO Storage Pool associated with the protection domain.", + Type: []string{"string"}, + Format: "", + }, + }, + "storageMode": { + SchemaProps: spec.SchemaProps{ + Description: "Indicates whether the storage for a volume should be ThickProvisioned or ThinProvisioned. Default is ThinProvisioned.", + Type: []string{"string"}, + Format: "", + }, + }, + "volumeName": { + SchemaProps: spec.SchemaProps{ + Description: "The name of a volume already created in the ScaleIO system that is associated with this volume source.", + Type: []string{"string"}, + Format: "", + }, + }, + "fsType": { + SchemaProps: spec.SchemaProps{ + Description: "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Default is \"xfs\"", + Type: []string{"string"}, + Format: "", + }, + }, + "readOnly": { + SchemaProps: spec.SchemaProps{ + Description: "Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.", + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + Required: []string{"gateway", "system", "secretRef"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.SecretReference"}, + } +} + +func schema_k8sio_api_core_v1_ScaleIOVolumeSource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ScaleIOVolumeSource represents a persistent ScaleIO volume", + Properties: map[string]spec.Schema{ + "gateway": { + SchemaProps: spec.SchemaProps{ + Description: "The host address of the ScaleIO API Gateway.", + Type: []string{"string"}, + Format: "", + }, + }, + "system": { + SchemaProps: spec.SchemaProps{ + Description: "The name of the storage system as configured in ScaleIO.", + Type: []string{"string"}, + Format: "", + }, + }, + "secretRef": { + SchemaProps: spec.SchemaProps{ + Description: "SecretRef references to the secret for ScaleIO user and other sensitive information. If this is not provided, Login operation will fail.", + Ref: ref("k8s.io/api/core/v1.LocalObjectReference"), + }, + }, + "sslEnabled": { + SchemaProps: spec.SchemaProps{ + Description: "Flag to enable/disable SSL communication with Gateway, default false", + Type: []string{"boolean"}, + Format: "", + }, + }, + "protectionDomain": { + SchemaProps: spec.SchemaProps{ + Description: "The name of the ScaleIO Protection Domain for the configured storage.", + Type: []string{"string"}, + Format: "", + }, + }, + "storagePool": { + SchemaProps: spec.SchemaProps{ + Description: "The ScaleIO Storage Pool associated with the protection domain.", + Type: []string{"string"}, + Format: "", + }, + }, + "storageMode": { + SchemaProps: spec.SchemaProps{ + Description: "Indicates whether the storage for a volume should be ThickProvisioned or ThinProvisioned. Default is ThinProvisioned.", + Type: []string{"string"}, + Format: "", + }, + }, + "volumeName": { + SchemaProps: spec.SchemaProps{ + Description: "The name of a volume already created in the ScaleIO system that is associated with this volume source.", + Type: []string{"string"}, + Format: "", + }, + }, + "fsType": { + SchemaProps: spec.SchemaProps{ + Description: "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Default is \"xfs\".", + Type: []string{"string"}, + Format: "", + }, + }, + "readOnly": { + SchemaProps: spec.SchemaProps{ + Description: "Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.", + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + Required: []string{"gateway", "system", "secretRef"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.LocalObjectReference"}, + } +} + +func schema_k8sio_api_core_v1_ScopeSelector(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "A scope selector represents the AND of the selectors represented by the scoped-resource selector requirements.", + Properties: map[string]spec.Schema{ + "matchExpressions": { + SchemaProps: spec.SchemaProps{ + Description: "A list of scope selector requirements by scope of the resources.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.ScopedResourceSelectorRequirement"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.ScopedResourceSelectorRequirement"}, + } +} + +func schema_k8sio_api_core_v1_ScopedResourceSelectorRequirement(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "A scoped-resource selector requirement is a selector that contains values, a scope name, and an operator that relates the scope name and values.", + Properties: map[string]spec.Schema{ + "scopeName": { + SchemaProps: spec.SchemaProps{ + Description: "The name of the scope that the selector applies to.", + Type: []string{"string"}, + Format: "", + }, + }, + "operator": { + SchemaProps: spec.SchemaProps{ + Description: "Represents a scope's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist.", + Type: []string{"string"}, + Format: "", + }, + }, + "values": { + SchemaProps: spec.SchemaProps{ + Description: "An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + Required: []string{"scopeName", "operator"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_Secret(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Secret holds secret data of a certain type. The total bytes of the values in the Data field must be less than MaxSecretSize bytes.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "data": { + SchemaProps: spec.SchemaProps{ + Description: "Data contains the secret data. Each key must consist of alphanumeric characters, '-', '_' or '.'. The serialized form of the secret data is a base64 encoded string, representing the arbitrary (possibly non-string) data value here. Described in https://tools.ietf.org/html/rfc4648#section-4", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "byte", + }, + }, + }, + }, + }, + "stringData": { + SchemaProps: spec.SchemaProps{ + Description: "stringData allows specifying non-binary secret data in string form. It is provided as a write-only convenience method. All keys and values are merged into the data field on write, overwriting any existing values. It is never output when reading from the API.", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "type": { + SchemaProps: spec.SchemaProps{ + Description: "Used to facilitate programmatic handling of secret data.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_k8sio_api_core_v1_SecretEnvSource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "SecretEnvSource selects a Secret to populate the environment variables with.\n\nThe contents of the target Secret's Data field will represent the key-value pairs as environment variables.", + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + Type: []string{"string"}, + Format: "", + }, + }, + "optional": { + SchemaProps: spec.SchemaProps{ + Description: "Specify whether the Secret must be defined", + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_SecretKeySelector(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "SecretKeySelector selects a key of a Secret.", + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + Type: []string{"string"}, + Format: "", + }, + }, + "key": { + SchemaProps: spec.SchemaProps{ + Description: "The key of the secret to select from. Must be a valid secret key.", + Type: []string{"string"}, + Format: "", + }, + }, + "optional": { + SchemaProps: spec.SchemaProps{ + Description: "Specify whether the Secret or it's key must be defined", + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + Required: []string{"key"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_SecretList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "SecretList is a list of Secret.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Description: "Items is a list of secret objects. More info: https://kubernetes.io/docs/concepts/configuration/secret", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.Secret"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.Secret", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_k8sio_api_core_v1_SecretProjection(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Adapts a secret into a projected volume.\n\nThe contents of the target Secret's Data field will be presented in a projected volume as files using the keys in the Data field as the file names. Note that this is identical to a secret volume source without the default mode.", + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + Type: []string{"string"}, + Format: "", + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Description: "If unspecified, each key-value pair in the Data field of the referenced Secret will be projected into the volume as a file whose name is the key and content is the value. If specified, the listed keys will be projected into the specified paths, and unlisted keys will not be present. If a key is specified which is not present in the Secret, the volume setup will error unless it is marked optional. Paths must be relative and may not contain the '..' path or start with '..'.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.KeyToPath"), + }, + }, + }, + }, + }, + "optional": { + SchemaProps: spec.SchemaProps{ + Description: "Specify whether the Secret or its key must be defined", + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.KeyToPath"}, + } +} + +func schema_k8sio_api_core_v1_SecretReference(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "SecretReference represents a Secret Reference. It has enough information to retrieve secret in any namespace", + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name is unique within a namespace to reference a secret resource.", + Type: []string{"string"}, + Format: "", + }, + }, + "namespace": { + SchemaProps: spec.SchemaProps{ + Description: "Namespace defines the space within which the secret name must be unique.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_SecretVolumeSource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Adapts a Secret into a volume.\n\nThe contents of the target Secret's Data field will be presented in a volume as files using the keys in the Data field as the file names. Secret volumes support ownership management and SELinux relabeling.", + Properties: map[string]spec.Schema{ + "secretName": { + SchemaProps: spec.SchemaProps{ + Description: "Name of the secret in the pod's namespace to use. More info: https://kubernetes.io/docs/concepts/storage/volumes#secret", + Type: []string{"string"}, + Format: "", + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Description: "If unspecified, each key-value pair in the Data field of the referenced Secret will be projected into the volume as a file whose name is the key and content is the value. If specified, the listed keys will be projected into the specified paths, and unlisted keys will not be present. If a key is specified which is not present in the Secret, the volume setup will error unless it is marked optional. Paths must be relative and may not contain the '..' path or start with '..'.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.KeyToPath"), + }, + }, + }, + }, + }, + "defaultMode": { + SchemaProps: spec.SchemaProps{ + Description: "Optional: mode bits to use on created files by default. Must be a value between 0 and 0777. Defaults to 0644. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "optional": { + SchemaProps: spec.SchemaProps{ + Description: "Specify whether the Secret or it's keys must be defined", + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.KeyToPath"}, + } +} + +func schema_k8sio_api_core_v1_SecurityContext(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "SecurityContext holds security configuration that will be applied to a container. Some fields are present in both SecurityContext and PodSecurityContext. When both are set, the values in SecurityContext take precedence.", + Properties: map[string]spec.Schema{ + "capabilities": { + SchemaProps: spec.SchemaProps{ + Description: "The capabilities to add/drop when running containers. Defaults to the default set of capabilities granted by the container runtime.", + Ref: ref("k8s.io/api/core/v1.Capabilities"), + }, + }, + "privileged": { + SchemaProps: spec.SchemaProps{ + Description: "Run container in privileged mode. Processes in privileged containers are essentially equivalent to root on the host. Defaults to false.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "seLinuxOptions": { + SchemaProps: spec.SchemaProps{ + Description: "The SELinux context to be applied to the container. If unspecified, the container runtime will allocate a random SELinux context for each container. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.", + Ref: ref("k8s.io/api/core/v1.SELinuxOptions"), + }, + }, + "runAsUser": { + SchemaProps: spec.SchemaProps{ + Description: "The UID to run the entrypoint of the container process. Defaults to user specified in image metadata if unspecified. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "runAsGroup": { + SchemaProps: spec.SchemaProps{ + Description: "The GID to run the entrypoint of the container process. Uses runtime default if unset. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "runAsNonRoot": { + SchemaProps: spec.SchemaProps{ + Description: "Indicates that the container must run as a non-root user. If true, the Kubelet will validate the image at runtime to ensure that it does not run as UID 0 (root) and fail to start the container if it does. If unset or false, no such validation will be performed. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "readOnlyRootFilesystem": { + SchemaProps: spec.SchemaProps{ + Description: "Whether this container has a read-only root filesystem. Default is false.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "allowPrivilegeEscalation": { + SchemaProps: spec.SchemaProps{ + Description: "AllowPrivilegeEscalation controls whether a process can gain more privileges than its parent process. This bool directly controls if the no_new_privs flag will be set on the container process. AllowPrivilegeEscalation is true always when the container is: 1) run as Privileged 2) has CAP_SYS_ADMIN", + Type: []string{"boolean"}, + Format: "", + }, + }, + "procMount": { + SchemaProps: spec.SchemaProps{ + Description: "procMount denotes the type of proc mount to use for the containers. The default is DefaultProcMount which uses the container runtime defaults for readonly paths and masked paths. This requires the ProcMountType feature flag to be enabled.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.Capabilities", "k8s.io/api/core/v1.SELinuxOptions"}, + } +} + +func schema_k8sio_api_core_v1_SerializedReference(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "SerializedReference is a reference to serialized object.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "reference": { + SchemaProps: spec.SchemaProps{ + Description: "The reference to an object in the system.", + Ref: ref("k8s.io/api/core/v1.ObjectReference"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.ObjectReference"}, + } +} + +func schema_k8sio_api_core_v1_Service(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Service is a named abstraction of software service (for example, mysql) consisting of local port (for example 3306) that the proxy listens on, and the selector that determines which pods will answer requests sent through the proxy.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Description: "Spec defines the behavior of a service. https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status", + Ref: ref("k8s.io/api/core/v1.ServiceSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Description: "Most recently observed status of the service. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status", + Ref: ref("k8s.io/api/core/v1.ServiceStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.ServiceSpec", "k8s.io/api/core/v1.ServiceStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_k8sio_api_core_v1_ServiceAccount(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ServiceAccount binds together: * a name, understood by users, and perhaps by peripheral systems, for an identity * a principal that can be authenticated and authorized * a set of secrets", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "secrets": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-patch-merge-key": "name", + "x-kubernetes-patch-strategy": "merge", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "Secrets is the list of secrets allowed to be used by pods running using this ServiceAccount. More info: https://kubernetes.io/docs/concepts/configuration/secret", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.ObjectReference"), + }, + }, + }, + }, + }, + "imagePullSecrets": { + SchemaProps: spec.SchemaProps{ + Description: "ImagePullSecrets is a list of references to secrets in the same namespace to use for pulling any images in pods that reference this ServiceAccount. ImagePullSecrets are distinct from Secrets because Secrets can be mounted in the pod, but ImagePullSecrets are only accessed by the kubelet. More info: https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.LocalObjectReference"), + }, + }, + }, + }, + }, + "automountServiceAccountToken": { + SchemaProps: spec.SchemaProps{ + Description: "AutomountServiceAccountToken indicates whether pods running as this service account should have an API token automatically mounted. Can be overridden at the pod level.", + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/api/core/v1.ObjectReference", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_k8sio_api_core_v1_ServiceAccountList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ServiceAccountList is a list of ServiceAccount objects", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Description: "List of ServiceAccounts. More info: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.ServiceAccount"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.ServiceAccount", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_k8sio_api_core_v1_ServiceAccountTokenProjection(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ServiceAccountTokenProjection represents a projected service account token volume. This projection can be used to insert a service account token into the pods runtime filesystem for use against APIs (Kubernetes API Server or otherwise).", + Properties: map[string]spec.Schema{ + "audience": { + SchemaProps: spec.SchemaProps{ + Description: "Audience is the intended audience of the token. A recipient of a token must identify itself with an identifier specified in the audience of the token, and otherwise should reject the token. The audience defaults to the identifier of the apiserver.", + Type: []string{"string"}, + Format: "", + }, + }, + "expirationSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "ExpirationSeconds is the requested duration of validity of the service account token. As the token approaches expiration, the kubelet volume plugin will proactively rotate the service account token. The kubelet will start trying to rotate the token if the token is older than 80 percent of its time to live or if the token is older than 24 hours.Defaults to 1 hour and must be at least 10 minutes.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "path": { + SchemaProps: spec.SchemaProps{ + Description: "Path is the path relative to the mount point of the file to project the token into.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"path"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_ServiceList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ServiceList holds a list of services.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Description: "List of services", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.Service"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.Service", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_k8sio_api_core_v1_ServicePort(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ServicePort contains information on service's port.", + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "The name of this port within the service. This must be a DNS_LABEL. All ports within a ServiceSpec must have unique names. This maps to the 'Name' field in EndpointPort objects. Optional if only one ServicePort is defined on this service.", + Type: []string{"string"}, + Format: "", + }, + }, + "protocol": { + SchemaProps: spec.SchemaProps{ + Description: "The IP protocol for this port. Supports \"TCP\", \"UDP\", and \"SCTP\". Default is TCP.", + Type: []string{"string"}, + Format: "", + }, + }, + "port": { + SchemaProps: spec.SchemaProps{ + Description: "The port that will be exposed by this service.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "targetPort": { + SchemaProps: spec.SchemaProps{ + Description: "Number or name of the port to access on the pods targeted by the service. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. If this is a string, it will be looked up as a named port in the target Pod's container ports. If this is not specified, the value of the 'port' field is used (an identity map). This field is ignored for services with clusterIP=None, and should be omitted or set equal to the 'port' field. More info: https://kubernetes.io/docs/concepts/services-networking/service/#defining-a-service", + Ref: ref("k8s.io/apimachinery/pkg/util/intstr.IntOrString"), + }, + }, + "nodePort": { + SchemaProps: spec.SchemaProps{ + Description: "The port on each node on which this service is exposed when type=NodePort or LoadBalancer. Usually assigned by the system. If specified, it will be allocated to the service if unused or else creation of the service will fail. Default is to auto-allocate a port if the ServiceType of this Service requires one. More info: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport", + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + Required: []string{"port"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/util/intstr.IntOrString"}, + } +} + +func schema_k8sio_api_core_v1_ServiceProxyOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ServiceProxyOptions is the query options to a Service's proxy call.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "path": { + SchemaProps: spec.SchemaProps{ + Description: "Path is the part of URLs that include service endpoints, suffixes, and parameters to use for the current proxy request to service. For example, the whole request URL is http://localhost/api/v1/namespaces/kube-system/services/elasticsearch-logging/_search?q=user:kimchy. Path is _search?q=user:kimchy.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_ServiceSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ServiceSpec describes the attributes that a user creates on a service.", + Properties: map[string]spec.Schema{ + "ports": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-patch-merge-key": "port", + "x-kubernetes-patch-strategy": "merge", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "The list of ports that are exposed by this service. More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.ServicePort"), + }, + }, + }, + }, + }, + "selector": { + SchemaProps: spec.SchemaProps{ + Description: "Route service traffic to pods with label keys and values matching this selector. If empty or not present, the service is assumed to have an external process managing its endpoints, which Kubernetes will not modify. Only applies to types ClusterIP, NodePort, and LoadBalancer. Ignored if type is ExternalName. More info: https://kubernetes.io/docs/concepts/services-networking/service/", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "clusterIP": { + SchemaProps: spec.SchemaProps{ + Description: "clusterIP is the IP address of the service and is usually assigned randomly by the master. If an address is specified manually and is not in use by others, it will be allocated to the service; otherwise, creation of the service will fail. This field can not be changed through updates. Valid values are \"None\", empty string (\"\"), or a valid IP address. \"None\" can be specified for headless services when proxying is not required. Only applies to types ClusterIP, NodePort, and LoadBalancer. Ignored if type is ExternalName. More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies", + Type: []string{"string"}, + Format: "", + }, + }, + "type": { + SchemaProps: spec.SchemaProps{ + Description: "type determines how the Service is exposed. Defaults to ClusterIP. Valid options are ExternalName, ClusterIP, NodePort, and LoadBalancer. \"ExternalName\" maps to the specified externalName. \"ClusterIP\" allocates a cluster-internal IP address for load-balancing to endpoints. Endpoints are determined by the selector or if that is not specified, by manual construction of an Endpoints object. If clusterIP is \"None\", no virtual IP is allocated and the endpoints are published as a set of endpoints rather than a stable IP. \"NodePort\" builds on ClusterIP and allocates a port on every node which routes to the clusterIP. \"LoadBalancer\" builds on NodePort and creates an external load-balancer (if supported in the current cloud) which routes to the clusterIP. More info: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services---service-types", + Type: []string{"string"}, + Format: "", + }, + }, + "externalIPs": { + SchemaProps: spec.SchemaProps{ + Description: "externalIPs is a list of IP addresses for which nodes in the cluster will also accept traffic for this service. These IPs are not managed by Kubernetes. The user is responsible for ensuring that traffic arrives at a node with this IP. A common example is external load-balancers that are not part of the Kubernetes system.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "sessionAffinity": { + SchemaProps: spec.SchemaProps{ + Description: "Supports \"ClientIP\" and \"None\". Used to maintain session affinity. Enable client IP based session affinity. Must be ClientIP or None. Defaults to None. More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies", + Type: []string{"string"}, + Format: "", + }, + }, + "loadBalancerIP": { + SchemaProps: spec.SchemaProps{ + Description: "Only applies to Service Type: LoadBalancer LoadBalancer will get created with the IP specified in this field. This feature depends on whether the underlying cloud-provider supports specifying the loadBalancerIP when a load balancer is created. This field will be ignored if the cloud-provider does not support the feature.", + Type: []string{"string"}, + Format: "", + }, + }, + "loadBalancerSourceRanges": { + SchemaProps: spec.SchemaProps{ + Description: "If specified and supported by the platform, this will restrict traffic through the cloud-provider load-balancer will be restricted to the specified client IPs. This field will be ignored if the cloud-provider does not support the feature.\" More info: https://kubernetes.io/docs/tasks/access-application-cluster/configure-cloud-provider-firewall/", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "externalName": { + SchemaProps: spec.SchemaProps{ + Description: "externalName is the external reference that kubedns or equivalent will return as a CNAME record for this service. No proxying will be involved. Must be a valid RFC-1123 hostname (https://tools.ietf.org/html/rfc1123) and requires Type to be ExternalName.", + Type: []string{"string"}, + Format: "", + }, + }, + "externalTrafficPolicy": { + SchemaProps: spec.SchemaProps{ + Description: "externalTrafficPolicy denotes if this Service desires to route external traffic to node-local or cluster-wide endpoints. \"Local\" preserves the client source IP and avoids a second hop for LoadBalancer and Nodeport type services, but risks potentially imbalanced traffic spreading. \"Cluster\" obscures the client source IP and may cause a second hop to another node, but should have good overall load-spreading.", + Type: []string{"string"}, + Format: "", + }, + }, + "healthCheckNodePort": { + SchemaProps: spec.SchemaProps{ + Description: "healthCheckNodePort specifies the healthcheck nodePort for the service. If not specified, HealthCheckNodePort is created by the service api backend with the allocated nodePort. Will use user-specified nodePort value if specified by the client. Only effects when Type is set to LoadBalancer and ExternalTrafficPolicy is set to Local.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "publishNotReadyAddresses": { + SchemaProps: spec.SchemaProps{ + Description: "publishNotReadyAddresses, when set to true, indicates that DNS implementations must publish the notReadyAddresses of subsets for the Endpoints associated with the Service. The default value is false. The primary use case for setting this field is to use a StatefulSet's Headless Service to propagate SRV records for its Pods without respect to their readiness for purpose of peer discovery.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "sessionAffinityConfig": { + SchemaProps: spec.SchemaProps{ + Description: "sessionAffinityConfig contains the configurations of session affinity.", + Ref: ref("k8s.io/api/core/v1.SessionAffinityConfig"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.ServicePort", "k8s.io/api/core/v1.SessionAffinityConfig"}, + } +} + +func schema_k8sio_api_core_v1_ServiceStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ServiceStatus represents the current status of a service.", + Properties: map[string]spec.Schema{ + "loadBalancer": { + SchemaProps: spec.SchemaProps{ + Description: "LoadBalancer contains the current status of the load-balancer, if one is present.", + Ref: ref("k8s.io/api/core/v1.LoadBalancerStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.LoadBalancerStatus"}, + } +} + +func schema_k8sio_api_core_v1_SessionAffinityConfig(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "SessionAffinityConfig represents the configurations of session affinity.", + Properties: map[string]spec.Schema{ + "clientIP": { + SchemaProps: spec.SchemaProps{ + Description: "clientIP contains the configurations of Client IP based session affinity.", + Ref: ref("k8s.io/api/core/v1.ClientIPConfig"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.ClientIPConfig"}, + } +} + +func schema_k8sio_api_core_v1_StorageOSPersistentVolumeSource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Represents a StorageOS persistent volume resource.", + Properties: map[string]spec.Schema{ + "volumeName": { + SchemaProps: spec.SchemaProps{ + Description: "VolumeName is the human-readable name of the StorageOS volume. Volume names are only unique within a namespace.", + Type: []string{"string"}, + Format: "", + }, + }, + "volumeNamespace": { + SchemaProps: spec.SchemaProps{ + Description: "VolumeNamespace specifies the scope of the volume within StorageOS. If no namespace is specified then the Pod's namespace will be used. This allows the Kubernetes name scoping to be mirrored within StorageOS for tighter integration. Set VolumeName to any name to override the default behaviour. Set to \"default\" if you are not using namespaces within StorageOS. Namespaces that do not pre-exist within StorageOS will be created.", + Type: []string{"string"}, + Format: "", + }, + }, + "fsType": { + SchemaProps: spec.SchemaProps{ + Description: "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified.", + Type: []string{"string"}, + Format: "", + }, + }, + "readOnly": { + SchemaProps: spec.SchemaProps{ + Description: "Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "secretRef": { + SchemaProps: spec.SchemaProps{ + Description: "SecretRef specifies the secret to use for obtaining the StorageOS API credentials. If not specified, default values will be attempted.", + Ref: ref("k8s.io/api/core/v1.ObjectReference"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.ObjectReference"}, + } +} + +func schema_k8sio_api_core_v1_StorageOSVolumeSource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Represents a StorageOS persistent volume resource.", + Properties: map[string]spec.Schema{ + "volumeName": { + SchemaProps: spec.SchemaProps{ + Description: "VolumeName is the human-readable name of the StorageOS volume. Volume names are only unique within a namespace.", + Type: []string{"string"}, + Format: "", + }, + }, + "volumeNamespace": { + SchemaProps: spec.SchemaProps{ + Description: "VolumeNamespace specifies the scope of the volume within StorageOS. If no namespace is specified then the Pod's namespace will be used. This allows the Kubernetes name scoping to be mirrored within StorageOS for tighter integration. Set VolumeName to any name to override the default behaviour. Set to \"default\" if you are not using namespaces within StorageOS. Namespaces that do not pre-exist within StorageOS will be created.", + Type: []string{"string"}, + Format: "", + }, + }, + "fsType": { + SchemaProps: spec.SchemaProps{ + Description: "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified.", + Type: []string{"string"}, + Format: "", + }, + }, + "readOnly": { + SchemaProps: spec.SchemaProps{ + Description: "Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "secretRef": { + SchemaProps: spec.SchemaProps{ + Description: "SecretRef specifies the secret to use for obtaining the StorageOS API credentials. If not specified, default values will be attempted.", + Ref: ref("k8s.io/api/core/v1.LocalObjectReference"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.LocalObjectReference"}, + } +} + +func schema_k8sio_api_core_v1_Sysctl(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Sysctl defines a kernel parameter to be set", + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name of a property to set", + Type: []string{"string"}, + Format: "", + }, + }, + "value": { + SchemaProps: spec.SchemaProps{ + Description: "Value of a property to set", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"name", "value"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_TCPSocketAction(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TCPSocketAction describes an action based on opening a socket", + Properties: map[string]spec.Schema{ + "port": { + SchemaProps: spec.SchemaProps{ + Description: "Number or name of the port to access on the container. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME.", + Ref: ref("k8s.io/apimachinery/pkg/util/intstr.IntOrString"), + }, + }, + "host": { + SchemaProps: spec.SchemaProps{ + Description: "Optional: Host name to connect to, defaults to the pod IP.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"port"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/util/intstr.IntOrString"}, + } +} + +func schema_k8sio_api_core_v1_Taint(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "The node this Taint is attached to has the \"effect\" on any pod that does not tolerate the Taint.", + Properties: map[string]spec.Schema{ + "key": { + SchemaProps: spec.SchemaProps{ + Description: "Required. The taint key to be applied to a node.", + Type: []string{"string"}, + Format: "", + }, + }, + "value": { + SchemaProps: spec.SchemaProps{ + Description: "Required. The taint value corresponding to the taint key.", + Type: []string{"string"}, + Format: "", + }, + }, + "effect": { + SchemaProps: spec.SchemaProps{ + Description: "Required. The effect of the taint on pods that do not tolerate the taint. Valid effects are NoSchedule, PreferNoSchedule and NoExecute.", + Type: []string{"string"}, + Format: "", + }, + }, + "timeAdded": { + SchemaProps: spec.SchemaProps{ + Description: "TimeAdded represents the time at which the taint was added. It is only written for NoExecute taints.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, + }, + Required: []string{"key", "effect"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, + } +} + +func schema_k8sio_api_core_v1_Toleration(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "The pod this Toleration is attached to tolerates any taint that matches the triple using the matching operator .", + Properties: map[string]spec.Schema{ + "key": { + SchemaProps: spec.SchemaProps{ + Description: "Key is the taint key that the toleration applies to. Empty means match all taint keys. If the key is empty, operator must be Exists; this combination means to match all values and all keys.", + Type: []string{"string"}, + Format: "", + }, + }, + "operator": { + SchemaProps: spec.SchemaProps{ + Description: "Operator represents a key's relationship to the value. Valid operators are Exists and Equal. Defaults to Equal. Exists is equivalent to wildcard for value, so that a pod can tolerate all taints of a particular category.", + Type: []string{"string"}, + Format: "", + }, + }, + "value": { + SchemaProps: spec.SchemaProps{ + Description: "Value is the taint value the toleration matches to. If the operator is Exists, the value should be empty, otherwise just a regular string.", + Type: []string{"string"}, + Format: "", + }, + }, + "effect": { + SchemaProps: spec.SchemaProps{ + Description: "Effect indicates the taint effect to match. Empty means match all taint effects. When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute.", + Type: []string{"string"}, + Format: "", + }, + }, + "tolerationSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "TolerationSeconds represents the period of time the toleration (which must be of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default, it is not set, which means tolerate the taint forever (do not evict). Zero and negative values will be treated as 0 (evict immediately) by the system.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + }, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_TopologySelectorLabelRequirement(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "A topology selector requirement is a selector that matches given label. This is an alpha feature and may change in the future.", + Properties: map[string]spec.Schema{ + "key": { + SchemaProps: spec.SchemaProps{ + Description: "The label key that the selector applies to.", + Type: []string{"string"}, + Format: "", + }, + }, + "values": { + SchemaProps: spec.SchemaProps{ + Description: "An array of string values. One value must match the label to be selected. Each entry in Values is ORed.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + Required: []string{"key", "values"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_TopologySelectorTerm(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "A topology selector term represents the result of label queries. A null or empty topology selector term matches no objects. The requirements of them are ANDed. It provides a subset of functionality as NodeSelectorTerm. This is an alpha feature and may change in the future.", + Properties: map[string]spec.Schema{ + "matchLabelExpressions": { + SchemaProps: spec.SchemaProps{ + Description: "A list of topology selector requirements by labels.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.TopologySelectorLabelRequirement"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.TopologySelectorLabelRequirement"}, + } +} + +func schema_k8sio_api_core_v1_TypedLocalObjectReference(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TypedLocalObjectReference contains enough information to let you locate the typed referenced object inside the same namespace.", + Properties: map[string]spec.Schema{ + "apiGroup": { + SchemaProps: spec.SchemaProps{ + Description: "APIGroup is the group for the resource being referenced. If APIGroup is not specified, the specified Kind must be in the core API group. For any other third-party types, APIGroup is required.", + Type: []string{"string"}, + Format: "", + }, + }, + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is the type of resource being referenced", + Type: []string{"string"}, + Format: "", + }, + }, + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name is the name of resource being referenced", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"kind", "name"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_Volume(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Volume represents a named volume in a pod that may be accessed by any container in the pod.", + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Volume's name. Must be a DNS_LABEL and unique within the pod. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + Type: []string{"string"}, + Format: "", + }, + }, + "hostPath": { + SchemaProps: spec.SchemaProps{ + Description: "HostPath represents a pre-existing file or directory on the host machine that is directly exposed to the container. This is generally used for system agents or other privileged things that are allowed to see the host machine. Most containers will NOT need this. More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath", + Ref: ref("k8s.io/api/core/v1.HostPathVolumeSource"), + }, + }, + "emptyDir": { + SchemaProps: spec.SchemaProps{ + Description: "EmptyDir represents a temporary directory that shares a pod's lifetime. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir", + Ref: ref("k8s.io/api/core/v1.EmptyDirVolumeSource"), + }, + }, + "gcePersistentDisk": { + SchemaProps: spec.SchemaProps{ + Description: "GCEPersistentDisk represents a GCE Disk resource that is attached to a kubelet's host machine and then exposed to the pod. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk", + Ref: ref("k8s.io/api/core/v1.GCEPersistentDiskVolumeSource"), + }, + }, + "awsElasticBlockStore": { + SchemaProps: spec.SchemaProps{ + Description: "AWSElasticBlockStore represents an AWS Disk resource that is attached to a kubelet's host machine and then exposed to the pod. More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore", + Ref: ref("k8s.io/api/core/v1.AWSElasticBlockStoreVolumeSource"), + }, + }, + "gitRepo": { + SchemaProps: spec.SchemaProps{ + Description: "GitRepo represents a git repository at a particular revision. DEPRECATED: GitRepo is deprecated. To provision a container with a git repo, mount an EmptyDir into an InitContainer that clones the repo using git, then mount the EmptyDir into the Pod's container.", + Ref: ref("k8s.io/api/core/v1.GitRepoVolumeSource"), + }, + }, + "secret": { + SchemaProps: spec.SchemaProps{ + Description: "Secret represents a secret that should populate this volume. More info: https://kubernetes.io/docs/concepts/storage/volumes#secret", + Ref: ref("k8s.io/api/core/v1.SecretVolumeSource"), + }, + }, + "nfs": { + SchemaProps: spec.SchemaProps{ + Description: "NFS represents an NFS mount on the host that shares a pod's lifetime More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs", + Ref: ref("k8s.io/api/core/v1.NFSVolumeSource"), + }, + }, + "iscsi": { + SchemaProps: spec.SchemaProps{ + Description: "ISCSI represents an ISCSI Disk resource that is attached to a kubelet's host machine and then exposed to the pod. More info: https://releases.k8s.io/HEAD/examples/volumes/iscsi/README.md", + Ref: ref("k8s.io/api/core/v1.ISCSIVolumeSource"), + }, + }, + "glusterfs": { + SchemaProps: spec.SchemaProps{ + Description: "Glusterfs represents a Glusterfs mount on the host that shares a pod's lifetime. More info: https://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md", + Ref: ref("k8s.io/api/core/v1.GlusterfsVolumeSource"), + }, + }, + "persistentVolumeClaim": { + SchemaProps: spec.SchemaProps{ + Description: "PersistentVolumeClaimVolumeSource represents a reference to a PersistentVolumeClaim in the same namespace. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims", + Ref: ref("k8s.io/api/core/v1.PersistentVolumeClaimVolumeSource"), + }, + }, + "rbd": { + SchemaProps: spec.SchemaProps{ + Description: "RBD represents a Rados Block Device mount on the host that shares a pod's lifetime. More info: https://releases.k8s.io/HEAD/examples/volumes/rbd/README.md", + Ref: ref("k8s.io/api/core/v1.RBDVolumeSource"), + }, + }, + "flexVolume": { + SchemaProps: spec.SchemaProps{ + Description: "FlexVolume represents a generic volume resource that is provisioned/attached using an exec based plugin.", + Ref: ref("k8s.io/api/core/v1.FlexVolumeSource"), + }, + }, + "cinder": { + SchemaProps: spec.SchemaProps{ + Description: "Cinder represents a cinder volume attached and mounted on kubelets host machine More info: https://releases.k8s.io/HEAD/examples/mysql-cinder-pd/README.md", + Ref: ref("k8s.io/api/core/v1.CinderVolumeSource"), + }, + }, + "cephfs": { + SchemaProps: spec.SchemaProps{ + Description: "CephFS represents a Ceph FS mount on the host that shares a pod's lifetime", + Ref: ref("k8s.io/api/core/v1.CephFSVolumeSource"), + }, + }, + "flocker": { + SchemaProps: spec.SchemaProps{ + Description: "Flocker represents a Flocker volume attached to a kubelet's host machine. This depends on the Flocker control service being running", + Ref: ref("k8s.io/api/core/v1.FlockerVolumeSource"), + }, + }, + "downwardAPI": { + SchemaProps: spec.SchemaProps{ + Description: "DownwardAPI represents downward API about the pod that should populate this volume", + Ref: ref("k8s.io/api/core/v1.DownwardAPIVolumeSource"), + }, + }, + "fc": { + SchemaProps: spec.SchemaProps{ + Description: "FC represents a Fibre Channel resource that is attached to a kubelet's host machine and then exposed to the pod.", + Ref: ref("k8s.io/api/core/v1.FCVolumeSource"), + }, + }, + "azureFile": { + SchemaProps: spec.SchemaProps{ + Description: "AzureFile represents an Azure File Service mount on the host and bind mount to the pod.", + Ref: ref("k8s.io/api/core/v1.AzureFileVolumeSource"), + }, + }, + "configMap": { + SchemaProps: spec.SchemaProps{ + Description: "ConfigMap represents a configMap that should populate this volume", + Ref: ref("k8s.io/api/core/v1.ConfigMapVolumeSource"), + }, + }, + "vsphereVolume": { + SchemaProps: spec.SchemaProps{ + Description: "VsphereVolume represents a vSphere volume attached and mounted on kubelets host machine", + Ref: ref("k8s.io/api/core/v1.VsphereVirtualDiskVolumeSource"), + }, + }, + "quobyte": { + SchemaProps: spec.SchemaProps{ + Description: "Quobyte represents a Quobyte mount on the host that shares a pod's lifetime", + Ref: ref("k8s.io/api/core/v1.QuobyteVolumeSource"), + }, + }, + "azureDisk": { + SchemaProps: spec.SchemaProps{ + Description: "AzureDisk represents an Azure Data Disk mount on the host and bind mount to the pod.", + Ref: ref("k8s.io/api/core/v1.AzureDiskVolumeSource"), + }, + }, + "photonPersistentDisk": { + SchemaProps: spec.SchemaProps{ + Description: "PhotonPersistentDisk represents a PhotonController persistent disk attached and mounted on kubelets host machine", + Ref: ref("k8s.io/api/core/v1.PhotonPersistentDiskVolumeSource"), + }, + }, + "projected": { + SchemaProps: spec.SchemaProps{ + Description: "Items for all in one resources secrets, configmaps, and downward API", + Ref: ref("k8s.io/api/core/v1.ProjectedVolumeSource"), + }, + }, + "portworxVolume": { + SchemaProps: spec.SchemaProps{ + Description: "PortworxVolume represents a portworx volume attached and mounted on kubelets host machine", + Ref: ref("k8s.io/api/core/v1.PortworxVolumeSource"), + }, + }, + "scaleIO": { + SchemaProps: spec.SchemaProps{ + Description: "ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes.", + Ref: ref("k8s.io/api/core/v1.ScaleIOVolumeSource"), + }, + }, + "storageos": { + SchemaProps: spec.SchemaProps{ + Description: "StorageOS represents a StorageOS volume attached and mounted on Kubernetes nodes.", + Ref: ref("k8s.io/api/core/v1.StorageOSVolumeSource"), + }, + }, + }, + Required: []string{"name"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.AWSElasticBlockStoreVolumeSource", "k8s.io/api/core/v1.AzureDiskVolumeSource", "k8s.io/api/core/v1.AzureFileVolumeSource", "k8s.io/api/core/v1.CephFSVolumeSource", "k8s.io/api/core/v1.CinderVolumeSource", "k8s.io/api/core/v1.ConfigMapVolumeSource", "k8s.io/api/core/v1.DownwardAPIVolumeSource", "k8s.io/api/core/v1.EmptyDirVolumeSource", "k8s.io/api/core/v1.FCVolumeSource", "k8s.io/api/core/v1.FlexVolumeSource", "k8s.io/api/core/v1.FlockerVolumeSource", "k8s.io/api/core/v1.GCEPersistentDiskVolumeSource", "k8s.io/api/core/v1.GitRepoVolumeSource", "k8s.io/api/core/v1.GlusterfsVolumeSource", "k8s.io/api/core/v1.HostPathVolumeSource", "k8s.io/api/core/v1.ISCSIVolumeSource", "k8s.io/api/core/v1.NFSVolumeSource", "k8s.io/api/core/v1.PersistentVolumeClaimVolumeSource", "k8s.io/api/core/v1.PhotonPersistentDiskVolumeSource", "k8s.io/api/core/v1.PortworxVolumeSource", "k8s.io/api/core/v1.ProjectedVolumeSource", "k8s.io/api/core/v1.QuobyteVolumeSource", "k8s.io/api/core/v1.RBDVolumeSource", "k8s.io/api/core/v1.ScaleIOVolumeSource", "k8s.io/api/core/v1.SecretVolumeSource", "k8s.io/api/core/v1.StorageOSVolumeSource", "k8s.io/api/core/v1.VsphereVirtualDiskVolumeSource"}, + } +} + +func schema_k8sio_api_core_v1_VolumeDevice(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "volumeDevice describes a mapping of a raw block device within a container.", + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "name must match the name of a persistentVolumeClaim in the pod", + Type: []string{"string"}, + Format: "", + }, + }, + "devicePath": { + SchemaProps: spec.SchemaProps{ + Description: "devicePath is the path inside of the container that the device will be mapped to.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"name", "devicePath"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_VolumeMount(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "VolumeMount describes a mounting of a Volume within a container.", + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "This must match the Name of a Volume.", + Type: []string{"string"}, + Format: "", + }, + }, + "readOnly": { + SchemaProps: spec.SchemaProps{ + Description: "Mounted read-only if true, read-write otherwise (false or unspecified). Defaults to false.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "mountPath": { + SchemaProps: spec.SchemaProps{ + Description: "Path within the container at which the volume should be mounted. Must not contain ':'.", + Type: []string{"string"}, + Format: "", + }, + }, + "subPath": { + SchemaProps: spec.SchemaProps{ + Description: "Path within the volume from which the container's volume should be mounted. Defaults to \"\" (volume's root).", + Type: []string{"string"}, + Format: "", + }, + }, + "mountPropagation": { + SchemaProps: spec.SchemaProps{ + Description: "mountPropagation determines how mounts are propagated from the host to container and the other way around. When not set, MountPropagationNone is used. This field is beta in 1.10.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"name", "mountPath"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_VolumeNodeAffinity(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "VolumeNodeAffinity defines constraints that limit what nodes this volume can be accessed from.", + Properties: map[string]spec.Schema{ + "required": { + SchemaProps: spec.SchemaProps{ + Description: "Required specifies hard node constraints that must be met.", + Ref: ref("k8s.io/api/core/v1.NodeSelector"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.NodeSelector"}, + } +} + +func schema_k8sio_api_core_v1_VolumeProjection(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Projection that may be projected along with other supported volume types", + Properties: map[string]spec.Schema{ + "secret": { + SchemaProps: spec.SchemaProps{ + Description: "information about the secret data to project", + Ref: ref("k8s.io/api/core/v1.SecretProjection"), + }, + }, + "downwardAPI": { + SchemaProps: spec.SchemaProps{ + Description: "information about the downwardAPI data to project", + Ref: ref("k8s.io/api/core/v1.DownwardAPIProjection"), + }, + }, + "configMap": { + SchemaProps: spec.SchemaProps{ + Description: "information about the configMap data to project", + Ref: ref("k8s.io/api/core/v1.ConfigMapProjection"), + }, + }, + "serviceAccountToken": { + SchemaProps: spec.SchemaProps{ + Description: "information about the serviceAccountToken data to project", + Ref: ref("k8s.io/api/core/v1.ServiceAccountTokenProjection"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.ConfigMapProjection", "k8s.io/api/core/v1.DownwardAPIProjection", "k8s.io/api/core/v1.SecretProjection", "k8s.io/api/core/v1.ServiceAccountTokenProjection"}, + } +} + +func schema_k8sio_api_core_v1_VolumeSource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Represents the source of a volume to mount. Only one of its members may be specified.", + Properties: map[string]spec.Schema{ + "hostPath": { + SchemaProps: spec.SchemaProps{ + Description: "HostPath represents a pre-existing file or directory on the host machine that is directly exposed to the container. This is generally used for system agents or other privileged things that are allowed to see the host machine. Most containers will NOT need this. More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath", + Ref: ref("k8s.io/api/core/v1.HostPathVolumeSource"), + }, + }, + "emptyDir": { + SchemaProps: spec.SchemaProps{ + Description: "EmptyDir represents a temporary directory that shares a pod's lifetime. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir", + Ref: ref("k8s.io/api/core/v1.EmptyDirVolumeSource"), + }, + }, + "gcePersistentDisk": { + SchemaProps: spec.SchemaProps{ + Description: "GCEPersistentDisk represents a GCE Disk resource that is attached to a kubelet's host machine and then exposed to the pod. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk", + Ref: ref("k8s.io/api/core/v1.GCEPersistentDiskVolumeSource"), + }, + }, + "awsElasticBlockStore": { + SchemaProps: spec.SchemaProps{ + Description: "AWSElasticBlockStore represents an AWS Disk resource that is attached to a kubelet's host machine and then exposed to the pod. More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore", + Ref: ref("k8s.io/api/core/v1.AWSElasticBlockStoreVolumeSource"), + }, + }, + "gitRepo": { + SchemaProps: spec.SchemaProps{ + Description: "GitRepo represents a git repository at a particular revision. DEPRECATED: GitRepo is deprecated. To provision a container with a git repo, mount an EmptyDir into an InitContainer that clones the repo using git, then mount the EmptyDir into the Pod's container.", + Ref: ref("k8s.io/api/core/v1.GitRepoVolumeSource"), + }, + }, + "secret": { + SchemaProps: spec.SchemaProps{ + Description: "Secret represents a secret that should populate this volume. More info: https://kubernetes.io/docs/concepts/storage/volumes#secret", + Ref: ref("k8s.io/api/core/v1.SecretVolumeSource"), + }, + }, + "nfs": { + SchemaProps: spec.SchemaProps{ + Description: "NFS represents an NFS mount on the host that shares a pod's lifetime More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs", + Ref: ref("k8s.io/api/core/v1.NFSVolumeSource"), + }, + }, + "iscsi": { + SchemaProps: spec.SchemaProps{ + Description: "ISCSI represents an ISCSI Disk resource that is attached to a kubelet's host machine and then exposed to the pod. More info: https://releases.k8s.io/HEAD/examples/volumes/iscsi/README.md", + Ref: ref("k8s.io/api/core/v1.ISCSIVolumeSource"), + }, + }, + "glusterfs": { + SchemaProps: spec.SchemaProps{ + Description: "Glusterfs represents a Glusterfs mount on the host that shares a pod's lifetime. More info: https://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md", + Ref: ref("k8s.io/api/core/v1.GlusterfsVolumeSource"), + }, + }, + "persistentVolumeClaim": { + SchemaProps: spec.SchemaProps{ + Description: "PersistentVolumeClaimVolumeSource represents a reference to a PersistentVolumeClaim in the same namespace. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims", + Ref: ref("k8s.io/api/core/v1.PersistentVolumeClaimVolumeSource"), + }, + }, + "rbd": { + SchemaProps: spec.SchemaProps{ + Description: "RBD represents a Rados Block Device mount on the host that shares a pod's lifetime. More info: https://releases.k8s.io/HEAD/examples/volumes/rbd/README.md", + Ref: ref("k8s.io/api/core/v1.RBDVolumeSource"), + }, + }, + "flexVolume": { + SchemaProps: spec.SchemaProps{ + Description: "FlexVolume represents a generic volume resource that is provisioned/attached using an exec based plugin.", + Ref: ref("k8s.io/api/core/v1.FlexVolumeSource"), + }, + }, + "cinder": { + SchemaProps: spec.SchemaProps{ + Description: "Cinder represents a cinder volume attached and mounted on kubelets host machine More info: https://releases.k8s.io/HEAD/examples/mysql-cinder-pd/README.md", + Ref: ref("k8s.io/api/core/v1.CinderVolumeSource"), + }, + }, + "cephfs": { + SchemaProps: spec.SchemaProps{ + Description: "CephFS represents a Ceph FS mount on the host that shares a pod's lifetime", + Ref: ref("k8s.io/api/core/v1.CephFSVolumeSource"), + }, + }, + "flocker": { + SchemaProps: spec.SchemaProps{ + Description: "Flocker represents a Flocker volume attached to a kubelet's host machine. This depends on the Flocker control service being running", + Ref: ref("k8s.io/api/core/v1.FlockerVolumeSource"), + }, + }, + "downwardAPI": { + SchemaProps: spec.SchemaProps{ + Description: "DownwardAPI represents downward API about the pod that should populate this volume", + Ref: ref("k8s.io/api/core/v1.DownwardAPIVolumeSource"), + }, + }, + "fc": { + SchemaProps: spec.SchemaProps{ + Description: "FC represents a Fibre Channel resource that is attached to a kubelet's host machine and then exposed to the pod.", + Ref: ref("k8s.io/api/core/v1.FCVolumeSource"), + }, + }, + "azureFile": { + SchemaProps: spec.SchemaProps{ + Description: "AzureFile represents an Azure File Service mount on the host and bind mount to the pod.", + Ref: ref("k8s.io/api/core/v1.AzureFileVolumeSource"), + }, + }, + "configMap": { + SchemaProps: spec.SchemaProps{ + Description: "ConfigMap represents a configMap that should populate this volume", + Ref: ref("k8s.io/api/core/v1.ConfigMapVolumeSource"), + }, + }, + "vsphereVolume": { + SchemaProps: spec.SchemaProps{ + Description: "VsphereVolume represents a vSphere volume attached and mounted on kubelets host machine", + Ref: ref("k8s.io/api/core/v1.VsphereVirtualDiskVolumeSource"), + }, + }, + "quobyte": { + SchemaProps: spec.SchemaProps{ + Description: "Quobyte represents a Quobyte mount on the host that shares a pod's lifetime", + Ref: ref("k8s.io/api/core/v1.QuobyteVolumeSource"), + }, + }, + "azureDisk": { + SchemaProps: spec.SchemaProps{ + Description: "AzureDisk represents an Azure Data Disk mount on the host and bind mount to the pod.", + Ref: ref("k8s.io/api/core/v1.AzureDiskVolumeSource"), + }, + }, + "photonPersistentDisk": { + SchemaProps: spec.SchemaProps{ + Description: "PhotonPersistentDisk represents a PhotonController persistent disk attached and mounted on kubelets host machine", + Ref: ref("k8s.io/api/core/v1.PhotonPersistentDiskVolumeSource"), + }, + }, + "projected": { + SchemaProps: spec.SchemaProps{ + Description: "Items for all in one resources secrets, configmaps, and downward API", + Ref: ref("k8s.io/api/core/v1.ProjectedVolumeSource"), + }, + }, + "portworxVolume": { + SchemaProps: spec.SchemaProps{ + Description: "PortworxVolume represents a portworx volume attached and mounted on kubelets host machine", + Ref: ref("k8s.io/api/core/v1.PortworxVolumeSource"), + }, + }, + "scaleIO": { + SchemaProps: spec.SchemaProps{ + Description: "ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes.", + Ref: ref("k8s.io/api/core/v1.ScaleIOVolumeSource"), + }, + }, + "storageos": { + SchemaProps: spec.SchemaProps{ + Description: "StorageOS represents a StorageOS volume attached and mounted on Kubernetes nodes.", + Ref: ref("k8s.io/api/core/v1.StorageOSVolumeSource"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.AWSElasticBlockStoreVolumeSource", "k8s.io/api/core/v1.AzureDiskVolumeSource", "k8s.io/api/core/v1.AzureFileVolumeSource", "k8s.io/api/core/v1.CephFSVolumeSource", "k8s.io/api/core/v1.CinderVolumeSource", "k8s.io/api/core/v1.ConfigMapVolumeSource", "k8s.io/api/core/v1.DownwardAPIVolumeSource", "k8s.io/api/core/v1.EmptyDirVolumeSource", "k8s.io/api/core/v1.FCVolumeSource", "k8s.io/api/core/v1.FlexVolumeSource", "k8s.io/api/core/v1.FlockerVolumeSource", "k8s.io/api/core/v1.GCEPersistentDiskVolumeSource", "k8s.io/api/core/v1.GitRepoVolumeSource", "k8s.io/api/core/v1.GlusterfsVolumeSource", "k8s.io/api/core/v1.HostPathVolumeSource", "k8s.io/api/core/v1.ISCSIVolumeSource", "k8s.io/api/core/v1.NFSVolumeSource", "k8s.io/api/core/v1.PersistentVolumeClaimVolumeSource", "k8s.io/api/core/v1.PhotonPersistentDiskVolumeSource", "k8s.io/api/core/v1.PortworxVolumeSource", "k8s.io/api/core/v1.ProjectedVolumeSource", "k8s.io/api/core/v1.QuobyteVolumeSource", "k8s.io/api/core/v1.RBDVolumeSource", "k8s.io/api/core/v1.ScaleIOVolumeSource", "k8s.io/api/core/v1.SecretVolumeSource", "k8s.io/api/core/v1.StorageOSVolumeSource", "k8s.io/api/core/v1.VsphereVirtualDiskVolumeSource"}, + } +} + +func schema_k8sio_api_core_v1_VsphereVirtualDiskVolumeSource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Represents a vSphere volume resource.", + Properties: map[string]spec.Schema{ + "volumePath": { + SchemaProps: spec.SchemaProps{ + Description: "Path that identifies vSphere volume vmdk", + Type: []string{"string"}, + Format: "", + }, + }, + "fsType": { + SchemaProps: spec.SchemaProps{ + Description: "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified.", + Type: []string{"string"}, + Format: "", + }, + }, + "storagePolicyName": { + SchemaProps: spec.SchemaProps{ + Description: "Storage Policy Based Management (SPBM) profile name.", + Type: []string{"string"}, + Format: "", + }, + }, + "storagePolicyID": { + SchemaProps: spec.SchemaProps{ + Description: "Storage Policy Based Management (SPBM) profile ID associated with the StoragePolicyName.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"volumePath"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_k8sio_api_core_v1_WeightedPodAffinityTerm(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "The weights of all of the matched WeightedPodAffinityTerm fields are added per-node to find the most preferred node(s)", + Properties: map[string]spec.Schema{ + "weight": { + SchemaProps: spec.SchemaProps{ + Description: "weight associated with matching the corresponding podAffinityTerm, in the range 1-100.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "podAffinityTerm": { + SchemaProps: spec.SchemaProps{ + Description: "Required. A pod affinity term, associated with the corresponding weight.", + Ref: ref("k8s.io/api/core/v1.PodAffinityTerm"), + }, + }, + }, + Required: []string{"weight", "podAffinityTerm"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.PodAffinityTerm"}, + } +} + +func schema_pkg_apis_meta_v1_APIGroup(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "APIGroup contains the name, the supported versions, and the preferred version of a group.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "name": { + SchemaProps: spec.SchemaProps{ + Description: "name is the name of the group.", + Type: []string{"string"}, + Format: "", + }, + }, + "versions": { + SchemaProps: spec.SchemaProps{ + Description: "versions are the versions supported in this group.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionForDiscovery"), + }, + }, + }, + }, + }, + "preferredVersion": { + SchemaProps: spec.SchemaProps{ + Description: "preferredVersion is the version preferred by the API server, which probably is the storage version.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionForDiscovery"), + }, + }, + "serverAddressByClientCIDRs": { + SchemaProps: spec.SchemaProps{ + Description: "a map of client CIDR to server address that is serving this group. This is to help clients reach servers in the most network-efficient way possible. Clients can use the appropriate server address as per the CIDR that they match. In case of multiple matches, clients should use the longest matching CIDR. The server returns only those CIDRs that it thinks that the client can match. For example: the master will return an internal IP CIDR only, if the client reaches the server using an internal IP. Server looks at X-Forwarded-For header or X-Real-Ip header or request.RemoteAddr (in that order) to get the client IP.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ServerAddressByClientCIDR"), + }, + }, + }, + }, + }, + }, + Required: []string{"name", "versions"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionForDiscovery", "k8s.io/apimachinery/pkg/apis/meta/v1.ServerAddressByClientCIDR"}, + } +} + +func schema_pkg_apis_meta_v1_APIGroupList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "APIGroupList is a list of APIGroup, to allow clients to discover the API at /apis.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "groups": { + SchemaProps: spec.SchemaProps{ + Description: "groups is a list of APIGroup.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.APIGroup"), + }, + }, + }, + }, + }, + }, + Required: []string{"groups"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.APIGroup"}, + } +} + +func schema_pkg_apis_meta_v1_APIResource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "APIResource specifies the name of a resource and whether it is namespaced.", + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "name is the plural name of the resource.", + Type: []string{"string"}, + Format: "", + }, + }, + "singularName": { + SchemaProps: spec.SchemaProps{ + Description: "singularName is the singular name of the resource. This allows clients to handle plural and singular opaquely. The singularName is more correct for reporting status on a single item and both singular and plural are allowed from the kubectl CLI interface.", + Type: []string{"string"}, + Format: "", + }, + }, + "namespaced": { + SchemaProps: spec.SchemaProps{ + Description: "namespaced indicates if a resource is namespaced or not.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "group": { + SchemaProps: spec.SchemaProps{ + Description: "group is the preferred group of the resource. Empty implies the group of the containing resource list. For subresources, this may have a different value, for example: Scale\".", + Type: []string{"string"}, + Format: "", + }, + }, + "version": { + SchemaProps: spec.SchemaProps{ + Description: "version is the preferred version of the resource. Empty implies the version of the containing resource list For subresources, this may have a different value, for example: v1 (while inside a v1beta1 version of the core resource's group)\".", + Type: []string{"string"}, + Format: "", + }, + }, + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "kind is the kind for the resource (e.g. 'Foo' is the kind for a resource 'foo')", + Type: []string{"string"}, + Format: "", + }, + }, + "verbs": { + SchemaProps: spec.SchemaProps{ + Description: "verbs is a list of supported kube verbs (this includes get, list, watch, create, update, patch, delete, deletecollection, and proxy)", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "shortNames": { + SchemaProps: spec.SchemaProps{ + Description: "shortNames is a list of suggested short names of the resource.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "categories": { + SchemaProps: spec.SchemaProps{ + Description: "categories is a list of the grouped resources this resource belongs to (e.g. 'all')", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + Required: []string{"name", "singularName", "namespaced", "kind", "verbs"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_meta_v1_APIResourceList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "APIResourceList is a list of APIResource, it is used to expose the name of the resources supported in a specific group and version, and if the resource is namespaced.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "groupVersion": { + SchemaProps: spec.SchemaProps{ + Description: "groupVersion is the group and version this APIResourceList is for.", + Type: []string{"string"}, + Format: "", + }, + }, + "resources": { + SchemaProps: spec.SchemaProps{ + Description: "resources contains the name of the resources and if they are namespaced.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.APIResource"), + }, + }, + }, + }, + }, + }, + Required: []string{"groupVersion", "resources"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.APIResource"}, + } +} + +func schema_pkg_apis_meta_v1_APIVersions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "APIVersions lists the versions that are available, to allow clients to discover the API at /api, which is the root path of the legacy v1 API.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "versions": { + SchemaProps: spec.SchemaProps{ + Description: "versions are the api versions that are available.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "serverAddressByClientCIDRs": { + SchemaProps: spec.SchemaProps{ + Description: "a map of client CIDR to server address that is serving this group. This is to help clients reach servers in the most network-efficient way possible. Clients can use the appropriate server address as per the CIDR that they match. In case of multiple matches, clients should use the longest matching CIDR. The server returns only those CIDRs that it thinks that the client can match. For example: the master will return an internal IP CIDR only, if the client reaches the server using an internal IP. Server looks at X-Forwarded-For header or X-Real-Ip header or request.RemoteAddr (in that order) to get the client IP.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ServerAddressByClientCIDR"), + }, + }, + }, + }, + }, + }, + Required: []string{"versions", "serverAddressByClientCIDRs"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ServerAddressByClientCIDR"}, + } +} + +func schema_pkg_apis_meta_v1_CreateOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "CreateOptions may be provided when creating an API object.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "dryRun": { + SchemaProps: spec.SchemaProps{ + Description: "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "includeUninitialized": { + SchemaProps: spec.SchemaProps{ + Description: "If IncludeUninitialized is specified, the object may be returned without completing initialization.", + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_meta_v1_DeleteOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "DeleteOptions may be provided when deleting an API object.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "gracePeriodSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "preconditions": { + SchemaProps: spec.SchemaProps{ + Description: "Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Preconditions"), + }, + }, + "orphanDependents": { + SchemaProps: spec.SchemaProps{ + Description: "Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the \"orphan\" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "propagationPolicy": { + SchemaProps: spec.SchemaProps{ + Description: "Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. Acceptable values are: 'Orphan' - orphan the dependents; 'Background' - allow the garbage collector to delete the dependents in the background; 'Foreground' - a cascading policy that deletes all dependents in the foreground.", + Type: []string{"string"}, + Format: "", + }, + }, + "dryRun": { + SchemaProps: spec.SchemaProps{ + Description: "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.Preconditions"}, + } +} + +func schema_pkg_apis_meta_v1_Duration(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Duration is a wrapper around time.Duration which supports correct marshaling to YAML and JSON. In particular, it marshals into strings, which can be used as map keys in json.", + Properties: map[string]spec.Schema{ + "Duration": { + SchemaProps: spec.SchemaProps{ + Type: []string{"integer"}, + Format: "int64", + }, + }, + }, + Required: []string{"Duration"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_meta_v1_ExportOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ExportOptions is the query options to the standard REST get call.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "export": { + SchemaProps: spec.SchemaProps{ + Description: "Should this value be exported. Export strips fields that a user can not specify.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "exact": { + SchemaProps: spec.SchemaProps{ + Description: "Should the export be exact. Exact export maintains cluster-specific fields like 'Namespace'.", + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + Required: []string{"export", "exact"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_meta_v1_GetOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GetOptions is the standard query options to the standard REST get call.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "resourceVersion": { + SchemaProps: spec.SchemaProps{ + Description: "When specified: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.", + Type: []string{"string"}, + Format: "", + }, + }, + "includeUninitialized": { + SchemaProps: spec.SchemaProps{ + Description: "If true, partially initialized resources are included in the response.", + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_meta_v1_GroupKind(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GroupKind specifies a Group and a Kind, but does not force a version. This is useful for identifying concepts during lookup stages without having partially valid types", + Properties: map[string]spec.Schema{ + "group": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "kind": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"group", "kind"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_meta_v1_GroupResource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GroupResource specifies a Group and a Resource, but does not force a version. This is useful for identifying concepts during lookup stages without having partially valid types", + Properties: map[string]spec.Schema{ + "group": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "resource": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"group", "resource"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_meta_v1_GroupVersion(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GroupVersion contains the \"group\" and the \"version\", which uniquely identifies the API.", + Properties: map[string]spec.Schema{ + "group": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "version": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"group", "version"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_meta_v1_GroupVersionForDiscovery(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GroupVersion contains the \"group/version\" and \"version\" string of a version. It is made a struct to keep extensibility.", + Properties: map[string]spec.Schema{ + "groupVersion": { + SchemaProps: spec.SchemaProps{ + Description: "groupVersion specifies the API group and version in the form \"group/version\"", + Type: []string{"string"}, + Format: "", + }, + }, + "version": { + SchemaProps: spec.SchemaProps{ + Description: "version specifies the version in the form of \"version\". This is to save the clients the trouble of splitting the GroupVersion.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"groupVersion", "version"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_meta_v1_GroupVersionKind(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GroupVersionKind unambiguously identifies a kind. It doesn't anonymously include GroupVersion to avoid automatic coersion. It doesn't use a GroupVersion to avoid custom marshalling", + Properties: map[string]spec.Schema{ + "group": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "version": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "kind": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"group", "version", "kind"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_meta_v1_GroupVersionResource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GroupVersionResource unambiguously identifies a resource. It doesn't anonymously include GroupVersion to avoid automatic coersion. It doesn't use a GroupVersion to avoid custom marshalling", + Properties: map[string]spec.Schema{ + "group": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "version": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "resource": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"group", "version", "resource"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_meta_v1_Initializer(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Initializer is information about an initializer that has not yet completed.", + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "name of the process that is responsible for initializing this object.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"name"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_meta_v1_Initializers(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Initializers tracks the progress of initialization.", + Properties: map[string]spec.Schema{ + "pending": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-patch-merge-key": "name", + "x-kubernetes-patch-strategy": "merge", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "Pending is a list of initializers that must execute in order before this object is visible. When the last pending initializer is removed, and no failing result is set, the initializers struct will be set to nil and the object is considered as initialized and visible to all clients.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Initializer"), + }, + }, + }, + }, + }, + "result": { + SchemaProps: spec.SchemaProps{ + Description: "If result is set with the Failure field, the object will be persisted to storage and then deleted, ensuring that other clients can observe the deletion.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Status"), + }, + }, + }, + Required: []string{"pending"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.Initializer", "k8s.io/apimachinery/pkg/apis/meta/v1.Status"}, + } +} + +func schema_pkg_apis_meta_v1_InternalEvent(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "InternalEvent makes watch.Event versioned", + Properties: map[string]spec.Schema{ + "Type": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "Object": { + SchemaProps: spec.SchemaProps{ + Description: "Object is:\n * If Type is Added or Modified: the new state of the object.\n * If Type is Deleted: the state of the object immediately before deletion.\n * If Type is Error: *api.Status is recommended; other types may make sense\n depending on context.", + Ref: ref("k8s.io/apimachinery/pkg/runtime.Object"), + }, + }, + }, + Required: []string{"Type", "Object"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/runtime.Object"}, + } +} + +func schema_pkg_apis_meta_v1_LabelSelector(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.", + Properties: map[string]spec.Schema{ + "matchLabels": { + SchemaProps: spec.SchemaProps{ + Description: "matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "matchExpressions": { + SchemaProps: spec.SchemaProps{ + Description: "matchExpressions is a list of label selector requirements. The requirements are ANDed.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelectorRequirement"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelectorRequirement"}, + } +} + +func schema_pkg_apis_meta_v1_LabelSelectorRequirement(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.", + Properties: map[string]spec.Schema{ + "key": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-patch-merge-key": "key", + "x-kubernetes-patch-strategy": "merge", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "key is the label key that the selector applies to.", + Type: []string{"string"}, + Format: "", + }, + }, + "operator": { + SchemaProps: spec.SchemaProps{ + Description: "operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.", + Type: []string{"string"}, + Format: "", + }, + }, + "values": { + SchemaProps: spec.SchemaProps{ + Description: "values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + Required: []string{"key", "operator"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_meta_v1_List(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "List holds a list of objects, which may not be known by the server.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Description: "List of objects", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/runtime.RawExtension"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta", "k8s.io/apimachinery/pkg/runtime.RawExtension"}, + } +} + +func schema_pkg_apis_meta_v1_ListMeta(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ListMeta describes metadata that synthetic resources must have, including lists and various status objects. A resource may have only one of {ObjectMeta, ListMeta}.", + Properties: map[string]spec.Schema{ + "selfLink": { + SchemaProps: spec.SchemaProps{ + Description: "selfLink is a URL representing this object. Populated by the system. Read-only.", + Type: []string{"string"}, + Format: "", + }, + }, + "resourceVersion": { + SchemaProps: spec.SchemaProps{ + Description: "String that identifies the server's internal version of this object that can be used by clients to determine when objects have changed. Value must be treated as opaque by clients and passed unmodified back to the server. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#concurrency-control-and-consistency", + Type: []string{"string"}, + Format: "", + }, + }, + "continue": { + SchemaProps: spec.SchemaProps{ + Description: "continue may be set if the user set a limit on the number of items returned, and indicates that the server has more data available. The value is opaque and may be used to issue another request to the endpoint that served this list to retrieve the next set of available objects. Continuing a consistent list may not be possible if the server configuration has changed or more than a few minutes have passed. The resourceVersion field returned when using this continue value will be identical to the value in the first response, unless you have received this token from an error message.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_meta_v1_ListOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ListOptions is the query options to a standard REST list call.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "labelSelector": { + SchemaProps: spec.SchemaProps{ + Description: "A selector to restrict the list of returned objects by their labels. Defaults to everything.", + Type: []string{"string"}, + Format: "", + }, + }, + "fieldSelector": { + SchemaProps: spec.SchemaProps{ + Description: "A selector to restrict the list of returned objects by their fields. Defaults to everything.", + Type: []string{"string"}, + Format: "", + }, + }, + "includeUninitialized": { + SchemaProps: spec.SchemaProps{ + Description: "If true, partially initialized resources are included in the response.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "watch": { + SchemaProps: spec.SchemaProps{ + Description: "Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "resourceVersion": { + SchemaProps: spec.SchemaProps{ + Description: "When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.", + Type: []string{"string"}, + Format: "", + }, + }, + "timeoutSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "limit": { + SchemaProps: spec.SchemaProps{ + Description: "limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true.\n\nThe server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "continue": { + SchemaProps: spec.SchemaProps{ + Description: "The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the \"next key\".\n\nThis field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_meta_v1_MicroTime(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "MicroTime is version of Time with microsecond level precision.", + Type: v1.MicroTime{}.OpenAPISchemaType(), + Format: v1.MicroTime{}.OpenAPISchemaFormat(), + }, + }, + } +} + +func schema_pkg_apis_meta_v1_ObjectMeta(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ObjectMeta is metadata that all persisted resources must have, which includes all objects users must create.", + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/identifiers#names", + Type: []string{"string"}, + Format: "", + }, + }, + "generateName": { + SchemaProps: spec.SchemaProps{ + Description: "GenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided. If this field is used, the name returned to the client will be different than the name passed. This value will also be combined with a unique suffix. The provided value has the same validation rules as the Name field, and may be truncated by the length of the suffix required to make the value unique on the server.\n\nIf this field is specified and the generated name exists, the server will NOT return a 409 - instead, it will either return 201 Created or 500 with Reason ServerTimeout indicating a unique name could not be found in the time allotted, and the client should retry (optionally after the time indicated in the Retry-After header).\n\nApplied only if Name is not specified. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#idempotency", + Type: []string{"string"}, + Format: "", + }, + }, + "namespace": { + SchemaProps: spec.SchemaProps{ + Description: "Namespace defines the space within each name must be unique. An empty namespace is equivalent to the \"default\" namespace, but \"default\" is the canonical representation. Not all objects are required to be scoped to a namespace - the value of this field for those objects will be empty.\n\nMust be a DNS_LABEL. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/namespaces", + Type: []string{"string"}, + Format: "", + }, + }, + "selfLink": { + SchemaProps: spec.SchemaProps{ + Description: "SelfLink is a URL representing this object. Populated by the system. Read-only.", + Type: []string{"string"}, + Format: "", + }, + }, + "uid": { + SchemaProps: spec.SchemaProps{ + Description: "UID is the unique in time and space value for this object. It is typically generated by the server on successful creation of a resource and is not allowed to change on PUT operations.\n\nPopulated by the system. Read-only. More info: http://kubernetes.io/docs/user-guide/identifiers#uids", + Type: []string{"string"}, + Format: "", + }, + }, + "resourceVersion": { + SchemaProps: spec.SchemaProps{ + Description: "An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed. May be used for optimistic concurrency, change detection, and the watch operation on a resource or set of resources. Clients must treat these values as opaque and passed unmodified back to the server. They may only be valid for a particular resource or set of resources.\n\nPopulated by the system. Read-only. Value must be treated as opaque by clients and . More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#concurrency-control-and-consistency", + Type: []string{"string"}, + Format: "", + }, + }, + "generation": { + SchemaProps: spec.SchemaProps{ + Description: "A sequence number representing a specific generation of the desired state. Populated by the system. Read-only.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "creationTimestamp": { + SchemaProps: spec.SchemaProps{ + Description: "CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC.\n\nPopulated by the system. Read-only. Null for lists. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, + "deletionTimestamp": { + SchemaProps: spec.SchemaProps{ + Description: "DeletionTimestamp is RFC 3339 date and time at which this resource will be deleted. This field is set by the server when a graceful deletion is requested by the user, and is not directly settable by a client. The resource is expected to be deleted (no longer visible from resource lists, and not reachable by name) after the time in this field, once the finalizers list is empty. As long as the finalizers list contains items, deletion is blocked. Once the deletionTimestamp is set, this value may not be unset or be set further into the future, although it may be shortened or the resource may be deleted prior to this time. For example, a user may request that a pod is deleted in 30 seconds. The Kubelet will react by sending a graceful termination signal to the containers in the pod. After that 30 seconds, the Kubelet will send a hard termination signal (SIGKILL) to the container and after cleanup, remove the pod from the API. In the presence of network partitions, this object may still exist after this timestamp, until an administrator or automated process can determine the resource is fully terminated. If not set, graceful deletion of the object has not been requested.\n\nPopulated by the system when a graceful deletion is requested. Read-only. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, + "deletionGracePeriodSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "Number of seconds allowed for this object to gracefully terminate before it will be removed from the system. Only set when deletionTimestamp is also set. May only be shortened. Read-only.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "labels": { + SchemaProps: spec.SchemaProps{ + Description: "Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: http://kubernetes.io/docs/user-guide/labels", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "annotations": { + SchemaProps: spec.SchemaProps{ + Description: "Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: http://kubernetes.io/docs/user-guide/annotations", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "ownerReferences": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-patch-merge-key": "uid", + "x-kubernetes-patch-strategy": "merge", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "List of objects depended by this object. If ALL objects in the list have been deleted, this object will be garbage collected. If this object is managed by a controller, then an entry in this list will point to this controller, with the controller field set to true. There cannot be more than one managing controller.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.OwnerReference"), + }, + }, + }, + }, + }, + "initializers": { + SchemaProps: spec.SchemaProps{ + Description: "An initializer is a controller which enforces some system invariant at object creation time. This field is a list of initializers that have not yet acted on this object. If nil or empty, this object has been completely initialized. Otherwise, the object is considered uninitialized and is hidden (in list/watch and get calls) from clients that haven't explicitly asked to observe uninitialized objects.\n\nWhen an object is created, the system will populate this list with the current set of initializers. Only privileged users may set or modify this list. Once it is empty, it may not be modified further by any user.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Initializers"), + }, + }, + "finalizers": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-patch-strategy": "merge", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "clusterName": { + SchemaProps: spec.SchemaProps{ + Description: "The name of the cluster which the object belongs to. This is used to distinguish resources with same name and namespace in different clusters. This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.Initializers", "k8s.io/apimachinery/pkg/apis/meta/v1.OwnerReference", "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, + } +} + +func schema_pkg_apis_meta_v1_OwnerReference(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "OwnerReference contains enough information to let you identify an owning object. Currently, an owning object must be in the same namespace, so there is no namespace field.", + Properties: map[string]spec.Schema{ + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "API version of the referent.", + Type: []string{"string"}, + Format: "", + }, + }, + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#names", + Type: []string{"string"}, + Format: "", + }, + }, + "uid": { + SchemaProps: spec.SchemaProps{ + Description: "UID of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#uids", + Type: []string{"string"}, + Format: "", + }, + }, + "controller": { + SchemaProps: spec.SchemaProps{ + Description: "If true, this reference points to the managing controller.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "blockOwnerDeletion": { + SchemaProps: spec.SchemaProps{ + Description: "If true, AND if the owner has the \"foregroundDeletion\" finalizer, then the owner cannot be deleted from the key-value store until this reference is removed. Defaults to false. To set this field, a user needs \"delete\" permission of the owner, otherwise 422 (Unprocessable Entity) will be returned.", + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + Required: []string{"apiVersion", "kind", "name", "uid"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_meta_v1_Patch(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Patch is provided to give a concrete name and type to the Kubernetes PATCH request body.", + Properties: map[string]spec.Schema{}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_meta_v1_Preconditions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Preconditions must be fulfilled before an operation (update, delete, etc.) is carried out.", + Properties: map[string]spec.Schema{ + "uid": { + SchemaProps: spec.SchemaProps{ + Description: "Specifies the target UID.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_meta_v1_RootPaths(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "RootPaths lists the paths available at root. For example: \"/healthz\", \"/apis\".", + Properties: map[string]spec.Schema{ + "paths": { + SchemaProps: spec.SchemaProps{ + Description: "paths are the paths available at root.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + Required: []string{"paths"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_meta_v1_ServerAddressByClientCIDR(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ServerAddressByClientCIDR helps the client to determine the server address that they should use, depending on the clientCIDR that they match.", + Properties: map[string]spec.Schema{ + "clientCIDR": { + SchemaProps: spec.SchemaProps{ + Description: "The CIDR with which clients can match their IP to figure out the server address that they should use.", + Type: []string{"string"}, + Format: "", + }, + }, + "serverAddress": { + SchemaProps: spec.SchemaProps{ + Description: "Address of this server, suitable for a client that matches the above CIDR. This can be a hostname, hostname:port, IP or IP:port.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"clientCIDR", "serverAddress"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_meta_v1_Status(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Status is a return value for calls that don't return other objects.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Description: "Status of the operation. One of: \"Success\" or \"Failure\". More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status", + Type: []string{"string"}, + Format: "", + }, + }, + "message": { + SchemaProps: spec.SchemaProps{ + Description: "A human-readable description of the status of this operation.", + Type: []string{"string"}, + Format: "", + }, + }, + "reason": { + SchemaProps: spec.SchemaProps{ + Description: "A machine-readable description of why this operation is in the \"Failure\" status. If this value is empty there is no information available. A Reason clarifies an HTTP status code but does not override it.", + Type: []string{"string"}, + Format: "", + }, + }, + "details": { + SchemaProps: spec.SchemaProps{ + Description: "Extended data associated with the reason. Each reason may define its own extended details. This field is optional and the data returned is not guaranteed to conform to any schema except that defined by the reason type.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.StatusDetails"), + }, + }, + "code": { + SchemaProps: spec.SchemaProps{ + Description: "Suggested HTTP return code for this status, 0 if not set.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta", "k8s.io/apimachinery/pkg/apis/meta/v1.StatusDetails"}, + } +} + +func schema_pkg_apis_meta_v1_StatusCause(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "StatusCause provides more information about an api.Status failure, including cases when multiple errors are encountered.", + Properties: map[string]spec.Schema{ + "reason": { + SchemaProps: spec.SchemaProps{ + Description: "A machine-readable description of the cause of the error. If this value is empty there is no information available.", + Type: []string{"string"}, + Format: "", + }, + }, + "message": { + SchemaProps: spec.SchemaProps{ + Description: "A human-readable description of the cause of the error. This field may be presented as-is to a reader.", + Type: []string{"string"}, + Format: "", + }, + }, + "field": { + SchemaProps: spec.SchemaProps{ + Description: "The field of the resource that has caused this error, as named by its JSON serialization. May include dot and postfix notation for nested attributes. Arrays are zero-indexed. Fields may appear more than once in an array of causes due to fields having multiple errors. Optional.\n\nExamples:\n \"name\" - the field \"name\" on the current resource\n \"items[0].name\" - the field \"name\" on the first array entry in \"items\"", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_meta_v1_StatusDetails(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "StatusDetails is a set of additional properties that MAY be set by the server to provide additional information about a response. The Reason field of a Status object defines what attributes will be set. Clients must ignore fields that do not match the defined type of each attribute, and should assume that any attribute may be empty, invalid, or under defined.", + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "The name attribute of the resource associated with the status StatusReason (when there is a single name which can be described).", + Type: []string{"string"}, + Format: "", + }, + }, + "group": { + SchemaProps: spec.SchemaProps{ + Description: "The group attribute of the resource associated with the status StatusReason.", + Type: []string{"string"}, + Format: "", + }, + }, + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "The kind attribute of the resource associated with the status StatusReason. On some operations may differ from the requested resource Kind. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "uid": { + SchemaProps: spec.SchemaProps{ + Description: "UID of the resource. (when there is a single resource which can be described). More info: http://kubernetes.io/docs/user-guide/identifiers#uids", + Type: []string{"string"}, + Format: "", + }, + }, + "causes": { + SchemaProps: spec.SchemaProps{ + Description: "The Causes array includes more details associated with the StatusReason failure. Not all StatusReasons may provide detailed causes.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.StatusCause"), + }, + }, + }, + }, + }, + "retryAfterSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "If specified, the time in seconds before the operation should be retried. Some errors may indicate the client must take an alternate action - for those errors this field may indicate how long to wait before taking the alternate action.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.StatusCause"}, + } +} + +func schema_pkg_apis_meta_v1_Time(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.", + Type: v1.Time{}.OpenAPISchemaType(), + Format: v1.Time{}.OpenAPISchemaFormat(), + }, + }, + } +} + +func schema_pkg_apis_meta_v1_Timestamp(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Timestamp is a struct that is equivalent to Time, but intended for protobuf marshalling/unmarshalling. It is generated into a serialization that matches Time. Do not use in Go structs.", + Properties: map[string]spec.Schema{ + "seconds": { + SchemaProps: spec.SchemaProps{ + Description: "Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "nanos": { + SchemaProps: spec.SchemaProps{ + Description: "Non-negative fractions of a second at nanosecond resolution. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be from 0 to 999,999,999 inclusive. This field may be limited in precision depending on context.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + Required: []string{"seconds", "nanos"}, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_meta_v1_TypeMeta(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TypeMeta describes an individual object in an API response or request with strings representing the type of the object and its API schema version. Structures that are versioned or persisted should inline TypeMeta.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_meta_v1_UpdateOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "UpdateOptions may be provided when updating an API object.", + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "dryRun": { + SchemaProps: spec.SchemaProps{ + Description: "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{}, + } +} + +func schema_pkg_apis_meta_v1_WatchEvent(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Event represents a single event to a watched resource.", + Properties: map[string]spec.Schema{ + "type": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "object": { + SchemaProps: spec.SchemaProps{ + Description: "Object is:\n * If Type is Added or Modified: the new state of the object.\n * If Type is Deleted: the state of the object immediately before deletion.\n * If Type is Error: *Status is recommended; other types may make sense\n depending on context.", + Ref: ref("k8s.io/apimachinery/pkg/runtime.RawExtension"), + }, + }, + }, + Required: []string{"type", "object"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/runtime.RawExtension"}, + } +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1/register.go b/vendor/github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1/register.go new file mode 100644 index 0000000000..60b8adda7d --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1/register.go @@ -0,0 +1,61 @@ +// Copyright 2018 The prometheus-operator 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 v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + + "github.com/coreos/prometheus-operator/pkg/apis/monitoring" +) + +// SchemeGroupVersion is the group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: monitoring.GroupName, Version: Version} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + // localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes. + SchemeBuilder runtime.SchemeBuilder + localSchemeBuilder = &SchemeBuilder + AddToScheme = localSchemeBuilder.AddToScheme +) + +func init() { + // We only register manually written functions here. The registration of the + // generated functions takes place in the generated files. The separation + // makes the code compile even when the generated files are missing. + localSchemeBuilder.Register(addKnownTypes) +} + +// Adds the list of known types to api.Scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &Prometheus{}, + &PrometheusList{}, + &ServiceMonitor{}, + &ServiceMonitorList{}, + &Alertmanager{}, + &AlertmanagerList{}, + &PrometheusRule{}, + &PrometheusRuleList{}, + ) + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1/types.go b/vendor/github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1/types.go new file mode 100644 index 0000000000..6995caa43c --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1/types.go @@ -0,0 +1,826 @@ +// Copyright 2018 The prometheus-operator 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 v1 + +import ( + "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/util/intstr" +) + +const ( + Version = "v1" + + PrometheusesKind = "Prometheus" + PrometheusName = "prometheuses" + PrometheusKindKey = "prometheus" + + AlertmanagersKind = "Alertmanager" + AlertmanagerName = "alertmanagers" + AlertManagerKindKey = "alertmanager" + + ServiceMonitorsKind = "ServiceMonitor" + ServiceMonitorName = "servicemonitors" + ServiceMonitorKindKey = "servicemonitor" + + PrometheusRuleKind = "PrometheusRule" + PrometheusRuleName = "prometheusrules" + PrometheusRuleKindKey = "prometheusrule" +) + +// Prometheus defines a Prometheus deployment. +// +genclient +// +k8s:openapi-gen=true +type Prometheus struct { + metav1.TypeMeta `json:",inline"` + // Standard object’s metadata. More info: + // https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata + // +k8s:openapi-gen=false + metav1.ObjectMeta `json:"metadata,omitempty"` + // Specification of the desired behavior of the Prometheus cluster. More info: + // https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status + Spec PrometheusSpec `json:"spec"` + // Most recent observed status of the Prometheus cluster. Read-only. Not + // included when requesting from the apiserver, only from the Prometheus + // Operator API itself. More info: + // https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status + Status *PrometheusStatus `json:"status,omitempty"` +} + +// PrometheusList is a list of Prometheuses. +// +k8s:openapi-gen=true +type PrometheusList struct { + metav1.TypeMeta `json:",inline"` + // Standard list metadata + // More info: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata + metav1.ListMeta `json:"metadata,omitempty"` + // List of Prometheuses + Items []*Prometheus `json:"items"` +} + +// PrometheusSpec is a specification of the desired behavior of the Prometheus cluster. More info: +// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status +// +k8s:openapi-gen=true +type PrometheusSpec struct { + // Standard object’s metadata. More info: + // https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata + // Metadata Labels and Annotations gets propagated to the prometheus pods. + PodMetadata *metav1.ObjectMeta `json:"podMetadata,omitempty"` + // ServiceMonitors to be selected for target discovery. + ServiceMonitorSelector *metav1.LabelSelector `json:"serviceMonitorSelector,omitempty"` + // Namespaces to be selected for ServiceMonitor discovery. If nil, only + // check own namespace. + ServiceMonitorNamespaceSelector *metav1.LabelSelector `json:"serviceMonitorNamespaceSelector,omitempty"` + // Version of Prometheus to be deployed. + Version string `json:"version,omitempty"` + // Tag of Prometheus container image to be deployed. Defaults to the value of `version`. + // Version is ignored if Tag is set. + Tag string `json:"tag,omitempty"` + // SHA of Prometheus container image to be deployed. Defaults to the value of `version`. + // Similar to a tag, but the SHA explicitly deploys an immutable container image. + // Version and Tag are ignored if SHA is set. + SHA string `json:"sha,omitempty"` + // When a Prometheus deployment is paused, no actions except for deletion + // will be performed on the underlying objects. + Paused bool `json:"paused,omitempty"` + // Image if specified has precedence over baseImage, tag and sha + // combinations. Specifying the version is still necessary to ensure the + // Prometheus Operator knows what version of Prometheus is being + // configured. + Image *string `json:"image,omitempty"` + // Base image to use for a Prometheus deployment. + BaseImage string `json:"baseImage,omitempty"` + // An optional list of references to secrets in the same namespace + // to use for pulling prometheus and alertmanager images from registries + // see http://kubernetes.io/docs/user-guide/images#specifying-imagepullsecrets-on-a-pod + ImagePullSecrets []v1.LocalObjectReference `json:"imagePullSecrets,omitempty"` + // Number of instances to deploy for a Prometheus deployment. + Replicas *int32 `json:"replicas,omitempty"` + // Time duration Prometheus shall retain data for. Default is '24h', + // and must match the regular expression `[0-9]+(ms|s|m|h|d|w|y)` (milliseconds seconds minutes hours days weeks years). + Retention string `json:"retention,omitempty"` + // Log level for Prometheus to be configured with. + LogLevel string `json:"logLevel,omitempty"` + // Interval between consecutive scrapes. + ScrapeInterval string `json:"scrapeInterval,omitempty"` + // Interval between consecutive evaluations. + EvaluationInterval string `json:"evaluationInterval,omitempty"` + // The labels to add to any time series or alerts when communicating with + // external systems (federation, remote storage, Alertmanager). + ExternalLabels map[string]string `json:"externalLabels,omitempty"` + // The external URL the Prometheus instances will be available under. This is + // necessary to generate correct URLs. This is necessary if Prometheus is not + // served from root of a DNS name. + ExternalURL string `json:"externalUrl,omitempty"` + // The route prefix Prometheus registers HTTP handlers for. This is useful, + // if using ExternalURL and a proxy is rewriting HTTP routes of a request, + // and the actual ExternalURL is still true, but the server serves requests + // under a different route prefix. For example for use with `kubectl proxy`. + RoutePrefix string `json:"routePrefix,omitempty"` + // QuerySpec defines the query command line flags when starting Prometheus. + Query *QuerySpec `json:"query,omitempty"` + // Storage spec to specify how storage shall be used. + Storage *StorageSpec `json:"storage,omitempty"` + // A selector to select which PrometheusRules to mount for loading alerting + // rules from. Until (excluding) Prometheus Operator v0.24.0 Prometheus + // Operator will migrate any legacy rule ConfigMaps to PrometheusRule custom + // resources selected by RuleSelector. Make sure it does not match any config + // maps that you do not want to be migrated. + RuleSelector *metav1.LabelSelector `json:"ruleSelector,omitempty"` + // Namespaces to be selected for PrometheusRules discovery. If unspecified, only + // the same namespace as the Prometheus object is in is used. + RuleNamespaceSelector *metav1.LabelSelector `json:"ruleNamespaceSelector,omitempty"` + // Define details regarding alerting. + Alerting *AlertingSpec `json:"alerting,omitempty"` + // Define resources requests and limits for single Pods. + Resources v1.ResourceRequirements `json:"resources,omitempty"` + // Define which Nodes the Pods are scheduled on. + NodeSelector map[string]string `json:"nodeSelector,omitempty"` + // ServiceAccountName is the name of the ServiceAccount to use to run the + // Prometheus Pods. + ServiceAccountName string `json:"serviceAccountName,omitempty"` + // Secrets is a list of Secrets in the same namespace as the Prometheus + // object, which shall be mounted into the Prometheus Pods. + // The Secrets are mounted into /etc/prometheus/secrets/. + Secrets []string `json:"secrets,omitempty"` + // ConfigMaps is a list of ConfigMaps in the same namespace as the Prometheus + // object, which shall be mounted into the Prometheus Pods. + // The ConfigMaps are mounted into /etc/prometheus/configmaps/. + ConfigMaps []string `json:"configMaps,omitempty"` + // If specified, the pod's scheduling constraints. + Affinity *v1.Affinity `json:"affinity,omitempty"` + // If specified, the pod's tolerations. + Tolerations []v1.Toleration `json:"tolerations,omitempty"` + // If specified, the remote_write spec. This is an experimental feature, it may change in any upcoming release in a breaking way. + RemoteWrite []RemoteWriteSpec `json:"remoteWrite,omitempty"` + // If specified, the remote_read spec. This is an experimental feature, it may change in any upcoming release in a breaking way. + RemoteRead []RemoteReadSpec `json:"remoteRead,omitempty"` + // SecurityContext holds pod-level security attributes and common container settings. + // This defaults to non root user with uid 1000 and gid 2000 for Prometheus >v2.0 and + // default PodSecurityContext for other versions. + SecurityContext *v1.PodSecurityContext `json:"securityContext,omitempty"` + // ListenLocal makes the Prometheus server listen on loopback, so that it + // does not bind against the Pod IP. + ListenLocal bool `json:"listenLocal,omitempty"` + // Containers allows injecting additional containers. This is meant to + // allow adding an authentication proxy to a Prometheus pod. + Containers []v1.Container `json:"containers,omitempty"` + // AdditionalScrapeConfigs allows specifying a key of a Secret containing + // additional Prometheus scrape configurations. Scrape configurations + // specified are appended to the configurations generated by the Prometheus + // Operator. Job configurations specified must have the form as specified + // in the official Prometheus documentation: + // https://prometheus.io/docs/prometheus/latest/configuration/configuration/#. + // As scrape configs are appended, the user is responsible to make sure it + // is valid. Note that using this feature may expose the possibility to + // break upgrades of Prometheus. It is advised to review Prometheus release + // notes to ensure that no incompatible scrape configs are going to break + // Prometheus after the upgrade. + AdditionalScrapeConfigs *v1.SecretKeySelector `json:"additionalScrapeConfigs,omitempty"` + // AdditionalAlertRelabelConfigs allows specifying a key of a Secret containing + // additional Prometheus alert relabel configurations. Alert relabel configurations + // specified are appended to the configurations generated by the Prometheus + // Operator. Alert relabel configurations specified must have the form as specified + // in the official Prometheus documentation: + // https://prometheus.io/docs/prometheus/latest/configuration/configuration/#alert_relabel_configs. + // As alert relabel configs are appended, the user is responsible to make sure it + // is valid. Note that using this feature may expose the possibility to + // break upgrades of Prometheus. It is advised to review Prometheus release + // notes to ensure that no incompatible alert relabel configs are going to break + // Prometheus after the upgrade. + AdditionalAlertRelabelConfigs *v1.SecretKeySelector `json:"additionalAlertRelabelConfigs,omitempty"` + // AdditionalAlertManagerConfigs allows specifying a key of a Secret containing + // additional Prometheus AlertManager configurations. AlertManager configurations + // specified are appended to the configurations generated by the Prometheus + // Operator. Job configurations specified must have the form as specified + // in the official Prometheus documentation: + // https://prometheus.io/docs/prometheus/latest/configuration/configuration/#. + // As AlertManager configs are appended, the user is responsible to make sure it + // is valid. Note that using this feature may expose the possibility to + // break upgrades of Prometheus. It is advised to review Prometheus release + // notes to ensure that no incompatible AlertManager configs are going to break + // Prometheus after the upgrade. + AdditionalAlertManagerConfigs *v1.SecretKeySelector `json:"additionalAlertManagerConfigs,omitempty"` + // APIServerConfig allows specifying a host and auth methods to access apiserver. + // If left empty, Prometheus is assumed to run inside of the cluster + // and will discover API servers automatically and use the pod's CA certificate + // and bearer token file at /var/run/secrets/kubernetes.io/serviceaccount/. + APIServerConfig *APIServerConfig `json:"apiserverConfig,omitempty"` + // Thanos configuration allows configuring various aspects of a Prometheus + // server in a Thanos environment. + // + // This section is experimental, it may change significantly without + // deprecation notice in any release. + // + // This is experimental and may change significantly without backward + // compatibility in any release. + Thanos *ThanosSpec `json:"thanos,omitempty"` + // Priority class assigned to the Pods + PriorityClassName string `json:"priorityClassName,omitempty"` +} + +// PrometheusStatus is the most recent observed status of the Prometheus cluster. Read-only. Not +// included when requesting from the apiserver, only from the Prometheus +// Operator API itself. More info: +// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status +// +k8s:openapi-gen=true +type PrometheusStatus struct { + // Represents whether any actions on the underlaying managed objects are + // being performed. Only delete actions will be performed. + Paused bool `json:"paused"` + // Total number of non-terminated pods targeted by this Prometheus deployment + // (their labels match the selector). + Replicas int32 `json:"replicas"` + // Total number of non-terminated pods targeted by this Prometheus deployment + // that have the desired version spec. + UpdatedReplicas int32 `json:"updatedReplicas"` + // Total number of available pods (ready for at least minReadySeconds) + // targeted by this Prometheus deployment. + AvailableReplicas int32 `json:"availableReplicas"` + // Total number of unavailable pods targeted by this Prometheus deployment. + UnavailableReplicas int32 `json:"unavailableReplicas"` +} + +// AlertingSpec defines parameters for alerting configuration of Prometheus servers. +// +k8s:openapi-gen=true +type AlertingSpec struct { + // AlertmanagerEndpoints Prometheus should fire alerts against. + Alertmanagers []AlertmanagerEndpoints `json:"alertmanagers"` +} + +// StorageSpec defines the configured storage for a group Prometheus servers. +// If neither `emptyDir` nor `volumeClaimTemplate` is specified, then by default an [EmptyDir](https://kubernetes.io/docs/concepts/storage/volumes/#emptydir) will be used. +// +k8s:openapi-gen=true +type StorageSpec struct { + // EmptyDirVolumeSource to be used by the Prometheus StatefulSets. If specified, used in place of any volumeClaimTemplate. More + // info: https://kubernetes.io/docs/concepts/storage/volumes/#emptydir + EmptyDir *v1.EmptyDirVolumeSource `json:"emptyDir,omitempty"` + // A PVC spec to be used by the Prometheus StatefulSets. + VolumeClaimTemplate v1.PersistentVolumeClaim `json:"volumeClaimTemplate,omitempty"` +} + +// QuerySpec defines the query command line flags when starting Prometheus. +// +k8s:openapi-gen=true +type QuerySpec struct { + // The delta difference allowed for retrieving metrics during expression evaluations. + LookbackDelta *string `json:"lookbackDelta,omitempty"` + // Number of concurrent queries that can be run at once. + MaxConcurrency *int32 `json:"maxConcurrency,omitempty"` + // Maximum time a query may take before being aborted. + Timeout *string `json:"timeout,omitempty"` +} + +// ThanosSpec defines parameters for a Prometheus server within a Thanos deployment. +// +k8s:openapi-gen=true +type ThanosSpec struct { + // Peers is a DNS name for Thanos to discover peers through. + Peers *string `json:"peers,omitempty"` + // Image if specified has precedence over baseImage, tag and sha + // combinations. Specifying the version is still necessary to ensure the + // Prometheus Operator knows what version of Thanos is being + // configured. + Image *string `json:"image,omitempty"` + // Version describes the version of Thanos to use. + Version *string `json:"version,omitempty"` + // Tag of Thanos sidecar container image to be deployed. Defaults to the value of `version`. + // Version is ignored if Tag is set. + Tag *string `json:"tag,omitempty"` + // SHA of Thanos container image to be deployed. Defaults to the value of `version`. + // Similar to a tag, but the SHA explicitly deploys an immutable container image. + // Version and Tag are ignored if SHA is set. + SHA *string `json:"sha,omitempty"` + // Thanos base image if other than default. + BaseImage *string `json:"baseImage,omitempty"` + // Resources defines the resource requirements for the Thanos sidecar. + // If not provided, no requests/limits will be set + Resources v1.ResourceRequirements `json:"resources,omitempty"` + // GCS configures use of GCS in Thanos. + GCS *ThanosGCSSpec `json:"gcs,omitempty"` + // S3 configures use of S3 in Thanos. + S3 *ThanosS3Spec `json:"s3,omitempty"` +} + +// ThanosGCSSpec defines parameters for use of Google Cloud Storage (GCS) with +// Thanos. +// +k8s:openapi-gen=true +type ThanosGCSSpec struct { + // Google Cloud Storage bucket name for stored blocks. If empty it won't + // store any block inside Google Cloud Storage. + Bucket *string `json:"bucket,omitempty"` + // Secret to access our Bucket. + SecretKey *v1.SecretKeySelector `json:"credentials,omitempty"` +} + +// ThanosS3Spec defines parameters for of AWS Simple Storage Service (S3) with +// Thanos. (S3 compatible services apply as well) +// +k8s:openapi-gen=true +type ThanosS3Spec struct { + // S3-Compatible API bucket name for stored blocks. + Bucket *string `json:"bucket,omitempty"` + // S3-Compatible API endpoint for stored blocks. + Endpoint *string `json:"endpoint,omitempty"` + // AccessKey for an S3-Compatible API. + AccessKey *v1.SecretKeySelector `json:"accessKey,omitempty"` + // SecretKey for an S3-Compatible API. + SecretKey *v1.SecretKeySelector `json:"secretKey,omitempty"` + // Whether to use an insecure connection with an S3-Compatible API. + Insecure *bool `json:"insecure,omitempty"` + // Whether to use S3 Signature Version 2; otherwise Signature Version 4 will be used. + SignatureVersion2 *bool `json:"signatureVersion2,omitempty"` + // Whether to use Server Side Encryption + EncryptSSE *bool `json:"encryptsse,omitempty"` +} + +// RemoteWriteSpec defines the remote_write configuration for prometheus. +// +k8s:openapi-gen=true +type RemoteWriteSpec struct { + //The URL of the endpoint to send samples to. + URL string `json:"url"` + //Timeout for requests to the remote write endpoint. + RemoteTimeout string `json:"remoteTimeout,omitempty"` + //The list of remote write relabel configurations. + WriteRelabelConfigs []RelabelConfig `json:"writeRelabelConfigs,omitempty"` + //BasicAuth for the URL. + BasicAuth *BasicAuth `json:"basicAuth,omitempty"` + // File to read bearer token for remote write. + BearerToken string `json:"bearerToken,omitempty"` + // File to read bearer token for remote write. + BearerTokenFile string `json:"bearerTokenFile,omitempty"` + // TLS Config to use for remote write. + TLSConfig *TLSConfig `json:"tlsConfig,omitempty"` + //Optional ProxyURL + ProxyURL string `json:"proxyUrl,omitempty"` + // QueueConfig allows tuning of the remote write queue parameters. + QueueConfig *QueueConfig `json:"queueConfig,omitempty"` +} + +// QueueConfig allows the tuning of remote_write queue_config parameters. This object +// is referenced in the RemoteWriteSpec object. +// +k8s:openapi-gen=true +type QueueConfig struct { + // Capacity is the number of samples to buffer per shard before we start dropping them. + Capacity int `json:"capacity,omitempty"` + // MaxShards is the maximum number of shards, i.e. amount of concurrency. + MaxShards int `json:"maxShards,omitempty"` + // MaxSamplesPerSend is the maximum number of samples per send. + MaxSamplesPerSend int `json:"maxSamplesPerSend,omitempty"` + // BatchSendDeadline is the maximum time a sample will wait in buffer. + BatchSendDeadline string `json:"batchSendDeadline,omitempty"` + // MaxRetries is the maximum number of times to retry a batch on recoverable errors. + MaxRetries int `json:"maxRetries,omitempty"` + // MinBackoff is the initial retry delay. Gets doubled for every retry. + MinBackoff string `json:"minBackoff,omitempty"` + // MaxBackoff is the maximum retry delay. + MaxBackoff string `json:"maxBackoff,omitempty"` +} + +// RemoteReadSpec defines the remote_read configuration for prometheus. +// +k8s:openapi-gen=true +type RemoteReadSpec struct { + //The URL of the endpoint to send samples to. + URL string `json:"url"` + //An optional list of equality matchers which have to be present + // in a selector to query the remote read endpoint. + RequiredMatchers map[string]string `json:"requiredMatchers,omitempty"` + //Timeout for requests to the remote read endpoint. + RemoteTimeout string `json:"remoteTimeout,omitempty"` + //Whether reads should be made for queries for time ranges that + // the local storage should have complete data for. + ReadRecent bool `json:"readRecent,omitempty"` + //BasicAuth for the URL. + BasicAuth *BasicAuth `json:"basicAuth,omitempty"` + // bearer token for remote read. + BearerToken string `json:"bearerToken,omitempty"` + // File to read bearer token for remote read. + BearerTokenFile string `json:"bearerTokenFile,omitempty"` + // TLS Config to use for remote read. + TLSConfig *TLSConfig `json:"tlsConfig,omitempty"` + //Optional ProxyURL + ProxyURL string `json:"proxyUrl,omitempty"` +} + +// RelabelConfig allows dynamic rewriting of the label set, being applied to samples before ingestion. +// It defines ``-section of Prometheus configuration. +// More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs +// +k8s:openapi-gen=true +type RelabelConfig struct { + //The source labels select values from existing labels. Their content is concatenated + //using the configured separator and matched against the configured regular expression + //for the replace, keep, and drop actions. + SourceLabels []string `json:"sourceLabels,omitempty"` + //Separator placed between concatenated source label values. default is ';'. + Separator string `json:"separator,omitempty"` + //Label to which the resulting value is written in a replace action. + //It is mandatory for replace actions. Regex capture groups are available. + TargetLabel string `json:"targetLabel,omitempty"` + //Regular expression against which the extracted value is matched. defailt is '(.*)' + Regex string `json:"regex,omitempty"` + // Modulus to take of the hash of the source label values. + Modulus uint64 `json:"modulus,omitempty"` + //Replacement value against which a regex replace is performed if the + //regular expression matches. Regex capture groups are available. Default is '$1' + Replacement string `json:"replacement,omitempty"` + // Action to perform based on regex matching. Default is 'replace' + Action string `json:"action,omitempty"` +} + +// APIServerConfig defines a host and auth methods to access apiserver. +// More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#kubernetes_sd_config +// +k8s:openapi-gen=true +type APIServerConfig struct { + // Host of apiserver. + // A valid string consisting of a hostname or IP followed by an optional port number + Host string `json:"host"` + // BasicAuth allow an endpoint to authenticate over basic authentication + BasicAuth *BasicAuth `json:"basicAuth,omitempty"` + // Bearer token for accessing apiserver. + BearerToken string `json:"bearerToken,omitempty"` + // File to read bearer token for accessing apiserver. + BearerTokenFile string `json:"bearerTokenFile,omitempty"` + // TLS Config to use for accessing apiserver. + TLSConfig *TLSConfig `json:"tlsConfig,omitempty"` +} + +// AlertmanagerEndpoints defines a selection of a single Endpoints object +// containing alertmanager IPs to fire alerts against. +// +k8s:openapi-gen=true +type AlertmanagerEndpoints struct { + // Namespace of Endpoints object. + Namespace string `json:"namespace"` + // Name of Endpoints object in Namespace. + Name string `json:"name"` + // Port the Alertmanager API is exposed on. + Port intstr.IntOrString `json:"port"` + // Scheme to use when firing alerts. + Scheme string `json:"scheme,omitempty"` + // Prefix for the HTTP path alerts are pushed to. + PathPrefix string `json:"pathPrefix,omitempty"` + // TLS Config to use for alertmanager connection. + TLSConfig *TLSConfig `json:"tlsConfig,omitempty"` + // BearerTokenFile to read from filesystem to use when authenticating to + // Alertmanager. + BearerTokenFile string `json:"bearerTokenFile,omitempty"` +} + +// ServiceMonitor defines monitoring for a set of services. +// +genclient +// +k8s:openapi-gen=true +type ServiceMonitor struct { + metav1.TypeMeta `json:",inline"` + // Standard object’s metadata. More info: + // https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata + // +k8s:openapi-gen=false + metav1.ObjectMeta `json:"metadata,omitempty"` + // Specification of desired Service selection for target discrovery by + // Prometheus. + Spec ServiceMonitorSpec `json:"spec"` +} + +// ServiceMonitorSpec contains specification parameters for a ServiceMonitor. +// +k8s:openapi-gen=true +type ServiceMonitorSpec struct { + // The label to use to retrieve the job name from. + JobLabel string `json:"jobLabel,omitempty"` + // TargetLabels transfers labels on the Kubernetes Service onto the target. + TargetLabels []string `json:"targetLabels,omitempty"` + // PodTargetLabels transfers labels on the Kubernetes Pod onto the target. + PodTargetLabels []string `json:"podTargetLabels,omitempty"` + // A list of endpoints allowed as part of this ServiceMonitor. + Endpoints []Endpoint `json:"endpoints"` + // Selector to select Endpoints objects. + Selector metav1.LabelSelector `json:"selector"` + // Selector to select which namespaces the Endpoints objects are discovered from. + NamespaceSelector NamespaceSelector `json:"namespaceSelector,omitempty"` + // SampleLimit defines per-scrape limit on number of scraped samples that will be accepted. + SampleLimit uint64 `json:"sampleLimit,omitempty"` +} + +// Endpoint defines a scrapeable endpoint serving Prometheus metrics. +// +k8s:openapi-gen=true +type Endpoint struct { + // Name of the service port this endpoint refers to. Mutually exclusive with targetPort. + Port string `json:"port,omitempty"` + // Name or number of the target port of the endpoint. Mutually exclusive with port. + TargetPort *intstr.IntOrString `json:"targetPort,omitempty"` + // HTTP path to scrape for metrics. + Path string `json:"path,omitempty"` + // HTTP scheme to use for scraping. + Scheme string `json:"scheme,omitempty"` + // Optional HTTP URL parameters + Params map[string][]string `json:"params,omitempty"` + // Interval at which metrics should be scraped + Interval string `json:"interval,omitempty"` + // Timeout after which the scrape is ended + ScrapeTimeout string `json:"scrapeTimeout,omitempty"` + // TLS configuration to use when scraping the endpoint + TLSConfig *TLSConfig `json:"tlsConfig,omitempty"` + // File to read bearer token for scraping targets. + BearerTokenFile string `json:"bearerTokenFile,omitempty"` + // HonorLabels chooses the metric's labels on collisions with target labels. + HonorLabels bool `json:"honorLabels,omitempty"` + // BasicAuth allow an endpoint to authenticate over basic authentication + // More info: https://prometheus.io/docs/operating/configuration/#endpoints + BasicAuth *BasicAuth `json:"basicAuth,omitempty"` + // MetricRelabelConfigs to apply to samples before ingestion. + MetricRelabelConfigs []*RelabelConfig `json:"metricRelabelings,omitempty"` + // RelabelConfigs to apply to samples before ingestion. + // More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/# + RelabelConfigs []*RelabelConfig `json:"relabelings,omitempty"` + // ProxyURL eg http://proxyserver:2195 Directs scrapes to proxy through this endpoint. + ProxyURL *string `json:"proxyUrl,omitempty"` +} + +// BasicAuth allow an endpoint to authenticate over basic authentication +// More info: https://prometheus.io/docs/operating/configuration/#endpoints +// +k8s:openapi-gen=true +type BasicAuth struct { + // The secret that contains the username for authenticate + Username v1.SecretKeySelector `json:"username,omitempty"` + // The secret that contains the password for authenticate + Password v1.SecretKeySelector `json:"password,omitempty"` +} + +// TLSConfig specifies TLS configuration parameters. +// +k8s:openapi-gen=true +type TLSConfig struct { + // The CA cert to use for the targets. + CAFile string `json:"caFile,omitempty"` + // The client cert file for the targets. + CertFile string `json:"certFile,omitempty"` + // The client key file for the targets. + KeyFile string `json:"keyFile,omitempty"` + // Used to verify the hostname for the targets. + ServerName string `json:"serverName,omitempty"` + // Disable target certificate validation. + InsecureSkipVerify bool `json:"insecureSkipVerify,omitempty"` +} + +// ServiceMonitorList is a list of ServiceMonitors. +// +k8s:openapi-gen=true +type ServiceMonitorList struct { + metav1.TypeMeta `json:",inline"` + // Standard list metadata + // More info: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata + metav1.ListMeta `json:"metadata,omitempty"` + // List of ServiceMonitors + Items []*ServiceMonitor `json:"items"` +} + +// PrometheusRuleList is a list of PrometheusRules. +// +k8s:openapi-gen=true +type PrometheusRuleList struct { + metav1.TypeMeta `json:",inline"` + // Standard list metadata + // More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata + metav1.ListMeta `json:"metadata,omitempty"` + // List of Rules + Items []*PrometheusRule `json:"items"` +} + +// PrometheusRule defines alerting rules for a Prometheus instance +// +genclient +// +k8s:openapi-gen=true +type PrometheusRule struct { + metav1.TypeMeta `json:",inline"` + // Standard object’s metadata. More info: + // http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata + metav1.ObjectMeta `json:"metadata,omitempty"` + // Specification of desired alerting rule definitions for Prometheus. + Spec PrometheusRuleSpec `json:"spec"` +} + +// PrometheusRuleSpec contains specification parameters for a Rule. +// +k8s:openapi-gen=true +type PrometheusRuleSpec struct { + // Content of Prometheus rule file + Groups []RuleGroup `json:"groups,omitempty"` +} + +// RuleGroup and Rule are copied instead of vendored because the +// upstream Prometheus struct definitions don't have json struct tags. + +// RuleGroup is a list of sequentially evaluated recording and alerting rules. +// +k8s:openapi-gen=true +type RuleGroup struct { + Name string `json:"name"` + Interval string `json:"interval,omitempty"` + Rules []Rule `json:"rules"` +} + +// Rule describes an alerting or recording rule. +// +k8s:openapi-gen=true +type Rule struct { + Record string `json:"record,omitempty"` + Alert string `json:"alert,omitempty"` + Expr intstr.IntOrString `json:"expr"` + For string `json:"for,omitempty"` + Labels map[string]string `json:"labels,omitempty"` + Annotations map[string]string `json:"annotations,omitempty"` +} + +// Alertmanager describes an Alertmanager cluster. +// +genclient +// +k8s:openapi-gen=true +type Alertmanager struct { + metav1.TypeMeta `json:",inline"` + // Standard object’s metadata. More info: + // https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata + // +k8s:openapi-gen=false + metav1.ObjectMeta `json:"metadata,omitempty"` + // Specification of the desired behavior of the Alertmanager cluster. More info: + // https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status + Spec AlertmanagerSpec `json:"spec"` + // Most recent observed status of the Alertmanager cluster. Read-only. Not + // included when requesting from the apiserver, only from the Prometheus + // Operator API itself. More info: + // https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status + Status *AlertmanagerStatus `json:"status,omitempty"` +} + +// AlertmanagerSpec is a specification of the desired behavior of the Alertmanager cluster. More info: +// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status +// +k8s:openapi-gen=true +type AlertmanagerSpec struct { + // Standard object’s metadata. More info: + // https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata + // Metadata Labels and Annotations gets propagated to the prometheus pods. + PodMetadata *metav1.ObjectMeta `json:"podMetadata,omitempty"` + // Image if specified has precedence over baseImage, tag and sha + // combinations. Specifying the version is still necessary to ensure the + // Prometheus Operator knows what version of Alertmanager is being + // configured. + Image *string `json:"image,omitempty"` + // Version the cluster should be on. + Version string `json:"version,omitempty"` + // Tag of Alertmanager container image to be deployed. Defaults to the value of `version`. + // Version is ignored if Tag is set. + Tag string `json:"tag,omitempty"` + // SHA of Alertmanager container image to be deployed. Defaults to the value of `version`. + // Similar to a tag, but the SHA explicitly deploys an immutable container image. + // Version and Tag are ignored if SHA is set. + SHA string `json:"sha,omitempty"` + // Base image that is used to deploy pods, without tag. + BaseImage string `json:"baseImage,omitempty"` + // An optional list of references to secrets in the same namespace + // to use for pulling prometheus and alertmanager images from registries + // see http://kubernetes.io/docs/user-guide/images#specifying-imagepullsecrets-on-a-pod + ImagePullSecrets []v1.LocalObjectReference `json:"imagePullSecrets,omitempty"` + // Secrets is a list of Secrets in the same namespace as the Alertmanager + // object, which shall be mounted into the Alertmanager Pods. + // The Secrets are mounted into /etc/alertmanager/secrets/. + Secrets []string `json:"secrets,omitempty"` + // ConfigMaps is a list of ConfigMaps in the same namespace as the Alertmanager + // object, which shall be mounted into the Alertmanager Pods. + // The ConfigMaps are mounted into /etc/alertmanager/configmaps/. + ConfigMaps []string `json:"configMaps,omitempty"` + // Log level for Alertmanager to be configured with. + LogLevel string `json:"logLevel,omitempty"` + // Size is the expected size of the alertmanager cluster. The controller will + // eventually make the size of the running cluster equal to the expected + // size. + Replicas *int32 `json:"replicas,omitempty"` + // Time duration Alertmanager shall retain data for. Default is '120h', + // and must match the regular expression `[0-9]+(ms|s|m|h)` (milliseconds seconds minutes hours). + Retention string `json:"retention,omitempty"` + // Storage is the definition of how storage will be used by the Alertmanager + // instances. + Storage *StorageSpec `json:"storage,omitempty"` + // The external URL the Alertmanager instances will be available under. This is + // necessary to generate correct URLs. This is necessary if Alertmanager is not + // served from root of a DNS name. + ExternalURL string `json:"externalUrl,omitempty"` + // The route prefix Alertmanager registers HTTP handlers for. This is useful, + // if using ExternalURL and a proxy is rewriting HTTP routes of a request, + // and the actual ExternalURL is still true, but the server serves requests + // under a different route prefix. For example for use with `kubectl proxy`. + RoutePrefix string `json:"routePrefix,omitempty"` + // If set to true all actions on the underlaying managed objects are not + // goint to be performed, except for delete actions. + Paused bool `json:"paused,omitempty"` + // Define which Nodes the Pods are scheduled on. + NodeSelector map[string]string `json:"nodeSelector,omitempty"` + // Define resources requests and limits for single Pods. + Resources v1.ResourceRequirements `json:"resources,omitempty"` + // If specified, the pod's scheduling constraints. + Affinity *v1.Affinity `json:"affinity,omitempty"` + // If specified, the pod's tolerations. + Tolerations []v1.Toleration `json:"tolerations,omitempty"` + // SecurityContext holds pod-level security attributes and common container settings. + // This defaults to non root user with uid 1000 and gid 2000. + SecurityContext *v1.PodSecurityContext `json:"securityContext,omitempty"` + // ServiceAccountName is the name of the ServiceAccount to use to run the + // Prometheus Pods. + ServiceAccountName string `json:"serviceAccountName,omitempty"` + // ListenLocal makes the Alertmanager server listen on loopback, so that it + // does not bind against the Pod IP. Note this is only for the Alertmanager + // UI, not the gossip communication. + ListenLocal bool `json:"listenLocal,omitempty"` + // Containers allows injecting additional containers. This is meant to + // allow adding an authentication proxy to an Alertmanager pod. + Containers []v1.Container `json:"containers,omitempty"` + // Priority class assigned to the Pods + PriorityClassName string `json:"priorityClassName,omitempty"` + // AdditionalPeers allows injecting a set of additional Alertmanagers to peer with to form a highly available cluster. + AdditionalPeers []string `json:"additionalPeers,omitempty"` +} + +// AlertmanagerList is a list of Alertmanagers. +// +k8s:openapi-gen=true +type AlertmanagerList struct { + metav1.TypeMeta `json:",inline"` + // Standard list metadata + // More info: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata + metav1.ListMeta `json:"metadata,omitempty"` + // List of Alertmanagers + Items []Alertmanager `json:"items"` +} + +// AlertmanagerStatus is the most recent observed status of the Alertmanager cluster. Read-only. Not +// included when requesting from the apiserver, only from the Prometheus +// Operator API itself. More info: +// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status +// +k8s:openapi-gen=true +type AlertmanagerStatus struct { + // Represents whether any actions on the underlaying managed objects are + // being performed. Only delete actions will be performed. + Paused bool `json:"paused"` + // Total number of non-terminated pods targeted by this Alertmanager + // cluster (their labels match the selector). + Replicas int32 `json:"replicas"` + // Total number of non-terminated pods targeted by this Alertmanager + // cluster that have the desired version spec. + UpdatedReplicas int32 `json:"updatedReplicas"` + // Total number of available pods (ready for at least minReadySeconds) + // targeted by this Alertmanager cluster. + AvailableReplicas int32 `json:"availableReplicas"` + // Total number of unavailable pods targeted by this Alertmanager cluster. + UnavailableReplicas int32 `json:"unavailableReplicas"` +} + +// NamespaceSelector is a selector for selecting either all namespaces or a +// list of namespaces. +// +k8s:openapi-gen=true +type NamespaceSelector struct { + // Boolean describing whether all namespaces are selected in contrast to a + // list restricting them. + Any bool `json:"any,omitempty"` + // List of namespace names. + MatchNames []string `json:"matchNames,omitempty"` + + // TODO(fabxc): this should embed metav1.LabelSelector eventually. + // Currently the selector is only used for namespaces which require more complex + // implementation to support label selections. +} + +// DeepCopyObject implements the runtime.Object interface. +func (l *Alertmanager) DeepCopyObject() runtime.Object { + return l.DeepCopy() +} + +// DeepCopyObject implements the runtime.Object interface. +func (l *AlertmanagerList) DeepCopyObject() runtime.Object { + return l.DeepCopy() +} + +// DeepCopyObject implements the runtime.Object interface. +func (l *Prometheus) DeepCopyObject() runtime.Object { + return l.DeepCopy() +} + +// DeepCopyObject implements the runtime.Object interface. +func (l *PrometheusList) DeepCopyObject() runtime.Object { + return l.DeepCopy() +} + +// DeepCopyObject implements the runtime.Object interface. +func (l *ServiceMonitor) DeepCopyObject() runtime.Object { + return l.DeepCopy() +} + +// DeepCopyObject implements the runtime.Object interface. +func (l *ServiceMonitorList) DeepCopyObject() runtime.Object { + return l.DeepCopy() +} + +// DeepCopyObject implements the runtime.Object interface. +func (f *PrometheusRule) DeepCopyObject() runtime.Object { + return f.DeepCopy() +} + +// DeepCopyObject implements the runtime.Object interface. +func (l *PrometheusRuleList) DeepCopyObject() runtime.Object { + return l.DeepCopy() +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1/zz_generated.deepcopy.go b/vendor/github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1/zz_generated.deepcopy.go new file mode 100644 index 0000000000..13a8722de5 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1/zz_generated.deepcopy.go @@ -0,0 +1,1378 @@ +// +build !ignore_autogenerated + +// Copyright 2018 The prometheus-operator 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 deepcopy-gen. DO NOT EDIT. + +package v1 + +import ( + core_v1 "k8s.io/api/core/v1" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + intstr "k8s.io/apimachinery/pkg/util/intstr" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *APIServerConfig) DeepCopyInto(out *APIServerConfig) { + *out = *in + if in.BasicAuth != nil { + in, out := &in.BasicAuth, &out.BasicAuth + if *in == nil { + *out = nil + } else { + *out = new(BasicAuth) + (*in).DeepCopyInto(*out) + } + } + if in.TLSConfig != nil { + in, out := &in.TLSConfig, &out.TLSConfig + if *in == nil { + *out = nil + } else { + *out = new(TLSConfig) + **out = **in + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIServerConfig. +func (in *APIServerConfig) DeepCopy() *APIServerConfig { + if in == nil { + return nil + } + out := new(APIServerConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AlertingSpec) DeepCopyInto(out *AlertingSpec) { + *out = *in + if in.Alertmanagers != nil { + in, out := &in.Alertmanagers, &out.Alertmanagers + *out = make([]AlertmanagerEndpoints, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlertingSpec. +func (in *AlertingSpec) DeepCopy() *AlertingSpec { + if in == nil { + return nil + } + out := new(AlertingSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Alertmanager) DeepCopyInto(out *Alertmanager) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + if in.Status != nil { + in, out := &in.Status, &out.Status + if *in == nil { + *out = nil + } else { + *out = new(AlertmanagerStatus) + **out = **in + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Alertmanager. +func (in *Alertmanager) DeepCopy() *Alertmanager { + if in == nil { + return nil + } + out := new(Alertmanager) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AlertmanagerEndpoints) DeepCopyInto(out *AlertmanagerEndpoints) { + *out = *in + out.Port = in.Port + if in.TLSConfig != nil { + in, out := &in.TLSConfig, &out.TLSConfig + if *in == nil { + *out = nil + } else { + *out = new(TLSConfig) + **out = **in + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlertmanagerEndpoints. +func (in *AlertmanagerEndpoints) DeepCopy() *AlertmanagerEndpoints { + if in == nil { + return nil + } + out := new(AlertmanagerEndpoints) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AlertmanagerList) DeepCopyInto(out *AlertmanagerList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Alertmanager, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlertmanagerList. +func (in *AlertmanagerList) DeepCopy() *AlertmanagerList { + if in == nil { + return nil + } + out := new(AlertmanagerList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AlertmanagerSpec) DeepCopyInto(out *AlertmanagerSpec) { + *out = *in + if in.PodMetadata != nil { + in, out := &in.PodMetadata, &out.PodMetadata + if *in == nil { + *out = nil + } else { + *out = new(meta_v1.ObjectMeta) + (*in).DeepCopyInto(*out) + } + } + if in.Image != nil { + in, out := &in.Image, &out.Image + if *in == nil { + *out = nil + } else { + *out = new(string) + **out = **in + } + } + if in.ImagePullSecrets != nil { + in, out := &in.ImagePullSecrets, &out.ImagePullSecrets + *out = make([]core_v1.LocalObjectReference, len(*in)) + copy(*out, *in) + } + if in.Secrets != nil { + in, out := &in.Secrets, &out.Secrets + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.ConfigMaps != nil { + in, out := &in.ConfigMaps, &out.ConfigMaps + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Replicas != nil { + in, out := &in.Replicas, &out.Replicas + if *in == nil { + *out = nil + } else { + *out = new(int32) + **out = **in + } + } + if in.Storage != nil { + in, out := &in.Storage, &out.Storage + if *in == nil { + *out = nil + } else { + *out = new(StorageSpec) + (*in).DeepCopyInto(*out) + } + } + if in.NodeSelector != nil { + in, out := &in.NodeSelector, &out.NodeSelector + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + in.Resources.DeepCopyInto(&out.Resources) + if in.Affinity != nil { + in, out := &in.Affinity, &out.Affinity + if *in == nil { + *out = nil + } else { + *out = new(core_v1.Affinity) + (*in).DeepCopyInto(*out) + } + } + if in.Tolerations != nil { + in, out := &in.Tolerations, &out.Tolerations + *out = make([]core_v1.Toleration, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.SecurityContext != nil { + in, out := &in.SecurityContext, &out.SecurityContext + if *in == nil { + *out = nil + } else { + *out = new(core_v1.PodSecurityContext) + (*in).DeepCopyInto(*out) + } + } + if in.Containers != nil { + in, out := &in.Containers, &out.Containers + *out = make([]core_v1.Container, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.AdditionalPeers != nil { + in, out := &in.AdditionalPeers, &out.AdditionalPeers + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlertmanagerSpec. +func (in *AlertmanagerSpec) DeepCopy() *AlertmanagerSpec { + if in == nil { + return nil + } + out := new(AlertmanagerSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AlertmanagerStatus) DeepCopyInto(out *AlertmanagerStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlertmanagerStatus. +func (in *AlertmanagerStatus) DeepCopy() *AlertmanagerStatus { + if in == nil { + return nil + } + out := new(AlertmanagerStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BasicAuth) DeepCopyInto(out *BasicAuth) { + *out = *in + in.Username.DeepCopyInto(&out.Username) + in.Password.DeepCopyInto(&out.Password) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BasicAuth. +func (in *BasicAuth) DeepCopy() *BasicAuth { + if in == nil { + return nil + } + out := new(BasicAuth) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CrdKind) DeepCopyInto(out *CrdKind) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CrdKind. +func (in *CrdKind) DeepCopy() *CrdKind { + if in == nil { + return nil + } + out := new(CrdKind) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CrdKinds) DeepCopyInto(out *CrdKinds) { + *out = *in + out.Prometheus = in.Prometheus + out.Alertmanager = in.Alertmanager + out.ServiceMonitor = in.ServiceMonitor + out.PrometheusRule = in.PrometheusRule + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CrdKinds. +func (in *CrdKinds) DeepCopy() *CrdKinds { + if in == nil { + return nil + } + out := new(CrdKinds) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Endpoint) DeepCopyInto(out *Endpoint) { + *out = *in + if in.TargetPort != nil { + in, out := &in.TargetPort, &out.TargetPort + if *in == nil { + *out = nil + } else { + *out = new(intstr.IntOrString) + **out = **in + } + } + if in.Params != nil { + in, out := &in.Params, &out.Params + *out = make(map[string][]string, len(*in)) + for key, val := range *in { + if val == nil { + (*out)[key] = nil + } else { + (*out)[key] = make([]string, len(val)) + copy((*out)[key], val) + } + } + } + if in.TLSConfig != nil { + in, out := &in.TLSConfig, &out.TLSConfig + if *in == nil { + *out = nil + } else { + *out = new(TLSConfig) + **out = **in + } + } + if in.BasicAuth != nil { + in, out := &in.BasicAuth, &out.BasicAuth + if *in == nil { + *out = nil + } else { + *out = new(BasicAuth) + (*in).DeepCopyInto(*out) + } + } + if in.MetricRelabelConfigs != nil { + in, out := &in.MetricRelabelConfigs, &out.MetricRelabelConfigs + *out = make([]*RelabelConfig, len(*in)) + for i := range *in { + if (*in)[i] == nil { + (*out)[i] = nil + } else { + (*out)[i] = new(RelabelConfig) + (*in)[i].DeepCopyInto((*out)[i]) + } + } + } + if in.RelabelConfigs != nil { + in, out := &in.RelabelConfigs, &out.RelabelConfigs + *out = make([]*RelabelConfig, len(*in)) + for i := range *in { + if (*in)[i] == nil { + (*out)[i] = nil + } else { + (*out)[i] = new(RelabelConfig) + (*in)[i].DeepCopyInto((*out)[i]) + } + } + } + if in.ProxyURL != nil { + in, out := &in.ProxyURL, &out.ProxyURL + if *in == nil { + *out = nil + } else { + *out = new(string) + **out = **in + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Endpoint. +func (in *Endpoint) DeepCopy() *Endpoint { + if in == nil { + return nil + } + out := new(Endpoint) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NamespaceSelector) DeepCopyInto(out *NamespaceSelector) { + *out = *in + if in.MatchNames != nil { + in, out := &in.MatchNames, &out.MatchNames + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamespaceSelector. +func (in *NamespaceSelector) DeepCopy() *NamespaceSelector { + if in == nil { + return nil + } + out := new(NamespaceSelector) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Prometheus) DeepCopyInto(out *Prometheus) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + if in.Status != nil { + in, out := &in.Status, &out.Status + if *in == nil { + *out = nil + } else { + *out = new(PrometheusStatus) + **out = **in + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Prometheus. +func (in *Prometheus) DeepCopy() *Prometheus { + if in == nil { + return nil + } + out := new(Prometheus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PrometheusList) DeepCopyInto(out *PrometheusList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]*Prometheus, len(*in)) + for i := range *in { + if (*in)[i] == nil { + (*out)[i] = nil + } else { + (*out)[i] = new(Prometheus) + (*in)[i].DeepCopyInto((*out)[i]) + } + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PrometheusList. +func (in *PrometheusList) DeepCopy() *PrometheusList { + if in == nil { + return nil + } + out := new(PrometheusList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PrometheusRule) DeepCopyInto(out *PrometheusRule) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PrometheusRule. +func (in *PrometheusRule) DeepCopy() *PrometheusRule { + if in == nil { + return nil + } + out := new(PrometheusRule) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PrometheusRuleList) DeepCopyInto(out *PrometheusRuleList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]*PrometheusRule, len(*in)) + for i := range *in { + if (*in)[i] == nil { + (*out)[i] = nil + } else { + (*out)[i] = new(PrometheusRule) + (*in)[i].DeepCopyInto((*out)[i]) + } + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PrometheusRuleList. +func (in *PrometheusRuleList) DeepCopy() *PrometheusRuleList { + if in == nil { + return nil + } + out := new(PrometheusRuleList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PrometheusRuleSpec) DeepCopyInto(out *PrometheusRuleSpec) { + *out = *in + if in.Groups != nil { + in, out := &in.Groups, &out.Groups + *out = make([]RuleGroup, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PrometheusRuleSpec. +func (in *PrometheusRuleSpec) DeepCopy() *PrometheusRuleSpec { + if in == nil { + return nil + } + out := new(PrometheusRuleSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PrometheusSpec) DeepCopyInto(out *PrometheusSpec) { + *out = *in + if in.PodMetadata != nil { + in, out := &in.PodMetadata, &out.PodMetadata + if *in == nil { + *out = nil + } else { + *out = new(meta_v1.ObjectMeta) + (*in).DeepCopyInto(*out) + } + } + if in.ServiceMonitorSelector != nil { + in, out := &in.ServiceMonitorSelector, &out.ServiceMonitorSelector + if *in == nil { + *out = nil + } else { + *out = new(meta_v1.LabelSelector) + (*in).DeepCopyInto(*out) + } + } + if in.ServiceMonitorNamespaceSelector != nil { + in, out := &in.ServiceMonitorNamespaceSelector, &out.ServiceMonitorNamespaceSelector + if *in == nil { + *out = nil + } else { + *out = new(meta_v1.LabelSelector) + (*in).DeepCopyInto(*out) + } + } + if in.Image != nil { + in, out := &in.Image, &out.Image + if *in == nil { + *out = nil + } else { + *out = new(string) + **out = **in + } + } + if in.ImagePullSecrets != nil { + in, out := &in.ImagePullSecrets, &out.ImagePullSecrets + *out = make([]core_v1.LocalObjectReference, len(*in)) + copy(*out, *in) + } + if in.Replicas != nil { + in, out := &in.Replicas, &out.Replicas + if *in == nil { + *out = nil + } else { + *out = new(int32) + **out = **in + } + } + if in.ExternalLabels != nil { + in, out := &in.ExternalLabels, &out.ExternalLabels + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Query != nil { + in, out := &in.Query, &out.Query + if *in == nil { + *out = nil + } else { + *out = new(QuerySpec) + (*in).DeepCopyInto(*out) + } + } + if in.Storage != nil { + in, out := &in.Storage, &out.Storage + if *in == nil { + *out = nil + } else { + *out = new(StorageSpec) + (*in).DeepCopyInto(*out) + } + } + if in.RuleSelector != nil { + in, out := &in.RuleSelector, &out.RuleSelector + if *in == nil { + *out = nil + } else { + *out = new(meta_v1.LabelSelector) + (*in).DeepCopyInto(*out) + } + } + if in.RuleNamespaceSelector != nil { + in, out := &in.RuleNamespaceSelector, &out.RuleNamespaceSelector + if *in == nil { + *out = nil + } else { + *out = new(meta_v1.LabelSelector) + (*in).DeepCopyInto(*out) + } + } + if in.Alerting != nil { + in, out := &in.Alerting, &out.Alerting + if *in == nil { + *out = nil + } else { + *out = new(AlertingSpec) + (*in).DeepCopyInto(*out) + } + } + in.Resources.DeepCopyInto(&out.Resources) + if in.NodeSelector != nil { + in, out := &in.NodeSelector, &out.NodeSelector + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Secrets != nil { + in, out := &in.Secrets, &out.Secrets + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.ConfigMaps != nil { + in, out := &in.ConfigMaps, &out.ConfigMaps + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Affinity != nil { + in, out := &in.Affinity, &out.Affinity + if *in == nil { + *out = nil + } else { + *out = new(core_v1.Affinity) + (*in).DeepCopyInto(*out) + } + } + if in.Tolerations != nil { + in, out := &in.Tolerations, &out.Tolerations + *out = make([]core_v1.Toleration, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.RemoteWrite != nil { + in, out := &in.RemoteWrite, &out.RemoteWrite + *out = make([]RemoteWriteSpec, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.RemoteRead != nil { + in, out := &in.RemoteRead, &out.RemoteRead + *out = make([]RemoteReadSpec, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.SecurityContext != nil { + in, out := &in.SecurityContext, &out.SecurityContext + if *in == nil { + *out = nil + } else { + *out = new(core_v1.PodSecurityContext) + (*in).DeepCopyInto(*out) + } + } + if in.Containers != nil { + in, out := &in.Containers, &out.Containers + *out = make([]core_v1.Container, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.AdditionalScrapeConfigs != nil { + in, out := &in.AdditionalScrapeConfigs, &out.AdditionalScrapeConfigs + if *in == nil { + *out = nil + } else { + *out = new(core_v1.SecretKeySelector) + (*in).DeepCopyInto(*out) + } + } + if in.AdditionalAlertRelabelConfigs != nil { + in, out := &in.AdditionalAlertRelabelConfigs, &out.AdditionalAlertRelabelConfigs + if *in == nil { + *out = nil + } else { + *out = new(core_v1.SecretKeySelector) + (*in).DeepCopyInto(*out) + } + } + if in.AdditionalAlertManagerConfigs != nil { + in, out := &in.AdditionalAlertManagerConfigs, &out.AdditionalAlertManagerConfigs + if *in == nil { + *out = nil + } else { + *out = new(core_v1.SecretKeySelector) + (*in).DeepCopyInto(*out) + } + } + if in.APIServerConfig != nil { + in, out := &in.APIServerConfig, &out.APIServerConfig + if *in == nil { + *out = nil + } else { + *out = new(APIServerConfig) + (*in).DeepCopyInto(*out) + } + } + if in.Thanos != nil { + in, out := &in.Thanos, &out.Thanos + if *in == nil { + *out = nil + } else { + *out = new(ThanosSpec) + (*in).DeepCopyInto(*out) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PrometheusSpec. +func (in *PrometheusSpec) DeepCopy() *PrometheusSpec { + if in == nil { + return nil + } + out := new(PrometheusSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PrometheusStatus) DeepCopyInto(out *PrometheusStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PrometheusStatus. +func (in *PrometheusStatus) DeepCopy() *PrometheusStatus { + if in == nil { + return nil + } + out := new(PrometheusStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *QuerySpec) DeepCopyInto(out *QuerySpec) { + *out = *in + if in.LookbackDelta != nil { + in, out := &in.LookbackDelta, &out.LookbackDelta + if *in == nil { + *out = nil + } else { + *out = new(string) + **out = **in + } + } + if in.MaxConcurrency != nil { + in, out := &in.MaxConcurrency, &out.MaxConcurrency + if *in == nil { + *out = nil + } else { + *out = new(int32) + **out = **in + } + } + if in.Timeout != nil { + in, out := &in.Timeout, &out.Timeout + if *in == nil { + *out = nil + } else { + *out = new(string) + **out = **in + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new QuerySpec. +func (in *QuerySpec) DeepCopy() *QuerySpec { + if in == nil { + return nil + } + out := new(QuerySpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *QueueConfig) DeepCopyInto(out *QueueConfig) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new QueueConfig. +func (in *QueueConfig) DeepCopy() *QueueConfig { + if in == nil { + return nil + } + out := new(QueueConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RelabelConfig) DeepCopyInto(out *RelabelConfig) { + *out = *in + if in.SourceLabels != nil { + in, out := &in.SourceLabels, &out.SourceLabels + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RelabelConfig. +func (in *RelabelConfig) DeepCopy() *RelabelConfig { + if in == nil { + return nil + } + out := new(RelabelConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RemoteReadSpec) DeepCopyInto(out *RemoteReadSpec) { + *out = *in + if in.RequiredMatchers != nil { + in, out := &in.RequiredMatchers, &out.RequiredMatchers + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.BasicAuth != nil { + in, out := &in.BasicAuth, &out.BasicAuth + if *in == nil { + *out = nil + } else { + *out = new(BasicAuth) + (*in).DeepCopyInto(*out) + } + } + if in.TLSConfig != nil { + in, out := &in.TLSConfig, &out.TLSConfig + if *in == nil { + *out = nil + } else { + *out = new(TLSConfig) + **out = **in + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RemoteReadSpec. +func (in *RemoteReadSpec) DeepCopy() *RemoteReadSpec { + if in == nil { + return nil + } + out := new(RemoteReadSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RemoteWriteSpec) DeepCopyInto(out *RemoteWriteSpec) { + *out = *in + if in.WriteRelabelConfigs != nil { + in, out := &in.WriteRelabelConfigs, &out.WriteRelabelConfigs + *out = make([]RelabelConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.BasicAuth != nil { + in, out := &in.BasicAuth, &out.BasicAuth + if *in == nil { + *out = nil + } else { + *out = new(BasicAuth) + (*in).DeepCopyInto(*out) + } + } + if in.TLSConfig != nil { + in, out := &in.TLSConfig, &out.TLSConfig + if *in == nil { + *out = nil + } else { + *out = new(TLSConfig) + **out = **in + } + } + if in.QueueConfig != nil { + in, out := &in.QueueConfig, &out.QueueConfig + if *in == nil { + *out = nil + } else { + *out = new(QueueConfig) + **out = **in + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RemoteWriteSpec. +func (in *RemoteWriteSpec) DeepCopy() *RemoteWriteSpec { + if in == nil { + return nil + } + out := new(RemoteWriteSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Rule) DeepCopyInto(out *Rule) { + *out = *in + out.Expr = in.Expr + if in.Labels != nil { + in, out := &in.Labels, &out.Labels + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Annotations != nil { + in, out := &in.Annotations, &out.Annotations + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Rule. +func (in *Rule) DeepCopy() *Rule { + if in == nil { + return nil + } + out := new(Rule) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RuleGroup) DeepCopyInto(out *RuleGroup) { + *out = *in + if in.Rules != nil { + in, out := &in.Rules, &out.Rules + *out = make([]Rule, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RuleGroup. +func (in *RuleGroup) DeepCopy() *RuleGroup { + if in == nil { + return nil + } + out := new(RuleGroup) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ServiceMonitor) DeepCopyInto(out *ServiceMonitor) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceMonitor. +func (in *ServiceMonitor) DeepCopy() *ServiceMonitor { + if in == nil { + return nil + } + out := new(ServiceMonitor) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ServiceMonitorList) DeepCopyInto(out *ServiceMonitorList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]*ServiceMonitor, len(*in)) + for i := range *in { + if (*in)[i] == nil { + (*out)[i] = nil + } else { + (*out)[i] = new(ServiceMonitor) + (*in)[i].DeepCopyInto((*out)[i]) + } + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceMonitorList. +func (in *ServiceMonitorList) DeepCopy() *ServiceMonitorList { + if in == nil { + return nil + } + out := new(ServiceMonitorList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ServiceMonitorSpec) DeepCopyInto(out *ServiceMonitorSpec) { + *out = *in + if in.TargetLabels != nil { + in, out := &in.TargetLabels, &out.TargetLabels + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.PodTargetLabels != nil { + in, out := &in.PodTargetLabels, &out.PodTargetLabels + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Endpoints != nil { + in, out := &in.Endpoints, &out.Endpoints + *out = make([]Endpoint, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + in.Selector.DeepCopyInto(&out.Selector) + in.NamespaceSelector.DeepCopyInto(&out.NamespaceSelector) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceMonitorSpec. +func (in *ServiceMonitorSpec) DeepCopy() *ServiceMonitorSpec { + if in == nil { + return nil + } + out := new(ServiceMonitorSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *StorageSpec) DeepCopyInto(out *StorageSpec) { + *out = *in + if in.EmptyDir != nil { + in, out := &in.EmptyDir, &out.EmptyDir + if *in == nil { + *out = nil + } else { + *out = new(core_v1.EmptyDirVolumeSource) + (*in).DeepCopyInto(*out) + } + } + in.VolumeClaimTemplate.DeepCopyInto(&out.VolumeClaimTemplate) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StorageSpec. +func (in *StorageSpec) DeepCopy() *StorageSpec { + if in == nil { + return nil + } + out := new(StorageSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TLSConfig) DeepCopyInto(out *TLSConfig) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TLSConfig. +func (in *TLSConfig) DeepCopy() *TLSConfig { + if in == nil { + return nil + } + out := new(TLSConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ThanosGCSSpec) DeepCopyInto(out *ThanosGCSSpec) { + *out = *in + if in.Bucket != nil { + in, out := &in.Bucket, &out.Bucket + if *in == nil { + *out = nil + } else { + *out = new(string) + **out = **in + } + } + if in.SecretKey != nil { + in, out := &in.SecretKey, &out.SecretKey + if *in == nil { + *out = nil + } else { + *out = new(core_v1.SecretKeySelector) + (*in).DeepCopyInto(*out) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ThanosGCSSpec. +func (in *ThanosGCSSpec) DeepCopy() *ThanosGCSSpec { + if in == nil { + return nil + } + out := new(ThanosGCSSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ThanosS3Spec) DeepCopyInto(out *ThanosS3Spec) { + *out = *in + if in.Bucket != nil { + in, out := &in.Bucket, &out.Bucket + if *in == nil { + *out = nil + } else { + *out = new(string) + **out = **in + } + } + if in.Endpoint != nil { + in, out := &in.Endpoint, &out.Endpoint + if *in == nil { + *out = nil + } else { + *out = new(string) + **out = **in + } + } + if in.AccessKey != nil { + in, out := &in.AccessKey, &out.AccessKey + if *in == nil { + *out = nil + } else { + *out = new(core_v1.SecretKeySelector) + (*in).DeepCopyInto(*out) + } + } + if in.SecretKey != nil { + in, out := &in.SecretKey, &out.SecretKey + if *in == nil { + *out = nil + } else { + *out = new(core_v1.SecretKeySelector) + (*in).DeepCopyInto(*out) + } + } + if in.Insecure != nil { + in, out := &in.Insecure, &out.Insecure + if *in == nil { + *out = nil + } else { + *out = new(bool) + **out = **in + } + } + if in.SignatureVersion2 != nil { + in, out := &in.SignatureVersion2, &out.SignatureVersion2 + if *in == nil { + *out = nil + } else { + *out = new(bool) + **out = **in + } + } + if in.EncryptSSE != nil { + in, out := &in.EncryptSSE, &out.EncryptSSE + if *in == nil { + *out = nil + } else { + *out = new(bool) + **out = **in + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ThanosS3Spec. +func (in *ThanosS3Spec) DeepCopy() *ThanosS3Spec { + if in == nil { + return nil + } + out := new(ThanosS3Spec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ThanosSpec) DeepCopyInto(out *ThanosSpec) { + *out = *in + if in.Peers != nil { + in, out := &in.Peers, &out.Peers + if *in == nil { + *out = nil + } else { + *out = new(string) + **out = **in + } + } + if in.Image != nil { + in, out := &in.Image, &out.Image + if *in == nil { + *out = nil + } else { + *out = new(string) + **out = **in + } + } + if in.Version != nil { + in, out := &in.Version, &out.Version + if *in == nil { + *out = nil + } else { + *out = new(string) + **out = **in + } + } + if in.Tag != nil { + in, out := &in.Tag, &out.Tag + if *in == nil { + *out = nil + } else { + *out = new(string) + **out = **in + } + } + if in.SHA != nil { + in, out := &in.SHA, &out.SHA + if *in == nil { + *out = nil + } else { + *out = new(string) + **out = **in + } + } + if in.BaseImage != nil { + in, out := &in.BaseImage, &out.BaseImage + if *in == nil { + *out = nil + } else { + *out = new(string) + **out = **in + } + } + in.Resources.DeepCopyInto(&out.Resources) + if in.GCS != nil { + in, out := &in.GCS, &out.GCS + if *in == nil { + *out = nil + } else { + *out = new(ThanosGCSSpec) + (*in).DeepCopyInto(*out) + } + } + if in.S3 != nil { + in, out := &in.S3, &out.S3 + if *in == nil { + *out = nil + } else { + *out = new(ThanosS3Spec) + (*in).DeepCopyInto(*out) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ThanosSpec. +func (in *ThanosSpec) DeepCopy() *ThanosSpec { + if in == nil { + return nil + } + out := new(ThanosSpec) + in.DeepCopyInto(out) + return out +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/factory.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/factory.go new file mode 100644 index 0000000000..dbce27d46f --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/factory.go @@ -0,0 +1,178 @@ +// Copyright 2018 The prometheus-operator 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 informer-gen. DO NOT EDIT. + +package externalversions + +import ( + reflect "reflect" + sync "sync" + time "time" + + internalinterfaces "github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/internalinterfaces" + monitoring "github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/monitoring" + versioned "github.com/coreos/prometheus-operator/pkg/client/versioned" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" +) + +// SharedInformerOption defines the functional option type for SharedInformerFactory. +type SharedInformerOption func(*sharedInformerFactory) *sharedInformerFactory + +type sharedInformerFactory struct { + client versioned.Interface + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc + lock sync.Mutex + defaultResync time.Duration + customResync map[reflect.Type]time.Duration + + informers map[reflect.Type]cache.SharedIndexInformer + // startedInformers is used for tracking which informers have been started. + // This allows Start() to be called multiple times safely. + startedInformers map[reflect.Type]bool +} + +// WithCustomResyncConfig sets a custom resync period for the specified informer types. +func WithCustomResyncConfig(resyncConfig map[v1.Object]time.Duration) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + for k, v := range resyncConfig { + factory.customResync[reflect.TypeOf(k)] = v + } + return factory + } +} + +// WithTweakListOptions sets a custom filter on all listers of the configured SharedInformerFactory. +func WithTweakListOptions(tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + factory.tweakListOptions = tweakListOptions + return factory + } +} + +// WithNamespace limits the SharedInformerFactory to the specified namespace. +func WithNamespace(namespace string) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + factory.namespace = namespace + return factory + } +} + +// NewSharedInformerFactory constructs a new instance of sharedInformerFactory for all namespaces. +func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) SharedInformerFactory { + return NewSharedInformerFactoryWithOptions(client, defaultResync) +} + +// 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)) +} + +// NewSharedInformerFactoryWithOptions constructs a new instance of a SharedInformerFactory with additional options. +func NewSharedInformerFactoryWithOptions(client versioned.Interface, defaultResync time.Duration, options ...SharedInformerOption) SharedInformerFactory { + factory := &sharedInformerFactory{ + client: client, + namespace: v1.NamespaceAll, + defaultResync: defaultResync, + informers: make(map[reflect.Type]cache.SharedIndexInformer), + startedInformers: make(map[reflect.Type]bool), + customResync: make(map[reflect.Type]time.Duration), + } + + // Apply all options + for _, opt := range options { + factory = opt(factory) + } + + return factory +} + +// Start initializes all requested informers. +func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) { + f.lock.Lock() + defer f.lock.Unlock() + + for informerType, informer := range f.informers { + if !f.startedInformers[informerType] { + go informer.Run(stopCh) + f.startedInformers[informerType] = true + } + } +} + +// WaitForCacheSync waits for all started informers' cache were synced. +func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool { + informers := func() map[reflect.Type]cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informers := map[reflect.Type]cache.SharedIndexInformer{} + for informerType, informer := range f.informers { + if f.startedInformers[informerType] { + informers[informerType] = informer + } + } + return informers + }() + + res := map[reflect.Type]bool{} + for informType, informer := range informers { + res[informType] = cache.WaitForCacheSync(stopCh, informer.HasSynced) + } + return res +} + +// InternalInformerFor returns the SharedIndexInformer for obj using an internal +// client. +func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informerType := reflect.TypeOf(obj) + informer, exists := f.informers[informerType] + if exists { + return informer + } + + resyncPeriod, exists := f.customResync[informerType] + if !exists { + resyncPeriod = f.defaultResync + } + + informer = newFunc(f.client, resyncPeriod) + f.informers[informerType] = informer + + return informer +} + +// SharedInformerFactory provides shared informers for resources in all known +// API group versions. +type SharedInformerFactory interface { + internalinterfaces.SharedInformerFactory + ForResource(resource schema.GroupVersionResource) (GenericInformer, error) + WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool + + Monitoring() monitoring.Interface +} + +func (f *sharedInformerFactory) Monitoring() monitoring.Interface { + return monitoring.New(f, f.namespace, f.tweakListOptions) +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/generic.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/generic.go new file mode 100644 index 0000000000..a284f26718 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/generic.go @@ -0,0 +1,66 @@ +// Copyright 2018 The prometheus-operator 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 informer-gen. DO NOT EDIT. + +package externalversions + +import ( + "fmt" + + v1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" +) + +// GenericInformer is type of SharedIndexInformer which will locate and delegate to other +// sharedInformers based on type +type GenericInformer interface { + Informer() cache.SharedIndexInformer + Lister() cache.GenericLister +} + +type genericInformer struct { + informer cache.SharedIndexInformer + resource schema.GroupResource +} + +// Informer returns the SharedIndexInformer. +func (f *genericInformer) Informer() cache.SharedIndexInformer { + return f.informer +} + +// Lister returns the GenericLister. +func (f *genericInformer) Lister() cache.GenericLister { + return cache.NewGenericLister(f.Informer().GetIndexer(), f.resource) +} + +// ForResource gives generic access to a shared informer of the matching type +// TODO extend this to unknown resources with a client pool +func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { + switch resource { + // Group=monitoring.coreos.com, Version=v1 + case v1.SchemeGroupVersion.WithResource("alertmanagers"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Monitoring().V1().Alertmanagers().Informer()}, nil + case v1.SchemeGroupVersion.WithResource("prometheuses"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Monitoring().V1().Prometheuses().Informer()}, nil + case v1.SchemeGroupVersion.WithResource("prometheusrules"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Monitoring().V1().PrometheusRules().Informer()}, nil + case v1.SchemeGroupVersion.WithResource("servicemonitors"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Monitoring().V1().ServiceMonitors().Informer()}, nil + + } + + return nil, fmt.Errorf("no informer found for %v", resource) +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go new file mode 100644 index 0000000000..edbe533dcd --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -0,0 +1,36 @@ +// Copyright 2018 The prometheus-operator 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 informer-gen. DO NOT EDIT. + +package internalinterfaces + +import ( + time "time" + + versioned "github.com/coreos/prometheus-operator/pkg/client/versioned" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + cache "k8s.io/client-go/tools/cache" +) + +type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexInformer + +// SharedInformerFactory a small interface to allow for adding an informer without an import cycle +type SharedInformerFactory interface { + Start(stopCh <-chan struct{}) + InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer +} + +type TweakListOptionsFunc func(*v1.ListOptions) diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/monitoring/interface.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/monitoring/interface.go new file mode 100644 index 0000000000..0daf262b4f --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/monitoring/interface.go @@ -0,0 +1,44 @@ +// Copyright 2018 The prometheus-operator 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 informer-gen. DO NOT EDIT. + +package monitoring + +import ( + internalinterfaces "github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/internalinterfaces" + v1 "github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/monitoring/v1" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/monitoring/v1/alertmanager.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/monitoring/v1/alertmanager.go new file mode 100644 index 0000000000..f4b92c42ad --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/monitoring/v1/alertmanager.go @@ -0,0 +1,87 @@ +// Copyright 2018 The prometheus-operator 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + time "time" + + monitoring_v1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + internalinterfaces "github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/internalinterfaces" + v1 "github.com/coreos/prometheus-operator/pkg/client/listers/monitoring/v1" + versioned "github.com/coreos/prometheus-operator/pkg/client/versioned" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// AlertmanagerInformer provides access to a shared informer and lister for +// Alertmanagers. +type AlertmanagerInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.AlertmanagerLister +} + +type alertmanagerInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewAlertmanagerInformer constructs a new informer for Alertmanager type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewAlertmanagerInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredAlertmanagerInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredAlertmanagerInformer constructs a new informer for Alertmanager type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredAlertmanagerInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.MonitoringV1().Alertmanagers(namespace).List(options) + }, + WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.MonitoringV1().Alertmanagers(namespace).Watch(options) + }, + }, + &monitoring_v1.Alertmanager{}, + resyncPeriod, + indexers, + ) +} + +func (f *alertmanagerInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredAlertmanagerInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *alertmanagerInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&monitoring_v1.Alertmanager{}, f.defaultInformer) +} + +func (f *alertmanagerInformer) Lister() v1.AlertmanagerLister { + return v1.NewAlertmanagerLister(f.Informer().GetIndexer()) +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/monitoring/v1/interface.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/monitoring/v1/interface.go new file mode 100644 index 0000000000..05533da0c0 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/monitoring/v1/interface.go @@ -0,0 +1,64 @@ +// Copyright 2018 The prometheus-operator 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // Alertmanagers returns a AlertmanagerInformer. + Alertmanagers() AlertmanagerInformer + // Prometheuses returns a PrometheusInformer. + Prometheuses() PrometheusInformer + // PrometheusRules returns a PrometheusRuleInformer. + PrometheusRules() PrometheusRuleInformer + // ServiceMonitors returns a ServiceMonitorInformer. + ServiceMonitors() ServiceMonitorInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// Alertmanagers returns a AlertmanagerInformer. +func (v *version) Alertmanagers() AlertmanagerInformer { + return &alertmanagerInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Prometheuses returns a PrometheusInformer. +func (v *version) Prometheuses() PrometheusInformer { + return &prometheusInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// PrometheusRules returns a PrometheusRuleInformer. +func (v *version) PrometheusRules() PrometheusRuleInformer { + return &prometheusRuleInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// ServiceMonitors returns a ServiceMonitorInformer. +func (v *version) ServiceMonitors() ServiceMonitorInformer { + return &serviceMonitorInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/monitoring/v1/prometheus.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/monitoring/v1/prometheus.go new file mode 100644 index 0000000000..46caf6c257 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/monitoring/v1/prometheus.go @@ -0,0 +1,87 @@ +// Copyright 2018 The prometheus-operator 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + time "time" + + monitoring_v1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + internalinterfaces "github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/internalinterfaces" + v1 "github.com/coreos/prometheus-operator/pkg/client/listers/monitoring/v1" + versioned "github.com/coreos/prometheus-operator/pkg/client/versioned" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// PrometheusInformer provides access to a shared informer and lister for +// Prometheuses. +type PrometheusInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.PrometheusLister +} + +type prometheusInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewPrometheusInformer constructs a new informer for Prometheus type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPrometheusInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPrometheusInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredPrometheusInformer constructs a new informer for Prometheus type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPrometheusInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.MonitoringV1().Prometheuses(namespace).List(options) + }, + WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.MonitoringV1().Prometheuses(namespace).Watch(options) + }, + }, + &monitoring_v1.Prometheus{}, + resyncPeriod, + indexers, + ) +} + +func (f *prometheusInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPrometheusInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *prometheusInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&monitoring_v1.Prometheus{}, f.defaultInformer) +} + +func (f *prometheusInformer) Lister() v1.PrometheusLister { + return v1.NewPrometheusLister(f.Informer().GetIndexer()) +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/monitoring/v1/prometheusrule.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/monitoring/v1/prometheusrule.go new file mode 100644 index 0000000000..122d8e641a --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/monitoring/v1/prometheusrule.go @@ -0,0 +1,87 @@ +// Copyright 2018 The prometheus-operator 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + time "time" + + monitoring_v1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + internalinterfaces "github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/internalinterfaces" + v1 "github.com/coreos/prometheus-operator/pkg/client/listers/monitoring/v1" + versioned "github.com/coreos/prometheus-operator/pkg/client/versioned" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// PrometheusRuleInformer provides access to a shared informer and lister for +// PrometheusRules. +type PrometheusRuleInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.PrometheusRuleLister +} + +type prometheusRuleInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewPrometheusRuleInformer constructs a new informer for PrometheusRule type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPrometheusRuleInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPrometheusRuleInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredPrometheusRuleInformer constructs a new informer for PrometheusRule type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPrometheusRuleInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.MonitoringV1().PrometheusRules(namespace).List(options) + }, + WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.MonitoringV1().PrometheusRules(namespace).Watch(options) + }, + }, + &monitoring_v1.PrometheusRule{}, + resyncPeriod, + indexers, + ) +} + +func (f *prometheusRuleInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPrometheusRuleInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *prometheusRuleInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&monitoring_v1.PrometheusRule{}, f.defaultInformer) +} + +func (f *prometheusRuleInformer) Lister() v1.PrometheusRuleLister { + return v1.NewPrometheusRuleLister(f.Informer().GetIndexer()) +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/monitoring/v1/servicemonitor.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/monitoring/v1/servicemonitor.go new file mode 100644 index 0000000000..c9dd0ee414 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/monitoring/v1/servicemonitor.go @@ -0,0 +1,87 @@ +// Copyright 2018 The prometheus-operator 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 informer-gen. DO NOT EDIT. + +package v1 + +import ( + time "time" + + monitoring_v1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + internalinterfaces "github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/internalinterfaces" + v1 "github.com/coreos/prometheus-operator/pkg/client/listers/monitoring/v1" + versioned "github.com/coreos/prometheus-operator/pkg/client/versioned" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// ServiceMonitorInformer provides access to a shared informer and lister for +// ServiceMonitors. +type ServiceMonitorInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ServiceMonitorLister +} + +type serviceMonitorInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewServiceMonitorInformer constructs a new informer for ServiceMonitor type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewServiceMonitorInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredServiceMonitorInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredServiceMonitorInformer constructs a new informer for ServiceMonitor type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredServiceMonitorInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.MonitoringV1().ServiceMonitors(namespace).List(options) + }, + WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.MonitoringV1().ServiceMonitors(namespace).Watch(options) + }, + }, + &monitoring_v1.ServiceMonitor{}, + resyncPeriod, + indexers, + ) +} + +func (f *serviceMonitorInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredServiceMonitorInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *serviceMonitorInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&monitoring_v1.ServiceMonitor{}, f.defaultInformer) +} + +func (f *serviceMonitorInformer) Lister() v1.ServiceMonitorLister { + return v1.NewServiceMonitorLister(f.Informer().GetIndexer()) +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/listers/monitoring/v1/alertmanager.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/listers/monitoring/v1/alertmanager.go new file mode 100644 index 0000000000..dcc5ee7ffc --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/listers/monitoring/v1/alertmanager.go @@ -0,0 +1,92 @@ +// Copyright 2018 The prometheus-operator 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// AlertmanagerLister helps list Alertmanagers. +type AlertmanagerLister interface { + // List lists all Alertmanagers in the indexer. + List(selector labels.Selector) (ret []*v1.Alertmanager, err error) + // Alertmanagers returns an object that can list and get Alertmanagers. + Alertmanagers(namespace string) AlertmanagerNamespaceLister + AlertmanagerListerExpansion +} + +// alertmanagerLister implements the AlertmanagerLister interface. +type alertmanagerLister struct { + indexer cache.Indexer +} + +// NewAlertmanagerLister returns a new AlertmanagerLister. +func NewAlertmanagerLister(indexer cache.Indexer) AlertmanagerLister { + return &alertmanagerLister{indexer: indexer} +} + +// List lists all Alertmanagers in the indexer. +func (s *alertmanagerLister) List(selector labels.Selector) (ret []*v1.Alertmanager, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Alertmanager)) + }) + return ret, err +} + +// Alertmanagers returns an object that can list and get Alertmanagers. +func (s *alertmanagerLister) Alertmanagers(namespace string) AlertmanagerNamespaceLister { + return alertmanagerNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// AlertmanagerNamespaceLister helps list and get Alertmanagers. +type AlertmanagerNamespaceLister interface { + // List lists all Alertmanagers in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1.Alertmanager, err error) + // Get retrieves the Alertmanager from the indexer for a given namespace and name. + Get(name string) (*v1.Alertmanager, error) + AlertmanagerNamespaceListerExpansion +} + +// alertmanagerNamespaceLister implements the AlertmanagerNamespaceLister +// interface. +type alertmanagerNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Alertmanagers in the indexer for a given namespace. +func (s alertmanagerNamespaceLister) List(selector labels.Selector) (ret []*v1.Alertmanager, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Alertmanager)) + }) + return ret, err +} + +// Get retrieves the Alertmanager from the indexer for a given namespace and name. +func (s alertmanagerNamespaceLister) Get(name string) (*v1.Alertmanager, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("alertmanager"), name) + } + return obj.(*v1.Alertmanager), nil +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/listers/monitoring/v1/expansion_generated.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/listers/monitoring/v1/expansion_generated.go new file mode 100644 index 0000000000..9abc0af714 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/listers/monitoring/v1/expansion_generated.go @@ -0,0 +1,49 @@ +// Copyright 2018 The prometheus-operator 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 lister-gen. DO NOT EDIT. + +package v1 + +// AlertmanagerListerExpansion allows custom methods to be added to +// AlertmanagerLister. +type AlertmanagerListerExpansion interface{} + +// AlertmanagerNamespaceListerExpansion allows custom methods to be added to +// AlertmanagerNamespaceLister. +type AlertmanagerNamespaceListerExpansion interface{} + +// PrometheusListerExpansion allows custom methods to be added to +// PrometheusLister. +type PrometheusListerExpansion interface{} + +// PrometheusNamespaceListerExpansion allows custom methods to be added to +// PrometheusNamespaceLister. +type PrometheusNamespaceListerExpansion interface{} + +// PrometheusRuleListerExpansion allows custom methods to be added to +// PrometheusRuleLister. +type PrometheusRuleListerExpansion interface{} + +// PrometheusRuleNamespaceListerExpansion allows custom methods to be added to +// PrometheusRuleNamespaceLister. +type PrometheusRuleNamespaceListerExpansion interface{} + +// ServiceMonitorListerExpansion allows custom methods to be added to +// ServiceMonitorLister. +type ServiceMonitorListerExpansion interface{} + +// ServiceMonitorNamespaceListerExpansion allows custom methods to be added to +// ServiceMonitorNamespaceLister. +type ServiceMonitorNamespaceListerExpansion interface{} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/listers/monitoring/v1/prometheus.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/listers/monitoring/v1/prometheus.go new file mode 100644 index 0000000000..d89d1d2e2a --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/listers/monitoring/v1/prometheus.go @@ -0,0 +1,92 @@ +// Copyright 2018 The prometheus-operator 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// PrometheusLister helps list Prometheuses. +type PrometheusLister interface { + // List lists all Prometheuses in the indexer. + List(selector labels.Selector) (ret []*v1.Prometheus, err error) + // Prometheuses returns an object that can list and get Prometheuses. + Prometheuses(namespace string) PrometheusNamespaceLister + PrometheusListerExpansion +} + +// prometheusLister implements the PrometheusLister interface. +type prometheusLister struct { + indexer cache.Indexer +} + +// NewPrometheusLister returns a new PrometheusLister. +func NewPrometheusLister(indexer cache.Indexer) PrometheusLister { + return &prometheusLister{indexer: indexer} +} + +// List lists all Prometheuses in the indexer. +func (s *prometheusLister) List(selector labels.Selector) (ret []*v1.Prometheus, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Prometheus)) + }) + return ret, err +} + +// Prometheuses returns an object that can list and get Prometheuses. +func (s *prometheusLister) Prometheuses(namespace string) PrometheusNamespaceLister { + return prometheusNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// PrometheusNamespaceLister helps list and get Prometheuses. +type PrometheusNamespaceLister interface { + // List lists all Prometheuses in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1.Prometheus, err error) + // Get retrieves the Prometheus from the indexer for a given namespace and name. + Get(name string) (*v1.Prometheus, error) + PrometheusNamespaceListerExpansion +} + +// prometheusNamespaceLister implements the PrometheusNamespaceLister +// interface. +type prometheusNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Prometheuses in the indexer for a given namespace. +func (s prometheusNamespaceLister) List(selector labels.Selector) (ret []*v1.Prometheus, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Prometheus)) + }) + return ret, err +} + +// Get retrieves the Prometheus from the indexer for a given namespace and name. +func (s prometheusNamespaceLister) Get(name string) (*v1.Prometheus, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("prometheus"), name) + } + return obj.(*v1.Prometheus), nil +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/listers/monitoring/v1/prometheusrule.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/listers/monitoring/v1/prometheusrule.go new file mode 100644 index 0000000000..b55bed8d14 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/listers/monitoring/v1/prometheusrule.go @@ -0,0 +1,92 @@ +// Copyright 2018 The prometheus-operator 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// PrometheusRuleLister helps list PrometheusRules. +type PrometheusRuleLister interface { + // List lists all PrometheusRules in the indexer. + List(selector labels.Selector) (ret []*v1.PrometheusRule, err error) + // PrometheusRules returns an object that can list and get PrometheusRules. + PrometheusRules(namespace string) PrometheusRuleNamespaceLister + PrometheusRuleListerExpansion +} + +// prometheusRuleLister implements the PrometheusRuleLister interface. +type prometheusRuleLister struct { + indexer cache.Indexer +} + +// NewPrometheusRuleLister returns a new PrometheusRuleLister. +func NewPrometheusRuleLister(indexer cache.Indexer) PrometheusRuleLister { + return &prometheusRuleLister{indexer: indexer} +} + +// List lists all PrometheusRules in the indexer. +func (s *prometheusRuleLister) List(selector labels.Selector) (ret []*v1.PrometheusRule, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.PrometheusRule)) + }) + return ret, err +} + +// PrometheusRules returns an object that can list and get PrometheusRules. +func (s *prometheusRuleLister) PrometheusRules(namespace string) PrometheusRuleNamespaceLister { + return prometheusRuleNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// PrometheusRuleNamespaceLister helps list and get PrometheusRules. +type PrometheusRuleNamespaceLister interface { + // List lists all PrometheusRules in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1.PrometheusRule, err error) + // Get retrieves the PrometheusRule from the indexer for a given namespace and name. + Get(name string) (*v1.PrometheusRule, error) + PrometheusRuleNamespaceListerExpansion +} + +// prometheusRuleNamespaceLister implements the PrometheusRuleNamespaceLister +// interface. +type prometheusRuleNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all PrometheusRules in the indexer for a given namespace. +func (s prometheusRuleNamespaceLister) List(selector labels.Selector) (ret []*v1.PrometheusRule, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.PrometheusRule)) + }) + return ret, err +} + +// Get retrieves the PrometheusRule from the indexer for a given namespace and name. +func (s prometheusRuleNamespaceLister) Get(name string) (*v1.PrometheusRule, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("prometheusrule"), name) + } + return obj.(*v1.PrometheusRule), nil +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/listers/monitoring/v1/servicemonitor.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/listers/monitoring/v1/servicemonitor.go new file mode 100644 index 0000000000..4864592f6e --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/listers/monitoring/v1/servicemonitor.go @@ -0,0 +1,92 @@ +// Copyright 2018 The prometheus-operator 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 lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ServiceMonitorLister helps list ServiceMonitors. +type ServiceMonitorLister interface { + // List lists all ServiceMonitors in the indexer. + List(selector labels.Selector) (ret []*v1.ServiceMonitor, err error) + // ServiceMonitors returns an object that can list and get ServiceMonitors. + ServiceMonitors(namespace string) ServiceMonitorNamespaceLister + ServiceMonitorListerExpansion +} + +// serviceMonitorLister implements the ServiceMonitorLister interface. +type serviceMonitorLister struct { + indexer cache.Indexer +} + +// NewServiceMonitorLister returns a new ServiceMonitorLister. +func NewServiceMonitorLister(indexer cache.Indexer) ServiceMonitorLister { + return &serviceMonitorLister{indexer: indexer} +} + +// List lists all ServiceMonitors in the indexer. +func (s *serviceMonitorLister) List(selector labels.Selector) (ret []*v1.ServiceMonitor, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ServiceMonitor)) + }) + return ret, err +} + +// ServiceMonitors returns an object that can list and get ServiceMonitors. +func (s *serviceMonitorLister) ServiceMonitors(namespace string) ServiceMonitorNamespaceLister { + return serviceMonitorNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ServiceMonitorNamespaceLister helps list and get ServiceMonitors. +type ServiceMonitorNamespaceLister interface { + // List lists all ServiceMonitors in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1.ServiceMonitor, err error) + // Get retrieves the ServiceMonitor from the indexer for a given namespace and name. + Get(name string) (*v1.ServiceMonitor, error) + ServiceMonitorNamespaceListerExpansion +} + +// serviceMonitorNamespaceLister implements the ServiceMonitorNamespaceLister +// interface. +type serviceMonitorNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ServiceMonitors in the indexer for a given namespace. +func (s serviceMonitorNamespaceLister) List(selector labels.Selector) (ret []*v1.ServiceMonitor, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ServiceMonitor)) + }) + return ret, err +} + +// Get retrieves the ServiceMonitor from the indexer for a given namespace and name. +func (s serviceMonitorNamespaceLister) Get(name string) (*v1.ServiceMonitor, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("servicemonitor"), name) + } + return obj.(*v1.ServiceMonitor), nil +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/clientset.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/clientset.go new file mode 100644 index 0000000000..65bcd3f50d --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/clientset.go @@ -0,0 +1,96 @@ +// Copyright 2018 The prometheus-operator 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 client-gen. DO NOT EDIT. + +package versioned + +import ( + monitoringv1 "github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1" + discovery "k8s.io/client-go/discovery" + rest "k8s.io/client-go/rest" + flowcontrol "k8s.io/client-go/util/flowcontrol" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + MonitoringV1() monitoringv1.MonitoringV1Interface + // Deprecated: please explicitly pick a version if possible. + Monitoring() monitoringv1.MonitoringV1Interface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *discovery.DiscoveryClient + monitoringV1 *monitoringv1.MonitoringV1Client +} + +// MonitoringV1 retrieves the MonitoringV1Client +func (c *Clientset) MonitoringV1() monitoringv1.MonitoringV1Interface { + return c.monitoringV1 +} + +// Deprecated: Monitoring retrieves the default version of MonitoringClient. +// Please explicitly pick a version. +func (c *Clientset) Monitoring() monitoringv1.MonitoringV1Interface { + return c.monitoringV1 +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + if c == nil { + return nil + } + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +func NewForConfig(c *rest.Config) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + var cs Clientset + var err error + cs.monitoringV1, err = monitoringv1.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + + cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + return &cs, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *Clientset { + var cs Clientset + cs.monitoringV1 = monitoringv1.NewForConfigOrDie(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) + return &cs +} + +// New creates a new Clientset for the given RESTClient. +func New(c rest.Interface) *Clientset { + var cs Clientset + cs.monitoringV1 = monitoringv1.New(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &cs +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/doc.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/doc.go new file mode 100644 index 0000000000..864d1ee957 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/doc.go @@ -0,0 +1,18 @@ +// Copyright 2018 The prometheus-operator 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 client-gen. DO NOT EDIT. + +// This package has the automatically generated clientset. +package versioned diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/fake/clientset_generated.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/fake/clientset_generated.go new file mode 100644 index 0000000000..9793e92875 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/fake/clientset_generated.go @@ -0,0 +1,80 @@ +// Copyright 2018 The prometheus-operator 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 client-gen. DO NOT EDIT. + +package fake + +import ( + clientset "github.com/coreos/prometheus-operator/pkg/client/versioned" + monitoringv1 "github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1" + fakemonitoringv1 "github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/fake" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/discovery" + fakediscovery "k8s.io/client-go/discovery/fake" + "k8s.io/client-go/testing" +) + +// 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, +// 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 NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + cs := &Clientset{} + cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake} + cs.AddReactor("*", "*", testing.ObjectReaction(o)) + cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) { + gvr := action.GetResource() + ns := action.GetNamespace() + watch, err := o.Watch(gvr, ns) + if err != nil { + return false, nil, err + } + return true, watch, nil + }) + + return cs +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + testing.Fake + discovery *fakediscovery.FakeDiscovery +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.discovery +} + +var _ clientset.Interface = &Clientset{} + +// MonitoringV1 retrieves the MonitoringV1Client +func (c *Clientset) MonitoringV1() monitoringv1.MonitoringV1Interface { + return &fakemonitoringv1.FakeMonitoringV1{Fake: &c.Fake} +} + +// Monitoring retrieves the MonitoringV1Client +func (c *Clientset) Monitoring() monitoringv1.MonitoringV1Interface { + return &fakemonitoringv1.FakeMonitoringV1{Fake: &c.Fake} +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/fake/doc.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/fake/doc.go new file mode 100644 index 0000000000..1966456031 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/fake/doc.go @@ -0,0 +1,18 @@ +// Copyright 2018 The prometheus-operator 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 client-gen. DO NOT EDIT. + +// This package has the automatically generated fake clientset. +package fake diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/fake/register.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/fake/register.go new file mode 100644 index 0000000000..a367c69067 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/fake/register.go @@ -0,0 +1,52 @@ +// Copyright 2018 The prometheus-operator 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 client-gen. DO NOT EDIT. + +package fake + +import ( + monitoringv1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" +) + +var scheme = runtime.NewScheme() +var codecs = serializer.NewCodecFactory(scheme) +var parameterCodec = runtime.NewParameterCodec(scheme) + +func init() { + v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) + AddToScheme(scheme) +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +func AddToScheme(scheme *runtime.Scheme) { + monitoringv1.AddToScheme(scheme) +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/scheme/doc.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/scheme/doc.go new file mode 100644 index 0000000000..ff8997207d --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/scheme/doc.go @@ -0,0 +1,18 @@ +// Copyright 2018 The prometheus-operator 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 client-gen. DO NOT EDIT. + +// This package contains the scheme of the automatically generated clientset. +package scheme diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/scheme/register.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/scheme/register.go new file mode 100644 index 0000000000..2fbbd18bbc --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/scheme/register.go @@ -0,0 +1,52 @@ +// Copyright 2018 The prometheus-operator 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 client-gen. DO NOT EDIT. + +package scheme + +import ( + monitoringv1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" +) + +var Scheme = runtime.NewScheme() +var Codecs = serializer.NewCodecFactory(Scheme) +var ParameterCodec = runtime.NewParameterCodec(Scheme) + +func init() { + v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) + AddToScheme(Scheme) +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +func AddToScheme(scheme *runtime.Scheme) { + monitoringv1.AddToScheme(scheme) +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/alertmanager.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/alertmanager.go new file mode 100644 index 0000000000..3aee46abd8 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/alertmanager.go @@ -0,0 +1,172 @@ +// Copyright 2018 The prometheus-operator 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 client-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + scheme "github.com/coreos/prometheus-operator/pkg/client/versioned/scheme" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// AlertmanagersGetter has a method to return a AlertmanagerInterface. +// A group's client should implement this interface. +type AlertmanagersGetter interface { + Alertmanagers(namespace string) AlertmanagerInterface +} + +// AlertmanagerInterface has methods to work with Alertmanager resources. +type AlertmanagerInterface interface { + Create(*v1.Alertmanager) (*v1.Alertmanager, error) + Update(*v1.Alertmanager) (*v1.Alertmanager, error) + UpdateStatus(*v1.Alertmanager) (*v1.Alertmanager, error) + Delete(name string, options *meta_v1.DeleteOptions) error + DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error + Get(name string, options meta_v1.GetOptions) (*v1.Alertmanager, error) + List(opts meta_v1.ListOptions) (*v1.AlertmanagerList, error) + Watch(opts meta_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Alertmanager, err error) + AlertmanagerExpansion +} + +// alertmanagers implements AlertmanagerInterface +type alertmanagers struct { + client rest.Interface + ns string +} + +// newAlertmanagers returns a Alertmanagers +func newAlertmanagers(c *MonitoringV1Client, namespace string) *alertmanagers { + return &alertmanagers{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the alertmanager, and returns the corresponding alertmanager object, and an error if there is any. +func (c *alertmanagers) Get(name string, options meta_v1.GetOptions) (result *v1.Alertmanager, err error) { + result = &v1.Alertmanager{} + err = c.client.Get(). + Namespace(c.ns). + Resource("alertmanagers"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Alertmanagers that match those selectors. +func (c *alertmanagers) List(opts meta_v1.ListOptions) (result *v1.AlertmanagerList, err error) { + result = &v1.AlertmanagerList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("alertmanagers"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested alertmanagers. +func (c *alertmanagers) Watch(opts meta_v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("alertmanagers"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a alertmanager and creates it. Returns the server's representation of the alertmanager, and an error, if there is any. +func (c *alertmanagers) Create(alertmanager *v1.Alertmanager) (result *v1.Alertmanager, err error) { + result = &v1.Alertmanager{} + err = c.client.Post(). + Namespace(c.ns). + Resource("alertmanagers"). + Body(alertmanager). + Do(). + Into(result) + return +} + +// Update takes the representation of a alertmanager and updates it. Returns the server's representation of the alertmanager, and an error, if there is any. +func (c *alertmanagers) Update(alertmanager *v1.Alertmanager) (result *v1.Alertmanager, err error) { + result = &v1.Alertmanager{} + err = c.client.Put(). + Namespace(c.ns). + Resource("alertmanagers"). + Name(alertmanager.Name). + Body(alertmanager). + Do(). + 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 *alertmanagers) UpdateStatus(alertmanager *v1.Alertmanager) (result *v1.Alertmanager, err error) { + result = &v1.Alertmanager{} + err = c.client.Put(). + Namespace(c.ns). + Resource("alertmanagers"). + Name(alertmanager.Name). + SubResource("status"). + Body(alertmanager). + Do(). + Into(result) + return +} + +// Delete takes name of the alertmanager and deletes it. Returns an error if one occurs. +func (c *alertmanagers) Delete(name string, options *meta_v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("alertmanagers"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *alertmanagers) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("alertmanagers"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched alertmanager. +func (c *alertmanagers) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Alertmanager, err error) { + result = &v1.Alertmanager{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("alertmanagers"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/doc.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/doc.go new file mode 100644 index 0000000000..7938dcdd2c --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/doc.go @@ -0,0 +1,18 @@ +// Copyright 2018 The prometheus-operator 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 client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1 diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/fake/doc.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/fake/doc.go new file mode 100644 index 0000000000..04062e3f3a --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/fake/doc.go @@ -0,0 +1,18 @@ +// Copyright 2018 The prometheus-operator 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 client-gen. DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/fake/fake_alertmanager.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/fake/fake_alertmanager.go new file mode 100644 index 0000000000..18bb1e9c60 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/fake/fake_alertmanager.go @@ -0,0 +1,138 @@ +// Copyright 2018 The prometheus-operator 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 client-gen. DO NOT EDIT. + +package fake + +import ( + monitoring_v1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeAlertmanagers implements AlertmanagerInterface +type FakeAlertmanagers struct { + Fake *FakeMonitoringV1 + ns string +} + +var alertmanagersResource = schema.GroupVersionResource{Group: "monitoring.coreos.com", Version: "v1", Resource: "alertmanagers"} + +var alertmanagersKind = schema.GroupVersionKind{Group: "monitoring.coreos.com", Version: "v1", Kind: "Alertmanager"} + +// Get takes name of the alertmanager, and returns the corresponding alertmanager object, and an error if there is any. +func (c *FakeAlertmanagers) Get(name string, options v1.GetOptions) (result *monitoring_v1.Alertmanager, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(alertmanagersResource, c.ns, name), &monitoring_v1.Alertmanager{}) + + if obj == nil { + return nil, err + } + return obj.(*monitoring_v1.Alertmanager), err +} + +// List takes label and field selectors, and returns the list of Alertmanagers that match those selectors. +func (c *FakeAlertmanagers) List(opts v1.ListOptions) (result *monitoring_v1.AlertmanagerList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(alertmanagersResource, alertmanagersKind, c.ns, opts), &monitoring_v1.AlertmanagerList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &monitoring_v1.AlertmanagerList{ListMeta: obj.(*monitoring_v1.AlertmanagerList).ListMeta} + for _, item := range obj.(*monitoring_v1.AlertmanagerList).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 alertmanagers. +func (c *FakeAlertmanagers) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(alertmanagersResource, c.ns, opts)) + +} + +// Create takes the representation of a alertmanager and creates it. Returns the server's representation of the alertmanager, and an error, if there is any. +func (c *FakeAlertmanagers) Create(alertmanager *monitoring_v1.Alertmanager) (result *monitoring_v1.Alertmanager, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(alertmanagersResource, c.ns, alertmanager), &monitoring_v1.Alertmanager{}) + + if obj == nil { + return nil, err + } + return obj.(*monitoring_v1.Alertmanager), err +} + +// Update takes the representation of a alertmanager and updates it. Returns the server's representation of the alertmanager, and an error, if there is any. +func (c *FakeAlertmanagers) Update(alertmanager *monitoring_v1.Alertmanager) (result *monitoring_v1.Alertmanager, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(alertmanagersResource, c.ns, alertmanager), &monitoring_v1.Alertmanager{}) + + if obj == nil { + return nil, err + } + return obj.(*monitoring_v1.Alertmanager), 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 *FakeAlertmanagers) UpdateStatus(alertmanager *monitoring_v1.Alertmanager) (*monitoring_v1.Alertmanager, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(alertmanagersResource, "status", c.ns, alertmanager), &monitoring_v1.Alertmanager{}) + + if obj == nil { + return nil, err + } + return obj.(*monitoring_v1.Alertmanager), err +} + +// Delete takes name of the alertmanager and deletes it. Returns an error if one occurs. +func (c *FakeAlertmanagers) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(alertmanagersResource, c.ns, name), &monitoring_v1.Alertmanager{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeAlertmanagers) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(alertmanagersResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &monitoring_v1.AlertmanagerList{}) + return err +} + +// Patch applies the patch and returns the patched alertmanager. +func (c *FakeAlertmanagers) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *monitoring_v1.Alertmanager, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(alertmanagersResource, c.ns, name, data, subresources...), &monitoring_v1.Alertmanager{}) + + if obj == nil { + return nil, err + } + return obj.(*monitoring_v1.Alertmanager), err +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/fake/fake_monitoring_client.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/fake/fake_monitoring_client.go new file mode 100644 index 0000000000..71d7ee8f6f --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/fake/fake_monitoring_client.go @@ -0,0 +1,50 @@ +// Copyright 2018 The prometheus-operator 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 client-gen. DO NOT EDIT. + +package fake + +import ( + v1 "github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeMonitoringV1 struct { + *testing.Fake +} + +func (c *FakeMonitoringV1) Alertmanagers(namespace string) v1.AlertmanagerInterface { + return &FakeAlertmanagers{c, namespace} +} + +func (c *FakeMonitoringV1) Prometheuses(namespace string) v1.PrometheusInterface { + return &FakePrometheuses{c, namespace} +} + +func (c *FakeMonitoringV1) PrometheusRules(namespace string) v1.PrometheusRuleInterface { + return &FakePrometheusRules{c, namespace} +} + +func (c *FakeMonitoringV1) ServiceMonitors(namespace string) v1.ServiceMonitorInterface { + return &FakeServiceMonitors{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeMonitoringV1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/fake/fake_prometheus.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/fake/fake_prometheus.go new file mode 100644 index 0000000000..5dc4eb2082 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/fake/fake_prometheus.go @@ -0,0 +1,138 @@ +// Copyright 2018 The prometheus-operator 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 client-gen. DO NOT EDIT. + +package fake + +import ( + monitoring_v1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakePrometheuses implements PrometheusInterface +type FakePrometheuses struct { + Fake *FakeMonitoringV1 + ns string +} + +var prometheusesResource = schema.GroupVersionResource{Group: "monitoring.coreos.com", Version: "v1", Resource: "prometheuses"} + +var prometheusesKind = schema.GroupVersionKind{Group: "monitoring.coreos.com", Version: "v1", Kind: "Prometheus"} + +// Get takes name of the prometheus, and returns the corresponding prometheus object, and an error if there is any. +func (c *FakePrometheuses) Get(name string, options v1.GetOptions) (result *monitoring_v1.Prometheus, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(prometheusesResource, c.ns, name), &monitoring_v1.Prometheus{}) + + if obj == nil { + return nil, err + } + return obj.(*monitoring_v1.Prometheus), err +} + +// List takes label and field selectors, and returns the list of Prometheuses that match those selectors. +func (c *FakePrometheuses) List(opts v1.ListOptions) (result *monitoring_v1.PrometheusList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(prometheusesResource, prometheusesKind, c.ns, opts), &monitoring_v1.PrometheusList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &monitoring_v1.PrometheusList{ListMeta: obj.(*monitoring_v1.PrometheusList).ListMeta} + for _, item := range obj.(*monitoring_v1.PrometheusList).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 prometheuses. +func (c *FakePrometheuses) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(prometheusesResource, c.ns, opts)) + +} + +// Create takes the representation of a prometheus and creates it. Returns the server's representation of the prometheus, and an error, if there is any. +func (c *FakePrometheuses) Create(prometheus *monitoring_v1.Prometheus) (result *monitoring_v1.Prometheus, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(prometheusesResource, c.ns, prometheus), &monitoring_v1.Prometheus{}) + + if obj == nil { + return nil, err + } + return obj.(*monitoring_v1.Prometheus), err +} + +// Update takes the representation of a prometheus and updates it. Returns the server's representation of the prometheus, and an error, if there is any. +func (c *FakePrometheuses) Update(prometheus *monitoring_v1.Prometheus) (result *monitoring_v1.Prometheus, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(prometheusesResource, c.ns, prometheus), &monitoring_v1.Prometheus{}) + + if obj == nil { + return nil, err + } + return obj.(*monitoring_v1.Prometheus), 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 *FakePrometheuses) UpdateStatus(prometheus *monitoring_v1.Prometheus) (*monitoring_v1.Prometheus, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(prometheusesResource, "status", c.ns, prometheus), &monitoring_v1.Prometheus{}) + + if obj == nil { + return nil, err + } + return obj.(*monitoring_v1.Prometheus), err +} + +// Delete takes name of the prometheus and deletes it. Returns an error if one occurs. +func (c *FakePrometheuses) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(prometheusesResource, c.ns, name), &monitoring_v1.Prometheus{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakePrometheuses) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(prometheusesResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &monitoring_v1.PrometheusList{}) + return err +} + +// Patch applies the patch and returns the patched prometheus. +func (c *FakePrometheuses) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *monitoring_v1.Prometheus, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(prometheusesResource, c.ns, name, data, subresources...), &monitoring_v1.Prometheus{}) + + if obj == nil { + return nil, err + } + return obj.(*monitoring_v1.Prometheus), err +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/fake/fake_prometheusrule.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/fake/fake_prometheusrule.go new file mode 100644 index 0000000000..4ad2b53790 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/fake/fake_prometheusrule.go @@ -0,0 +1,126 @@ +// Copyright 2018 The prometheus-operator 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 client-gen. DO NOT EDIT. + +package fake + +import ( + monitoring_v1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakePrometheusRules implements PrometheusRuleInterface +type FakePrometheusRules struct { + Fake *FakeMonitoringV1 + ns string +} + +var prometheusrulesResource = schema.GroupVersionResource{Group: "monitoring.coreos.com", Version: "v1", Resource: "prometheusrules"} + +var prometheusrulesKind = schema.GroupVersionKind{Group: "monitoring.coreos.com", Version: "v1", Kind: "PrometheusRule"} + +// Get takes name of the prometheusRule, and returns the corresponding prometheusRule object, and an error if there is any. +func (c *FakePrometheusRules) Get(name string, options v1.GetOptions) (result *monitoring_v1.PrometheusRule, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(prometheusrulesResource, c.ns, name), &monitoring_v1.PrometheusRule{}) + + if obj == nil { + return nil, err + } + return obj.(*monitoring_v1.PrometheusRule), err +} + +// List takes label and field selectors, and returns the list of PrometheusRules that match those selectors. +func (c *FakePrometheusRules) List(opts v1.ListOptions) (result *monitoring_v1.PrometheusRuleList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(prometheusrulesResource, prometheusrulesKind, c.ns, opts), &monitoring_v1.PrometheusRuleList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &monitoring_v1.PrometheusRuleList{ListMeta: obj.(*monitoring_v1.PrometheusRuleList).ListMeta} + for _, item := range obj.(*monitoring_v1.PrometheusRuleList).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 prometheusRules. +func (c *FakePrometheusRules) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(prometheusrulesResource, c.ns, opts)) + +} + +// Create takes the representation of a prometheusRule and creates it. Returns the server's representation of the prometheusRule, and an error, if there is any. +func (c *FakePrometheusRules) Create(prometheusRule *monitoring_v1.PrometheusRule) (result *monitoring_v1.PrometheusRule, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(prometheusrulesResource, c.ns, prometheusRule), &monitoring_v1.PrometheusRule{}) + + if obj == nil { + return nil, err + } + return obj.(*monitoring_v1.PrometheusRule), err +} + +// Update takes the representation of a prometheusRule and updates it. Returns the server's representation of the prometheusRule, and an error, if there is any. +func (c *FakePrometheusRules) Update(prometheusRule *monitoring_v1.PrometheusRule) (result *monitoring_v1.PrometheusRule, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(prometheusrulesResource, c.ns, prometheusRule), &monitoring_v1.PrometheusRule{}) + + if obj == nil { + return nil, err + } + return obj.(*monitoring_v1.PrometheusRule), err +} + +// Delete takes name of the prometheusRule and deletes it. Returns an error if one occurs. +func (c *FakePrometheusRules) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(prometheusrulesResource, c.ns, name), &monitoring_v1.PrometheusRule{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakePrometheusRules) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(prometheusrulesResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &monitoring_v1.PrometheusRuleList{}) + return err +} + +// Patch applies the patch and returns the patched prometheusRule. +func (c *FakePrometheusRules) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *monitoring_v1.PrometheusRule, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(prometheusrulesResource, c.ns, name, data, subresources...), &monitoring_v1.PrometheusRule{}) + + if obj == nil { + return nil, err + } + return obj.(*monitoring_v1.PrometheusRule), err +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/fake/fake_servicemonitor.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/fake/fake_servicemonitor.go new file mode 100644 index 0000000000..9ea2b24d09 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/fake/fake_servicemonitor.go @@ -0,0 +1,126 @@ +// Copyright 2018 The prometheus-operator 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 client-gen. DO NOT EDIT. + +package fake + +import ( + monitoring_v1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeServiceMonitors implements ServiceMonitorInterface +type FakeServiceMonitors struct { + Fake *FakeMonitoringV1 + ns string +} + +var servicemonitorsResource = schema.GroupVersionResource{Group: "monitoring.coreos.com", Version: "v1", Resource: "servicemonitors"} + +var servicemonitorsKind = schema.GroupVersionKind{Group: "monitoring.coreos.com", Version: "v1", Kind: "ServiceMonitor"} + +// Get takes name of the serviceMonitor, and returns the corresponding serviceMonitor object, and an error if there is any. +func (c *FakeServiceMonitors) Get(name string, options v1.GetOptions) (result *monitoring_v1.ServiceMonitor, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(servicemonitorsResource, c.ns, name), &monitoring_v1.ServiceMonitor{}) + + if obj == nil { + return nil, err + } + return obj.(*monitoring_v1.ServiceMonitor), err +} + +// List takes label and field selectors, and returns the list of ServiceMonitors that match those selectors. +func (c *FakeServiceMonitors) List(opts v1.ListOptions) (result *monitoring_v1.ServiceMonitorList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(servicemonitorsResource, servicemonitorsKind, c.ns, opts), &monitoring_v1.ServiceMonitorList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &monitoring_v1.ServiceMonitorList{ListMeta: obj.(*monitoring_v1.ServiceMonitorList).ListMeta} + for _, item := range obj.(*monitoring_v1.ServiceMonitorList).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 serviceMonitors. +func (c *FakeServiceMonitors) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(servicemonitorsResource, c.ns, opts)) + +} + +// Create takes the representation of a serviceMonitor and creates it. Returns the server's representation of the serviceMonitor, and an error, if there is any. +func (c *FakeServiceMonitors) Create(serviceMonitor *monitoring_v1.ServiceMonitor) (result *monitoring_v1.ServiceMonitor, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(servicemonitorsResource, c.ns, serviceMonitor), &monitoring_v1.ServiceMonitor{}) + + if obj == nil { + return nil, err + } + return obj.(*monitoring_v1.ServiceMonitor), err +} + +// Update takes the representation of a serviceMonitor and updates it. Returns the server's representation of the serviceMonitor, and an error, if there is any. +func (c *FakeServiceMonitors) Update(serviceMonitor *monitoring_v1.ServiceMonitor) (result *monitoring_v1.ServiceMonitor, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(servicemonitorsResource, c.ns, serviceMonitor), &monitoring_v1.ServiceMonitor{}) + + if obj == nil { + return nil, err + } + return obj.(*monitoring_v1.ServiceMonitor), err +} + +// Delete takes name of the serviceMonitor and deletes it. Returns an error if one occurs. +func (c *FakeServiceMonitors) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(servicemonitorsResource, c.ns, name), &monitoring_v1.ServiceMonitor{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeServiceMonitors) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(servicemonitorsResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &monitoring_v1.ServiceMonitorList{}) + return err +} + +// Patch applies the patch and returns the patched serviceMonitor. +func (c *FakeServiceMonitors) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *monitoring_v1.ServiceMonitor, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(servicemonitorsResource, c.ns, name, data, subresources...), &monitoring_v1.ServiceMonitor{}) + + if obj == nil { + return nil, err + } + return obj.(*monitoring_v1.ServiceMonitor), err +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/generated_expansion.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/generated_expansion.go new file mode 100644 index 0000000000..88cf4ce921 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/generated_expansion.go @@ -0,0 +1,25 @@ +// Copyright 2018 The prometheus-operator 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 client-gen. DO NOT EDIT. + +package v1 + +type AlertmanagerExpansion interface{} + +type PrometheusExpansion interface{} + +type PrometheusRuleExpansion interface{} + +type ServiceMonitorExpansion interface{} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/monitoring_client.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/monitoring_client.go new file mode 100644 index 0000000000..6e5bac92b2 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/monitoring_client.go @@ -0,0 +1,103 @@ +// Copyright 2018 The prometheus-operator 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 client-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + "github.com/coreos/prometheus-operator/pkg/client/versioned/scheme" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + rest "k8s.io/client-go/rest" +) + +type MonitoringV1Interface interface { + RESTClient() rest.Interface + AlertmanagersGetter + PrometheusesGetter + PrometheusRulesGetter + ServiceMonitorsGetter +} + +// MonitoringV1Client is used to interact with features provided by the monitoring.coreos.com group. +type MonitoringV1Client struct { + restClient rest.Interface +} + +func (c *MonitoringV1Client) Alertmanagers(namespace string) AlertmanagerInterface { + return newAlertmanagers(c, namespace) +} + +func (c *MonitoringV1Client) Prometheuses(namespace string) PrometheusInterface { + return newPrometheuses(c, namespace) +} + +func (c *MonitoringV1Client) PrometheusRules(namespace string) PrometheusRuleInterface { + return newPrometheusRules(c, namespace) +} + +func (c *MonitoringV1Client) ServiceMonitors(namespace string) ServiceMonitorInterface { + return newServiceMonitors(c, namespace) +} + +// NewForConfig creates a new MonitoringV1Client for the given config. +func NewForConfig(c *rest.Config) (*MonitoringV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &MonitoringV1Client{client}, nil +} + +// NewForConfigOrDie creates a new MonitoringV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *MonitoringV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new MonitoringV1Client for the given RESTClient. +func New(c rest.Interface) *MonitoringV1Client { + return &MonitoringV1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs} + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *MonitoringV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/prometheus.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/prometheus.go new file mode 100644 index 0000000000..2e572b1b7a --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/prometheus.go @@ -0,0 +1,172 @@ +// Copyright 2018 The prometheus-operator 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 client-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + scheme "github.com/coreos/prometheus-operator/pkg/client/versioned/scheme" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// PrometheusesGetter has a method to return a PrometheusInterface. +// A group's client should implement this interface. +type PrometheusesGetter interface { + Prometheuses(namespace string) PrometheusInterface +} + +// PrometheusInterface has methods to work with Prometheus resources. +type PrometheusInterface interface { + Create(*v1.Prometheus) (*v1.Prometheus, error) + Update(*v1.Prometheus) (*v1.Prometheus, error) + UpdateStatus(*v1.Prometheus) (*v1.Prometheus, error) + Delete(name string, options *meta_v1.DeleteOptions) error + DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error + Get(name string, options meta_v1.GetOptions) (*v1.Prometheus, error) + List(opts meta_v1.ListOptions) (*v1.PrometheusList, error) + Watch(opts meta_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Prometheus, err error) + PrometheusExpansion +} + +// prometheuses implements PrometheusInterface +type prometheuses struct { + client rest.Interface + ns string +} + +// newPrometheuses returns a Prometheuses +func newPrometheuses(c *MonitoringV1Client, namespace string) *prometheuses { + return &prometheuses{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the prometheus, and returns the corresponding prometheus object, and an error if there is any. +func (c *prometheuses) Get(name string, options meta_v1.GetOptions) (result *v1.Prometheus, err error) { + result = &v1.Prometheus{} + err = c.client.Get(). + Namespace(c.ns). + Resource("prometheuses"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Prometheuses that match those selectors. +func (c *prometheuses) List(opts meta_v1.ListOptions) (result *v1.PrometheusList, err error) { + result = &v1.PrometheusList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("prometheuses"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested prometheuses. +func (c *prometheuses) Watch(opts meta_v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("prometheuses"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a prometheus and creates it. Returns the server's representation of the prometheus, and an error, if there is any. +func (c *prometheuses) Create(prometheus *v1.Prometheus) (result *v1.Prometheus, err error) { + result = &v1.Prometheus{} + err = c.client.Post(). + Namespace(c.ns). + Resource("prometheuses"). + Body(prometheus). + Do(). + Into(result) + return +} + +// Update takes the representation of a prometheus and updates it. Returns the server's representation of the prometheus, and an error, if there is any. +func (c *prometheuses) Update(prometheus *v1.Prometheus) (result *v1.Prometheus, err error) { + result = &v1.Prometheus{} + err = c.client.Put(). + Namespace(c.ns). + Resource("prometheuses"). + Name(prometheus.Name). + Body(prometheus). + Do(). + 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 *prometheuses) UpdateStatus(prometheus *v1.Prometheus) (result *v1.Prometheus, err error) { + result = &v1.Prometheus{} + err = c.client.Put(). + Namespace(c.ns). + Resource("prometheuses"). + Name(prometheus.Name). + SubResource("status"). + Body(prometheus). + Do(). + Into(result) + return +} + +// Delete takes name of the prometheus and deletes it. Returns an error if one occurs. +func (c *prometheuses) Delete(name string, options *meta_v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("prometheuses"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *prometheuses) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("prometheuses"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched prometheus. +func (c *prometheuses) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Prometheus, err error) { + result = &v1.Prometheus{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("prometheuses"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/prometheusrule.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/prometheusrule.go new file mode 100644 index 0000000000..6e0f17bcdf --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/prometheusrule.go @@ -0,0 +1,155 @@ +// Copyright 2018 The prometheus-operator 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 client-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + scheme "github.com/coreos/prometheus-operator/pkg/client/versioned/scheme" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// PrometheusRulesGetter has a method to return a PrometheusRuleInterface. +// A group's client should implement this interface. +type PrometheusRulesGetter interface { + PrometheusRules(namespace string) PrometheusRuleInterface +} + +// PrometheusRuleInterface has methods to work with PrometheusRule resources. +type PrometheusRuleInterface interface { + Create(*v1.PrometheusRule) (*v1.PrometheusRule, error) + Update(*v1.PrometheusRule) (*v1.PrometheusRule, error) + Delete(name string, options *meta_v1.DeleteOptions) error + DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error + Get(name string, options meta_v1.GetOptions) (*v1.PrometheusRule, error) + List(opts meta_v1.ListOptions) (*v1.PrometheusRuleList, error) + Watch(opts meta_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.PrometheusRule, err error) + PrometheusRuleExpansion +} + +// prometheusRules implements PrometheusRuleInterface +type prometheusRules struct { + client rest.Interface + ns string +} + +// newPrometheusRules returns a PrometheusRules +func newPrometheusRules(c *MonitoringV1Client, namespace string) *prometheusRules { + return &prometheusRules{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the prometheusRule, and returns the corresponding prometheusRule object, and an error if there is any. +func (c *prometheusRules) Get(name string, options meta_v1.GetOptions) (result *v1.PrometheusRule, err error) { + result = &v1.PrometheusRule{} + err = c.client.Get(). + Namespace(c.ns). + Resource("prometheusrules"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of PrometheusRules that match those selectors. +func (c *prometheusRules) List(opts meta_v1.ListOptions) (result *v1.PrometheusRuleList, err error) { + result = &v1.PrometheusRuleList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("prometheusrules"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested prometheusRules. +func (c *prometheusRules) Watch(opts meta_v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("prometheusrules"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a prometheusRule and creates it. Returns the server's representation of the prometheusRule, and an error, if there is any. +func (c *prometheusRules) Create(prometheusRule *v1.PrometheusRule) (result *v1.PrometheusRule, err error) { + result = &v1.PrometheusRule{} + err = c.client.Post(). + Namespace(c.ns). + Resource("prometheusrules"). + Body(prometheusRule). + Do(). + Into(result) + return +} + +// Update takes the representation of a prometheusRule and updates it. Returns the server's representation of the prometheusRule, and an error, if there is any. +func (c *prometheusRules) Update(prometheusRule *v1.PrometheusRule) (result *v1.PrometheusRule, err error) { + result = &v1.PrometheusRule{} + err = c.client.Put(). + Namespace(c.ns). + Resource("prometheusrules"). + Name(prometheusRule.Name). + Body(prometheusRule). + Do(). + Into(result) + return +} + +// Delete takes name of the prometheusRule and deletes it. Returns an error if one occurs. +func (c *prometheusRules) Delete(name string, options *meta_v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("prometheusrules"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *prometheusRules) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("prometheusrules"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched prometheusRule. +func (c *prometheusRules) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.PrometheusRule, err error) { + result = &v1.PrometheusRule{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("prometheusrules"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/servicemonitor.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/servicemonitor.go new file mode 100644 index 0000000000..ae31233bcc --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/servicemonitor.go @@ -0,0 +1,155 @@ +// Copyright 2018 The prometheus-operator 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 client-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + scheme "github.com/coreos/prometheus-operator/pkg/client/versioned/scheme" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// ServiceMonitorsGetter has a method to return a ServiceMonitorInterface. +// A group's client should implement this interface. +type ServiceMonitorsGetter interface { + ServiceMonitors(namespace string) ServiceMonitorInterface +} + +// ServiceMonitorInterface has methods to work with ServiceMonitor resources. +type ServiceMonitorInterface interface { + Create(*v1.ServiceMonitor) (*v1.ServiceMonitor, error) + Update(*v1.ServiceMonitor) (*v1.ServiceMonitor, error) + Delete(name string, options *meta_v1.DeleteOptions) error + DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error + Get(name string, options meta_v1.GetOptions) (*v1.ServiceMonitor, error) + List(opts meta_v1.ListOptions) (*v1.ServiceMonitorList, error) + Watch(opts meta_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ServiceMonitor, err error) + ServiceMonitorExpansion +} + +// serviceMonitors implements ServiceMonitorInterface +type serviceMonitors struct { + client rest.Interface + ns string +} + +// newServiceMonitors returns a ServiceMonitors +func newServiceMonitors(c *MonitoringV1Client, namespace string) *serviceMonitors { + return &serviceMonitors{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the serviceMonitor, and returns the corresponding serviceMonitor object, and an error if there is any. +func (c *serviceMonitors) Get(name string, options meta_v1.GetOptions) (result *v1.ServiceMonitor, err error) { + result = &v1.ServiceMonitor{} + err = c.client.Get(). + Namespace(c.ns). + Resource("servicemonitors"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ServiceMonitors that match those selectors. +func (c *serviceMonitors) List(opts meta_v1.ListOptions) (result *v1.ServiceMonitorList, err error) { + result = &v1.ServiceMonitorList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("servicemonitors"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested serviceMonitors. +func (c *serviceMonitors) Watch(opts meta_v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("servicemonitors"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a serviceMonitor and creates it. Returns the server's representation of the serviceMonitor, and an error, if there is any. +func (c *serviceMonitors) Create(serviceMonitor *v1.ServiceMonitor) (result *v1.ServiceMonitor, err error) { + result = &v1.ServiceMonitor{} + err = c.client.Post(). + Namespace(c.ns). + Resource("servicemonitors"). + Body(serviceMonitor). + Do(). + Into(result) + return +} + +// Update takes the representation of a serviceMonitor and updates it. Returns the server's representation of the serviceMonitor, and an error, if there is any. +func (c *serviceMonitors) Update(serviceMonitor *v1.ServiceMonitor) (result *v1.ServiceMonitor, err error) { + result = &v1.ServiceMonitor{} + err = c.client.Put(). + Namespace(c.ns). + Resource("servicemonitors"). + Name(serviceMonitor.Name). + Body(serviceMonitor). + Do(). + Into(result) + return +} + +// Delete takes name of the serviceMonitor and deletes it. Returns an error if one occurs. +func (c *serviceMonitors) Delete(name string, options *meta_v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("servicemonitors"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *serviceMonitors) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("servicemonitors"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched serviceMonitor. +func (c *serviceMonitors) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ServiceMonitor, err error) { + result = &v1.ServiceMonitor{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("servicemonitors"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/k8sutil/k8sutil.go b/vendor/github.com/coreos/prometheus-operator/pkg/k8sutil/k8sutil.go new file mode 100644 index 0000000000..17bda0cc24 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/k8sutil/k8sutil.go @@ -0,0 +1,219 @@ +// Copyright 2016 The prometheus-operator 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 k8sutil + +import ( + "fmt" + "net/http" + "net/url" + "regexp" + "strings" + "time" + + crdutils "github.com/ant31/crd-validation/pkg" + monitoringv1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + version "github.com/hashicorp/go-version" + "github.com/pkg/errors" + "k8s.io/api/core/v1" + extensionsobj "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/util/validation" + "k8s.io/apimachinery/pkg/util/wait" + "k8s.io/client-go/discovery" + clientv1 "k8s.io/client-go/kubernetes/typed/core/v1" + "k8s.io/client-go/rest" +) + +var invalidDNS1123Characters = regexp.MustCompile("[^-a-z0-9]+") + +// CustomResourceDefinitionTypeMeta set the default kind/apiversion of CRD +var CustomResourceDefinitionTypeMeta metav1.TypeMeta = metav1.TypeMeta{ + Kind: "CustomResourceDefinition", + APIVersion: "apiextensions.k8s.io/v1beta1", +} + +// WaitForCRDReady waits for a custom resource definition to be available for use. +func WaitForCRDReady(listFunc func(opts metav1.ListOptions) (runtime.Object, error)) error { + err := wait.Poll(3*time.Second, 10*time.Minute, func() (bool, error) { + _, err := listFunc(metav1.ListOptions{}) + if err != nil { + if se, ok := err.(*apierrors.StatusError); ok { + if se.Status().Code == http.StatusNotFound { + return false, nil + } + } + return false, errors.Wrap(err, "failed to list CRD") + } + return true, nil + }) + + return errors.Wrap(err, fmt.Sprintf("timed out waiting for Custom Resource")) +} + +// PodRunningAndReady returns whether a pod is running and each container has +// passed it's ready state. +func PodRunningAndReady(pod v1.Pod) (bool, error) { + switch pod.Status.Phase { + case v1.PodFailed, v1.PodSucceeded: + return false, fmt.Errorf("pod completed") + case v1.PodRunning: + for _, cond := range pod.Status.Conditions { + if cond.Type != v1.PodReady { + continue + } + return cond.Status == v1.ConditionTrue, nil + } + return false, fmt.Errorf("pod ready condition not found") + } + return false, nil +} + +func NewClusterConfig(host string, tlsInsecure bool, tlsConfig *rest.TLSClientConfig) (*rest.Config, error) { + var cfg *rest.Config + var err error + + if len(host) == 0 { + if cfg, err = rest.InClusterConfig(); err != nil { + return nil, err + } + } else { + cfg = &rest.Config{ + Host: host, + } + hostURL, err := url.Parse(host) + if err != nil { + return nil, fmt.Errorf("error parsing host url %s : %v", host, err) + } + if hostURL.Scheme == "https" { + cfg.TLSClientConfig = *tlsConfig + cfg.Insecure = tlsInsecure + } + } + cfg.QPS = 100 + cfg.Burst = 100 + + return cfg, nil +} + +func IsResourceNotFoundError(err error) bool { + se, ok := err.(*apierrors.StatusError) + if !ok { + return false + } + if se.Status().Code == http.StatusNotFound && se.Status().Reason == metav1.StatusReasonNotFound { + return true + } + return false +} + +func CreateOrUpdateService(sclient clientv1.ServiceInterface, svc *v1.Service) error { + service, err := sclient.Get(svc.Name, metav1.GetOptions{}) + if err != nil && !apierrors.IsNotFound(err) { + return errors.Wrap(err, "retrieving service object failed") + } + + if apierrors.IsNotFound(err) { + _, err = sclient.Create(svc) + if err != nil { + return errors.Wrap(err, "creating service object failed") + } + } else { + svc.ResourceVersion = service.ResourceVersion + svc.SetOwnerReferences(mergeOwnerReferences(service.GetOwnerReferences(), svc.GetOwnerReferences())) + _, err := sclient.Update(svc) + if err != nil && !apierrors.IsNotFound(err) { + return errors.Wrap(err, "updating service object failed") + } + } + + return nil +} + +func CreateOrUpdateEndpoints(eclient clientv1.EndpointsInterface, eps *v1.Endpoints) error { + endpoints, err := eclient.Get(eps.Name, metav1.GetOptions{}) + if err != nil && !apierrors.IsNotFound(err) { + return errors.Wrap(err, "retrieving existing kubelet endpoints object failed") + } + + if apierrors.IsNotFound(err) { + _, err = eclient.Create(eps) + if err != nil { + return errors.Wrap(err, "creating kubelet endpoints object failed") + } + } else { + eps.ResourceVersion = endpoints.ResourceVersion + _, err = eclient.Update(eps) + if err != nil { + return errors.Wrap(err, "updating kubelet endpoints object failed") + } + } + + return nil +} + +// GetMinorVersion returns the minor version as an integer +func GetMinorVersion(dclient discovery.DiscoveryInterface) (int, error) { + v, err := dclient.ServerVersion() + if err != nil { + return 0, err + } + + ver, err := version.NewVersion(v.String()) + if err != nil { + return 0, err + } + + return ver.Segments()[1], nil +} + +func NewCustomResourceDefinition(crdKind monitoringv1.CrdKind, group string, labels map[string]string, validation bool) *extensionsobj.CustomResourceDefinition { + return crdutils.NewCustomResourceDefinition(crdutils.Config{ + SpecDefinitionName: crdKind.SpecName, + EnableValidation: validation, + Labels: crdutils.Labels{LabelsMap: labels}, + ResourceScope: string(extensionsobj.NamespaceScoped), + Group: group, + Kind: crdKind.Kind, + Version: monitoringv1.Version, + Plural: crdKind.Plural, + GetOpenAPIDefinitions: monitoringv1.GetOpenAPIDefinitions, + }) +} + +// SanitizeVolumeName ensures that the given volume name is a valid DNS-1123 label +// accepted by Kubernetes. +func SanitizeVolumeName(name string) string { + name = strings.ToLower(name) + name = invalidDNS1123Characters.ReplaceAllString(name, "-") + if len(name) > validation.DNS1123LabelMaxLength { + name = name[0:validation.DNS1123LabelMaxLength] + } + return strings.Trim(name, "-") +} + +func mergeOwnerReferences(old []metav1.OwnerReference, new []metav1.OwnerReference) []metav1.OwnerReference { + existing := make(map[metav1.OwnerReference]bool) + for _, ownerRef := range old { + existing[ownerRef] = true + } + for _, ownerRef := range new { + if _, ok := existing[ownerRef]; !ok { + old = append(old, ownerRef) + } + } + return old +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/listwatch/listwatch.go b/vendor/github.com/coreos/prometheus-operator/pkg/listwatch/listwatch.go new file mode 100644 index 0000000000..6234c75b69 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/listwatch/listwatch.go @@ -0,0 +1,240 @@ +// Copyright 2016 The prometheus-operator 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 listwatch + +import ( + "fmt" + "strings" + "sync" + + "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/meta" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/kubernetes/scheme" + "k8s.io/client-go/tools/cache" +) + +// NewUnprivilegedNamespaceListWatchFromClient mimics +// cache.NewListWatchFromClient. +// It allows for the creation of a cache.ListWatch for namespaces from a client +// that does not have `List` privileges. If the slice of namespaces contains +// only v1.NamespaceAll, then this func assumes that the client has List and +// Watch privileges and returns a regular cache.ListWatch, since there is no +// other way to get all namespaces. +func NewUnprivilegedNamespaceListWatchFromClient(c cache.Getter, namespaces []string, fieldSelector fields.Selector) *cache.ListWatch { + optionsModifier := func(options *metav1.ListOptions) { + options.FieldSelector = fieldSelector.String() + } + return NewFilteredUnprivilegedNamespaceListWatchFromClient(c, namespaces, optionsModifier) +} + +// NewFilteredUnprivilegedNamespaceListWatchFromClient mimics +// cache.NewUnprivilegedNamespaceListWatchFromClient. +// It allows for the creation of a cache.ListWatch for namespaces from a client +// that does not have `List` privileges. If the slice of namespaces contains +// only v1.NamespaceAll, then this func assumes that the client has List and +// Watch privileges and returns a regular cache.ListWatch, since there is no +// other way to get all namespaces. +func NewFilteredUnprivilegedNamespaceListWatchFromClient(c cache.Getter, namespaces []string, optionsModifier func(options *metav1.ListOptions)) *cache.ListWatch { + // If the only namespace given is `v1.NamespaceAll`, then this + // cache.ListWatch must be privileged. In this case, return a regular + // cache.ListWatch. + if IsAllNamespaces(namespaces) { + return cache.NewFilteredListWatchFromClient(c, "namespaces", metav1.NamespaceAll, optionsModifier) + } + listFunc := func(options metav1.ListOptions) (runtime.Object, error) { + optionsModifier(&options) + list := &v1.NamespaceList{} + for _, name := range namespaces { + result := &v1.Namespace{} + err := c.Get(). + Resource("namespaces"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + if err != nil { + return nil, err + } + list.Items = append(list.Items, *result) + } + return list, nil + } + watchFunc := func(_ metav1.ListOptions) (watch.Interface, error) { + // Since the client does not have Watch privileges, do not + // actually watch anything. Use a watch.FakeWatcher here to + // implement watch.Interface but not send any events. + return watch.NewFake(), nil + } + return &cache.ListWatch{ListFunc: listFunc, WatchFunc: watchFunc} +} + +// MultiNamespaceListerWatcher takes a list of namespaces and a +// cache.ListerWatcher generator func and returns a single cache.ListerWatcher +// capable of operating on multiple namespaces. +func MultiNamespaceListerWatcher(namespaces []string, f func(string) cache.ListerWatcher) cache.ListerWatcher { + // If there is only one namespace then there is no need to create a + // proxy. + if len(namespaces) == 1 { + return f(namespaces[0]) + } + var lws []cache.ListerWatcher + for _, n := range namespaces { + lws = append(lws, f(n)) + } + return multiListerWatcher(lws) +} + +// multiListerWatcher abstracts several cache.ListerWatchers, allowing them +// to be treated as a single cache.ListerWatcher. +type multiListerWatcher []cache.ListerWatcher + +// List implements the ListerWatcher interface. +// It combines the output of the List method of every ListerWatcher into +// a single result. +func (mlw multiListerWatcher) List(options metav1.ListOptions) (runtime.Object, error) { + l := metav1.List{} + var resourceVersions []string + for _, lw := range mlw { + list, err := lw.List(options) + if err != nil { + return nil, err + } + items, err := meta.ExtractList(list) + if err != nil { + return nil, err + } + metaObj, err := meta.ListAccessor(list) + if err != nil { + return nil, err + } + for _, item := range items { + l.Items = append(l.Items, runtime.RawExtension{Object: item.DeepCopyObject()}) + } + resourceVersions = append(resourceVersions, metaObj.GetResourceVersion()) + } + // Combine the resource versions so that the composite Watch method can + // distribute appropriate versions to each underlying Watch func. + l.ListMeta.ResourceVersion = strings.Join(resourceVersions, "/") + return &l, nil +} + +// Watch implements the ListerWatcher interface. +// It returns a watch.Interface that combines the output from the +// watch.Interface of every cache.ListerWatcher into a single result chan. +func (mlw multiListerWatcher) Watch(options metav1.ListOptions) (watch.Interface, error) { + resourceVersions := make([]string, len(mlw)) + // Allow resource versions to be "". + if options.ResourceVersion != "" { + rvs := strings.Split(options.ResourceVersion, "/") + if len(rvs) != len(mlw) { + return nil, fmt.Errorf("expected resource version to have %d parts to match the number of ListerWatchers", len(mlw)) + } + resourceVersions = rvs + } + return newMultiWatch(mlw, resourceVersions, options) +} + +// multiWatch abstracts multiple watch.Interface's, allowing them +// to be treated as a single watch.Interface. +type multiWatch struct { + result chan watch.Event + stopped chan struct{} + stoppers []func() +} + +// newMultiWatch returns a new multiWatch or an error if one of the underlying +// Watch funcs errored. The length of []cache.ListerWatcher and []string must +// match. +func newMultiWatch(lws []cache.ListerWatcher, resourceVersions []string, options metav1.ListOptions) (*multiWatch, error) { + var ( + result = make(chan watch.Event) + stopped = make(chan struct{}) + stoppers []func() + wg sync.WaitGroup + ) + + wg.Add(len(lws)) + + for i, lw := range lws { + o := options.DeepCopy() + o.ResourceVersion = resourceVersions[i] + w, err := lw.Watch(*o) + if err != nil { + return nil, err + } + + go func() { + defer wg.Done() + + for { + event, ok := <-w.ResultChan() + if !ok { + return + } + + select { + case result <- event: + case <-stopped: + return + } + } + }() + stoppers = append(stoppers, w.Stop) + } + + // result chan must be closed, + // once all event sender goroutines exited. + go func() { + wg.Wait() + close(result) + }() + + return &multiWatch{ + result: result, + stoppers: stoppers, + stopped: stopped, + }, nil +} + +// ResultChan implements the watch.Interface interface. +func (mw *multiWatch) ResultChan() <-chan watch.Event { + return mw.result +} + +// Stop implements the watch.Interface interface. +// It stops all of the underlying watch.Interfaces and closes the backing chan. +// Can safely be called more than once. +func (mw *multiWatch) Stop() { + select { + case <-mw.stopped: + // nothing to do, we are already stopped + default: + for _, stop := range mw.stoppers { + stop() + } + close(mw.stopped) + } + return +} + +// IsAllNamespaces checks if the given slice of namespaces +// contains only v1.NamespaceAll. +func IsAllNamespaces(namespaces []string) bool { + return len(namespaces) == 1 && namespaces[0] == v1.NamespaceAll +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/collector.go b/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/collector.go new file mode 100644 index 0000000000..e61d76546b --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/collector.go @@ -0,0 +1,61 @@ +// Copyright 2016 The prometheus-operator 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 prometheus + +import ( + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + + "github.com/prometheus/client_golang/prometheus" + "k8s.io/client-go/tools/cache" +) + +var ( + descPrometheusSpecReplicas = prometheus.NewDesc( + "prometheus_operator_spec_replicas", + "Number of expected replicas for the object.", + []string{ + "namespace", + "name", + }, nil, + ) +) + +type prometheusCollector struct { + store cache.Store +} + +func NewPrometheusCollector(s cache.Store) *prometheusCollector { + return &prometheusCollector{store: s} +} + +// Describe implements the prometheus.Collector interface. +func (c *prometheusCollector) Describe(ch chan<- *prometheus.Desc) { + ch <- descPrometheusSpecReplicas +} + +// Collect implements the prometheus.Collector interface. +func (c *prometheusCollector) Collect(ch chan<- prometheus.Metric) { + for _, p := range c.store.List() { + c.collectPrometheus(ch, p.(*v1.Prometheus)) + } +} + +func (c *prometheusCollector) collectPrometheus(ch chan<- prometheus.Metric, p *v1.Prometheus) { + replicas := float64(minReplicas) + if p.Spec.Replicas != nil { + replicas = float64(*p.Spec.Replicas) + } + ch <- prometheus.MustNewConstMetric(descPrometheusSpecReplicas, prometheus.GaugeValue, replicas, p.Namespace, p.Name) +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/operator.go b/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/operator.go new file mode 100644 index 0000000000..c3f085ef5c --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/operator.go @@ -0,0 +1,1490 @@ +// Copyright 2016 The prometheus-operator 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 prometheus + +import ( + "bytes" + "fmt" + "reflect" + "strings" + "time" + + monitoringv1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + monitoringclient "github.com/coreos/prometheus-operator/pkg/client/versioned" + "github.com/coreos/prometheus-operator/pkg/k8sutil" + "github.com/coreos/prometheus-operator/pkg/listwatch" + + "github.com/go-kit/kit/log" + "github.com/go-kit/kit/log/level" + "github.com/mitchellh/hashstructure" + "github.com/pkg/errors" + "github.com/prometheus/client_golang/prometheus" + appsv1 "k8s.io/api/apps/v1beta2" + "k8s.io/api/core/v1" + extensionsobj "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" + apiextensionsclient "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" + apierrors "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/api/meta" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/runtime" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" + "k8s.io/client-go/kubernetes" + corev1client "k8s.io/client-go/kubernetes/typed/core/v1" + "k8s.io/client-go/rest" + "k8s.io/client-go/tools/cache" + "k8s.io/client-go/util/workqueue" +) + +const ( + resyncPeriod = 5 * time.Minute +) + +// Operator manages life cycle of Prometheus deployments and +// monitoring configurations. +type Operator struct { + kclient kubernetes.Interface + mclient monitoringclient.Interface + crdclient apiextensionsclient.Interface + logger log.Logger + + promInf cache.SharedIndexInformer + smonInf cache.SharedIndexInformer + ruleInf cache.SharedIndexInformer + cmapInf cache.SharedIndexInformer + secrInf cache.SharedIndexInformer + ssetInf cache.SharedIndexInformer + nsInf cache.SharedIndexInformer + + queue workqueue.RateLimitingInterface + + reconcileErrorsCounter *prometheus.CounterVec + + // triggerByCounter is a set of counters keeping track of the amount + // of times Prometheus Operator was triggered to reconcile its created + // objects. It is split in the dimensions of Kubernetes objects and + // corresponding actions (add, delete, update). + triggerByCounter *prometheus.CounterVec + nodeAddressLookupErrors prometheus.Counter + + host string + kubeletObjectName string + kubeletObjectNamespace string + kubeletSyncEnabled bool + config Config + + configGenerator *configGenerator +} + +type Labels struct { + LabelsString string + LabelsMap map[string]string +} + +// Implement the flag.Value interface +func (labels *Labels) String() string { + return labels.LabelsString +} + +// Merge labels create a new map with labels merged. +func (labels *Labels) Merge(otherLabels map[string]string) map[string]string { + mergedLabels := map[string]string{} + + for key, value := range otherLabels { + mergedLabels[key] = value + } + + for key, value := range labels.LabelsMap { + mergedLabels[key] = value + } + return mergedLabels +} + +// Set implements the flag.Set interface. +func (labels *Labels) Set(value string) error { + m := map[string]string{} + if value != "" { + splited := strings.Split(value, ",") + for _, pair := range splited { + sp := strings.Split(pair, "=") + m[sp[0]] = sp[1] + } + } + (*labels).LabelsMap = m + (*labels).LabelsString = value + return nil +} + +// Config defines configuration parameters for the Operator. +type Config struct { + Host string + KubeletObject string + TLSInsecure bool + TLSConfig rest.TLSClientConfig + ConfigReloaderImage string + PrometheusConfigReloader string + AlertmanagerDefaultBaseImage string + PrometheusDefaultBaseImage string + ThanosDefaultBaseImage string + Namespaces []string + Labels Labels + CrdGroup string + CrdKinds monitoringv1.CrdKinds + EnableValidation bool + LocalHost string + LogLevel string + LogFormat string + ManageCRDs bool +} + +type BasicAuthCredentials struct { + username string + password string +} + +// New creates a new controller. +func New(conf Config, logger log.Logger) (*Operator, error) { + cfg, err := k8sutil.NewClusterConfig(conf.Host, conf.TLSInsecure, &conf.TLSConfig) + if err != nil { + return nil, errors.Wrap(err, "instantiating cluster config failed") + } + + client, err := kubernetes.NewForConfig(cfg) + if err != nil { + return nil, errors.Wrap(err, "instantiating kubernetes client failed") + } + + crdclient, err := apiextensionsclient.NewForConfig(cfg) + if err != nil { + return nil, errors.Wrap(err, "instantiating apiextensions client failed") + } + + mclient, err := monitoringclient.NewForConfig(cfg) + if err != nil { + return nil, errors.Wrap(err, "instantiating monitoring client failed") + } + + kubeletObjectName := "" + kubeletObjectNamespace := "" + kubeletSyncEnabled := false + + if conf.KubeletObject != "" { + parts := strings.Split(conf.KubeletObject, "/") + if len(parts) != 2 { + return nil, fmt.Errorf("malformatted kubelet object string, must be in format \"namespace/name\"") + } + kubeletObjectNamespace = parts[0] + kubeletObjectName = parts[1] + kubeletSyncEnabled = true + } + + c := &Operator{ + kclient: client, + mclient: mclient, + crdclient: crdclient, + logger: logger, + queue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "prometheus"), + host: cfg.Host, + kubeletObjectName: kubeletObjectName, + kubeletObjectNamespace: kubeletObjectNamespace, + kubeletSyncEnabled: kubeletSyncEnabled, + config: conf, + configGenerator: NewConfigGenerator(logger), + } + + c.promInf = cache.NewSharedIndexInformer( + listwatch.MultiNamespaceListerWatcher(c.config.Namespaces, func(namespace string) cache.ListerWatcher { + return &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + return mclient.MonitoringV1().Prometheuses(namespace).List(options) + }, + WatchFunc: mclient.MonitoringV1().Prometheuses(namespace).Watch, + } + }), + &monitoringv1.Prometheus{}, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, + ) + + c.smonInf = cache.NewSharedIndexInformer( + listwatch.MultiNamespaceListerWatcher(c.config.Namespaces, func(namespace string) cache.ListerWatcher { + return &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + return mclient.MonitoringV1().ServiceMonitors(namespace).List(options) + }, + WatchFunc: mclient.MonitoringV1().ServiceMonitors(namespace).Watch, + } + }), + &monitoringv1.ServiceMonitor{}, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, + ) + + c.ruleInf = cache.NewSharedIndexInformer( + listwatch.MultiNamespaceListerWatcher(c.config.Namespaces, func(namespace string) cache.ListerWatcher { + return &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + return mclient.MonitoringV1().PrometheusRules(namespace).List(options) + }, + WatchFunc: mclient.MonitoringV1().PrometheusRules(namespace).Watch, + } + }), + &monitoringv1.PrometheusRule{}, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, + ) + + c.cmapInf = cache.NewSharedIndexInformer( + listwatch.MultiNamespaceListerWatcher(c.config.Namespaces, func(namespace string) cache.ListerWatcher { + return cache.NewListWatchFromClient(c.kclient.Core().RESTClient(), "configmaps", namespace, fields.Everything()) + }), + &v1.ConfigMap{}, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, + ) + + c.secrInf = cache.NewSharedIndexInformer( + listwatch.MultiNamespaceListerWatcher(c.config.Namespaces, func(namespace string) cache.ListerWatcher { + return cache.NewListWatchFromClient(c.kclient.Core().RESTClient(), "secrets", namespace, fields.Everything()) + }), + &v1.Secret{}, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, + ) + + c.ssetInf = cache.NewSharedIndexInformer( + listwatch.MultiNamespaceListerWatcher(c.config.Namespaces, func(namespace string) cache.ListerWatcher { + return cache.NewListWatchFromClient(c.kclient.AppsV1beta2().RESTClient(), "statefulsets", namespace, fields.Everything()) + }), + &appsv1.StatefulSet{}, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, + ) + + // nsResyncPeriod is used to control how often the namespace informer + // should resync. If the unprivileged ListerWatcher is used, then the + // informer must resync more often because it cannot watch for + // namespace changes. + nsResyncPeriod := 15 * time.Second + // If the only namespace is v1.NamespaceAll, then the client must be + // privileged and a regular cache.ListWatch will be used. In this case + // watching works and we do not need to resync so frequently. + if listwatch.IsAllNamespaces(c.config.Namespaces) { + nsResyncPeriod = resyncPeriod + } + c.nsInf = cache.NewSharedIndexInformer( + listwatch.NewUnprivilegedNamespaceListWatchFromClient(c.kclient.Core().RESTClient(), c.config.Namespaces, fields.Everything()), + &v1.Namespace{}, nsResyncPeriod, cache.Indexers{}, + ) + + return c, nil +} + +// RegisterMetrics registers Prometheus metrics on the given Prometheus +// registerer. +func (c *Operator) RegisterMetrics(r prometheus.Registerer, reconcileErrorsCounter *prometheus.CounterVec, triggerByCounter *prometheus.CounterVec) { + c.reconcileErrorsCounter = reconcileErrorsCounter + c.triggerByCounter = triggerByCounter + + c.reconcileErrorsCounter.With(prometheus.Labels{}).Add(0) + + c.nodeAddressLookupErrors = prometheus.NewCounter(prometheus.CounterOpts{ + Name: "prometheus_operator_node_address_lookup_errors_total", + Help: "Number of times a node IP address could not be determined", + }) + + r.MustRegister( + c.nodeAddressLookupErrors, + NewPrometheusCollector(c.promInf.GetStore()), + ) +} + +// waitForCacheSync waits for the informers' caches to be synced. +func (c *Operator) waitForCacheSync(stopc <-chan struct{}) error { + ok := true + informers := []struct { + name string + informer cache.SharedIndexInformer + }{ + {"Prometheus", c.promInf}, + {"ServiceMonitor", c.smonInf}, + {"PrometheusRule", c.ruleInf}, + {"ConfigMap", c.cmapInf}, + {"Secret", c.secrInf}, + {"StatefulSet", c.ssetInf}, + {"Namespace", c.nsInf}, + } + for _, inf := range informers { + if !cache.WaitForCacheSync(stopc, inf.informer.HasSynced) { + level.Error(c.logger).Log("msg", fmt.Sprintf("failed to sync %s cache", inf.name)) + ok = false + } else { + level.Debug(c.logger).Log("msg", fmt.Sprintf("successfully synced %s cache", inf.name)) + } + } + if !ok { + return errors.New("failed to sync caches") + } + level.Info(c.logger).Log("msg", "successfully synced all caches") + return nil +} + +// addHandlers adds the eventhandlers to the informers. +func (c *Operator) addHandlers() { + c.promInf.AddEventHandler(cache.ResourceEventHandlerFuncs{ + AddFunc: c.handlePrometheusAdd, + DeleteFunc: c.handlePrometheusDelete, + UpdateFunc: c.handlePrometheusUpdate, + }) + c.smonInf.AddEventHandler(cache.ResourceEventHandlerFuncs{ + AddFunc: c.handleSmonAdd, + DeleteFunc: c.handleSmonDelete, + UpdateFunc: c.handleSmonUpdate, + }) + c.ruleInf.AddEventHandler(cache.ResourceEventHandlerFuncs{ + AddFunc: c.handleRuleAdd, + DeleteFunc: c.handleRuleDelete, + UpdateFunc: c.handleRuleUpdate, + }) + c.cmapInf.AddEventHandler(cache.ResourceEventHandlerFuncs{ + AddFunc: c.handleConfigMapAdd, + DeleteFunc: c.handleConfigMapDelete, + UpdateFunc: c.handleConfigMapUpdate, + }) + c.secrInf.AddEventHandler(cache.ResourceEventHandlerFuncs{ + AddFunc: c.handleSecretAdd, + DeleteFunc: c.handleSecretDelete, + UpdateFunc: c.handleSecretUpdate, + }) + c.ssetInf.AddEventHandler(cache.ResourceEventHandlerFuncs{ + AddFunc: c.handleStatefulSetAdd, + DeleteFunc: c.handleStatefulSetDelete, + UpdateFunc: c.handleStatefulSetUpdate, + }) +} + +// Run the controller. +func (c *Operator) Run(stopc <-chan struct{}) error { + defer c.queue.ShutDown() + + errChan := make(chan error) + go func() { + v, err := c.kclient.Discovery().ServerVersion() + if err != nil { + errChan <- errors.Wrap(err, "communicating with server failed") + return + } + level.Info(c.logger).Log("msg", "connection established", "cluster-version", v) + + if c.config.ManageCRDs { + if err := c.createCRDs(); err != nil { + errChan <- errors.Wrap(err, "creating CRDs failed") + return + } + } + errChan <- nil + }() + + select { + case err := <-errChan: + if err != nil { + return err + } + level.Info(c.logger).Log("msg", "CRD API endpoints ready") + case <-stopc: + return nil + } + + go c.worker() + + go c.promInf.Run(stopc) + go c.smonInf.Run(stopc) + go c.ruleInf.Run(stopc) + go c.cmapInf.Run(stopc) + go c.secrInf.Run(stopc) + go c.ssetInf.Run(stopc) + go c.nsInf.Run(stopc) + if err := c.waitForCacheSync(stopc); err != nil { + return err + } + c.addHandlers() + + if c.kubeletSyncEnabled { + go c.reconcileNodeEndpoints(stopc) + } + + <-stopc + return nil +} + +func (c *Operator) keyFunc(obj interface{}) (string, bool) { + k, err := cache.DeletionHandlingMetaNamespaceKeyFunc(obj) + if err != nil { + level.Error(c.logger).Log("msg", "creating key failed", "err", err) + return k, false + } + return k, true +} + +func (c *Operator) handlePrometheusAdd(obj interface{}) { + key, ok := c.keyFunc(obj) + if !ok { + return + } + + level.Debug(c.logger).Log("msg", "Prometheus added", "key", key) + c.triggerByCounter.WithLabelValues(monitoringv1.PrometheusesKind, "add").Inc() + c.enqueue(key) +} + +func (c *Operator) handlePrometheusDelete(obj interface{}) { + key, ok := c.keyFunc(obj) + if !ok { + return + } + + level.Debug(c.logger).Log("msg", "Prometheus deleted", "key", key) + c.triggerByCounter.WithLabelValues(monitoringv1.PrometheusesKind, "delete").Inc() + c.enqueue(key) +} + +func (c *Operator) handlePrometheusUpdate(old, cur interface{}) { + if old.(*monitoringv1.Prometheus).ResourceVersion == cur.(*monitoringv1.Prometheus).ResourceVersion { + return + } + + key, ok := c.keyFunc(cur) + if !ok { + return + } + + level.Debug(c.logger).Log("msg", "Prometheus updated", "key", key) + c.triggerByCounter.WithLabelValues(monitoringv1.PrometheusesKind, "update").Inc() + c.enqueue(key) +} + +func (c *Operator) reconcileNodeEndpoints(stopc <-chan struct{}) { + ticker := time.NewTicker(3 * time.Minute) + defer ticker.Stop() + for { + select { + case <-stopc: + return + case <-ticker.C: + err := c.syncNodeEndpoints() + if err != nil { + level.Error(c.logger).Log("msg", "syncing nodes into Endpoints object failed", "err", err) + } + } + } +} + +// nodeAddresses returns the provided node's address, based on the priority: +// 1. NodeInternalIP +// 2. NodeExternalIP +// +// Copied from github.com/prometheus/prometheus/discovery/kubernetes/node.go +func nodeAddress(node v1.Node) (string, map[v1.NodeAddressType][]string, error) { + m := map[v1.NodeAddressType][]string{} + for _, a := range node.Status.Addresses { + m[a.Type] = append(m[a.Type], a.Address) + } + + if addresses, ok := m[v1.NodeInternalIP]; ok { + return addresses[0], m, nil + } + if addresses, ok := m[v1.NodeExternalIP]; ok { + return addresses[0], m, nil + } + return "", m, fmt.Errorf("host address unknown") +} + +func getNodeAddresses(nodes *v1.NodeList) ([]v1.EndpointAddress, []error) { + addresses := make([]v1.EndpointAddress, 0) + errs := make([]error, 0) + + for _, n := range nodes.Items { + address, _, err := nodeAddress(n) + if err != nil { + errs = append(errs, errors.Wrapf(err, "failed to determine hostname for node (%s)", n.Name)) + continue + } + addresses = append(addresses, v1.EndpointAddress{ + IP: address, + TargetRef: &v1.ObjectReference{ + Kind: "Node", + Name: n.Name, + UID: n.UID, + APIVersion: n.APIVersion, + }, + }) + } + + return addresses, errs +} + +func (c *Operator) syncNodeEndpoints() error { + eps := &v1.Endpoints{ + ObjectMeta: metav1.ObjectMeta{ + Name: c.kubeletObjectName, + Labels: c.config.Labels.Merge(map[string]string{ + "k8s-app": "kubelet", + }), + }, + Subsets: []v1.EndpointSubset{ + { + Ports: []v1.EndpointPort{ + { + Name: "https-metrics", + Port: 10250, + }, + { + Name: "http-metrics", + Port: 10255, + }, + { + Name: "cadvisor", + Port: 4194, + }, + }, + }, + }, + } + + nodes, err := c.kclient.CoreV1().Nodes().List(metav1.ListOptions{}) + if err != nil { + return errors.Wrap(err, "listing nodes failed") + } + + addresses, errs := getNodeAddresses(nodes) + if len(errs) > 0 { + for _, err := range errs { + level.Warn(c.logger).Log("err", err) + } + c.nodeAddressLookupErrors.Add(float64(len(errs))) + } + eps.Subsets[0].Addresses = addresses + + svc := &v1.Service{ + ObjectMeta: metav1.ObjectMeta{ + Name: c.kubeletObjectName, + Labels: c.config.Labels.Merge(map[string]string{ + "k8s-app": "kubelet", + }), + }, + Spec: v1.ServiceSpec{ + Type: v1.ServiceTypeClusterIP, + ClusterIP: "None", + Ports: []v1.ServicePort{ + { + Name: "https-metrics", + Port: 10250, + }, + }, + }, + } + + err = k8sutil.CreateOrUpdateService(c.kclient.CoreV1().Services(c.kubeletObjectNamespace), svc) + if err != nil { + return errors.Wrap(err, "synchronizing kubelet service object failed") + } + + err = k8sutil.CreateOrUpdateEndpoints(c.kclient.CoreV1().Endpoints(c.kubeletObjectNamespace), eps) + if err != nil { + return errors.Wrap(err, "synchronizing kubelet endpoints object failed") + } + + return nil +} + +// TODO: Don't enque just for the namespace +func (c *Operator) handleSmonAdd(obj interface{}) { + o, ok := c.getObject(obj) + if ok { + level.Debug(c.logger).Log("msg", "ServiceMonitor added") + c.triggerByCounter.WithLabelValues(monitoringv1.ServiceMonitorsKind, "add").Inc() + + c.enqueueForNamespace(o.GetNamespace()) + } +} + +// TODO: Don't enque just for the namespace +func (c *Operator) handleSmonUpdate(old, cur interface{}) { + if old.(*monitoringv1.ServiceMonitor).ResourceVersion == cur.(*monitoringv1.ServiceMonitor).ResourceVersion { + return + } + + o, ok := c.getObject(cur) + if ok { + level.Debug(c.logger).Log("msg", "ServiceMonitor updated") + c.triggerByCounter.WithLabelValues(monitoringv1.ServiceMonitorsKind, "update").Inc() + + c.enqueueForNamespace(o.GetNamespace()) + } +} + +// TODO: Don't enque just for the namespace +func (c *Operator) handleSmonDelete(obj interface{}) { + o, ok := c.getObject(obj) + if ok { + level.Debug(c.logger).Log("msg", "ServiceMonitor delete") + c.triggerByCounter.WithLabelValues(monitoringv1.ServiceMonitorsKind, "delete").Inc() + + c.enqueueForNamespace(o.GetNamespace()) + } +} + +// TODO: Don't enque just for the namespace +func (c *Operator) handleRuleAdd(obj interface{}) { + o, ok := c.getObject(obj) + if ok { + level.Debug(c.logger).Log("msg", "PrometheusRule added") + c.triggerByCounter.WithLabelValues(monitoringv1.PrometheusRuleKind, "add").Inc() + + c.enqueueForNamespace(o.GetNamespace()) + } +} + +// TODO: Don't enque just for the namespace +func (c *Operator) handleRuleUpdate(old, cur interface{}) { + if old.(*monitoringv1.PrometheusRule).ResourceVersion == cur.(*monitoringv1.PrometheusRule).ResourceVersion { + return + } + + o, ok := c.getObject(cur) + if ok { + level.Debug(c.logger).Log("msg", "PrometheusRule updated") + c.triggerByCounter.WithLabelValues(monitoringv1.PrometheusRuleKind, "update").Inc() + + c.enqueueForNamespace(o.GetNamespace()) + } +} + +// TODO: Don't enque just for the namespace +func (c *Operator) handleRuleDelete(obj interface{}) { + o, ok := c.getObject(obj) + if ok { + level.Debug(c.logger).Log("msg", "PrometheusRule deleted") + c.triggerByCounter.WithLabelValues(monitoringv1.PrometheusRuleKind, "delete").Inc() + + c.enqueueForNamespace(o.GetNamespace()) + } +} + +// TODO: Do we need to enque secrets just for the namespace or in general? +func (c *Operator) handleSecretDelete(obj interface{}) { + o, ok := c.getObject(obj) + if ok { + level.Debug(c.logger).Log("msg", "Secret deleted") + c.triggerByCounter.WithLabelValues("Secret", "delete").Inc() + + c.enqueueForNamespace(o.GetNamespace()) + } +} + +func (c *Operator) handleSecretUpdate(old, cur interface{}) { + if old.(*v1.Secret).ResourceVersion == cur.(*v1.Secret).ResourceVersion { + return + } + + o, ok := c.getObject(cur) + if ok { + level.Debug(c.logger).Log("msg", "Secret updated") + c.triggerByCounter.WithLabelValues("Secret", "update").Inc() + + c.enqueueForNamespace(o.GetNamespace()) + } +} + +func (c *Operator) handleSecretAdd(obj interface{}) { + o, ok := c.getObject(obj) + if ok { + level.Debug(c.logger).Log("msg", "Secret added") + c.triggerByCounter.WithLabelValues("Secret", "add").Inc() + + c.enqueueForNamespace(o.GetNamespace()) + } +} + +// TODO: Do we need to enque configmaps just for the namespace or in general? +func (c *Operator) handleConfigMapAdd(obj interface{}) { + o, ok := c.getObject(obj) + if ok { + level.Debug(c.logger).Log("msg", "ConfigMap added") + c.triggerByCounter.WithLabelValues("ConfigMap", "add").Inc() + + c.enqueueForNamespace(o.GetNamespace()) + } +} + +func (c *Operator) handleConfigMapDelete(obj interface{}) { + o, ok := c.getObject(obj) + if ok { + level.Debug(c.logger).Log("msg", "ConfigMap deleted") + c.triggerByCounter.WithLabelValues("ConfigMap", "delete").Inc() + + c.enqueueForNamespace(o.GetNamespace()) + } +} + +func (c *Operator) handleConfigMapUpdate(old, cur interface{}) { + if old.(*v1.ConfigMap).ResourceVersion == cur.(*v1.ConfigMap).ResourceVersion { + return + } + + o, ok := c.getObject(cur) + if ok { + level.Debug(c.logger).Log("msg", "ConfigMap updated") + c.triggerByCounter.WithLabelValues("ConfigMap", "update").Inc() + + c.enqueueForNamespace(o.GetNamespace()) + } +} + +func (c *Operator) getObject(obj interface{}) (metav1.Object, bool) { + ts, ok := obj.(cache.DeletedFinalStateUnknown) + if ok { + obj = ts.Obj + } + + o, err := meta.Accessor(obj) + if err != nil { + level.Error(c.logger).Log("msg", "get object failed", "err", err) + return nil, false + } + return o, true +} + +// enqueue adds a key to the queue. If obj is a key already it gets added +// directly. Otherwise, the key is extracted via keyFunc. +func (c *Operator) enqueue(obj interface{}) { + if obj == nil { + return + } + + key, ok := obj.(string) + if !ok { + key, ok = c.keyFunc(obj) + if !ok { + return + } + } + + c.queue.Add(key) +} + +// enqueueForNamespace enqueues all Prometheus object keys that belong to the +// given namespace or select objects in the given namespace. +func (c *Operator) enqueueForNamespace(nsName string) { + nsObject, exists, err := c.nsInf.GetStore().GetByKey(nsName) + if err != nil { + level.Error(c.logger).Log( + "msg", "get namespace to enqueue Prometheus instances failed", + "err", err, + ) + return + } + if !exists { + level.Error(c.logger).Log( + "msg", fmt.Sprintf("get namespace to enqueue Prometheus instances failed: namespace %q does not exist", nsName), + "err", err, + ) + return + } + ns := nsObject.(*v1.Namespace) + + err = cache.ListAll(c.promInf.GetStore(), labels.Everything(), func(obj interface{}) { + // Check for Prometheus instances in the NS. + p := obj.(*monitoringv1.Prometheus) + if p.Namespace == nsName { + c.enqueue(p) + return + } + + // Check for Prometheus instances selecting ServiceMonitors in + // the NS. + smNSSelector, err := metav1.LabelSelectorAsSelector(p.Spec.ServiceMonitorNamespaceSelector) + if err != nil { + level.Error(c.logger).Log( + "msg", fmt.Sprintf("failed to convert ServiceMonitorNamespaceSelector of %q to selector", p.Name), + "err", err, + ) + return + } + + if smNSSelector.Matches(labels.Set(ns.Labels)) { + c.enqueue(p) + return + } + + // Check for Prometheus instances selecting PrometheusRules in + // the NS. + ruleNSSelector, err := metav1.LabelSelectorAsSelector(p.Spec.RuleNamespaceSelector) + if err != nil { + level.Error(c.logger).Log( + "msg", fmt.Sprintf("failed to convert RuleNamespaceSelector of %q to selector", p.Name), + "err", err, + ) + return + } + + if ruleNSSelector.Matches(labels.Set(ns.Labels)) { + c.enqueue(p) + return + } + }) + if err != nil { + level.Error(c.logger).Log( + "msg", "listing all Prometheus instances from cache failed", + "err", err, + ) + } +} + +// worker runs a worker thread that just dequeues items, processes them, and +// marks them done. It enforces that the syncHandler is never invoked +// concurrently with the same key. +func (c *Operator) worker() { + for c.processNextWorkItem() { + } +} + +func (c *Operator) processNextWorkItem() bool { + key, quit := c.queue.Get() + if quit { + return false + } + defer c.queue.Done(key) + + err := c.sync(key.(string)) + if err == nil { + c.queue.Forget(key) + return true + } + + c.reconcileErrorsCounter.With(prometheus.Labels{}).Inc() + utilruntime.HandleError(errors.Wrap(err, fmt.Sprintf("Sync %q failed", key))) + c.queue.AddRateLimited(key) + + return true +} + +func (c *Operator) prometheusForStatefulSet(sset interface{}) *monitoringv1.Prometheus { + key, ok := c.keyFunc(sset) + if !ok { + return nil + } + + promKey := statefulSetKeyToPrometheusKey(key) + p, exists, err := c.promInf.GetStore().GetByKey(promKey) + if err != nil { + level.Error(c.logger).Log("msg", "Prometheus lookup failed", "err", err) + return nil + } + if !exists { + return nil + } + return p.(*monitoringv1.Prometheus) +} + +func prometheusNameFromStatefulSetName(name string) string { + return strings.TrimPrefix(name, "prometheus-") +} + +func statefulSetNameFromPrometheusName(name string) string { + return "prometheus-" + name +} + +func statefulSetKeyToPrometheusKey(key string) string { + keyParts := strings.Split(key, "/") + return keyParts[0] + "/" + strings.TrimPrefix(keyParts[1], "prometheus-") +} + +func prometheusKeyToStatefulSetKey(key string) string { + keyParts := strings.Split(key, "/") + return keyParts[0] + "/prometheus-" + keyParts[1] +} + +func (c *Operator) handleStatefulSetDelete(obj interface{}) { + if ps := c.prometheusForStatefulSet(obj); ps != nil { + level.Debug(c.logger).Log("msg", "StatefulSet delete") + c.triggerByCounter.WithLabelValues("StatefulSet", "delete").Inc() + + c.enqueue(ps) + } +} + +func (c *Operator) handleStatefulSetAdd(obj interface{}) { + if ps := c.prometheusForStatefulSet(obj); ps != nil { + level.Debug(c.logger).Log("msg", "StatefulSet added") + c.triggerByCounter.WithLabelValues("StatefulSet", "add").Inc() + + c.enqueue(ps) + } +} + +func (c *Operator) handleStatefulSetUpdate(oldo, curo interface{}) { + old := oldo.(*appsv1.StatefulSet) + cur := curo.(*appsv1.StatefulSet) + + level.Debug(c.logger).Log("msg", "update handler", "old", old.ResourceVersion, "cur", cur.ResourceVersion) + + // Periodic resync may resend the StatefulSet without changes + // in-between. Also breaks loops created by updating the resource + // ourselves. + if old.ResourceVersion == cur.ResourceVersion { + return + } + + if ps := c.prometheusForStatefulSet(cur); ps != nil { + level.Debug(c.logger).Log("msg", "StatefulSet updated") + c.triggerByCounter.WithLabelValues("StatefulSet", "update").Inc() + + c.enqueue(ps) + } +} + +func (c *Operator) sync(key string) error { + obj, exists, err := c.promInf.GetIndexer().GetByKey(key) + if err != nil { + return err + } + if !exists { + // Dependent resources are cleaned up by K8s via OwnerReferences + return nil + } + + p := obj.(*monitoringv1.Prometheus) + p = p.DeepCopy() + p.APIVersion = monitoringv1.SchemeGroupVersion.String() + p.Kind = monitoringv1.PrometheusesKind + + if p.Spec.Paused { + return nil + } + + level.Info(c.logger).Log("msg", "sync prometheus", "key", key) + + ruleConfigMapNames, err := c.createOrUpdateRuleConfigMaps(p) + if err != nil { + return err + } + + // If no service monitor selectors are configured, the user wants to + // manage configuration themselves. + if p.Spec.ServiceMonitorSelector != nil { + // We just always regenerate the configuration to be safe. + if err := c.createOrUpdateConfigurationSecret(p, ruleConfigMapNames); err != nil { + return errors.Wrap(err, "creating config failed") + } + } + + // Create empty Secret if it doesn't exist. See comment above. + s, err := makeEmptyConfigurationSecret(p, c.config) + if err != nil { + return errors.Wrap(err, "generating empty config secret failed") + } + sClient := c.kclient.CoreV1().Secrets(p.Namespace) + _, err = sClient.Get(s.Name, metav1.GetOptions{}) + if apierrors.IsNotFound(err) { + if _, err := c.kclient.Core().Secrets(p.Namespace).Create(s); err != nil && !apierrors.IsAlreadyExists(err) { + return errors.Wrap(err, "creating empty config file failed") + } + } + if !apierrors.IsNotFound(err) && err != nil { + return err + } + + // Create governing service if it doesn't exist. + svcClient := c.kclient.Core().Services(p.Namespace) + if err := k8sutil.CreateOrUpdateService(svcClient, makeStatefulSetService(p, c.config)); err != nil { + return errors.Wrap(err, "synchronizing governing service failed") + } + + ssetClient := c.kclient.AppsV1beta2().StatefulSets(p.Namespace) + // Ensure we have a StatefulSet running Prometheus deployed. + obj, exists, err = c.ssetInf.GetIndexer().GetByKey(prometheusKeyToStatefulSetKey(key)) + if err != nil { + return errors.Wrap(err, "retrieving statefulset failed") + } + + newSSetInputHash, err := createSSetInputHash(*p, c.config, ruleConfigMapNames) + if err != nil { + return err + } + + sset, err := makeStatefulSet(*p, &c.config, ruleConfigMapNames, newSSetInputHash) + if err != nil { + return errors.Wrap(err, "making statefulset failed") + } + + if !exists { + level.Debug(c.logger).Log("msg", "no current Prometheus statefulset found") + level.Debug(c.logger).Log("msg", "creating Prometheus statefulset") + if _, err := ssetClient.Create(sset); err != nil { + return errors.Wrap(err, "creating statefulset failed") + } + return nil + } + + oldSSetInputHash := obj.(*appsv1.StatefulSet).ObjectMeta.Annotations[sSetInputHashName] + if newSSetInputHash == oldSSetInputHash { + level.Debug(c.logger).Log("msg", "new statefulset generation inputs match current, skipping any actions") + return nil + } + + level.Debug(c.logger).Log("msg", "updating current Prometheus statefulset") + + _, err = ssetClient.Update(sset) + sErr, ok := err.(*apierrors.StatusError) + + if ok && sErr.ErrStatus.Code == 422 && sErr.ErrStatus.Reason == metav1.StatusReasonInvalid { + level.Debug(c.logger).Log("msg", "resolving illegal update of Prometheus StatefulSet") + propagationPolicy := metav1.DeletePropagationForeground + if err := ssetClient.Delete(sset.GetName(), &metav1.DeleteOptions{PropagationPolicy: &propagationPolicy}); err != nil { + return errors.Wrap(err, "failed to delete StatefulSet to avoid forbidden action") + } + return nil + } + + if err != nil { + return errors.Wrap(err, "updating StatefulSet failed") + } + + return nil +} + +func createSSetInputHash(p monitoringv1.Prometheus, c Config, ruleConfigMapNames []string) (string, error) { + hash, err := hashstructure.Hash(struct { + P monitoringv1.Prometheus + C Config + R []string `hash:"set"` + }{p, c, ruleConfigMapNames}, + nil, + ) + if err != nil { + return "", errors.Wrap( + err, + "failed to calculate combined hash of Prometheus CRD, config and"+ + " rule ConfigMap names", + ) + } + + return fmt.Sprintf("%d", hash), nil +} + +func ListOptions(name string) metav1.ListOptions { + return metav1.ListOptions{ + LabelSelector: fields.SelectorFromSet(fields.Set(map[string]string{ + "app": "prometheus", + "prometheus": name, + })).String(), + } +} + +// PrometheusStatus evaluates the current status of a Prometheus deployment with +// respect to its specified resource object. It return the status and a list of +// pods that are not updated. +func PrometheusStatus(kclient kubernetes.Interface, p *monitoringv1.Prometheus) (*monitoringv1.PrometheusStatus, []v1.Pod, error) { + res := &monitoringv1.PrometheusStatus{Paused: p.Spec.Paused} + + pods, err := kclient.Core().Pods(p.Namespace).List(ListOptions(p.Name)) + if err != nil { + return nil, nil, errors.Wrap(err, "retrieving pods of failed") + } + sset, err := kclient.AppsV1beta2().StatefulSets(p.Namespace).Get(statefulSetNameFromPrometheusName(p.Name), metav1.GetOptions{}) + if err != nil { + return nil, nil, errors.Wrap(err, "retrieving stateful set failed") + } + + res.Replicas = int32(len(pods.Items)) + + var oldPods []v1.Pod + for _, pod := range pods.Items { + ready, err := k8sutil.PodRunningAndReady(pod) + if err != nil { + return nil, nil, errors.Wrap(err, "cannot determine pod ready state") + } + if ready { + res.AvailableReplicas++ + // TODO(fabxc): detect other fields of the pod template + // that are mutable. + if needsUpdate(&pod, sset.Spec.Template) { + oldPods = append(oldPods, pod) + } else { + res.UpdatedReplicas++ + } + continue + } + res.UnavailableReplicas++ + } + + return res, oldPods, nil +} + +// needsUpdate checks whether the given pod conforms with the pod template spec +// for various attributes that are influenced by the Prometheus CRD settings. +func needsUpdate(pod *v1.Pod, tmpl v1.PodTemplateSpec) bool { + c1 := pod.Spec.Containers[0] + c2 := tmpl.Spec.Containers[0] + + if c1.Image != c2.Image { + return true + } + if !reflect.DeepEqual(c1.Args, c2.Args) { + return true + } + + return false +} + +func loadAdditionalScrapeConfigsSecret(additionalScrapeConfigs *v1.SecretKeySelector, s *v1.SecretList) ([]byte, error) { + if additionalScrapeConfigs != nil { + for _, secret := range s.Items { + if secret.Name == additionalScrapeConfigs.Name { + if c, ok := secret.Data[additionalScrapeConfigs.Key]; ok { + return c, nil + } + + return nil, fmt.Errorf("key %v could not be found in Secret %v", additionalScrapeConfigs.Key, additionalScrapeConfigs.Name) + } + } + return nil, fmt.Errorf("secret %v could not be found", additionalScrapeConfigs.Name) + } + return nil, nil +} + +func extractCredKey(secret *v1.Secret, sel v1.SecretKeySelector, cred string) (string, error) { + if s, ok := secret.Data[sel.Key]; ok { + return string(s), nil + } + return "", fmt.Errorf("secret %s key %q in secret %q not found", cred, sel.Key, sel.Name) +} + +func getCredFromSecret(c corev1client.SecretInterface, sel v1.SecretKeySelector, cred string, cacheKey string, cache map[string]*v1.Secret) (_ string, err error) { + var s *v1.Secret + var ok bool + + if s, ok = cache[cacheKey]; !ok { + if s, err = c.Get(sel.Name, metav1.GetOptions{}); err != nil { + return "", fmt.Errorf("unable to fetch %s secret %q: %s", cred, sel.Name, err) + } + cache[cacheKey] = s + } + return extractCredKey(s, sel, cred) +} + +func loadBasicAuthSecretFromAPI(basicAuth *monitoringv1.BasicAuth, c corev1client.CoreV1Interface, ns string, cache map[string]*v1.Secret) (BasicAuthCredentials, error) { + var username string + var password string + var err error + + sClient := c.Secrets(ns) + + if username, err = getCredFromSecret(sClient, basicAuth.Username, "username", ns+"/"+basicAuth.Username.Name, cache); err != nil { + return BasicAuthCredentials{}, err + } + + if password, err = getCredFromSecret(sClient, basicAuth.Password, "password", ns+"/"+basicAuth.Password.Name, cache); err != nil { + return BasicAuthCredentials{}, err + } + + return BasicAuthCredentials{username: username, password: password}, nil +} + +func loadBasicAuthSecret(basicAuth *monitoringv1.BasicAuth, s *v1.SecretList) (BasicAuthCredentials, error) { + var username string + var password string + var err error + + for _, secret := range s.Items { + + if secret.Name == basicAuth.Username.Name { + if username, err = extractCredKey(&secret, basicAuth.Username, "username"); err != nil { + return BasicAuthCredentials{}, err + } + } + + if secret.Name == basicAuth.Password.Name { + if password, err = extractCredKey(&secret, basicAuth.Password, "password"); err != nil { + return BasicAuthCredentials{}, err + } + + } + if username != "" && password != "" { + break + } + } + + if username == "" && password == "" { + return BasicAuthCredentials{}, fmt.Errorf("basic auth username and password secret not found") + } + + return BasicAuthCredentials{username: username, password: password}, nil + +} + +func (c *Operator) loadBasicAuthSecrets( + mons map[string]*monitoringv1.ServiceMonitor, + remoteReads []monitoringv1.RemoteReadSpec, + remoteWrites []monitoringv1.RemoteWriteSpec, + apiserverConfig *monitoringv1.APIServerConfig, + SecretsInPromNS *v1.SecretList, +) (map[string]BasicAuthCredentials, error) { + + secrets := map[string]BasicAuthCredentials{} + nsSecretCache := make(map[string]*v1.Secret) + for _, mon := range mons { + for i, ep := range mon.Spec.Endpoints { + if ep.BasicAuth != nil { + credentials, err := loadBasicAuthSecretFromAPI(ep.BasicAuth, c.kclient.CoreV1(), mon.Namespace, nsSecretCache) + if err != nil { + return nil, fmt.Errorf("could not generate basicAuth for servicemonitor %s. %s", mon.Name, err) + } + secrets[fmt.Sprintf("serviceMonitor/%s/%s/%d", mon.Namespace, mon.Name, i)] = credentials + } + } + } + + for i, remote := range remoteReads { + if remote.BasicAuth != nil { + credentials, err := loadBasicAuthSecret(remote.BasicAuth, SecretsInPromNS) + if err != nil { + return nil, fmt.Errorf("could not generate basicAuth for remote_read config %d. %s", i, err) + } + secrets[fmt.Sprintf("remoteRead/%d", i)] = credentials + } + } + + for i, remote := range remoteWrites { + if remote.BasicAuth != nil { + credentials, err := loadBasicAuthSecret(remote.BasicAuth, SecretsInPromNS) + if err != nil { + return nil, fmt.Errorf("could not generate basicAuth for remote_write config %d. %s", i, err) + } + secrets[fmt.Sprintf("remoteWrite/%d", i)] = credentials + } + } + + // load apiserver basic auth secret + if apiserverConfig != nil && apiserverConfig.BasicAuth != nil { + credentials, err := loadBasicAuthSecret(apiserverConfig.BasicAuth, SecretsInPromNS) + if err != nil { + return nil, fmt.Errorf("could not generate basicAuth for apiserver config. %s", err) + } + secrets["apiserver"] = credentials + } + + return secrets, nil + +} + +func (c *Operator) createOrUpdateConfigurationSecret(p *monitoringv1.Prometheus, ruleConfigMapNames []string) error { + smons, err := c.selectServiceMonitors(p) + if err != nil { + return errors.Wrap(err, "selecting ServiceMonitors failed") + } + + sClient := c.kclient.CoreV1().Secrets(p.Namespace) + SecretsInPromNS, err := sClient.List(metav1.ListOptions{}) + if err != nil { + return err + } + + basicAuthSecrets, err := c.loadBasicAuthSecrets(smons, p.Spec.RemoteRead, p.Spec.RemoteWrite, p.Spec.APIServerConfig, SecretsInPromNS) + if err != nil { + return err + } + + additionalScrapeConfigs, err := loadAdditionalScrapeConfigsSecret(p.Spec.AdditionalScrapeConfigs, SecretsInPromNS) + if err != nil { + return errors.Wrap(err, "loading additional scrape configs from Secret failed") + } + additionalAlertRelabelConfigs, err := loadAdditionalScrapeConfigsSecret(p.Spec.AdditionalAlertRelabelConfigs, SecretsInPromNS) + if err != nil { + return errors.Wrap(err, "loading additional alert relabel configs from Secret failed") + } + additionalAlertManagerConfigs, err := loadAdditionalScrapeConfigsSecret(p.Spec.AdditionalAlertManagerConfigs, SecretsInPromNS) + if err != nil { + return errors.Wrap(err, "loading additional alert manager configs from Secret failed") + } + + // Update secret based on the most recent configuration. + conf, err := c.configGenerator.generateConfig( + p, + smons, + basicAuthSecrets, + additionalScrapeConfigs, + additionalAlertRelabelConfigs, + additionalAlertManagerConfigs, + ruleConfigMapNames, + ) + if err != nil { + return errors.Wrap(err, "generating config failed") + } + + s := makeConfigSecret(p, c.config) + s.ObjectMeta.Annotations = map[string]string{ + "generated": "true", + } + s.Data[configFilename] = []byte(conf) + + curSecret, err := sClient.Get(s.Name, metav1.GetOptions{}) + if apierrors.IsNotFound(err) { + level.Debug(c.logger).Log("msg", "creating configuration") + _, err = sClient.Create(s) + return err + } + + var ( + generatedConf = s.Data[configFilename] + curConfig, curConfigFound = curSecret.Data[configFilename] + ) + if curConfigFound { + if bytes.Equal(curConfig, generatedConf) { + level.Debug(c.logger).Log("msg", "updating Prometheus configuration secret skipped, no configuration change") + return nil + } + level.Debug(c.logger).Log("msg", "current Prometheus configuration has changed") + } else { + level.Debug(c.logger).Log("msg", "no current Prometheus configuration secret found", "currentConfigFound", curConfigFound) + } + + level.Debug(c.logger).Log("msg", "updating Prometheus configuration secret") + _, err = sClient.Update(s) + return err +} + +func (c *Operator) selectServiceMonitors(p *monitoringv1.Prometheus) (map[string]*monitoringv1.ServiceMonitor, error) { + namespaces := []string{} + // Selectors might overlap. Deduplicate them along the keyFunc. + res := make(map[string]*monitoringv1.ServiceMonitor) + + servMonSelector, err := metav1.LabelSelectorAsSelector(p.Spec.ServiceMonitorSelector) + if err != nil { + return nil, err + } + + // If 'ServiceMonitorNamespaceSelector' is nil only check own namespace. + if p.Spec.ServiceMonitorNamespaceSelector == nil { + namespaces = append(namespaces, p.Namespace) + } else { + servMonNSSelector, err := metav1.LabelSelectorAsSelector(p.Spec.ServiceMonitorNamespaceSelector) + if err != nil { + return nil, err + } + + namespaces, err = c.listMatchingNamespaces(servMonNSSelector) + if err != nil { + return nil, err + } + } + + level.Debug(c.logger).Log("msg", "filtering namespaces to select ServiceMonitors from", "namespaces", strings.Join(namespaces, ","), "namespace", p.Namespace, "prometheus", p.Name) + + for _, ns := range namespaces { + cache.ListAllByNamespace(c.smonInf.GetIndexer(), ns, servMonSelector, func(obj interface{}) { + k, ok := c.keyFunc(obj) + if ok { + res[k] = obj.(*monitoringv1.ServiceMonitor) + } + }) + } + + serviceMonitors := []string{} + for k := range res { + serviceMonitors = append(serviceMonitors, k) + } + level.Debug(c.logger).Log("msg", "selected ServiceMonitors", "servicemonitors", strings.Join(serviceMonitors, ","), "namespace", p.Namespace, "prometheus", p.Name) + + return res, nil +} + +// listMatchingNamespaces lists all the namespaces that match the provided +// selector. +func (c *Operator) listMatchingNamespaces(selector labels.Selector) ([]string, error) { + var ns []string + err := cache.ListAll(c.nsInf.GetStore(), selector, func(obj interface{}) { + ns = append(ns, obj.(*v1.Namespace).Name) + }) + if err != nil { + return nil, errors.Wrap(err, "failed to list namespaces") + } + return ns, nil +} + +func (c *Operator) createCRDs() error { + crds := []*extensionsobj.CustomResourceDefinition{ + k8sutil.NewCustomResourceDefinition(c.config.CrdKinds.Prometheus, c.config.CrdGroup, c.config.Labels.LabelsMap, c.config.EnableValidation), + k8sutil.NewCustomResourceDefinition(c.config.CrdKinds.ServiceMonitor, c.config.CrdGroup, c.config.Labels.LabelsMap, c.config.EnableValidation), + k8sutil.NewCustomResourceDefinition(c.config.CrdKinds.PrometheusRule, c.config.CrdGroup, c.config.Labels.LabelsMap, c.config.EnableValidation), + } + + crdClient := c.crdclient.ApiextensionsV1beta1().CustomResourceDefinitions() + + for _, crd := range crds { + oldCRD, err := crdClient.Get(crd.Name, metav1.GetOptions{}) + if err != nil && !apierrors.IsNotFound(err) { + return errors.Wrapf(err, "getting CRD: %s", crd.Spec.Names.Kind) + } + if apierrors.IsNotFound(err) { + if _, err := crdClient.Create(crd); err != nil { + return errors.Wrapf(err, "creating CRD: %s", crd.Spec.Names.Kind) + } + level.Info(c.logger).Log("msg", "CRD created", "crd", crd.Spec.Names.Kind) + } + if err == nil { + crd.ResourceVersion = oldCRD.ResourceVersion + if _, err := crdClient.Update(crd); err != nil { + return errors.Wrapf(err, "creating CRD: %s", crd.Spec.Names.Kind) + } + level.Info(c.logger).Log("msg", "CRD updated", "crd", crd.Spec.Names.Kind) + } + } + + crdListFuncs := []struct { + name string + listFunc func(opts metav1.ListOptions) (runtime.Object, error) + }{ + { + monitoringv1.PrometheusesKind, + listwatch.MultiNamespaceListerWatcher(c.config.Namespaces, func(namespace string) cache.ListerWatcher { + return &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + return c.mclient.MonitoringV1().Prometheuses(namespace).List(options) + }, + } + }).List, + }, + { + monitoringv1.ServiceMonitorsKind, + listwatch.MultiNamespaceListerWatcher(c.config.Namespaces, func(namespace string) cache.ListerWatcher { + return &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + return c.mclient.MonitoringV1().ServiceMonitors(namespace).List(options) + }, + } + }).List, + }, + { + monitoringv1.PrometheusRuleKind, + listwatch.MultiNamespaceListerWatcher(c.config.Namespaces, func(namespace string) cache.ListerWatcher { + return &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + return c.mclient.MonitoringV1().PrometheusRules(namespace).List(options) + }, + } + }).List, + }, + } + + for _, crdListFunc := range crdListFuncs { + err := k8sutil.WaitForCRDReady(crdListFunc.listFunc) + if err != nil { + return errors.Wrapf(err, "waiting for %v crd failed", crdListFunc.name) + } + } + + return nil +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/promcfg.go b/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/promcfg.go new file mode 100644 index 0000000000..241245aa72 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/promcfg.go @@ -0,0 +1,853 @@ +// Copyright 2016 The prometheus-operator 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 prometheus + +import ( + "fmt" + "regexp" + "sort" + "strings" + + "github.com/blang/semver" + "github.com/go-kit/kit/log" + "github.com/go-kit/kit/log/level" + "github.com/pkg/errors" + "gopkg.in/yaml.v2" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" +) + +var ( + invalidLabelCharRE = regexp.MustCompile(`[^a-zA-Z0-9_]`) +) + +type configGenerator struct { + logger log.Logger +} + +func NewConfigGenerator(logger log.Logger) *configGenerator { + cg := &configGenerator{ + logger: logger, + } + return cg +} + +func sanitizeLabelName(name string) string { + return invalidLabelCharRE.ReplaceAllString(name, "_") +} + +func stringMapToMapSlice(m map[string]string) yaml.MapSlice { + res := yaml.MapSlice{} + ks := make([]string, 0) + + for k := range m { + ks = append(ks, k) + } + sort.Strings(ks) + + for _, k := range ks { + res = append(res, yaml.MapItem{Key: k, Value: m[k]}) + } + + return res +} + +func addTLStoYaml(cfg yaml.MapSlice, tls *v1.TLSConfig) yaml.MapSlice { + if tls != nil { + tlsConfig := yaml.MapSlice{ + {Key: "insecure_skip_verify", Value: tls.InsecureSkipVerify}, + } + if tls.CAFile != "" { + tlsConfig = append(tlsConfig, yaml.MapItem{Key: "ca_file", Value: tls.CAFile}) + } + if tls.CertFile != "" { + tlsConfig = append(tlsConfig, yaml.MapItem{Key: "cert_file", Value: tls.CertFile}) + } + if tls.KeyFile != "" { + tlsConfig = append(tlsConfig, yaml.MapItem{Key: "key_file", Value: tls.KeyFile}) + } + if tls.ServerName != "" { + tlsConfig = append(tlsConfig, yaml.MapItem{Key: "server_name", Value: tls.ServerName}) + } + cfg = append(cfg, yaml.MapItem{Key: "tls_config", Value: tlsConfig}) + } + return cfg +} + +func buildExternalLabels(p *v1.Prometheus) yaml.MapSlice { + m := map[string]string{} + + m["prometheus"] = fmt.Sprintf("%s/%s", p.Namespace, p.Name) + m["prometheus_replica"] = "$(POD_NAME)" + + for n, v := range p.Spec.ExternalLabels { + m[n] = v + } + return stringMapToMapSlice(m) +} + +func (cg *configGenerator) generateConfig( + p *v1.Prometheus, + mons map[string]*v1.ServiceMonitor, + basicAuthSecrets map[string]BasicAuthCredentials, + additionalScrapeConfigs []byte, + additionalAlertRelabelConfigs []byte, + additionalAlertManagerConfigs []byte, + ruleConfigMapNames []string, +) ([]byte, error) { + versionStr := p.Spec.Version + if versionStr == "" { + versionStr = DefaultPrometheusVersion + } + + version, err := semver.Parse(strings.TrimLeft(versionStr, "v")) + if err != nil { + return nil, errors.Wrap(err, "parse version") + } + + cfg := yaml.MapSlice{} + + scrapeInterval := "30s" + if p.Spec.ScrapeInterval != "" { + scrapeInterval = p.Spec.ScrapeInterval + } + + evaluationInterval := "30s" + if p.Spec.EvaluationInterval != "" { + evaluationInterval = p.Spec.EvaluationInterval + } + + cfg = append(cfg, yaml.MapItem{ + Key: "global", + Value: yaml.MapSlice{ + {Key: "evaluation_interval", Value: evaluationInterval}, + {Key: "scrape_interval", Value: scrapeInterval}, + {Key: "external_labels", Value: buildExternalLabels(p)}, + }, + }) + + ruleFilePaths := []string{} + for _, name := range ruleConfigMapNames { + ruleFilePaths = append(ruleFilePaths, rulesDir+"/"+name+"/*.yaml") + } + cfg = append(cfg, yaml.MapItem{ + Key: "rule_files", + Value: ruleFilePaths, + }) + + identifiers := make([]string, len(mons)) + i := 0 + for k := range mons { + identifiers[i] = k + i++ + } + + // Sorting ensures, that we always generate the config in the same order. + sort.Strings(identifiers) + + apiserverConfig := p.Spec.APIServerConfig + + var scrapeConfigs []yaml.MapSlice + for _, identifier := range identifiers { + for i, ep := range mons[identifier].Spec.Endpoints { + scrapeConfigs = append(scrapeConfigs, cg.generateServiceMonitorConfig(version, mons[identifier], ep, i, apiserverConfig, basicAuthSecrets)) + } + } + var alertmanagerConfigs []yaml.MapSlice + if p.Spec.Alerting != nil { + for _, am := range p.Spec.Alerting.Alertmanagers { + alertmanagerConfigs = append(alertmanagerConfigs, cg.generateAlertmanagerConfig(version, am, apiserverConfig, basicAuthSecrets)) + } + } + + var additionalScrapeConfigsYaml []yaml.MapSlice + err = yaml.Unmarshal([]byte(additionalScrapeConfigs), &additionalScrapeConfigsYaml) + if err != nil { + return nil, errors.Wrap(err, "unmarshalling additional scrape configs failed") + } + + cfg = append(cfg, yaml.MapItem{ + Key: "scrape_configs", + Value: append(scrapeConfigs, additionalScrapeConfigsYaml...), + }) + + var additionalAlertManagerConfigsYaml []yaml.MapSlice + err = yaml.Unmarshal([]byte(additionalAlertManagerConfigs), &additionalAlertManagerConfigsYaml) + if err != nil { + return nil, errors.Wrap(err, "unmarshalling additional alert manager configs failed") + } + + alertmanagerConfigs = append(alertmanagerConfigs, additionalAlertManagerConfigsYaml...) + + var alertRelabelConfigs []yaml.MapSlice + + // action 'labeldrop' is not supported <= v1.4.1 + if version.GT(semver.MustParse("1.4.1")) { + // Drop 'prometheus_replica' label, to make alerts from two Prometheus replicas alike + alertRelabelConfigs = append(alertRelabelConfigs, yaml.MapSlice{ + {Key: "action", Value: "labeldrop"}, + {Key: "regex", Value: "prometheus_replica"}, + }) + } + + var additionalAlertRelabelConfigsYaml []yaml.MapSlice + err = yaml.Unmarshal([]byte(additionalAlertRelabelConfigs), &additionalAlertRelabelConfigsYaml) + if err != nil { + return nil, errors.Wrap(err, "unmarshalling additional alerting relabel configs failed") + } + + cfg = append(cfg, yaml.MapItem{ + Key: "alerting", + Value: yaml.MapSlice{ + { + Key: "alert_relabel_configs", + Value: append(alertRelabelConfigs, additionalAlertRelabelConfigsYaml...), + }, + { + Key: "alertmanagers", + Value: alertmanagerConfigs, + }, + }, + }) + + if len(p.Spec.RemoteWrite) > 0 && version.Major >= 2 { + cfg = append(cfg, cg.generateRemoteWriteConfig(version, p.Spec.RemoteWrite, basicAuthSecrets)) + } + + if len(p.Spec.RemoteRead) > 0 && version.Major >= 2 { + cfg = append(cfg, cg.generateRemoteReadConfig(version, p.Spec.RemoteRead, basicAuthSecrets)) + } + + return yaml.Marshal(cfg) +} + +func (cg *configGenerator) generateServiceMonitorConfig(version semver.Version, m *v1.ServiceMonitor, ep v1.Endpoint, i int, apiserverConfig *v1.APIServerConfig, basicAuthSecrets map[string]BasicAuthCredentials) yaml.MapSlice { + cfg := yaml.MapSlice{ + { + Key: "job_name", + Value: fmt.Sprintf("%s/%s/%d", m.Namespace, m.Name, i), + }, + { + Key: "honor_labels", + Value: ep.HonorLabels, + }, + } + + switch version.Major { + case 1: + if version.Minor < 7 { + if apiserverConfig != nil { + level.Info(cg.logger).Log("msg", "custom apiserver config is set but it will not take effect because prometheus version is < 1.7") + } + cfg = append(cfg, cg.generateK8SSDConfig(nil, nil, nil)) + } else { + cfg = append(cfg, cg.generateK8SSDConfig(getNamespacesFromServiceMonitor(m), apiserverConfig, basicAuthSecrets)) + } + case 2: + cfg = append(cfg, cg.generateK8SSDConfig(getNamespacesFromServiceMonitor(m), apiserverConfig, basicAuthSecrets)) + } + + if ep.Interval != "" { + cfg = append(cfg, yaml.MapItem{Key: "scrape_interval", Value: ep.Interval}) + } + if ep.ScrapeTimeout != "" { + cfg = append(cfg, yaml.MapItem{Key: "scrape_timeout", Value: ep.ScrapeTimeout}) + } + if ep.Path != "" { + cfg = append(cfg, yaml.MapItem{Key: "metrics_path", Value: ep.Path}) + } + if ep.ProxyURL != nil { + cfg = append(cfg, yaml.MapItem{Key: "proxy_url", Value: ep.ProxyURL}) + } + if ep.Params != nil { + cfg = append(cfg, yaml.MapItem{Key: "params", Value: ep.Params}) + } + if ep.Scheme != "" { + cfg = append(cfg, yaml.MapItem{Key: "scheme", Value: ep.Scheme}) + } + + cfg = addTLStoYaml(cfg, ep.TLSConfig) + + if ep.BearerTokenFile != "" { + cfg = append(cfg, yaml.MapItem{Key: "bearer_token_file", Value: ep.BearerTokenFile}) + } + + if ep.BasicAuth != nil { + if s, ok := basicAuthSecrets[fmt.Sprintf("serviceMonitor/%s/%s/%d", m.Namespace, m.Name, i)]; ok { + cfg = append(cfg, yaml.MapItem{ + Key: "basic_auth", Value: yaml.MapSlice{ + {Key: "username", Value: s.username}, + {Key: "password", Value: s.password}, + }, + }) + } + } + + var relabelings []yaml.MapSlice + + // Filter targets by services selected by the monitor. + + // Exact label matches. + var labelKeys []string + for k := range m.Spec.Selector.MatchLabels { + labelKeys = append(labelKeys, k) + } + sort.Strings(labelKeys) + + for _, k := range labelKeys { + relabelings = append(relabelings, yaml.MapSlice{ + {Key: "action", Value: "keep"}, + {Key: "source_labels", Value: []string{"__meta_kubernetes_service_label_" + sanitizeLabelName(k)}}, + {Key: "regex", Value: m.Spec.Selector.MatchLabels[k]}, + }) + } + // Set based label matching. We have to map the valid relations + // `In`, `NotIn`, `Exists`, and `DoesNotExist`, into relabeling rules. + for _, exp := range m.Spec.Selector.MatchExpressions { + switch exp.Operator { + case metav1.LabelSelectorOpIn: + relabelings = append(relabelings, yaml.MapSlice{ + {Key: "action", Value: "keep"}, + {Key: "source_labels", Value: []string{"__meta_kubernetes_service_label_" + sanitizeLabelName(exp.Key)}}, + {Key: "regex", Value: strings.Join(exp.Values, "|")}, + }) + case metav1.LabelSelectorOpNotIn: + relabelings = append(relabelings, yaml.MapSlice{ + {Key: "action", Value: "drop"}, + {Key: "source_labels", Value: []string{"__meta_kubernetes_service_label_" + sanitizeLabelName(exp.Key)}}, + {Key: "regex", Value: strings.Join(exp.Values, "|")}, + }) + case metav1.LabelSelectorOpExists: + relabelings = append(relabelings, yaml.MapSlice{ + {Key: "action", Value: "keep"}, + {Key: "source_labels", Value: []string{"__meta_kubernetes_service_label_" + sanitizeLabelName(exp.Key)}}, + {Key: "regex", Value: ".+"}, + }) + case metav1.LabelSelectorOpDoesNotExist: + relabelings = append(relabelings, yaml.MapSlice{ + {Key: "action", Value: "drop"}, + {Key: "source_labels", Value: []string{"__meta_kubernetes_service_label_" + sanitizeLabelName(exp.Key)}}, + {Key: "regex", Value: ".+"}, + }) + } + } + + if version.Major == 1 && version.Minor < 7 { + // Filter targets based on the namespace selection configuration. + // By default we only discover services within the namespace of the + // ServiceMonitor. + // Selections allow extending this to all namespaces or to a subset + // of them specified by label or name matching. + // + // Label selections are not supported yet as they require either supported + // in the upstream SD integration or require out-of-band implementation + // in the operator with configuration reload. + // + // There's no explicit nil for the selector, we decide for the default + // case if it's all zero values. + nsel := m.Spec.NamespaceSelector + + if !nsel.Any && len(nsel.MatchNames) == 0 { + relabelings = append(relabelings, yaml.MapSlice{ + {Key: "action", Value: "keep"}, + {Key: "source_labels", Value: []string{"__meta_kubernetes_namespace"}}, + {Key: "regex", Value: m.Namespace}, + }) + } else if len(nsel.MatchNames) > 0 { + relabelings = append(relabelings, yaml.MapSlice{ + {Key: "action", Value: "keep"}, + {Key: "source_labels", Value: []string{"__meta_kubernetes_namespace"}}, + {Key: "regex", Value: strings.Join(nsel.MatchNames, "|")}, + }) + } + } + + // Filter targets based on correct port for the endpoint. + if ep.Port != "" { + relabelings = append(relabelings, yaml.MapSlice{ + {Key: "action", Value: "keep"}, + {Key: "source_labels", Value: []string{"__meta_kubernetes_endpoint_port_name"}}, + {Key: "regex", Value: ep.Port}, + }) + } else if ep.TargetPort.StrVal != "" { + relabelings = append(relabelings, yaml.MapSlice{ + {Key: "action", Value: "keep"}, + {Key: "source_labels", Value: []string{"__meta_kubernetes_pod_container_port_name"}}, + {Key: "regex", Value: ep.TargetPort.String()}, + }) + } else if ep.TargetPort.IntVal != 0 { + relabelings = append(relabelings, yaml.MapSlice{ + {Key: "action", Value: "keep"}, + {Key: "source_labels", Value: []string{"__meta_kubernetes_pod_container_port_number"}}, + {Key: "regex", Value: ep.TargetPort.String()}, + }) + } + + // Relabel namespace and pod and service labels into proper labels. + relabelings = append(relabelings, []yaml.MapSlice{ + { // Relabel node labels for pre v2.3 meta labels + {Key: "source_labels", Value: []string{"__meta_kubernetes_endpoint_address_target_kind", "__meta_kubernetes_endpoint_address_target_name"}}, + {Key: "separator", Value: ";"}, + {Key: "regex", Value: "Node;(.*)"}, + {Key: "replacement", Value: "${1}"}, + {Key: "target_label", Value: "node"}, + }, + { // Relabel pod labels for >=v2.3 meta labels + {Key: "source_labels", Value: []string{"__meta_kubernetes_endpoint_address_target_kind", "__meta_kubernetes_endpoint_address_target_name"}}, + {Key: "separator", Value: ";"}, + {Key: "regex", Value: "Pod;(.*)"}, + {Key: "replacement", Value: "${1}"}, + {Key: "target_label", Value: "pod"}, + }, + { + {Key: "source_labels", Value: []string{"__meta_kubernetes_namespace"}}, + {Key: "target_label", Value: "namespace"}, + }, + { + {Key: "source_labels", Value: []string{"__meta_kubernetes_service_name"}}, + {Key: "target_label", Value: "service"}, + }, + { + {Key: "source_labels", Value: []string{"__meta_kubernetes_pod_name"}}, + {Key: "target_label", Value: "pod"}, + }, + }...) + + // Relabel targetLabels from Service onto target. + for _, l := range m.Spec.TargetLabels { + relabelings = append(relabelings, yaml.MapSlice{ + {Key: "source_labels", Value: []string{"__meta_kubernetes_service_label_" + sanitizeLabelName(l)}}, + {Key: "target_label", Value: sanitizeLabelName(l)}, + {Key: "regex", Value: "(.+)"}, + {Key: "replacement", Value: "${1}"}, + }) + } + + for _, l := range m.Spec.PodTargetLabels { + relabelings = append(relabelings, yaml.MapSlice{ + {Key: "source_labels", Value: []string{"__meta_kubernetes_pod_label_" + sanitizeLabelName(l)}}, + {Key: "target_label", Value: sanitizeLabelName(l)}, + {Key: "regex", Value: "(.+)"}, + {Key: "replacement", Value: "${1}"}, + }) + } + + // By default, generate a safe job name from the service name. We also keep + // this around if a jobLabel is set in case the targets don't actually have a + // value for it. A single service may potentially have multiple metrics + // endpoints, therefore the endpoints labels is filled with the ports name or + // as a fallback the port number. + + relabelings = append(relabelings, yaml.MapSlice{ + {Key: "source_labels", Value: []string{"__meta_kubernetes_service_name"}}, + {Key: "target_label", Value: "job"}, + {Key: "replacement", Value: "${1}"}, + }) + if m.Spec.JobLabel != "" { + relabelings = append(relabelings, yaml.MapSlice{ + {Key: "source_labels", Value: []string{"__meta_kubernetes_service_label_" + sanitizeLabelName(m.Spec.JobLabel)}}, + {Key: "target_label", Value: "job"}, + {Key: "regex", Value: "(.+)"}, + {Key: "replacement", Value: "${1}"}, + }) + } + + if ep.Port != "" { + relabelings = append(relabelings, yaml.MapSlice{ + {Key: "target_label", Value: "endpoint"}, + {Key: "replacement", Value: ep.Port}, + }) + } else if ep.TargetPort.String() != "" { + relabelings = append(relabelings, yaml.MapSlice{ + {Key: "target_label", Value: "endpoint"}, + {Key: "replacement", Value: ep.TargetPort.String()}, + }) + } + + if ep.RelabelConfigs != nil { + for _, c := range ep.RelabelConfigs { + relabelings = append(relabelings, generateRelabelConfig(c)) + } + } + + cfg = append(cfg, yaml.MapItem{Key: "relabel_configs", Value: relabelings}) + + if m.Spec.SampleLimit > 0 { + cfg = append(cfg, yaml.MapItem{Key: "sample_limit", Value: m.Spec.SampleLimit}) + } + + if ep.MetricRelabelConfigs != nil { + var metricRelabelings []yaml.MapSlice + for _, c := range ep.MetricRelabelConfigs { + relabeling := generateRelabelConfig(c) + + metricRelabelings = append(metricRelabelings, relabeling) + } + cfg = append(cfg, yaml.MapItem{Key: "metric_relabel_configs", Value: metricRelabelings}) + } + + return cfg +} + +func generateRelabelConfig(c *v1.RelabelConfig) yaml.MapSlice { + relabeling := yaml.MapSlice{} + + if len(c.SourceLabels) > 0 { + relabeling = append(relabeling, yaml.MapItem{Key: "source_labels", Value: c.SourceLabels}) + } + + if c.Separator != "" { + relabeling = append(relabeling, yaml.MapItem{Key: "separator", Value: c.Separator}) + } + + if c.TargetLabel != "" { + relabeling = append(relabeling, yaml.MapItem{Key: "target_label", Value: c.TargetLabel}) + } + + if c.Regex != "" { + relabeling = append(relabeling, yaml.MapItem{Key: "regex", Value: c.Regex}) + } + + if c.Modulus != uint64(0) { + relabeling = append(relabeling, yaml.MapItem{Key: "modulus", Value: c.Modulus}) + } + + if c.Replacement != "" { + relabeling = append(relabeling, yaml.MapItem{Key: "replacement", Value: c.Replacement}) + } + + if c.Action != "" { + relabeling = append(relabeling, yaml.MapItem{Key: "action", Value: c.Action}) + } + + return relabeling +} + +func getNamespacesFromServiceMonitor(m *v1.ServiceMonitor) []string { + nsel := m.Spec.NamespaceSelector + namespaces := []string{} + if !nsel.Any && len(nsel.MatchNames) == 0 { + namespaces = append(namespaces, m.Namespace) + } + if !nsel.Any && len(nsel.MatchNames) > 0 { + for i := range nsel.MatchNames { + namespaces = append(namespaces, nsel.MatchNames[i]) + } + } + return namespaces +} + +func (cg *configGenerator) generateK8SSDConfig(namespaces []string, apiserverConfig *v1.APIServerConfig, basicAuthSecrets map[string]BasicAuthCredentials) yaml.MapItem { + k8sSDConfig := yaml.MapSlice{ + { + Key: "role", + Value: "endpoints", + }, + } + + if namespaces != nil { + k8sSDConfig = append(k8sSDConfig, yaml.MapItem{ + Key: "namespaces", + Value: yaml.MapSlice{ + { + Key: "names", + Value: namespaces, + }, + }, + }) + } + + if apiserverConfig != nil { + k8sSDConfig = append(k8sSDConfig, yaml.MapItem{ + Key: "api_server", Value: apiserverConfig.Host, + }) + + if apiserverConfig.BasicAuth != nil && basicAuthSecrets != nil { + if s, ok := basicAuthSecrets["apiserver"]; ok { + k8sSDConfig = append(k8sSDConfig, yaml.MapItem{ + Key: "basic_auth", Value: yaml.MapSlice{ + {Key: "username", Value: s.username}, + {Key: "password", Value: s.password}, + }, + }) + } + } + + if apiserverConfig.BearerToken != "" { + k8sSDConfig = append(k8sSDConfig, yaml.MapItem{Key: "bearer_token", Value: apiserverConfig.BearerToken}) + } + + if apiserverConfig.BearerTokenFile != "" { + k8sSDConfig = append(k8sSDConfig, yaml.MapItem{Key: "bearer_token_file", Value: apiserverConfig.BearerTokenFile}) + } + + k8sSDConfig = addTLStoYaml(k8sSDConfig, apiserverConfig.TLSConfig) + } + + return yaml.MapItem{ + Key: "kubernetes_sd_configs", + Value: []yaml.MapSlice{ + k8sSDConfig, + }, + } +} + +func (cg *configGenerator) generateAlertmanagerConfig(version semver.Version, am v1.AlertmanagerEndpoints, apiserverConfig *v1.APIServerConfig, basicAuthSecrets map[string]BasicAuthCredentials) yaml.MapSlice { + if am.Scheme == "" { + am.Scheme = "http" + } + + if am.PathPrefix == "" { + am.PathPrefix = "/" + } + + cfg := yaml.MapSlice{ + {Key: "path_prefix", Value: am.PathPrefix}, + {Key: "scheme", Value: am.Scheme}, + } + + cfg = addTLStoYaml(cfg, am.TLSConfig) + + switch version.Major { + case 1: + if version.Minor < 7 { + if apiserverConfig != nil { + level.Info(cg.logger).Log("msg", "custom apiserver config is set but it will not take effect because prometheus version is < 1.7") + } + cfg = append(cfg, cg.generateK8SSDConfig(nil, nil, nil)) + } else { + cfg = append(cfg, cg.generateK8SSDConfig([]string{am.Namespace}, apiserverConfig, basicAuthSecrets)) + } + case 2: + cfg = append(cfg, cg.generateK8SSDConfig([]string{am.Namespace}, apiserverConfig, basicAuthSecrets)) + } + + if am.BearerTokenFile != "" { + cfg = append(cfg, yaml.MapItem{Key: "bearer_token_file", Value: am.BearerTokenFile}) + } + + var relabelings []yaml.MapSlice + + relabelings = append(relabelings, yaml.MapSlice{ + {Key: "action", Value: "keep"}, + {Key: "source_labels", Value: []string{"__meta_kubernetes_service_name"}}, + {Key: "regex", Value: am.Name}, + }) + + if am.Port.StrVal != "" { + relabelings = append(relabelings, yaml.MapSlice{ + {Key: "action", Value: "keep"}, + {Key: "source_labels", Value: []string{"__meta_kubernetes_endpoint_port_name"}}, + {Key: "regex", Value: am.Port.String()}, + }) + } else if am.Port.IntVal != 0 { + relabelings = append(relabelings, yaml.MapSlice{ + {Key: "action", Value: "keep"}, + {Key: "source_labels", Value: []string{"__meta_kubernetes_pod_container_port_number"}}, + {Key: "regex", Value: am.Port.String()}, + }) + } + + if version.Major == 1 && version.Minor < 7 { + relabelings = append(relabelings, yaml.MapSlice{ + {Key: "action", Value: "keep"}, + {Key: "source_labels", Value: []string{"__meta_kubernetes_namespace"}}, + {Key: "regex", Value: am.Namespace}, + }) + } + + cfg = append(cfg, yaml.MapItem{Key: "relabel_configs", Value: relabelings}) + + return cfg +} + +func (cg *configGenerator) generateRemoteReadConfig(version semver.Version, specs []v1.RemoteReadSpec, basicAuthSecrets map[string]BasicAuthCredentials) yaml.MapItem { + + cfgs := []yaml.MapSlice{} + + for i, spec := range specs { + //defaults + if spec.RemoteTimeout == "" { + spec.RemoteTimeout = "30s" + } + + cfg := yaml.MapSlice{ + {Key: "url", Value: spec.URL}, + {Key: "remote_timeout", Value: spec.RemoteTimeout}, + } + + if len(spec.RequiredMatchers) > 0 { + cfg = append(cfg, yaml.MapItem{Key: "required_matchers", Value: stringMapToMapSlice(spec.RequiredMatchers)}) + } + + if spec.ReadRecent { + cfg = append(cfg, yaml.MapItem{Key: "read_recent", Value: spec.ReadRecent}) + } + + if spec.BasicAuth != nil { + if s, ok := basicAuthSecrets[fmt.Sprintf("remoteRead/%d", i)]; ok { + cfg = append(cfg, yaml.MapItem{ + Key: "basic_auth", Value: yaml.MapSlice{ + {Key: "username", Value: s.username}, + {Key: "password", Value: s.password}, + }, + }) + } + } + + if spec.BearerToken != "" { + cfg = append(cfg, yaml.MapItem{Key: "bearer_token", Value: spec.BearerToken}) + } + + if spec.BearerTokenFile != "" { + cfg = append(cfg, yaml.MapItem{Key: "bearer_token_file", Value: spec.BearerTokenFile}) + } + + cfg = addTLStoYaml(cfg, spec.TLSConfig) + + if spec.ProxyURL != "" { + cfg = append(cfg, yaml.MapItem{Key: "proxy_url", Value: spec.ProxyURL}) + } + + cfgs = append(cfgs, cfg) + + } + + return yaml.MapItem{ + Key: "remote_read", + Value: cfgs, + } +} + +func (cg *configGenerator) generateRemoteWriteConfig(version semver.Version, specs []v1.RemoteWriteSpec, basicAuthSecrets map[string]BasicAuthCredentials) yaml.MapItem { + + cfgs := []yaml.MapSlice{} + + for i, spec := range specs { + //defaults + if spec.RemoteTimeout == "" { + spec.RemoteTimeout = "30s" + } + + cfg := yaml.MapSlice{ + {Key: "url", Value: spec.URL}, + {Key: "remote_timeout", Value: spec.RemoteTimeout}, + } + + if spec.WriteRelabelConfigs != nil { + relabelings := []yaml.MapSlice{} + for _, c := range spec.WriteRelabelConfigs { + relabeling := yaml.MapSlice{ + {Key: "source_labels", Value: c.SourceLabels}, + } + + if c.Separator != "" { + relabeling = append(relabeling, yaml.MapItem{Key: "separator", Value: c.Separator}) + } + + if c.TargetLabel != "" { + relabeling = append(relabeling, yaml.MapItem{Key: "target_label", Value: c.TargetLabel}) + } + + if c.Regex != "" { + relabeling = append(relabeling, yaml.MapItem{Key: "regex", Value: c.Regex}) + } + + if c.Modulus != uint64(0) { + relabeling = append(relabeling, yaml.MapItem{Key: "modulus", Value: c.Modulus}) + } + + if c.Replacement != "" { + relabeling = append(relabeling, yaml.MapItem{Key: "replacement", Value: c.Replacement}) + } + + if c.Action != "" { + relabeling = append(relabeling, yaml.MapItem{Key: "action", Value: c.Action}) + } + relabelings = append(relabelings, relabeling) + } + + cfg = append(cfg, yaml.MapItem{Key: "write_relabel_configs", Value: relabelings}) + + } + + if spec.BasicAuth != nil { + if s, ok := basicAuthSecrets[fmt.Sprintf("remoteWrite/%d", i)]; ok { + cfg = append(cfg, yaml.MapItem{ + Key: "basic_auth", Value: yaml.MapSlice{ + {Key: "username", Value: s.username}, + {Key: "password", Value: s.password}, + }, + }) + } + } + + if spec.BearerToken != "" { + cfg = append(cfg, yaml.MapItem{Key: "bearer_token", Value: spec.BearerToken}) + } + + if spec.BearerTokenFile != "" { + cfg = append(cfg, yaml.MapItem{Key: "bearer_token_file", Value: spec.BearerTokenFile}) + } + + cfg = addTLStoYaml(cfg, spec.TLSConfig) + + if spec.ProxyURL != "" { + cfg = append(cfg, yaml.MapItem{Key: "proxy_url", Value: spec.ProxyURL}) + } + + if spec.QueueConfig != nil { + queueConfig := yaml.MapSlice{} + + if spec.QueueConfig.Capacity != int(0) { + queueConfig = append(queueConfig, yaml.MapItem{Key: "capacity", Value: spec.QueueConfig.Capacity}) + } + + if spec.QueueConfig.MaxShards != int(0) { + queueConfig = append(queueConfig, yaml.MapItem{Key: "max_shards", Value: spec.QueueConfig.MaxShards}) + } + + if spec.QueueConfig.MaxSamplesPerSend != int(0) { + queueConfig = append(queueConfig, yaml.MapItem{Key: "max_samples_per_send", Value: spec.QueueConfig.MaxSamplesPerSend}) + } + + if spec.QueueConfig.BatchSendDeadline != "" { + queueConfig = append(queueConfig, yaml.MapItem{Key: "batch_send_deadline", Value: spec.QueueConfig.BatchSendDeadline}) + } + + if spec.QueueConfig.MaxRetries != int(0) { + queueConfig = append(queueConfig, yaml.MapItem{Key: "max_retries", Value: spec.QueueConfig.MaxRetries}) + } + + if spec.QueueConfig.MinBackoff != "" { + queueConfig = append(queueConfig, yaml.MapItem{Key: "min_backoff", Value: spec.QueueConfig.MinBackoff}) + } + + if spec.QueueConfig.MaxBackoff != "" { + queueConfig = append(queueConfig, yaml.MapItem{Key: "max_backoff", Value: spec.QueueConfig.MaxBackoff}) + } + + cfg = append(cfg, yaml.MapItem{Key: "queue_config", Value: queueConfig}) + } + + cfgs = append(cfgs, cfg) + } + + return yaml.MapItem{ + Key: "remote_write", + Value: cfgs, + } +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/rules.go b/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/rules.go new file mode 100644 index 0000000000..bd2efde8b3 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/rules.go @@ -0,0 +1,293 @@ +// Copyright 2016 The prometheus-operator 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 prometheus + +import ( + "fmt" + "reflect" + "sort" + "strconv" + "strings" + + monitoringv1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + + "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/cache" + + "github.com/ghodss/yaml" + "github.com/go-kit/kit/log/level" + "github.com/pkg/errors" +) + +// The maximum `Data` size of a ConfigMap seems to differ between +// environments. This is probably due to different meta data sizes which count +// into the overall maximum size of a ConfigMap. Thereby lets leave a +// large buffer. +var maxConfigMapDataSize = int(float64(v1.MaxSecretSize) * 0.5) + +func (c *Operator) createOrUpdateRuleConfigMaps(p *monitoringv1.Prometheus) ([]string, error) { + cClient := c.kclient.CoreV1().ConfigMaps(p.Namespace) + + namespaces, err := c.selectRuleNamespaces(p) + if err != nil { + return nil, err + } + + newRules, err := c.selectRules(p, namespaces) + if err != nil { + return nil, err + } + + currentConfigMapList, err := cClient.List(prometheusRulesConfigMapSelector(p.Name)) + if err != nil { + return nil, err + } + currentConfigMaps := currentConfigMapList.Items + + currentRules := map[string]string{} + for _, cm := range currentConfigMaps { + for ruleFileName, ruleFile := range cm.Data { + currentRules[ruleFileName] = ruleFile + } + } + + equal := reflect.DeepEqual(newRules, currentRules) + if equal && len(currentConfigMaps) != 0 { + level.Debug(c.logger).Log( + "msg", "no PrometheusRule changes", + "namespace", p.Namespace, + "prometheus", p.Name, + ) + currentConfigMapNames := []string{} + for _, cm := range currentConfigMaps { + currentConfigMapNames = append(currentConfigMapNames, cm.Name) + } + return currentConfigMapNames, nil + } + + newConfigMaps, err := makeRulesConfigMaps(p, newRules) + if err != nil { + return nil, errors.Wrap(err, "failed to make rules ConfigMaps") + } + + newConfigMapNames := []string{} + for _, cm := range newConfigMaps { + newConfigMapNames = append(newConfigMapNames, cm.Name) + } + + if len(currentConfigMaps) == 0 { + level.Debug(c.logger).Log( + "msg", "no PrometheusRule configmap found, creating new one", + "namespace", p.Namespace, + "prometheus", p.Name, + ) + for _, cm := range newConfigMaps { + _, err = cClient.Create(&cm) + if err != nil { + return nil, errors.Wrapf(err, "failed to create ConfigMap '%v'", cm.Name) + } + } + return newConfigMapNames, nil + } + + // Simply deleting old ConfigMaps and creating new ones for now. Could be + // replaced by logic that only deletes obsolete ConfigMaps in the future. + for _, cm := range currentConfigMaps { + err := cClient.Delete(cm.Name, &metav1.DeleteOptions{}) + if err != nil { + return nil, errors.Wrapf(err, "failed to delete current ConfigMap '%v'", cm.Name) + } + } + + level.Debug(c.logger).Log( + "msg", "updating PrometheusRule", + "namespace", p.Namespace, + "prometheus", p.Name, + ) + for _, cm := range newConfigMaps { + _, err = cClient.Create(&cm) + if err != nil { + return nil, errors.Wrapf(err, "failed to create new ConfigMap '%v'", cm.Name) + } + } + + return newConfigMapNames, nil +} + +func prometheusRulesConfigMapSelector(prometheusName string) metav1.ListOptions { + return metav1.ListOptions{LabelSelector: fmt.Sprintf("prometheus-name=%v", prometheusName)} +} + +func (c *Operator) selectRuleNamespaces(p *monitoringv1.Prometheus) ([]string, error) { + namespaces := []string{} + + // If 'RuleNamespaceSelector' is nil, only check own namespace. + if p.Spec.RuleNamespaceSelector == nil { + namespaces = append(namespaces, p.Namespace) + } else { + ruleNamespaceSelector, err := metav1.LabelSelectorAsSelector(p.Spec.RuleNamespaceSelector) + if err != nil { + return namespaces, errors.Wrap(err, "convert rule namespace label selector to selector") + } + + namespaces, err = c.listMatchingNamespaces(ruleNamespaceSelector) + if err != nil { + return nil, err + } + } + + level.Debug(c.logger).Log( + "msg", "selected RuleNamespaces", + "namespaces", strings.Join(namespaces, ","), + "namespace", p.Namespace, + "prometheus", p.Name, + ) + + return namespaces, nil +} + +func (c *Operator) selectRules(p *monitoringv1.Prometheus, namespaces []string) (map[string]string, error) { + rules := map[string]string{} + + ruleSelector, err := metav1.LabelSelectorAsSelector(p.Spec.RuleSelector) + if err != nil { + return rules, errors.Wrap(err, "convert rule label selector to selector") + } + + for _, ns := range namespaces { + var marshalErr error + err := cache.ListAllByNamespace(c.ruleInf.GetIndexer(), ns, ruleSelector, func(obj interface{}) { + rule := obj.(*monitoringv1.PrometheusRule) + content, err := yaml.Marshal(rule.Spec) + if err != nil { + marshalErr = err + return + } + rules[fmt.Sprintf("%v-%v.yaml", rule.Namespace, rule.Name)] = string(content) + }) + if err != nil { + return nil, err + } + if marshalErr != nil { + return nil, marshalErr + } + } + + ruleNames := []string{} + for name := range rules { + ruleNames = append(ruleNames, name) + } + + level.Debug(c.logger).Log( + "msg", "selected Rules", + "rules", strings.Join(ruleNames, ","), + "namespace", p.Namespace, + "prometheus", p.Name, + ) + + return rules, nil +} + +// makeRulesConfigMaps takes a Prometheus configuration and rule files and +// returns a list of Kubernetes ConfigMaps to be later on mounted into the +// Prometheus instance. +// If the total size of rule files exceeds the Kubernetes ConfigMap limit, +// they are split up via the simple first-fit [1] bin packing algorithm. In the +// future this can be replaced by a more sophisticated algorithm, but for now +// simplicity should be sufficient. +// [1] https://en.wikipedia.org/wiki/Bin_packing_problem#First-fit_algorithm +func makeRulesConfigMaps(p *monitoringv1.Prometheus, ruleFiles map[string]string) ([]v1.ConfigMap, error) { + //check if none of the rule files is too large for a single ConfigMap + for filename, file := range ruleFiles { + if len(file) > maxConfigMapDataSize { + return nil, errors.Errorf( + "rule file '%v' is too large for a single Kubernetes ConfigMap", + filename, + ) + } + } + + buckets := []map[string]string{ + {}, + } + currBucketIndex := 0 + + // To make bin packing algorithm deterministic, sort ruleFiles filenames and + // iterate over filenames instead of ruleFiles map (not deterministic). + fileNames := []string{} + for n := range ruleFiles { + fileNames = append(fileNames, n) + } + sort.Strings(fileNames) + + for _, filename := range fileNames { + // If rule file doesn't fit into current bucket, create new bucket. + if bucketSize(buckets[currBucketIndex])+len(ruleFiles[filename]) > maxConfigMapDataSize { + buckets = append(buckets, map[string]string{}) + currBucketIndex++ + } + buckets[currBucketIndex][filename] = ruleFiles[filename] + } + + ruleFileConfigMaps := []v1.ConfigMap{} + for i, bucket := range buckets { + cm := makeRulesConfigMap(p, bucket) + cm.Name = cm.Name + "-" + strconv.Itoa(i) + ruleFileConfigMaps = append(ruleFileConfigMaps, cm) + } + + return ruleFileConfigMaps, nil +} + +func bucketSize(bucket map[string]string) int { + totalSize := 0 + for _, v := range bucket { + totalSize += len(v) + } + + return totalSize +} + +func makeRulesConfigMap(p *monitoringv1.Prometheus, ruleFiles map[string]string) v1.ConfigMap { + boolTrue := true + + labels := map[string]string{"prometheus-name": p.Name} + for k, v := range managedByOperatorLabels { + labels[k] = v + } + + return v1.ConfigMap{ + ObjectMeta: metav1.ObjectMeta{ + Name: prometheusRuleConfigMapName(p.Name), + Labels: labels, + OwnerReferences: []metav1.OwnerReference{ + { + APIVersion: p.APIVersion, + BlockOwnerDeletion: &boolTrue, + Controller: &boolTrue, + Kind: p.Kind, + Name: p.Name, + UID: p.UID, + }, + }, + }, + Data: ruleFiles, + } +} + +func prometheusRuleConfigMapName(prometheusName string) string { + return "prometheus-" + prometheusName + "-rulefiles" +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/statefulset.go b/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/statefulset.go new file mode 100644 index 0000000000..b778b6cbf0 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/statefulset.go @@ -0,0 +1,858 @@ +// Copyright 2016 The prometheus-operator 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 prometheus + +import ( + "fmt" + "net/url" + "path" + "strings" + + appsv1 "k8s.io/api/apps/v1beta2" + "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/resource" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/intstr" + + "github.com/blang/semver" + monitoringv1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + "github.com/coreos/prometheus-operator/pkg/k8sutil" + "github.com/pkg/errors" +) + +const ( + governingServiceName = "prometheus-operated" + DefaultPrometheusVersion = "v2.5.0" + DefaultThanosVersion = "v0.1.0" + defaultRetention = "24h" + storageDir = "/prometheus" + confDir = "/etc/prometheus/config" + confOutDir = "/etc/prometheus/config_out" + rulesDir = "/etc/prometheus/rules" + secretsDir = "/etc/prometheus/secrets/" + configmapsDir = "/etc/prometheus/configmaps/" + configFilename = "prometheus.yaml" + configEnvsubstFilename = "prometheus.env.yaml" + sSetInputHashName = "prometheus-operator-input-hash" +) + +var ( + minReplicas int32 = 1 + defaultMaxConcurrency int32 = 20 + managedByOperatorLabel = "managed-by" + managedByOperatorLabelValue = "prometheus-operator" + managedByOperatorLabels = map[string]string{ + managedByOperatorLabel: managedByOperatorLabelValue, + } + probeTimeoutSeconds int32 = 3 + + CompatibilityMatrix = []string{ + "v1.4.0", + "v1.4.1", + "v1.5.0", + "v1.5.1", + "v1.5.2", + "v1.5.3", + "v1.6.0", + "v1.6.1", + "v1.6.2", + "v1.6.3", + "v1.7.0", + "v1.7.1", + "v1.7.2", + "v1.8.0", + "v2.0.0", + "v2.2.1", + "v2.3.1", + "v2.3.2", + "v2.4.0", + "v2.4.1", + "v2.4.2", + "v2.4.3", + "v2.5.0", + } +) + +func makeStatefulSet( + p monitoringv1.Prometheus, + config *Config, + ruleConfigMapNames []string, + inputHash string, +) (*appsv1.StatefulSet, error) { + // p is passed in by value, not by reference. But p contains references like + // to annotation map, that do not get copied on function invocation. Ensure to + // prevent side effects before editing p by creating a deep copy. For more + // details see https://github.com/coreos/prometheus-operator/issues/1659. + p = *p.DeepCopy() + + // TODO(fabxc): is this the right point to inject defaults? + // Ideally we would do it before storing but that's currently not possible. + // Potentially an update handler on first insertion. + + if p.Spec.BaseImage == "" { + p.Spec.BaseImage = config.PrometheusDefaultBaseImage + } + if p.Spec.Version == "" { + p.Spec.Version = DefaultPrometheusVersion + } + if p.Spec.Thanos != nil && p.Spec.Thanos.Version == nil { + v := DefaultThanosVersion + p.Spec.Thanos.Version = &v + } + + versionStr := strings.TrimLeft(p.Spec.Version, "v") + + version, err := semver.Parse(versionStr) + if err != nil { + return nil, errors.Wrap(err, "parse version") + } + + if p.Spec.Replicas == nil { + p.Spec.Replicas = &minReplicas + } + intZero := int32(0) + if p.Spec.Replicas != nil && *p.Spec.Replicas < 0 { + p.Spec.Replicas = &intZero + } + if p.Spec.Retention == "" { + p.Spec.Retention = defaultRetention + } + + if p.Spec.Resources.Requests == nil { + p.Spec.Resources.Requests = v1.ResourceList{} + } + _, memoryRequestFound := p.Spec.Resources.Requests[v1.ResourceMemory] + memoryLimit, memoryLimitFound := p.Spec.Resources.Limits[v1.ResourceMemory] + if !memoryRequestFound && version.Major == 1 { + defaultMemoryRequest := resource.MustParse("2Gi") + compareResult := memoryLimit.Cmp(defaultMemoryRequest) + // If limit is given and smaller or equal to 2Gi, then set memory + // request to the given limit. This is necessary as if limit < request, + // then a Pod is not schedulable. + if memoryLimitFound && compareResult <= 0 { + p.Spec.Resources.Requests[v1.ResourceMemory] = memoryLimit + } else { + p.Spec.Resources.Requests[v1.ResourceMemory] = defaultMemoryRequest + } + } + + spec, err := makeStatefulSetSpec(p, config, ruleConfigMapNames) + if err != nil { + return nil, errors.Wrap(err, "make StatefulSet spec") + } + + boolTrue := true + statefulset := &appsv1.StatefulSet{ + ObjectMeta: metav1.ObjectMeta{ + Name: prefixedName(p.Name), + Labels: config.Labels.Merge(p.ObjectMeta.Labels), + Annotations: p.ObjectMeta.Annotations, + OwnerReferences: []metav1.OwnerReference{ + { + APIVersion: p.APIVersion, + BlockOwnerDeletion: &boolTrue, + Controller: &boolTrue, + Kind: p.Kind, + Name: p.Name, + UID: p.UID, + }, + }, + }, + Spec: *spec, + } + + if statefulset.ObjectMeta.Annotations == nil { + statefulset.ObjectMeta.Annotations = map[string]string{ + sSetInputHashName: inputHash, + } + } else { + statefulset.ObjectMeta.Annotations[sSetInputHashName] = inputHash + } + + if p.Spec.ImagePullSecrets != nil && len(p.Spec.ImagePullSecrets) > 0 { + statefulset.Spec.Template.Spec.ImagePullSecrets = p.Spec.ImagePullSecrets + } + storageSpec := p.Spec.Storage + if storageSpec == nil { + statefulset.Spec.Template.Spec.Volumes = append(statefulset.Spec.Template.Spec.Volumes, v1.Volume{ + Name: volumeName(p.Name), + VolumeSource: v1.VolumeSource{ + EmptyDir: &v1.EmptyDirVolumeSource{}, + }, + }) + } else if storageSpec.EmptyDir != nil { + emptyDir := storageSpec.EmptyDir + statefulset.Spec.Template.Spec.Volumes = append(statefulset.Spec.Template.Spec.Volumes, v1.Volume{ + Name: volumeName(p.Name), + VolumeSource: v1.VolumeSource{ + EmptyDir: emptyDir, + }, + }) + } else { + pvcTemplate := storageSpec.VolumeClaimTemplate + if pvcTemplate.Name == "" { + pvcTemplate.Name = volumeName(p.Name) + } + pvcTemplate.Spec.AccessModes = []v1.PersistentVolumeAccessMode{v1.ReadWriteOnce} + pvcTemplate.Spec.Resources = storageSpec.VolumeClaimTemplate.Spec.Resources + pvcTemplate.Spec.Selector = storageSpec.VolumeClaimTemplate.Spec.Selector + statefulset.Spec.VolumeClaimTemplates = append(statefulset.Spec.VolumeClaimTemplates, pvcTemplate) + } + + return statefulset, nil +} + +func makeEmptyConfigurationSecret(p *monitoringv1.Prometheus, config Config) (*v1.Secret, error) { + s := makeConfigSecret(p, config) + + s.ObjectMeta.Annotations = map[string]string{ + "empty": "true", + } + + return s, nil +} + +func makeConfigSecret(p *monitoringv1.Prometheus, config Config) *v1.Secret { + boolTrue := true + return &v1.Secret{ + ObjectMeta: metav1.ObjectMeta{ + Name: configSecretName(p.Name), + Labels: config.Labels.Merge(managedByOperatorLabels), + OwnerReferences: []metav1.OwnerReference{ + { + APIVersion: p.APIVersion, + BlockOwnerDeletion: &boolTrue, + Controller: &boolTrue, + Kind: p.Kind, + Name: p.Name, + UID: p.UID, + }, + }, + }, + Data: map[string][]byte{ + configFilename: {}, + }, + } +} + +func makeStatefulSetService(p *monitoringv1.Prometheus, config Config) *v1.Service { + svc := &v1.Service{ + ObjectMeta: metav1.ObjectMeta{ + Name: governingServiceName, + OwnerReferences: []metav1.OwnerReference{ + metav1.OwnerReference{ + Name: p.GetName(), + Kind: p.Kind, + APIVersion: p.APIVersion, + UID: p.GetUID(), + }, + }, + Labels: config.Labels.Merge(map[string]string{ + "operated-prometheus": "true", + }), + }, + Spec: v1.ServiceSpec{ + ClusterIP: "None", + Ports: []v1.ServicePort{ + { + Name: "web", + Port: 9090, + TargetPort: intstr.FromString("web"), + }, + }, + Selector: map[string]string{ + "app": "prometheus", + }, + }, + } + return svc +} + +func makeStatefulSetSpec(p monitoringv1.Prometheus, c *Config, ruleConfigMapNames []string) (*appsv1.StatefulSetSpec, error) { + // Prometheus may take quite long to shut down to checkpoint existing data. + // Allow up to 10 minutes for clean termination. + terminationGracePeriod := int64(600) + + versionStr := strings.TrimLeft(p.Spec.Version, "v") + + version, err := semver.Parse(versionStr) + if err != nil { + return nil, errors.Wrap(err, "parse version") + } + + promArgs := []string{ + "-web.console.templates=/etc/prometheus/consoles", + "-web.console.libraries=/etc/prometheus/console_libraries", + } + + switch version.Major { + case 1: + promArgs = append(promArgs, + "-storage.local.retention="+p.Spec.Retention, + "-storage.local.num-fingerprint-mutexes=4096", + fmt.Sprintf("-storage.local.path=%s", storageDir), + "-storage.local.chunk-encoding-version=2", + fmt.Sprintf("-config.file=%s", path.Join(confOutDir, configEnvsubstFilename)), + ) + // We attempt to specify decent storage tuning flags based on how much the + // requested memory can fit. The user has to specify an appropriate buffering + // in memory limits to catch increased memory usage during query bursts. + // More info: https://prometheus.io/docs/operating/storage/. + reqMem := p.Spec.Resources.Requests[v1.ResourceMemory] + + if version.Minor < 6 { + // 1024 byte is the fixed chunk size. With increasing number of chunks actually + // in memory, overhead owed to their management, higher ingestion buffers, etc. + // increases. + // We are conservative for now an assume this to be 80% as the Kubernetes environment + // generally has a very high time series churn. + memChunks := reqMem.Value() / 1024 / 5 + + promArgs = append(promArgs, + "-storage.local.memory-chunks="+fmt.Sprintf("%d", memChunks), + "-storage.local.max-chunks-to-persist="+fmt.Sprintf("%d", memChunks/2), + ) + } else { + // Leave 1/3 head room for other overhead. + promArgs = append(promArgs, + "-storage.local.target-heap-size="+fmt.Sprintf("%d", reqMem.Value()/3*2), + ) + } + case 2: + promArgs = append(promArgs, + fmt.Sprintf("-config.file=%s", path.Join(confOutDir, configEnvsubstFilename)), + fmt.Sprintf("-storage.tsdb.path=%s", storageDir), + "-storage.tsdb.retention="+p.Spec.Retention, + "-web.enable-lifecycle", + "-storage.tsdb.no-lockfile", + ) + + if p.Spec.Query != nil && p.Spec.Query.LookbackDelta != nil { + promArgs = append(promArgs, + fmt.Sprintf("-query.lookback-delta=%s", *p.Spec.Query.LookbackDelta), + ) + } + default: + return nil, errors.Errorf("unsupported Prometheus major version %s", version) + } + + if p.Spec.Query != nil { + if p.Spec.Query.MaxConcurrency != nil { + if *p.Spec.Query.MaxConcurrency < 1 { + p.Spec.Query.MaxConcurrency = &defaultMaxConcurrency + } + promArgs = append(promArgs, + fmt.Sprintf("-query.max-concurrency=%d", *p.Spec.Query.MaxConcurrency), + ) + } + if p.Spec.Query.Timeout != nil { + promArgs = append(promArgs, + fmt.Sprintf("-query.timeout=%s", *p.Spec.Query.Timeout), + ) + } + } + + var securityContext *v1.PodSecurityContext = nil + if p.Spec.SecurityContext != nil { + securityContext = p.Spec.SecurityContext + } + + if p.Spec.ExternalURL != "" { + promArgs = append(promArgs, "-web.external-url="+p.Spec.ExternalURL) + } + + webRoutePrefix := "/" + if p.Spec.RoutePrefix != "" { + webRoutePrefix = p.Spec.RoutePrefix + } + promArgs = append(promArgs, "-web.route-prefix="+webRoutePrefix) + + if p.Spec.LogLevel != "" && p.Spec.LogLevel != "info" { + promArgs = append(promArgs, fmt.Sprintf("-log.level=%s", p.Spec.LogLevel)) + } + + var ports []v1.ContainerPort + if p.Spec.ListenLocal { + promArgs = append(promArgs, "-web.listen-address=127.0.0.1:9090") + } else { + ports = []v1.ContainerPort{ + { + Name: "web", + ContainerPort: 9090, + Protocol: v1.ProtocolTCP, + }, + } + } + + if version.Major == 2 { + for i, a := range promArgs { + promArgs[i] = "-" + a + } + } + + localReloadURL := &url.URL{ + Scheme: "http", + Host: c.LocalHost + ":9090", + Path: path.Clean(webRoutePrefix + "/-/reload"), + } + + volumes := []v1.Volume{ + { + Name: "config", + VolumeSource: v1.VolumeSource{ + Secret: &v1.SecretVolumeSource{ + SecretName: configSecretName(p.Name), + }, + }, + }, + { + Name: "config-out", + VolumeSource: v1.VolumeSource{ + EmptyDir: &v1.EmptyDirVolumeSource{}, + }, + }, + } + + for _, name := range ruleConfigMapNames { + volumes = append(volumes, v1.Volume{ + Name: name, + VolumeSource: v1.VolumeSource{ + ConfigMap: &v1.ConfigMapVolumeSource{ + LocalObjectReference: v1.LocalObjectReference{ + Name: name, + }, + }, + }, + }) + } + + volName := volumeName(p.Name) + if p.Spec.Storage != nil { + if p.Spec.Storage.VolumeClaimTemplate.Name != "" { + volName = p.Spec.Storage.VolumeClaimTemplate.Name + } + } + + promVolumeMounts := []v1.VolumeMount{ + { + Name: "config-out", + ReadOnly: true, + MountPath: confOutDir, + }, + { + Name: volName, + MountPath: storageDir, + SubPath: subPathForStorage(p.Spec.Storage), + }, + } + + for _, name := range ruleConfigMapNames { + promVolumeMounts = append(promVolumeMounts, v1.VolumeMount{ + Name: name, + MountPath: rulesDir + "/" + name, + }) + } + + for _, s := range p.Spec.Secrets { + volumes = append(volumes, v1.Volume{ + Name: k8sutil.SanitizeVolumeName("secret-" + s), + VolumeSource: v1.VolumeSource{ + Secret: &v1.SecretVolumeSource{ + SecretName: s, + }, + }, + }) + promVolumeMounts = append(promVolumeMounts, v1.VolumeMount{ + Name: k8sutil.SanitizeVolumeName("secret-" + s), + ReadOnly: true, + MountPath: secretsDir + s, + }) + } + + for _, c := range p.Spec.ConfigMaps { + volumes = append(volumes, v1.Volume{ + Name: k8sutil.SanitizeVolumeName("configmap-" + c), + VolumeSource: v1.VolumeSource{ + ConfigMap: &v1.ConfigMapVolumeSource{ + LocalObjectReference: v1.LocalObjectReference{ + Name: c, + }, + }, + }, + }) + promVolumeMounts = append(promVolumeMounts, v1.VolumeMount{ + Name: k8sutil.SanitizeVolumeName("configmap-" + c), + ReadOnly: true, + MountPath: configmapsDir + c, + }) + } + + configReloadVolumeMounts := []v1.VolumeMount{ + { + Name: "config", + MountPath: confDir, + }, + { + Name: "config-out", + MountPath: confOutDir, + }, + } + + configReloadArgs := []string{ + fmt.Sprintf("--log-format=%s", c.LogFormat), + fmt.Sprintf("--reload-url=%s", localReloadURL), + fmt.Sprintf("--config-file=%s", path.Join(confDir, configFilename)), + fmt.Sprintf("--config-envsubst-file=%s", path.Join(confOutDir, configEnvsubstFilename)), + } + + var livenessProbeHandler v1.Handler + var readinessProbeHandler v1.Handler + var livenessFailureThreshold int32 + if (version.Major == 1 && version.Minor >= 8) || version.Major == 2 { + livenessProbeHandler = v1.Handler{ + HTTPGet: &v1.HTTPGetAction{ + Path: path.Clean(webRoutePrefix + "/-/healthy"), + Port: intstr.FromString("web"), + }, + } + readinessProbeHandler = v1.Handler{ + HTTPGet: &v1.HTTPGetAction{ + Path: path.Clean(webRoutePrefix + "/-/ready"), + Port: intstr.FromString("web"), + }, + } + livenessFailureThreshold = 6 + } else { + livenessProbeHandler = v1.Handler{ + HTTPGet: &v1.HTTPGetAction{ + Path: path.Clean(webRoutePrefix + "/status"), + Port: intstr.FromString("web"), + }, + } + readinessProbeHandler = livenessProbeHandler + // For larger servers, restoring a checkpoint on startup may take quite a bit of time. + // Wait up to 5 minutes (60 fails * 5s per fail) + livenessFailureThreshold = 60 + } + + var livenessProbe *v1.Probe + var readinessProbe *v1.Probe + if !p.Spec.ListenLocal { + livenessProbe = &v1.Probe{ + Handler: livenessProbeHandler, + PeriodSeconds: 5, + TimeoutSeconds: probeTimeoutSeconds, + FailureThreshold: livenessFailureThreshold, + } + readinessProbe = &v1.Probe{ + Handler: readinessProbeHandler, + TimeoutSeconds: probeTimeoutSeconds, + PeriodSeconds: 5, + FailureThreshold: 120, // Allow up to 10m on startup for data recovery + } + } + + podAnnotations := map[string]string{} + podLabels := map[string]string{} + if p.Spec.PodMetadata != nil { + if p.Spec.PodMetadata.Labels != nil { + for k, v := range p.Spec.PodMetadata.Labels { + podLabels[k] = v + } + } + if p.Spec.PodMetadata.Annotations != nil { + for k, v := range p.Spec.PodMetadata.Annotations { + podAnnotations[k] = v + } + } + } + + podLabels["app"] = "prometheus" + podLabels["prometheus"] = p.Name + + finalLabels := c.Labels.Merge(podLabels) + + additionalContainers := p.Spec.Containers + + if len(ruleConfigMapNames) != 0 { + container := v1.Container{ + Name: "rules-configmap-reloader", + Image: c.ConfigReloaderImage, + Args: []string{ + fmt.Sprintf("--webhook-url=%s", localReloadURL), + }, + VolumeMounts: []v1.VolumeMount{}, + Resources: v1.ResourceRequirements{ + Limits: v1.ResourceList{ + v1.ResourceCPU: resource.MustParse("25m"), + v1.ResourceMemory: resource.MustParse("10Mi"), + }, + }, + } + + for _, name := range ruleConfigMapNames { + mountPath := rulesDir + "/" + name + container.VolumeMounts = append(container.VolumeMounts, v1.VolumeMount{ + Name: name, + MountPath: mountPath, + }) + container.Args = append(container.Args, fmt.Sprintf("--volume-dir=%s", mountPath)) + } + + additionalContainers = append(additionalContainers, container) + } + + if p.Spec.Thanos != nil { + thanosBaseImage := c.ThanosDefaultBaseImage + if p.Spec.Thanos.BaseImage != nil { + thanosBaseImage = *p.Spec.Thanos.BaseImage + } + + // Version is used by default. + // If the tag is specified, we use the tag to identify the container image. + // If the sha is specified, we use the sha to identify the container image, + // as it has even stronger immutable guarantees to identify the image. + thanosImage := fmt.Sprintf("%s:%s", thanosBaseImage, *p.Spec.Thanos.Version) + if p.Spec.Thanos.Tag != nil { + thanosImage = fmt.Sprintf("%s:%s", thanosBaseImage, *p.Spec.Thanos.Tag) + } + if p.Spec.Thanos.SHA != nil { + thanosImage = fmt.Sprintf("%s@sha256:%s", thanosBaseImage, *p.Spec.Thanos.SHA) + } + if p.Spec.Thanos.Image != nil && *p.Spec.Thanos.Image != "" { + thanosImage = *p.Spec.Thanos.Image + } + + thanosArgs := []string{ + "sidecar", + fmt.Sprintf("--prometheus.url=http://%s:9090", c.LocalHost), + fmt.Sprintf("--tsdb.path=%s", storageDir), + fmt.Sprintf("--cluster.address=[$(POD_IP)]:%d", 10900), + fmt.Sprintf("--grpc-address=[$(POD_IP)]:%d", 10901), + } + + if p.Spec.Thanos.Peers != nil { + thanosArgs = append(thanosArgs, fmt.Sprintf("--cluster.peers=%s", *p.Spec.Thanos.Peers)) + } + if p.Spec.LogLevel != "" && p.Spec.LogLevel != "info" { + thanosArgs = append(thanosArgs, fmt.Sprintf("--log.level=%s", p.Spec.LogLevel)) + } + + thanosVolumeMounts := []v1.VolumeMount{ + { + Name: volName, + MountPath: storageDir, + SubPath: subPathForStorage(p.Spec.Storage), + }, + } + + envVars := []v1.EnvVar{ + { + // Necessary for '--cluster.address', '--grpc-address' flags + Name: "POD_IP", + ValueFrom: &v1.EnvVarSource{ + FieldRef: &v1.ObjectFieldSelector{ + FieldPath: "status.podIP", + }, + }, + }, + } + if p.Spec.Thanos.GCS != nil { + if p.Spec.Thanos.GCS.Bucket != nil { + thanosArgs = append(thanosArgs, fmt.Sprintf("--gcs.bucket=%s", *p.Spec.Thanos.GCS.Bucket)) + } + if p.Spec.Thanos.GCS.SecretKey != nil { + secretFileName := "service-account.json" + if p.Spec.Thanos.GCS.SecretKey.Key != "" { + secretFileName = p.Spec.Thanos.GCS.SecretKey.Key + } + secretDir := path.Join("/var/run/secrets/prometheus.io", p.Spec.Thanos.GCS.SecretKey.Name) + envVars = append(envVars, v1.EnvVar{ + Name: "GOOGLE_APPLICATION_CREDENTIALS", + Value: path.Join(secretDir, secretFileName), + }) + volumeName := k8sutil.SanitizeVolumeName("secret-" + p.Spec.Thanos.GCS.SecretKey.Name) + volumes = append(volumes, v1.Volume{ + Name: volumeName, + VolumeSource: v1.VolumeSource{ + Secret: &v1.SecretVolumeSource{ + SecretName: p.Spec.Thanos.GCS.SecretKey.Name, + }, + }, + }) + thanosVolumeMounts = append(thanosVolumeMounts, v1.VolumeMount{ + Name: volumeName, + ReadOnly: true, + MountPath: secretDir, + }) + } + } + + if p.Spec.Thanos.S3 != nil { + if p.Spec.Thanos.S3.Bucket != nil { + thanosArgs = append(thanosArgs, fmt.Sprintf("--s3.bucket=%s", *p.Spec.Thanos.S3.Bucket)) + } + if p.Spec.Thanos.S3.Endpoint != nil { + thanosArgs = append(thanosArgs, fmt.Sprintf("--s3.endpoint=%s", *p.Spec.Thanos.S3.Endpoint)) + } + if p.Spec.Thanos.S3.Insecure != nil && *p.Spec.Thanos.S3.Insecure { + thanosArgs = append(thanosArgs, "--s3.insecure") + } + if p.Spec.Thanos.S3.SignatureVersion2 != nil && *p.Spec.Thanos.S3.SignatureVersion2 { + thanosArgs = append(thanosArgs, "--s3.signature-version2") + } + if p.Spec.Thanos.S3.AccessKey != nil { + envVars = append(envVars, v1.EnvVar{ + Name: "S3_ACCESS_KEY", + ValueFrom: &v1.EnvVarSource{ + SecretKeyRef: p.Spec.Thanos.S3.AccessKey, + }, + }) + } + if p.Spec.Thanos.S3.EncryptSSE != nil && *p.Spec.Thanos.S3.EncryptSSE { + thanosArgs = append(thanosArgs, "--s3.encrypt-sse") + } + if p.Spec.Thanos.S3.SecretKey != nil { + envVars = append(envVars, v1.EnvVar{ + Name: "S3_SECRET_KEY", + ValueFrom: &v1.EnvVarSource{ + SecretKeyRef: p.Spec.Thanos.S3.SecretKey, + }, + }) + } + } + + c := v1.Container{ + Name: "thanos-sidecar", + Image: thanosImage, + Args: thanosArgs, + Ports: []v1.ContainerPort{ + { + Name: "http", + ContainerPort: 10902, + }, + { + Name: "grpc", + ContainerPort: 10901, + }, + { + Name: "cluster", + ContainerPort: 10900, + }, + }, + Env: envVars, + VolumeMounts: thanosVolumeMounts, + Resources: p.Spec.Thanos.Resources, + } + + additionalContainers = append(additionalContainers, c) + promArgs = append(promArgs, "--storage.tsdb.min-block-duration=2h", "--storage.tsdb.max-block-duration=2h") + } + + // Version is used by default. + // If the tag is specified, we use the tag to identify the container image. + // If the sha is specified, we use the sha to identify the container image, + // as it has even stronger immutable guarantees to identify the image. + prometheusImage := fmt.Sprintf("%s:%s", p.Spec.BaseImage, p.Spec.Version) + if p.Spec.Tag != "" { + prometheusImage = fmt.Sprintf("%s:%s", p.Spec.BaseImage, p.Spec.Tag) + } + if p.Spec.SHA != "" { + prometheusImage = fmt.Sprintf("%s@sha256:%s", p.Spec.BaseImage, p.Spec.SHA) + } + if p.Spec.Image != nil && *p.Spec.Image != "" { + prometheusImage = *p.Spec.Image + } + + return &appsv1.StatefulSetSpec{ + ServiceName: governingServiceName, + Replicas: p.Spec.Replicas, + PodManagementPolicy: appsv1.ParallelPodManagement, + UpdateStrategy: appsv1.StatefulSetUpdateStrategy{ + Type: appsv1.RollingUpdateStatefulSetStrategyType, + }, + Selector: &metav1.LabelSelector{ + MatchLabels: finalLabels, + }, + Template: v1.PodTemplateSpec{ + ObjectMeta: metav1.ObjectMeta{ + Labels: finalLabels, + Annotations: podAnnotations, + }, + Spec: v1.PodSpec{ + Containers: append([]v1.Container{ + { + Name: "prometheus", + Image: prometheusImage, + Ports: ports, + Args: promArgs, + VolumeMounts: promVolumeMounts, + LivenessProbe: livenessProbe, + ReadinessProbe: readinessProbe, + Resources: p.Spec.Resources, + }, { + Name: "prometheus-config-reloader", + Image: c.PrometheusConfigReloader, + Env: []v1.EnvVar{ + { + Name: "POD_NAME", + ValueFrom: &v1.EnvVarSource{ + FieldRef: &v1.ObjectFieldSelector{FieldPath: "metadata.name"}, + }, + }, + }, + Command: []string{"/bin/prometheus-config-reloader"}, + Args: configReloadArgs, + VolumeMounts: configReloadVolumeMounts, + Resources: v1.ResourceRequirements{ + Limits: v1.ResourceList{ + v1.ResourceCPU: resource.MustParse("50m"), + v1.ResourceMemory: resource.MustParse("50Mi"), + }, + }, + }, + }, additionalContainers...), + SecurityContext: securityContext, + ServiceAccountName: p.Spec.ServiceAccountName, + NodeSelector: p.Spec.NodeSelector, + PriorityClassName: p.Spec.PriorityClassName, + TerminationGracePeriodSeconds: &terminationGracePeriod, + Volumes: volumes, + Tolerations: p.Spec.Tolerations, + Affinity: p.Spec.Affinity, + }, + }, + }, nil +} + +func configSecretName(name string) string { + return prefixedName(name) +} + +func volumeName(name string) string { + return fmt.Sprintf("%s-db", prefixedName(name)) +} + +func prefixedName(name string) string { + return fmt.Sprintf("prometheus-%s", name) +} + +func subPathForStorage(s *monitoringv1.StorageSpec) string { + if s == nil { + return "" + } + + return "prometheus-db" +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/version/version.go b/vendor/github.com/coreos/prometheus-operator/pkg/version/version.go new file mode 100644 index 0000000000..c6c86208fe --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/version/version.go @@ -0,0 +1,18 @@ +// Copyright 2016 The prometheus-operator 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 version + +// Version represents the software version of the Prometheus Operator +var Version string diff --git a/vendor/github.com/coreos/prometheus-operator/test/basic-auth-test-app/main.go b/vendor/github.com/coreos/prometheus-operator/test/basic-auth-test-app/main.go new file mode 100644 index 0000000000..9220ba4a27 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/test/basic-auth-test-app/main.go @@ -0,0 +1,65 @@ +// Copyright 2016 The prometheus-operator 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/base64" + "fmt" + "github.com/prometheus/client_golang/prometheus/promhttp" + "net/http" + "os" + "strings" + "time" +) + +func main() { + http.HandleFunc("/", handler) + http.HandleFunc("/metrics", func(w http.ResponseWriter, r *http.Request) { + if checkAuth(w, r) { + promhttp.Handler().ServeHTTP(w, r) + return + } + + w.Header().Set("WWW-Authenticate", `Basic realm="MY REALM"`) + w.WriteHeader(401) + w.Write([]byte("401 Unauthorized\n")) + }) + + http.ListenAndServe(":8080", nil) +} + +func handler(w http.ResponseWriter, r *http.Request) { + fmt.Fprintf(w, time.Now().String()) + fmt.Fprintf(w, "\nAppVersion:"+os.Getenv("VERSION")) +} + +func checkAuth(w http.ResponseWriter, r *http.Request) bool { + s := strings.SplitN(r.Header.Get("Authorization"), " ", 2) + if len(s) != 2 { + return false + } + + b, err := base64.StdEncoding.DecodeString(s[1]) + if err != nil { + return false + } + + pair := strings.SplitN(string(b), ":", 2) + if len(pair) != 2 { + return false + } + + return pair[0] == "user" && pair[1] == "pass" +} diff --git a/vendor/github.com/coreos/prometheus-operator/test/framework/alertmanager.go b/vendor/github.com/coreos/prometheus-operator/test/framework/alertmanager.go new file mode 100644 index 0000000000..8ae2c6848a --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/test/framework/alertmanager.go @@ -0,0 +1,389 @@ +// Copyright 2016 The prometheus-operator 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 framework + +import ( + "encoding/json" + "fmt" + "os" + "strings" + "time" + + "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/intstr" + "k8s.io/apimachinery/pkg/util/wait" + "k8s.io/apimachinery/pkg/util/yaml" + + "github.com/coreos/prometheus-operator/pkg/alertmanager" + monitoringv1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + "github.com/pkg/errors" +) + +var ValidAlertmanagerConfig = `global: + resolve_timeout: 5m +route: + group_by: ['job'] + group_wait: 30s + group_interval: 5m + repeat_interval: 12h + receiver: 'webhook' +receivers: +- name: 'webhook' + webhook_configs: + - url: 'http://alertmanagerwh:30500/' +` + +func (f *Framework) MakeBasicAlertmanager(name string, replicas int32) *monitoringv1.Alertmanager { + return &monitoringv1.Alertmanager{ + ObjectMeta: metav1.ObjectMeta{ + Name: name, + }, + Spec: monitoringv1.AlertmanagerSpec{ + Replicas: &replicas, + LogLevel: "debug", + }, + } +} + +func (f *Framework) MakeAlertmanagerService(name, group string, serviceType v1.ServiceType) *v1.Service { + service := &v1.Service{ + ObjectMeta: metav1.ObjectMeta{ + Name: fmt.Sprintf("alertmanager-%s", name), + Labels: map[string]string{ + "group": group, + }, + }, + Spec: v1.ServiceSpec{ + Type: serviceType, + Ports: []v1.ServicePort{ + { + Name: "web", + Port: 9093, + TargetPort: intstr.FromString("web"), + }, + }, + Selector: map[string]string{ + "alertmanager": name, + }, + }, + } + + return service +} + +func (f *Framework) SecretFromYaml(filepath string) (*v1.Secret, error) { + manifest, err := os.Open(filepath) + if err != nil { + return nil, err + } + + s := v1.Secret{} + err = yaml.NewYAMLOrJSONDecoder(manifest, 100).Decode(&s) + if err != nil { + return nil, err + } + + return &s, nil +} + +func (f *Framework) AlertmanagerConfigSecret(ns, name string) (*v1.Secret, error) { + s, err := f.SecretFromYaml("../../test/framework/ressources/alertmanager-main-secret.yaml") + if err != nil { + return nil, err + } + + s.Name = name + s.Namespace = ns + return s, nil +} + +func (f *Framework) CreateAlertmanagerAndWaitUntilReady(ns string, a *monitoringv1.Alertmanager) (*monitoringv1.Alertmanager, error) { + amConfigSecretName := fmt.Sprintf("alertmanager-%s", a.Name) + s, err := f.AlertmanagerConfigSecret(ns, amConfigSecretName) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("making alertmanager config secret %v failed", amConfigSecretName)) + } + _, err = f.KubeClient.CoreV1().Secrets(ns).Create(s) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("creating alertmanager config secret %v failed", s.Name)) + } + + a, err = f.MonClientV1.Alertmanagers(ns).Create(a) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("creating alertmanager %v failed", a.Name)) + } + + return a, f.WaitForAlertmanagerReady(ns, a.Name, int(*a.Spec.Replicas)) +} + +func (f *Framework) WaitForAlertmanagerReady(ns, name string, replicas int) error { + err := WaitForPodsReady( + f.KubeClient, + ns, + 5*time.Minute, + replicas, + alertmanager.ListOptions(name), + ) + + return errors.Wrap(err, fmt.Sprintf("failed to create an Alertmanager cluster (%s) with %d instances", name, replicas)) +} + +func (f *Framework) UpdateAlertmanagerAndWaitUntilReady(ns string, a *monitoringv1.Alertmanager) (*monitoringv1.Alertmanager, error) { + a, err := f.MonClientV1.Alertmanagers(ns).Update(a) + if err != nil { + return nil, err + } + + err = WaitForPodsReady( + f.KubeClient, + ns, + 5*time.Minute, + int(*a.Spec.Replicas), + alertmanager.ListOptions(a.Name), + ) + if err != nil { + return nil, fmt.Errorf("failed to update %d Alertmanager instances (%s): %v", a.Spec.Replicas, a.Name, err) + } + + return a, nil +} + +func (f *Framework) DeleteAlertmanagerAndWaitUntilGone(ns, name string) error { + _, err := f.MonClientV1.Alertmanagers(ns).Get(name, metav1.GetOptions{}) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("requesting Alertmanager tpr %v failed", name)) + } + + if err := f.MonClientV1.Alertmanagers(ns).Delete(name, nil); err != nil { + return errors.Wrap(err, fmt.Sprintf("deleting Alertmanager tpr %v failed", name)) + } + + if err := WaitForPodsReady( + f.KubeClient, + ns, + f.DefaultTimeout, + 0, + alertmanager.ListOptions(name), + ); err != nil { + return errors.Wrap(err, fmt.Sprintf("waiting for Alertmanager tpr (%s) to vanish timed out", name)) + } + + return f.KubeClient.CoreV1().Secrets(ns).Delete(fmt.Sprintf("alertmanager-%s", name), nil) +} + +func amImage(version string) string { + return fmt.Sprintf("quay.io/prometheus/alertmanager:%s", version) +} + +func (f *Framework) WaitForAlertmanagerInitializedMesh(ns, name string, amountPeers int) error { + return wait.Poll(time.Second, time.Minute*5, func() (bool, error) { + amStatus, err := f.GetAlertmanagerConfig(ns, name) + if err != nil { + return false, err + } + if amStatus.Data.getAmountPeers() == amountPeers { + return true, nil + } + + return false, nil + }) +} + +func (f *Framework) GetAlertmanagerConfig(ns, n string) (amAPIStatusResp, error) { + var amStatus amAPIStatusResp + request := ProxyGetPod(f.KubeClient, ns, n, "web", "/api/v1/status") + resp, err := request.DoRaw() + if err != nil { + return amStatus, err + } + + if err := json.Unmarshal(resp, &amStatus); err != nil { + return amStatus, err + } + + return amStatus, nil +} + +func (f *Framework) CreateSilence(ns, n string) (string, error) { + var createSilenceResponse amAPICreateSilResp + + request := ProxyPostPod( + f.KubeClient, ns, n, + "web", "/api/v1/silences", + `{"id":"","createdBy":"Max Mustermann","comment":"1234","startsAt":"2030-04-09T09:16:15.114Z","endsAt":"2031-04-09T11:16:15.114Z","matchers":[{"name":"test","value":"123","isRegex":false}]}`, + ) + resp, err := request.DoRaw() + if err != nil { + return "", err + } + + if err := json.Unmarshal(resp, &createSilenceResponse); err != nil { + return "", err + } + + if createSilenceResponse.Status != "success" { + return "", errors.Errorf( + "expected Alertmanager to return 'success', but got '%v' instead", + createSilenceResponse.Status, + ) + } + + return createSilenceResponse.Data.SilenceID, nil +} + +// alert represents an alert that can be posted to the /api/v1/alerts endpoint +// of an Alertmanager. +// Taken from github.com/prometheus/common/model/alert.go.Alert. +type alert struct { + // Label value pairs for purpose of aggregation, matching, and disposition + // dispatching. This must minimally include an "alertname" label. + Labels map[string]string `json:"labels"` + + // Extra key/value information which does not define alert identity. + Annotations map[string]string `json:"annotations"` + + // The known time range for this alert. Both ends are optional. + StartsAt time.Time `json:"startsAt,omitempty"` + EndsAt time.Time `json:"endsAt,omitempty"` + GeneratorURL string `json:"generatorURL"` +} + +// SendAlertToAlertmanager sends an alert to the alertmanager in the given +// namespace (ns) with the given name (n). +func (f *Framework) SendAlertToAlertmanager(ns, n string, start time.Time) error { + alerts := []*alert{&alert{ + Labels: map[string]string{ + "alertname": "ExampleAlert", "prometheus": "my-prometheus", + }, + Annotations: map[string]string{}, + StartsAt: start, + GeneratorURL: "http://prometheus-test-0:9090/graph?g0.expr=vector%281%29\u0026g0.tab=1", + }} + b, err := json.Marshal(alerts) + if err != nil { + return err + } + + var postAlertResp amAPIPostAlertResp + request := ProxyPostPod(f.KubeClient, ns, n, "web", "api/v1/alerts", string(b)) + resp, err := request.DoRaw() + if err != nil { + return err + } + + if err := json.Unmarshal(resp, &postAlertResp); err != nil { + return err + } + + if postAlertResp.Status != "success" { + return errors.Errorf("expected Alertmanager to return 'success' but got %q instead", postAlertResp.Status) + } + + return nil +} + +func (f *Framework) GetSilences(ns, n string) ([]amAPISil, error) { + var getSilencesResponse amAPIGetSilResp + + request := ProxyGetPod(f.KubeClient, ns, n, "web", "/api/v1/silences") + resp, err := request.DoRaw() + if err != nil { + return getSilencesResponse.Data, err + } + + if err := json.Unmarshal(resp, &getSilencesResponse); err != nil { + return getSilencesResponse.Data, err + } + + if getSilencesResponse.Status != "success" { + return getSilencesResponse.Data, errors.Errorf( + "expected Alertmanager to return 'success', but got '%v' instead", + getSilencesResponse.Status, + ) + } + + return getSilencesResponse.Data, nil +} + +// WaitForAlertmanagerConfigToContainString retrieves the Alertmanager +// configuration via the Alertmanager's API and checks if it contains the given +// string. +func (f *Framework) WaitForAlertmanagerConfigToContainString(ns, amName, expectedString string) error { + var pollError error + err := wait.Poll(10*time.Second, time.Minute*5, func() (bool, error) { + config, err := f.GetAlertmanagerConfig(ns, "alertmanager-"+amName+"-0") + if err != nil { + return false, err + } + + if strings.Contains(config.Data.ConfigYAML, expectedString) { + return true, nil + } + + return false, nil + }) + + if err != nil { + return fmt.Errorf("failed to wait for alertmanager config to contain %q: %v: %v", expectedString, err, pollError) + } + + return nil +} + +type amAPICreateSilResp struct { + Status string `json:"status"` + Data amAPICreateSilData `json:"data"` +} + +type amAPIPostAlertResp struct { + Status string `json:"status"` +} + +type amAPICreateSilData struct { + SilenceID string `json:"silenceId"` +} + +type amAPIGetSilResp struct { + Status string `json:"status"` + Data []amAPISil `json:"data"` +} + +type amAPISil struct { + ID string `json:"id"` + CreatedBy string `json:"createdBy"` +} + +type amAPIStatusResp struct { + Data amAPIStatusData `json:"data"` +} + +type amAPIStatusData struct { + ClusterStatus *clusterStatus `json:"clusterStatus,omitempty"` + MeshStatus *clusterStatus `json:"meshStatus,omitempty"` + ConfigYAML string `json:"configYAML"` +} + +// Starting from AM v0.15.0 'MeshStatus' is called 'ClusterStatus' +func (s *amAPIStatusData) getAmountPeers() int { + if s.MeshStatus != nil { + return len(s.MeshStatus.Peers) + } + return len(s.ClusterStatus.Peers) +} + +type clusterStatus struct { + Peers []interface{} `json:"peers"` +} diff --git a/vendor/github.com/coreos/prometheus-operator/test/framework/cluster_role.go b/vendor/github.com/coreos/prometheus-operator/test/framework/cluster_role.go new file mode 100644 index 0000000000..bfe3d172fa --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/test/framework/cluster_role.go @@ -0,0 +1,71 @@ +// Copyright 2017 The prometheus-operator 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 framework + +import ( + rbacv1 "k8s.io/api/rbac/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/yaml" + "k8s.io/client-go/kubernetes" +) + +func CreateClusterRole(kubeClient kubernetes.Interface, relativePath string) error { + clusterRole, err := parseClusterRoleYaml(relativePath) + if err != nil { + return err + } + + _, err = kubeClient.RbacV1().ClusterRoles().Get(clusterRole.Name, metav1.GetOptions{}) + + if err == nil { + // ClusterRole already exists -> Update + _, err = kubeClient.RbacV1().ClusterRoles().Update(clusterRole) + if err != nil { + return err + } + + } else { + // ClusterRole doesn't exists -> Create + _, err = kubeClient.RbacV1().ClusterRoles().Create(clusterRole) + if err != nil { + return err + } + } + + return nil +} + +func DeleteClusterRole(kubeClient kubernetes.Interface, relativePath string) error { + clusterRole, err := parseClusterRoleYaml(relativePath) + if err != nil { + return err + } + + return kubeClient.RbacV1().ClusterRoles().Delete(clusterRole.Name, &metav1.DeleteOptions{}) +} + +func parseClusterRoleYaml(relativePath string) (*rbacv1.ClusterRole, error) { + manifest, err := PathToOSFile(relativePath) + if err != nil { + return nil, err + } + + clusterRole := rbacv1.ClusterRole{} + if err := yaml.NewYAMLOrJSONDecoder(manifest, 100).Decode(&clusterRole); err != nil { + return nil, err + } + + return &clusterRole, nil +} diff --git a/vendor/github.com/coreos/prometheus-operator/test/framework/cluster_role_binding.go b/vendor/github.com/coreos/prometheus-operator/test/framework/cluster_role_binding.go new file mode 100644 index 0000000000..2b469f64e7 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/test/framework/cluster_role_binding.go @@ -0,0 +1,73 @@ +// Copyright 2017 The prometheus-operator 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 framework + +import ( + rbacv1 "k8s.io/api/rbac/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/yaml" + "k8s.io/client-go/kubernetes" +) + +func CreateClusterRoleBinding(kubeClient kubernetes.Interface, ns string, relativePath string) (finalizerFn, error) { + finalizerFn := func() error { return DeleteClusterRoleBinding(kubeClient, relativePath) } + clusterRoleBinding, err := parseClusterRoleBindingYaml(relativePath) + if err != nil { + return finalizerFn, err + } + + clusterRoleBinding.Subjects[0].Namespace = ns + + _, err = kubeClient.RbacV1().ClusterRoleBindings().Get(clusterRoleBinding.Name, metav1.GetOptions{}) + + if err == nil { + // ClusterRoleBinding already exists -> Update + _, err = kubeClient.RbacV1().ClusterRoleBindings().Update(clusterRoleBinding) + if err != nil { + return finalizerFn, err + } + } else { + // ClusterRoleBinding doesn't exists -> Create + _, err = kubeClient.RbacV1().ClusterRoleBindings().Create(clusterRoleBinding) + if err != nil { + return finalizerFn, err + } + } + + return finalizerFn, err +} + +func DeleteClusterRoleBinding(kubeClient kubernetes.Interface, relativePath string) error { + clusterRoleBinding, err := parseClusterRoleYaml(relativePath) + if err != nil { + return err + } + + return kubeClient.RbacV1().ClusterRoleBindings().Delete(clusterRoleBinding.Name, &metav1.DeleteOptions{}) +} + +func parseClusterRoleBindingYaml(relativePath string) (*rbacv1.ClusterRoleBinding, error) { + manifest, err := PathToOSFile(relativePath) + if err != nil { + return nil, err + } + + clusterRoleBinding := rbacv1.ClusterRoleBinding{} + if err := yaml.NewYAMLOrJSONDecoder(manifest, 100).Decode(&clusterRoleBinding); err != nil { + return nil, err + } + + return &clusterRoleBinding, nil +} diff --git a/vendor/github.com/coreos/prometheus-operator/test/framework/config_map.go b/vendor/github.com/coreos/prometheus-operator/test/framework/config_map.go new file mode 100644 index 0000000000..4925a0a82e --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/test/framework/config_map.go @@ -0,0 +1,69 @@ +// Copyright 2016 The prometheus-operator 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 framework + +import ( + "time" + + "k8s.io/api/core/v1" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/wait" + + "github.com/pkg/errors" +) + +func (f *Framework) WaitForConfigMapExist(ns, name string) (*v1.ConfigMap, error) { + var configMap *v1.ConfigMap + err := wait.Poll(2*time.Second, f.DefaultTimeout, func() (bool, error) { + var err error + configMap, err = f. + KubeClient. + CoreV1(). + ConfigMaps(ns). + Get(name, metav1.GetOptions{}) + + if apierrors.IsNotFound(err) { + return false, nil + } + if err != nil { + return false, err + } + return true, nil + }) + + return configMap, errors.Wrapf(err, "waiting for ConfigMap '%v' in namespace '%v'", name, ns) +} + +func (f *Framework) WaitForConfigMapNotExist(ns, name string) error { + err := wait.Poll(2*time.Second, f.DefaultTimeout, func() (bool, error) { + var err error + _, err = f. + KubeClient. + CoreV1(). + ConfigMaps(ns). + Get(name, metav1.GetOptions{}) + + if apierrors.IsNotFound(err) { + return true, nil + } + if err != nil { + return false, err + } + return false, nil + }) + + return errors.Wrapf(err, "waiting for ConfigMap '%v' in namespace '%v' to not exist", name, ns) +} diff --git a/vendor/github.com/coreos/prometheus-operator/test/framework/context.go b/vendor/github.com/coreos/prometheus-operator/test/framework/context.go new file mode 100644 index 0000000000..0d1ec1d30d --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/test/framework/context.go @@ -0,0 +1,73 @@ +// Copyright 2017 The prometheus-operator 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 framework + +import ( + "strconv" + "strings" + "testing" + "time" + + "golang.org/x/sync/errgroup" +) + +type TestCtx struct { + ID string + cleanUpFns []finalizerFn +} + +type finalizerFn func() error + +func (f *Framework) NewTestCtx(t *testing.T) TestCtx { + // TestCtx is used among others for namespace names where '/' is forbidden + prefix := strings.TrimPrefix( + strings.Replace( + strings.ToLower(t.Name()), + "/", + "-", + -1, + ), + "test", + ) + + id := prefix + "-" + strconv.FormatInt(time.Now().Unix(), 36) + return TestCtx{ + ID: id, + } +} + +// GetObjID returns an ascending ID based on the length of cleanUpFns. It is +// based on the premise that every new object also appends a new finalizerFn on +// cleanUpFns. This can e.g. be used to create multiple namespaces in the same +// test context. +func (ctx *TestCtx) GetObjID() string { + return ctx.ID + "-" + strconv.Itoa(len(ctx.cleanUpFns)) +} + +func (ctx *TestCtx) Cleanup(t *testing.T) { + var eg errgroup.Group + + for i := len(ctx.cleanUpFns) - 1; i >= 0; i-- { + eg.Go(ctx.cleanUpFns[i]) + } + + if err := eg.Wait(); err != nil { + t.Fatal(err) + } +} + +func (ctx *TestCtx) AddFinalizerFn(fn finalizerFn) { + ctx.cleanUpFns = append(ctx.cleanUpFns, fn) +} diff --git a/vendor/github.com/coreos/prometheus-operator/test/framework/deployment.go b/vendor/github.com/coreos/prometheus-operator/test/framework/deployment.go new file mode 100644 index 0000000000..1f328c0bdf --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/test/framework/deployment.go @@ -0,0 +1,84 @@ +// Copyright 2017 The prometheus-operator 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 framework + +import ( + "fmt" + "time" + + "github.com/pkg/errors" + appsv1 "k8s.io/api/apps/v1beta2" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/wait" + "k8s.io/apimachinery/pkg/util/yaml" + "k8s.io/client-go/kubernetes" +) + +func MakeDeployment(pathToYaml string) (*appsv1.Deployment, error) { + manifest, err := PathToOSFile(pathToYaml) + if err != nil { + return nil, err + } + tectonicPromOp := appsv1.Deployment{} + if err := yaml.NewYAMLOrJSONDecoder(manifest, 100).Decode(&tectonicPromOp); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("failed to decode file %s", pathToYaml)) + } + + return &tectonicPromOp, nil +} + +func CreateDeployment(kubeClient kubernetes.Interface, namespace string, d *appsv1.Deployment) error { + d.Namespace = namespace + _, err := kubeClient.AppsV1beta2().Deployments(namespace).Create(d) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("failed to create deployment %s", d.Name)) + } + return nil +} + +func DeleteDeployment(kubeClient kubernetes.Interface, namespace, name string) error { + d, err := kubeClient.AppsV1beta2().Deployments(namespace).Get(name, metav1.GetOptions{}) + if err != nil { + return err + } + + zero := int32(0) + d.Spec.Replicas = &zero + + d, err = kubeClient.AppsV1beta2().Deployments(namespace).Update(d) + if err != nil { + return err + } + return kubeClient.AppsV1beta2().Deployments(namespace).Delete(d.Name, &metav1.DeleteOptions{}) +} + +func WaitUntilDeploymentGone(kubeClient kubernetes.Interface, namespace, name string, timeout time.Duration) error { + return wait.Poll(time.Second, timeout, func() (bool, error) { + _, err := kubeClient. + AppsV1beta2().Deployments(namespace). + Get(name, metav1.GetOptions{}) + + if err != nil { + if apierrors.IsNotFound(err) { + return true, nil + } + + return false, err + } + + return false, nil + }) +} diff --git a/vendor/github.com/coreos/prometheus-operator/test/framework/event.go b/vendor/github.com/coreos/prometheus-operator/test/framework/event.go new file mode 100644 index 0000000000..0a7c417fba --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/test/framework/event.go @@ -0,0 +1,37 @@ +// Copyright 2016 The prometheus-operator 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 framework + +import ( + "fmt" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// PrintEvents prints the Kubernetes events to standard out. +func (f *Framework) PrintEvents() error { + events, err := f.KubeClient.CoreV1().Events("").List(metav1.ListOptions{}) + if err != nil { + return err + } + if events != nil { + fmt.Println("=== Kubernetes events:") + for _, e := range events.Items { + fmt.Printf("FirstTimestamp: '%v', Reason: '%v', Message: '%v'\n", e.FirstTimestamp, e.Reason, e.Message) + } + } + + return nil +} diff --git a/vendor/github.com/coreos/prometheus-operator/test/framework/framework.go b/vendor/github.com/coreos/prometheus-operator/test/framework/framework.go new file mode 100644 index 0000000000..552bdb70ee --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/test/framework/framework.go @@ -0,0 +1,210 @@ +// Copyright 2016 The prometheus-operator 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 framework + +import ( + "fmt" + "net/http" + "strings" + "testing" + "time" + + "k8s.io/api/core/v1" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/client-go/kubernetes" + "k8s.io/client-go/rest" + "k8s.io/client-go/tools/clientcmd" + + monitoringclient "github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1" + "github.com/coreos/prometheus-operator/pkg/k8sutil" + + "github.com/pkg/errors" +) + +type Framework struct { + KubeClient kubernetes.Interface + MonClientV1 monitoringclient.MonitoringV1Interface + HTTPClient *http.Client + MasterHost string + DefaultTimeout time.Duration +} + +// New setups a test framework and returns it. +func New(kubeconfig, opImage string) (*Framework, error) { + config, err := clientcmd.BuildConfigFromFlags("", kubeconfig) + if err != nil { + return nil, errors.Wrap(err, "build config from flags failed") + } + + cli, err := kubernetes.NewForConfig(config) + if err != nil { + return nil, errors.Wrap(err, "creating new kube-client failed") + } + + httpc := cli.CoreV1().RESTClient().(*rest.RESTClient).Client + if err != nil { + return nil, errors.Wrap(err, "creating http-client failed") + } + + mClientV1, err := monitoringclient.NewForConfig(config) + if err != nil { + return nil, errors.Wrap(err, "creating v1 monitoring client failed") + } + + f := &Framework{ + MasterHost: config.Host, + KubeClient: cli, + MonClientV1: mClientV1, + HTTPClient: httpc, + DefaultTimeout: time.Minute, + } + + return f, nil +} + +// CreatePrometheusOperator creates a Prometheus Operator Kubernetes Deployment +// inside the specified namespace using the specified operator image. In addition +// one can specify the namespaces to watch, which defaults to all namespaces. +func (f *Framework) CreatePrometheusOperator(ns, opImage string, namespacesToWatch []string) error { + _, err := CreateServiceAccount( + f.KubeClient, + ns, + "../../example/rbac/prometheus-operator/prometheus-operator-service-account.yaml", + ) + if err != nil && !apierrors.IsAlreadyExists(err) { + return errors.Wrap(err, "failed to create prometheus operator service account") + } + + if err := CreateClusterRole(f.KubeClient, "../../example/rbac/prometheus-operator/prometheus-operator-cluster-role.yaml"); err != nil && !apierrors.IsAlreadyExists(err) { + return errors.Wrap(err, "failed to create prometheus cluster role") + } + + if _, err := CreateClusterRoleBinding(f.KubeClient, ns, "../../example/rbac/prometheus-operator/prometheus-operator-cluster-role-binding.yaml"); err != nil && !apierrors.IsAlreadyExists(err) { + return errors.Wrap(err, "failed to create prometheus cluster role binding") + } + + deploy, err := MakeDeployment("../../example/rbac/prometheus-operator/prometheus-operator-deployment.yaml") + if err != nil { + return err + } + + if opImage != "" { + // Override operator image used, if specified when running tests. + deploy.Spec.Template.Spec.Containers[0].Image = opImage + repoAndTag := strings.Split(opImage, ":") + if len(repoAndTag) != 2 { + return errors.Errorf( + "expected operator image '%v' split by colon to result in two substrings but got '%v'", + opImage, + repoAndTag, + ) + } + // Override Prometheus config reloader image + for i, arg := range deploy.Spec.Template.Spec.Containers[0].Args { + if strings.Contains(arg, "--prometheus-config-reloader=") { + deploy.Spec.Template.Spec.Containers[0].Args[i] = "--prometheus-config-reloader=" + + "quay.io/coreos/prometheus-config-reloader:" + + repoAndTag[1] + } + } + } + + deploy.Spec.Template.Spec.Containers[0].Args = append(deploy.Spec.Template.Spec.Containers[0].Args, "--log-level=all") + + for _, ns := range namespacesToWatch { + deploy.Spec.Template.Spec.Containers[0].Args = append( + deploy.Spec.Template.Spec.Containers[0].Args, + fmt.Sprintf("--namespaces=%v", ns), + ) + } + + err = CreateDeployment(f.KubeClient, ns, deploy) + if err != nil { + return err + } + + opts := metav1.ListOptions{LabelSelector: fields.SelectorFromSet(fields.Set(deploy.Spec.Template.ObjectMeta.Labels)).String()} + err = WaitForPodsReady(f.KubeClient, ns, f.DefaultTimeout, 1, opts) + if err != nil { + return errors.Wrap(err, "failed to wait for prometheus operator to become ready") + } + + err = k8sutil.WaitForCRDReady(func(opts metav1.ListOptions) (runtime.Object, error) { + return f.MonClientV1.Prometheuses(v1.NamespaceAll).List(opts) + }) + if err != nil { + return errors.Wrap(err, "Prometheus CRD not ready: %v\n") + } + + err = k8sutil.WaitForCRDReady(func(opts metav1.ListOptions) (runtime.Object, error) { + return f.MonClientV1.ServiceMonitors(v1.NamespaceAll).List(opts) + }) + if err != nil { + return errors.Wrap(err, "ServiceMonitor CRD not ready: %v\n") + } + + err = k8sutil.WaitForCRDReady(func(opts metav1.ListOptions) (runtime.Object, error) { + return f.MonClientV1.PrometheusRules(v1.NamespaceAll).List(opts) + }) + if err != nil { + return errors.Wrap(err, "PrometheusRule CRD not ready: %v\n") + } + + err = k8sutil.WaitForCRDReady(func(opts metav1.ListOptions) (runtime.Object, error) { + return f.MonClientV1.Alertmanagers(v1.NamespaceAll).List(opts) + }) + if err != nil { + return errors.Wrap(err, "Alertmanager CRD not ready: %v\n") + } + + return nil +} + +func (ctx *TestCtx) SetupPrometheusRBAC(t *testing.T, ns string, kubeClient kubernetes.Interface) { + if err := CreateClusterRole(kubeClient, "../../example/rbac/prometheus/prometheus-cluster-role.yaml"); err != nil && !apierrors.IsAlreadyExists(err) { + t.Fatalf("failed to create prometheus cluster role: %v", err) + } + if finalizerFn, err := CreateServiceAccount(kubeClient, ns, "../../example/rbac/prometheus/prometheus-service-account.yaml"); err != nil { + t.Fatal(errors.Wrap(err, "failed to create prometheus service account")) + } else { + ctx.AddFinalizerFn(finalizerFn) + } + + if finalizerFn, err := CreateRoleBinding(kubeClient, ns, "../framework/ressources/prometheus-role-binding.yml"); err != nil { + t.Fatal(errors.Wrap(err, "failed to create prometheus role binding")) + } else { + ctx.AddFinalizerFn(finalizerFn) + } +} + +func (ctx *TestCtx) SetupPrometheusRBACGlobal(t *testing.T, ns string, kubeClient kubernetes.Interface) { + if err := CreateClusterRole(kubeClient, "../../example/rbac/prometheus/prometheus-cluster-role.yaml"); err != nil && !apierrors.IsAlreadyExists(err) { + t.Fatalf("failed to create prometheus cluster role: %v", err) + } + if finalizerFn, err := CreateServiceAccount(kubeClient, ns, "../../example/rbac/prometheus/prometheus-service-account.yaml"); err != nil { + t.Fatal(errors.Wrap(err, "failed to create prometheus service account")) + } else { + ctx.AddFinalizerFn(finalizerFn) + } + + if finalizerFn, err := CreateClusterRoleBinding(kubeClient, ns, "../../example/rbac/prometheus/prometheus-cluster-role-binding.yaml"); err != nil { + t.Fatal(errors.Wrap(err, "failed to create prometheus cluster role binding")) + } else { + ctx.AddFinalizerFn(finalizerFn) + } +} diff --git a/vendor/github.com/coreos/prometheus-operator/test/framework/helpers.go b/vendor/github.com/coreos/prometheus-operator/test/framework/helpers.go new file mode 100644 index 0000000000..d8c43c7b7e --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/test/framework/helpers.go @@ -0,0 +1,184 @@ +// Copyright 2017 The prometheus-operator 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 framework + +import ( + "fmt" + "net/http" + "os" + "path/filepath" + "time" + + "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/wait" + "k8s.io/client-go/kubernetes" + "k8s.io/client-go/rest" + + "github.com/coreos/prometheus-operator/pkg/k8sutil" + "github.com/pkg/errors" +) + +func PathToOSFile(relativPath string) (*os.File, error) { + path, err := filepath.Abs(relativPath) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("failed generate absolut file path of %s", relativPath)) + } + + manifest, err := os.Open(path) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("failed to open file %s", path)) + } + + return manifest, nil +} + +// WaitForPodsReady waits for a selection of Pods to be running and each +// container to pass its readiness check. +func WaitForPodsReady(kubeClient kubernetes.Interface, namespace string, timeout time.Duration, expectedReplicas int, opts metav1.ListOptions) error { + return wait.Poll(time.Second, timeout, func() (bool, error) { + pl, err := kubeClient.Core().Pods(namespace).List(opts) + if err != nil { + return false, err + } + + runningAndReady := 0 + for _, p := range pl.Items { + isRunningAndReady, err := k8sutil.PodRunningAndReady(p) + if err != nil { + return false, err + } + + if isRunningAndReady { + runningAndReady++ + } + } + + if runningAndReady == expectedReplicas { + return true, nil + } + return false, nil + }) +} + +func WaitForPodsRunImage(kubeClient kubernetes.Interface, namespace string, expectedReplicas int, image string, opts metav1.ListOptions) error { + return wait.Poll(time.Second, time.Minute*5, func() (bool, error) { + pl, err := kubeClient.Core().Pods(namespace).List(opts) + if err != nil { + return false, err + } + + runningImage := 0 + for _, p := range pl.Items { + if podRunsImage(p, image) { + runningImage++ + } + } + + if runningImage == expectedReplicas { + return true, nil + } + return false, nil + }) +} + +func WaitForHTTPSuccessStatusCode(timeout time.Duration, url string) error { + var resp *http.Response + err := wait.Poll(time.Second, timeout, func() (bool, error) { + var err error + resp, err = http.Get(url) + if err == nil && resp.StatusCode == 200 { + return true, nil + } + return false, nil + }) + + return errors.Wrap(err, fmt.Sprintf( + "waiting for %v to return a successful status code timed out. Last response from server was: %v", + url, + resp, + )) +} + +func podRunsImage(p v1.Pod, image string) bool { + for _, c := range p.Spec.Containers { + if image == c.Image { + return true + } + } + + return false +} + +func GetLogs(kubeClient kubernetes.Interface, namespace string, podName, containerName string) (string, error) { + logs, err := kubeClient.Core().RESTClient().Get(). + Resource("pods"). + Namespace(namespace). + Name(podName).SubResource("log"). + Param("container", containerName). + Do(). + Raw() + if err != nil { + return "", err + } + return string(logs), err +} + +func (f *Framework) Poll(timeout, pollInterval time.Duration, pollFunc func() (bool, error)) error { + t := time.After(timeout) + ticker := time.NewTicker(pollInterval) + defer ticker.Stop() + + for { + select { + case <-t: + return fmt.Errorf("timed out") + case <-ticker.C: + b, err := pollFunc() + if err != nil { + return err + } + if b { + return nil + } + } + } +} + +func ProxyGetPod(kubeClient kubernetes.Interface, namespace, podName, port, path string) *rest.Request { + return kubeClient. + CoreV1(). + RESTClient(). + Get(). + Namespace(namespace). + Resource("pods"). + SubResource("proxy"). + Name(podName). + Suffix(path) +} + +func ProxyPostPod(kubeClient kubernetes.Interface, namespace, podName, port, path, body string) *rest.Request { + return kubeClient. + CoreV1(). + RESTClient(). + Post(). + Namespace(namespace). + Resource("pods"). + SubResource("proxy"). + Name(podName). + Suffix(path). + Body([]byte(body)). + SetHeader("Content-Type", "application/json") +} diff --git a/vendor/github.com/coreos/prometheus-operator/test/framework/ingress.go b/vendor/github.com/coreos/prometheus-operator/test/framework/ingress.go new file mode 100644 index 0000000000..e5da8a75b1 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/test/framework/ingress.go @@ -0,0 +1,147 @@ +// Copyright 2016 The prometheus-operator 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 framework + +import ( + "fmt" + "os" + "time" + + "github.com/pkg/errors" + "k8s.io/api/core/v1" + "k8s.io/api/extensions/v1beta1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/intstr" + "k8s.io/apimachinery/pkg/util/wait" + "k8s.io/apimachinery/pkg/util/yaml" + "k8s.io/client-go/kubernetes" +) + +func MakeBasicIngress(serviceName string, servicePort int) *v1beta1.Ingress { + return &v1beta1.Ingress{ + ObjectMeta: metav1.ObjectMeta{ + Name: "monitoring", + }, + Spec: v1beta1.IngressSpec{ + Rules: []v1beta1.IngressRule{ + { + IngressRuleValue: v1beta1.IngressRuleValue{ + HTTP: &v1beta1.HTTPIngressRuleValue{ + Paths: []v1beta1.HTTPIngressPath{ + { + Backend: v1beta1.IngressBackend{ + ServiceName: serviceName, + ServicePort: intstr.FromInt(servicePort), + }, + Path: "/metrics", + }, + }, + }, + }, + }, + }, + }, + } +} + +func CreateIngress(kubeClient kubernetes.Interface, namespace string, i *v1beta1.Ingress) error { + _, err := kubeClient.Extensions().Ingresses(namespace).Create(i) + return errors.Wrap(err, fmt.Sprintf("creating ingress %v failed", i.Name)) +} + +func SetupNginxIngressControllerIncDefaultBackend(kubeClient kubernetes.Interface, namespace string) error { + // Create Nginx Ingress Replication Controller + if err := createReplicationControllerViaYml(kubeClient, namespace, "./framework/ressources/nxginx-ingress-controller.yml"); err != nil { + return errors.Wrap(err, "creating nginx ingress replication controller failed") + } + + // Create Default HTTP Backend Replication Controller + if err := createReplicationControllerViaYml(kubeClient, namespace, "./framework/ressources/default-http-backend.yml"); err != nil { + return errors.Wrap(err, "creating default http backend replication controller failed") + } + + // Create Default HTTP Backend Service + manifest, err := os.Open("./framework/ressources/default-http-backend-service.yml") + if err != nil { + return errors.Wrap(err, "reading default http backend service yaml failed") + } + + service := v1.Service{} + err = yaml.NewYAMLOrJSONDecoder(manifest, 100).Decode(&service) + if err != nil { + return errors.Wrap(err, "decoding http backend service yaml failed") + } + + _, err = kubeClient.CoreV1().Services(namespace).Create(&service) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("creating http backend service %v failed", service.Name)) + } + if err := WaitForServiceReady(kubeClient, namespace, service.Name); err != nil { + return errors.Wrap(err, fmt.Sprintf("waiting for http backend service %v timed out", service.Name)) + } + + return nil +} + +func DeleteNginxIngressControllerIncDefaultBackend(kubeClient kubernetes.Interface, namespace string) error { + // Delete Nginx Ingress Replication Controller + if err := deleteReplicationControllerViaYml(kubeClient, namespace, "./framework/ressources/nxginx-ingress-controller.yml"); err != nil { + return errors.Wrap(err, "deleting nginx ingress replication controller failed") + } + + // Delete Default HTTP Backend Replication Controller + if err := deleteReplicationControllerViaYml(kubeClient, namespace, "./framework/ressources/default-http-backend.yml"); err != nil { + return errors.Wrap(err, "deleting default http backend replication controller failed") + } + + // Delete Default HTTP Backend Service + manifest, err := os.Open("./framework/ressources/default-http-backend-service.yml") + if err != nil { + return errors.Wrap(err, "reading default http backend service yaml failed") + } + + service := v1.Service{} + err = yaml.NewYAMLOrJSONDecoder(manifest, 100).Decode(&service) + if err != nil { + return errors.Wrap(err, "decoding http backend service yaml failed") + } + + if err := kubeClient.CoreV1().Services(namespace).Delete(service.Name, nil); err != nil { + return errors.Wrap(err, fmt.Sprintf("deleting http backend service %v failed", service.Name)) + } + + return nil +} + +func GetIngressIP(kubeClient kubernetes.Interface, namespace string, ingressName string) (*string, error) { + var ingress *v1beta1.Ingress + err := wait.Poll(time.Millisecond*500, time.Minute*5, func() (bool, error) { + var err error + ingress, err = kubeClient.Extensions().Ingresses(namespace).Get(ingressName, metav1.GetOptions{}) + if err != nil { + return false, errors.Wrap(err, fmt.Sprintf("requesting the ingress %v failed", ingressName)) + } + ingresses := ingress.Status.LoadBalancer.Ingress + if len(ingresses) != 0 { + return true, nil + } + return false, nil + }) + if err != nil { + return nil, err + } + + return &ingress.Status.LoadBalancer.Ingress[0].IP, nil +} diff --git a/vendor/github.com/coreos/prometheus-operator/test/framework/namespace.go b/vendor/github.com/coreos/prometheus-operator/test/framework/namespace.go new file mode 100644 index 0000000000..9371095b37 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/test/framework/namespace.go @@ -0,0 +1,78 @@ +// Copyright 2017 The prometheus-operator 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 framework + +import ( + "fmt" + "testing" + + "github.com/pkg/errors" + "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/kubernetes" +) + +func CreateNamespace(kubeClient kubernetes.Interface, name string) (*v1.Namespace, error) { + namespace, err := kubeClient.Core().Namespaces().Create(&v1.Namespace{ + ObjectMeta: metav1.ObjectMeta{ + Name: name, + }, + }) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("failed to create namespace with name %v", name)) + } + return namespace, nil +} + +func (ctx *TestCtx) CreateNamespace(t *testing.T, kubeClient kubernetes.Interface) string { + name := ctx.GetObjID() + if _, err := CreateNamespace(kubeClient, name); err != nil { + t.Fatal(err) + } + + namespaceFinalizerFn := func() error { + return DeleteNamespace(kubeClient, name) + } + + ctx.AddFinalizerFn(namespaceFinalizerFn) + + return name +} + +func DeleteNamespace(kubeClient kubernetes.Interface, name string) error { + return kubeClient.Core().Namespaces().Delete(name, nil) +} + +func AddLabelsToNamespace(kubeClient kubernetes.Interface, name string, additionalLabels map[string]string) error { + ns, err := kubeClient.CoreV1().Namespaces().Get(name, metav1.GetOptions{}) + if err != nil { + return err + } + + if ns.Labels == nil { + ns.Labels = map[string]string{} + } + + for k, v := range additionalLabels { + ns.Labels[k] = v + } + + _, err = kubeClient.CoreV1().Namespaces().Update(ns) + if err != nil { + return err + } + + return nil +} diff --git a/vendor/github.com/coreos/prometheus-operator/test/framework/pod.go b/vendor/github.com/coreos/prometheus-operator/test/framework/pod.go new file mode 100644 index 0000000000..9e34ece519 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/test/framework/pod.go @@ -0,0 +1,61 @@ +// Copyright 2016 The prometheus-operator 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 framework + +import ( + "fmt" + "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + "github.com/pkg/errors" +) + +// PrintPodLogs prints the logs of a specified Pod +func (f *Framework) PrintPodLogs(ns, p string) error { + pod, err := f.KubeClient.CoreV1().Pods(ns).Get(p, metav1.GetOptions{}) + if err != nil { + return errors.Wrapf(err, "failed to print logs of pod '%v': failed to get pod", p) + } + + for _, c := range pod.Spec.Containers { + req := f.KubeClient.CoreV1().Pods(ns).GetLogs(p, &v1.PodLogOptions{Container: c.Name}) + resp, err := req.DoRaw() + if err != nil { + return errors.Wrapf(err, "failed to retrieve logs of pod '%v'", p) + } + + fmt.Printf("=== Logs of %v/%v/%v:", ns, p, c.Name) + fmt.Println(string(resp)) + } + + return nil +} + +// GetPodRestartCount returns a map of container names and their restart counts for +// a given pod. +func (f *Framework) GetPodRestartCount(ns, podName string) (map[string]int32, error) { + pod, err := f.KubeClient.CoreV1().Pods(ns).Get(podName, metav1.GetOptions{}) + if err != nil { + return nil, errors.Wrap(err, "failed to retrieve pod to get restart count") + } + + restarts := map[string]int32{} + + for _, status := range pod.Status.ContainerStatuses { + restarts[status.Name] = status.RestartCount + } + + return restarts, nil +} diff --git a/vendor/github.com/coreos/prometheus-operator/test/framework/prometheus.go b/vendor/github.com/coreos/prometheus-operator/test/framework/prometheus.go new file mode 100644 index 0000000000..b75f50cbe2 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/test/framework/prometheus.go @@ -0,0 +1,368 @@ +// Copyright 2016 The prometheus-operator 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 framework + +import ( + "bytes" + "encoding/json" + "fmt" + "time" + + "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/resource" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/intstr" + "k8s.io/apimachinery/pkg/util/wait" + + monitoringv1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + "github.com/coreos/prometheus-operator/pkg/prometheus" + "github.com/pkg/errors" +) + +func (f *Framework) MakeBasicPrometheus(ns, name, group string, replicas int32) *monitoringv1.Prometheus { + return &monitoringv1.Prometheus{ + ObjectMeta: metav1.ObjectMeta{ + Name: name, + Namespace: ns, + Annotations: map[string]string{}, + }, + Spec: monitoringv1.PrometheusSpec{ + Replicas: &replicas, + Version: prometheus.DefaultPrometheusVersion, + ServiceMonitorSelector: &metav1.LabelSelector{ + MatchLabels: map[string]string{ + "group": group, + }, + }, + ServiceAccountName: "prometheus", + RuleSelector: &metav1.LabelSelector{ + MatchLabels: map[string]string{ + "role": "rulefile", + }, + }, + Resources: v1.ResourceRequirements{ + Requests: v1.ResourceList{ + v1.ResourceMemory: resource.MustParse("400Mi"), + }, + }, + }, + } +} + +func (f *Framework) AddAlertingToPrometheus(p *monitoringv1.Prometheus, ns, name string) { + p.Spec.Alerting = &monitoringv1.AlertingSpec{ + Alertmanagers: []monitoringv1.AlertmanagerEndpoints{ + { + Namespace: ns, + Name: fmt.Sprintf("alertmanager-%s", name), + Port: intstr.FromString("web"), + }, + }, + } +} + +func (f *Framework) MakeBasicServiceMonitor(name string) *monitoringv1.ServiceMonitor { + return &monitoringv1.ServiceMonitor{ + ObjectMeta: metav1.ObjectMeta{ + Name: name, + Labels: map[string]string{ + "group": name, + }, + }, + Spec: monitoringv1.ServiceMonitorSpec{ + Selector: metav1.LabelSelector{ + MatchLabels: map[string]string{ + "group": name, + }, + }, + Endpoints: []monitoringv1.Endpoint{ + { + Port: "web", + Interval: "30s", + }, + }, + }, + } +} + +func (f *Framework) MakePrometheusService(name, group string, serviceType v1.ServiceType) *v1.Service { + service := &v1.Service{ + ObjectMeta: metav1.ObjectMeta{ + Name: fmt.Sprintf("prometheus-%s", name), + Labels: map[string]string{ + "group": group, + }, + }, + Spec: v1.ServiceSpec{ + Type: serviceType, + Ports: []v1.ServicePort{ + { + Name: "web", + Port: 9090, + TargetPort: intstr.FromString("web"), + }, + }, + Selector: map[string]string{ + "prometheus": name, + }, + }, + } + return service +} + +func (f *Framework) MakeThanosQuerierService(name string) *v1.Service { + service := &v1.Service{ + ObjectMeta: metav1.ObjectMeta{ + Name: name, + }, + Spec: v1.ServiceSpec{ + Ports: []v1.ServicePort{ + { + Name: "http-query", + Port: 10902, + TargetPort: intstr.FromString("http"), + }, + }, + Selector: map[string]string{ + "app": "thanos-query", + }, + }, + } + return service +} + +func (f *Framework) MakeThanosService(name string) *v1.Service { + service := &v1.Service{ + ObjectMeta: metav1.ObjectMeta{ + Name: name, + }, + Spec: v1.ServiceSpec{ + Ports: []v1.ServicePort{ + { + Name: "cluster", + Port: 10900, + TargetPort: intstr.FromString("cluster"), + }, + }, + Selector: map[string]string{ + "thanos-peer": "true", + }, + }, + } + return service +} + +func (f *Framework) CreatePrometheusAndWaitUntilReady(ns string, p *monitoringv1.Prometheus) (*monitoringv1.Prometheus, error) { + result, err := f.MonClientV1.Prometheuses(ns).Create(p) + if err != nil { + return nil, fmt.Errorf("creating %v Prometheus instances failed (%v): %v", p.Spec.Replicas, p.Name, err) + } + + if err := f.WaitForPrometheusReady(result, 5*time.Minute); err != nil { + return nil, fmt.Errorf("waiting for %v Prometheus instances timed out (%v): %v", p.Spec.Replicas, p.Name, err) + } + + return result, nil +} + +func (f *Framework) UpdatePrometheusAndWaitUntilReady(ns string, p *monitoringv1.Prometheus) (*monitoringv1.Prometheus, error) { + result, err := f.MonClientV1.Prometheuses(ns).Update(p) + if err != nil { + return nil, err + } + if err := f.WaitForPrometheusReady(result, 5*time.Minute); err != nil { + return nil, fmt.Errorf("failed to update %d Prometheus instances (%v): %v", p.Spec.Replicas, p.Name, err) + } + + return result, nil +} + +func (f *Framework) WaitForPrometheusReady(p *monitoringv1.Prometheus, timeout time.Duration) error { + var pollErr error + + err := wait.Poll(2*time.Second, timeout, func() (bool, error) { + st, _, pollErr := prometheus.PrometheusStatus(f.KubeClient, p) + + if pollErr != nil { + return false, nil + } + + if st.UpdatedReplicas == *p.Spec.Replicas { + return true, nil + } + + return false, nil + }) + return errors.Wrapf(pollErr, "waiting for Prometheus %v/%v: %v", p.Namespace, p.Name, err) +} + +func (f *Framework) DeletePrometheusAndWaitUntilGone(ns, name string) error { + _, err := f.MonClientV1.Prometheuses(ns).Get(name, metav1.GetOptions{}) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("requesting Prometheus custom resource %v failed", name)) + } + + if err := f.MonClientV1.Prometheuses(ns).Delete(name, nil); err != nil { + return errors.Wrap(err, fmt.Sprintf("deleting Prometheus custom resource %v failed", name)) + } + + if err := WaitForPodsReady( + f.KubeClient, + ns, + f.DefaultTimeout, + 0, + prometheus.ListOptions(name), + ); err != nil { + return errors.Wrap( + err, + fmt.Sprintf("waiting for Prometheus custom resource (%s) to vanish timed out", name), + ) + } + + return nil +} + +func (f *Framework) WaitForPrometheusRunImageAndReady(ns string, p *monitoringv1.Prometheus) error { + if err := WaitForPodsRunImage(f.KubeClient, ns, int(*p.Spec.Replicas), promImage(p.Spec.Version), prometheus.ListOptions(p.Name)); err != nil { + return err + } + return WaitForPodsReady( + f.KubeClient, + ns, + f.DefaultTimeout, + int(*p.Spec.Replicas), + prometheus.ListOptions(p.Name), + ) +} + +func promImage(version string) string { + return fmt.Sprintf("quay.io/prometheus/prometheus:%s", version) +} + +func (f *Framework) WaitForTargets(ns, svcName string, amount int) error { + var targets []*Target + + if err := wait.Poll(time.Second, time.Minute*5, func() (bool, error) { + var err error + targets, err = f.GetActiveTargets(ns, svcName) + if err != nil { + return false, err + } + + if len(targets) == amount { + return true, nil + } + + return false, nil + }); err != nil { + return fmt.Errorf("waiting for targets timed out. %v of %v targets found. %v", len(targets), amount, err) + } + + return nil +} + +func (f *Framework) QueryPrometheusSVC(ns, svcName, endpoint string, query map[string]string) ([]byte, error) { + ProxyGet := f.KubeClient.CoreV1().Services(ns).ProxyGet + request := ProxyGet("", svcName, "web", endpoint, query) + return request.DoRaw() +} + +func (f *Framework) GetActiveTargets(ns, svcName string) ([]*Target, error) { + response, err := f.QueryPrometheusSVC(ns, svcName, "/api/v1/targets", map[string]string{}) + if err != nil { + return nil, err + } + + rt := prometheusTargetAPIResponse{} + if err := json.NewDecoder(bytes.NewBuffer(response)).Decode(&rt); err != nil { + return nil, err + } + + return rt.Data.ActiveTargets, nil +} + +func (f *Framework) CheckPrometheusFiringAlert(ns, svcName, alertName string) (bool, error) { + response, err := f.QueryPrometheusSVC( + ns, + svcName, + "/api/v1/query", + map[string]string{"query": fmt.Sprintf("ALERTS{alertname=\"%v\"}", alertName)}, + ) + if err != nil { + return false, err + } + + q := prometheusQueryAPIResponse{} + if err := json.NewDecoder(bytes.NewBuffer(response)).Decode(&q); err != nil { + return false, err + } + + if len(q.Data.Result) != 1 { + return false, errors.Errorf("expected 1 query result but got %v", len(q.Data.Result)) + } + + alertstate, ok := q.Data.Result[0].Metric["alertstate"] + if !ok { + return false, errors.Errorf("could not retrieve 'alertstate' label from query result: %v", q.Data.Result[0]) + } + + return alertstate == "firing", nil +} + +func (f *Framework) WaitForPrometheusFiringAlert(ns, svcName, alertName string) error { + var loopError error + + err := wait.Poll(time.Second, 5*f.DefaultTimeout, func() (bool, error) { + var firing bool + firing, loopError = f.CheckPrometheusFiringAlert(ns, svcName, alertName) + return firing, nil + }) + + if err != nil { + return errors.Errorf( + "waiting for alert '%v' to fire: %v: %v", + alertName, + err.Error(), + loopError.Error(), + ) + } + return nil +} + +type Target struct { + ScrapeURL string `json:"scrapeUrl"` +} + +type targetDiscovery struct { + ActiveTargets []*Target `json:"activeTargets"` +} + +type prometheusTargetAPIResponse struct { + Status string `json:"status"` + Data *targetDiscovery `json:"data"` +} + +type prometheusQueryResult struct { + Metric map[string]string `json:"metric"` +} + +type prometheusQueryData struct { + Result []prometheusQueryResult `json:"result"` +} + +type prometheusQueryAPIResponse struct { + Status string `json:"status"` + Data *prometheusQueryData `json:"data"` +} diff --git a/vendor/github.com/coreos/prometheus-operator/test/framework/prometheus_rule.go b/vendor/github.com/coreos/prometheus-operator/test/framework/prometheus_rule.go new file mode 100644 index 0000000000..a4d604db28 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/test/framework/prometheus_rule.go @@ -0,0 +1,104 @@ +// Copyright 2016 The prometheus-operator 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 framework + +import ( + "fmt" + "time" + + monitoringv1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/intstr" + "k8s.io/apimachinery/pkg/util/wait" +) + +func (f *Framework) MakeBasicRule(ns, name string, groups []monitoringv1.RuleGroup) *monitoringv1.PrometheusRule { + return &monitoringv1.PrometheusRule{ + ObjectMeta: metav1.ObjectMeta{ + Name: name, + Namespace: ns, + Labels: map[string]string{ + "role": "rulefile", + }, + }, + Spec: monitoringv1.PrometheusRuleSpec{ + Groups: groups, + }, + } +} + +func (f *Framework) CreateRule(ns string, ar *monitoringv1.PrometheusRule) (*monitoringv1.PrometheusRule, error) { + result, err := f.MonClientV1.PrometheusRules(ns).Create(ar) + if err != nil { + return nil, fmt.Errorf("creating %v RuleFile failed: %v", ar.Name, err) + } + + return result, nil +} + +func (f *Framework) MakeAndCreateFiringRule(ns, name, alertName string) (*monitoringv1.PrometheusRule, error) { + groups := []monitoringv1.RuleGroup{ + { + Name: alertName, + Rules: []monitoringv1.Rule{ + { + Alert: alertName, + Expr: intstr.FromString("vector(1)"), + }, + }, + }, + } + file := f.MakeBasicRule(ns, name, groups) + + result, err := f.CreateRule(ns, file) + if err != nil { + return nil, err + } + + return result, nil +} + +// WaitForRule waits for a rule file with a given name to exist in a given +// namespace. +func (f *Framework) WaitForRule(ns, name string) error { + return wait.Poll(time.Second, f.DefaultTimeout, func() (bool, error) { + _, err := f.MonClientV1.PrometheusRules(ns).Get(name, metav1.GetOptions{}) + if apierrors.IsNotFound(err) { + return false, nil + } else if err != nil { + return false, err + } + return true, nil + }) +} + +func (f *Framework) UpdateRule(ns string, ar *monitoringv1.PrometheusRule) (*monitoringv1.PrometheusRule, error) { + result, err := f.MonClientV1.PrometheusRules(ns).Update(ar) + if err != nil { + return nil, fmt.Errorf("updating %v RuleFile failed: %v", ar.Name, err) + } + + return result, nil +} + +func (f *Framework) DeleteRule(ns string, r string) error { + err := f.MonClientV1.PrometheusRules(ns).Delete(r, &metav1.DeleteOptions{}) + if err != nil { + return fmt.Errorf("deleteing %v Prometheus rule in namespace %v failed: %v", r, ns, err.Error()) + } + + return nil +} diff --git a/vendor/github.com/coreos/prometheus-operator/test/framework/replication-controller.go b/vendor/github.com/coreos/prometheus-operator/test/framework/replication-controller.go new file mode 100644 index 0000000000..2f3845a2a6 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/test/framework/replication-controller.go @@ -0,0 +1,91 @@ +// Copyright 2016 The prometheus-operator 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 framework + +import ( + "os" + "time" + + "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/wait" + "k8s.io/apimachinery/pkg/util/yaml" + "k8s.io/client-go/kubernetes" +) + +func createReplicationControllerViaYml(kubeClient kubernetes.Interface, namespace string, filepath string) error { + manifest, err := os.Open(filepath) + if err != nil { + return err + } + + var rC v1.ReplicationController + err = yaml.NewYAMLOrJSONDecoder(manifest, 100).Decode(&rC) + if err != nil { + return err + } + + _, err = kubeClient.CoreV1().ReplicationControllers(namespace).Create(&rC) + if err != nil { + return err + } + + return nil +} + +func deleteReplicationControllerViaYml(kubeClient kubernetes.Interface, namespace string, filepath string) error { + manifest, err := os.Open(filepath) + if err != nil { + return err + } + + var rC v1.ReplicationController + err = yaml.NewYAMLOrJSONDecoder(manifest, 100).Decode(&rC) + if err != nil { + return err + } + + if err := scaleDownReplicationController(kubeClient, namespace, rC); err != nil { + return err + } + + if err := kubeClient.CoreV1().ReplicationControllers(namespace).Delete(rC.Name, nil); err != nil { + return err + } + + return nil +} + +func scaleDownReplicationController(kubeClient kubernetes.Interface, namespace string, rC v1.ReplicationController) error { + *rC.Spec.Replicas = 0 + rCAPI := kubeClient.CoreV1().ReplicationControllers(namespace) + + _, err := kubeClient.CoreV1().ReplicationControllers(namespace).Update(&rC) + if err != nil { + return err + } + + return wait.Poll(time.Second, time.Minute*5, func() (bool, error) { + currentRC, err := rCAPI.Get(rC.Name, metav1.GetOptions{}) + if err != nil { + return false, err + } + + if currentRC.Status.Replicas == 0 { + return true, nil + } + return false, nil + }) +} diff --git a/vendor/github.com/coreos/prometheus-operator/test/framework/role-binding.go b/vendor/github.com/coreos/prometheus-operator/test/framework/role-binding.go new file mode 100644 index 0000000000..1b188192a5 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/test/framework/role-binding.go @@ -0,0 +1,56 @@ +// Copyright 2017 The prometheus-operator 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 framework + +import ( + rbacv1 "k8s.io/api/rbac/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/yaml" + "k8s.io/client-go/kubernetes" +) + +func CreateRoleBinding(kubeClient kubernetes.Interface, ns string, relativePath string) (finalizerFn, error) { + finalizerFn := func() error { return DeleteRoleBinding(kubeClient, ns, relativePath) } + roleBinding, err := parseRoleBindingYaml(relativePath) + if err != nil { + return finalizerFn, err + } + + _, err = kubeClient.RbacV1().RoleBindings(ns).Create(roleBinding) + return finalizerFn, err +} + +func DeleteRoleBinding(kubeClient kubernetes.Interface, ns string, relativePath string) error { + roleBinding, err := parseRoleBindingYaml(relativePath) + if err != nil { + return err + } + + return kubeClient.RbacV1().RoleBindings(ns).Delete(roleBinding.Name, &metav1.DeleteOptions{}) +} + +func parseRoleBindingYaml(relativePath string) (*rbacv1.RoleBinding, error) { + manifest, err := PathToOSFile(relativePath) + if err != nil { + return nil, err + } + + roleBinding := rbacv1.RoleBinding{} + if err := yaml.NewYAMLOrJSONDecoder(manifest, 100).Decode(&roleBinding); err != nil { + return nil, err + } + + return &roleBinding, nil +} diff --git a/vendor/github.com/coreos/prometheus-operator/test/framework/service.go b/vendor/github.com/coreos/prometheus-operator/test/framework/service.go new file mode 100644 index 0000000000..c2105c85f1 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/test/framework/service.go @@ -0,0 +1,80 @@ +// Copyright 2016 The prometheus-operator 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 framework + +import ( + "fmt" + "time" + + "github.com/pkg/errors" + "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/wait" + "k8s.io/client-go/kubernetes" +) + +func CreateServiceAndWaitUntilReady(kubeClient kubernetes.Interface, namespace string, service *v1.Service) (finalizerFn, error) { + finalizerFn := func() error { return DeleteServiceAndWaitUntilGone(kubeClient, namespace, service.Name) } + + if _, err := kubeClient.CoreV1().Services(namespace).Create(service); err != nil { + return finalizerFn, errors.Wrap(err, fmt.Sprintf("creating service %v failed", service.Name)) + } + + if err := WaitForServiceReady(kubeClient, namespace, service.Name); err != nil { + return finalizerFn, errors.Wrap(err, fmt.Sprintf("waiting for service %v to become ready timed out", service.Name)) + } + return finalizerFn, nil +} + +func WaitForServiceReady(kubeClient kubernetes.Interface, namespace string, serviceName string) error { + err := wait.Poll(time.Second, time.Minute*5, func() (bool, error) { + endpoints, err := getEndpoints(kubeClient, namespace, serviceName) + if err != nil { + return false, err + } + if len(endpoints.Subsets) != 0 && len(endpoints.Subsets[0].Addresses) > 0 { + return true, nil + } + return false, nil + }) + return err +} + +func DeleteServiceAndWaitUntilGone(kubeClient kubernetes.Interface, namespace string, serviceName string) error { + if err := kubeClient.CoreV1().Services(namespace).Delete(serviceName, nil); err != nil { + return errors.Wrap(err, fmt.Sprintf("deleting service %v failed", serviceName)) + } + + err := wait.Poll(5*time.Second, time.Minute, func() (bool, error) { + _, err := getEndpoints(kubeClient, namespace, serviceName) + if err != nil { + return true, nil + } + return false, nil + }) + if err != nil { + return errors.Wrap(err, "waiting for service to go away failed") + } + + return nil +} + +func getEndpoints(kubeClient kubernetes.Interface, namespace, serviceName string) (*v1.Endpoints, error) { + endpoints, err := kubeClient.CoreV1().Endpoints(namespace).Get(serviceName, metav1.GetOptions{}) + if err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("requesting endpoints for servce %v failed", serviceName)) + } + return endpoints, nil +} diff --git a/vendor/github.com/coreos/prometheus-operator/test/framework/service_account.go b/vendor/github.com/coreos/prometheus-operator/test/framework/service_account.go new file mode 100644 index 0000000000..0dd2fafc36 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/test/framework/service_account.go @@ -0,0 +1,60 @@ +// Copyright 2017 The prometheus-operator 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 framework + +import ( + "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/util/yaml" + "k8s.io/client-go/kubernetes" +) + +func CreateServiceAccount(kubeClient kubernetes.Interface, namespace string, relativPath string) (finalizerFn, error) { + finalizerFn := func() error { return DeleteServiceAccount(kubeClient, namespace, relativPath) } + + serviceAccount, err := parseServiceAccountYaml(relativPath) + if err != nil { + return finalizerFn, err + } + serviceAccount.Namespace = namespace + _, err = kubeClient.CoreV1().ServiceAccounts(namespace).Create(serviceAccount) + if err != nil { + return finalizerFn, err + } + + return finalizerFn, nil +} + +func parseServiceAccountYaml(relativPath string) (*v1.ServiceAccount, error) { + manifest, err := PathToOSFile(relativPath) + if err != nil { + return nil, err + } + + serviceAccount := v1.ServiceAccount{} + if err := yaml.NewYAMLOrJSONDecoder(manifest, 100).Decode(&serviceAccount); err != nil { + return nil, err + } + + return &serviceAccount, nil +} + +func DeleteServiceAccount(kubeClient kubernetes.Interface, namespace string, relativPath string) error { + serviceAccount, err := parseServiceAccountYaml(relativPath) + if err != nil { + return err + } + + return kubeClient.CoreV1().ServiceAccounts(namespace).Delete(serviceAccount.Name, nil) +} diff --git a/vendor/k8s.io/kube-openapi/cmd/openapi-gen/openapi-gen.go b/vendor/k8s.io/kube-openapi/cmd/openapi-gen/openapi-gen.go index 3d42da21a8..0f7563b10b 100644 --- a/vendor/k8s.io/kube-openapi/cmd/openapi-gen/openapi-gen.go +++ b/vendor/k8s.io/kube-openapi/cmd/openapi-gen/openapi-gen.go @@ -28,12 +28,9 @@ import ( "k8s.io/kube-openapi/pkg/generators" "github.com/spf13/pflag" - - "k8s.io/klog" ) func main() { - klog.InitFlags(nil) genericArgs, customArgs := generatorargs.NewDefaults() genericArgs.AddFlags(pflag.CommandLine) diff --git a/vendor/k8s.io/kube-openapi/cmd/openapi2smd/openapi2smd.go b/vendor/k8s.io/kube-openapi/cmd/openapi2smd/openapi2smd.go deleted file mode 100644 index f48a084e89..0000000000 --- a/vendor/k8s.io/kube-openapi/cmd/openapi2smd/openapi2smd.go +++ /dev/null @@ -1,60 +0,0 @@ -/* -Copyright 2018 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 ( - "log" - "os" - - "github.com/googleapis/gnostic/OpenAPIv2" - "github.com/googleapis/gnostic/compiler" - yaml "gopkg.in/yaml.v2" - - "k8s.io/kube-openapi/pkg/schemaconv" - "k8s.io/kube-openapi/pkg/util/proto" -) - -func main() { - if len(os.Args) != 1 { - log.Fatal("this program takes input on stdin and writes output to stdout.") - } - - var info yaml.MapSlice - if err := yaml.NewDecoder(os.Stdin).Decode(&info); err != nil { - log.Fatalf("error decoding stdin: %v", err) - } - - document, err := openapi_v2.NewDocument(info, compiler.NewContext("$root", nil)) - if err != nil { - log.Fatalf("error interpreting stdin: %v", err) - } - - models, err := proto.NewOpenAPIData(document) - if err != nil { - log.Fatalf("error interpreting models: %v", err) - } - - newSchema, err := schemaconv.ToSchema(models) - if err != nil { - log.Fatalf("error converting schema format: %v", err) - } - - if err := yaml.NewEncoder(os.Stdout).Encode(newSchema); err != nil { - log.Fatalf("error writing new schema: %v", err) - } - -} diff --git a/vendor/k8s.io/kube-openapi/pkg/aggregator/aggregator.go b/vendor/k8s.io/kube-openapi/pkg/aggregator/aggregator.go index cbeb3ef8a5..f05b501725 100644 --- a/vendor/k8s.io/kube-openapi/pkg/aggregator/aggregator.go +++ b/vendor/k8s.io/kube-openapi/pkg/aggregator/aggregator.go @@ -87,13 +87,13 @@ func (s *referenceWalker) walkSchema(schema *spec.Schema) { s.walkSchema(&v) schema.PatternProperties[k] = v } - for i := range schema.AllOf { + for i, _ := range schema.AllOf { s.walkSchema(&schema.AllOf[i]) } - for i := range schema.AnyOf { + for i, _ := range schema.AnyOf { s.walkSchema(&schema.AnyOf[i]) } - for i := range schema.OneOf { + for i, _ := range schema.OneOf { s.walkSchema(&schema.OneOf[i]) } if schema.Not != nil { @@ -109,7 +109,7 @@ func (s *referenceWalker) walkSchema(schema *spec.Schema) { if schema.Items.Schema != nil { s.walkSchema(schema.Items.Schema) } - for i := range schema.Items.Schemas { + for i, _ := range schema.Items.Schemas { s.walkSchema(&schema.Items.Schemas[i]) } } @@ -257,9 +257,7 @@ func mergeSpecs(dest, source *spec.Swagger, renameModelConflicts, ignorePathConf specCloned := false // Paths may be empty, due to [ACL constraints](http://goo.gl/8us55a#securityFiltering). if source.Paths == nil { - // When a source spec does not have any path, that means none of the definitions - // are used thus we should not do anything - return nil + source.Paths = &spec.Paths{} } if dest.Paths == nil { dest.Paths = &spec.Paths{} diff --git a/vendor/k8s.io/kube-openapi/pkg/builder/openapi.go b/vendor/k8s.io/kube-openapi/pkg/builder/openapi.go index 072c8ec4ae..f48700d545 100644 --- a/vendor/k8s.io/kube-openapi/pkg/builder/openapi.go +++ b/vendor/k8s.io/kube-openapi/pkg/builder/openapi.go @@ -20,6 +20,7 @@ import ( "encoding/json" "fmt" "net/http" + "reflect" "strings" restful "github.com/emicklei/go-restful" @@ -57,7 +58,7 @@ func BuildOpenAPIDefinitionsForResource(model interface{}, config *common.Config o := newOpenAPI(config) // We can discard the return value of toSchema because all we care about is the side effect of calling it. // All the models created for this resource get added to o.swagger.Definitions - _, err := o.toSchema(util.GetCanonicalTypeName(model)) + _, err := o.toSchema(getCanonicalTypeName(model)) if err != nil { return nil, err } @@ -91,7 +92,6 @@ func newOpenAPI(config *common.Config) openAPI { SwaggerProps: spec.SwaggerProps{ Swagger: OpenAPIVersion, Definitions: spec.Definitions{}, - Responses: config.ResponseDefinitions, Paths: &spec.Paths{Paths: map[string]spec.PathItem{}}, Info: config.Info, }, @@ -135,6 +135,21 @@ func (o *openAPI) finalizeSwagger() (*spec.Swagger, error) { return o.swagger, nil } +func getCanonicalTypeName(model interface{}) string { + t := reflect.TypeOf(model) + if t.Kind() == reflect.Ptr { + t = t.Elem() + } + if t.PkgPath() == "" { + return t.Name() + } + path := t.PkgPath() + if strings.Contains(path, "/vendor/") { + path = path[strings.Index(path, "/vendor/")+len("/vendor/"):] + } + return path + "." + t.Name() +} + func (o *openAPI) buildDefinitionRecursively(name string) error { uniqueName, extensions := o.config.GetDefinitionName(name) if _, ok := o.swagger.Definitions[uniqueName]; ok { @@ -320,7 +335,7 @@ func (o *openAPI) buildOperations(route restful.Route, inPathCommonParamsMap map } func (o *openAPI) buildResponse(model interface{}, description string) (spec.Response, error) { - schema, err := o.toSchema(util.GetCanonicalTypeName(model)) + schema, err := o.toSchema(getCanonicalTypeName(model)) if err != nil { return spec.Response{}, err } @@ -398,7 +413,7 @@ func (o *openAPI) buildParameter(restParam restful.ParameterData, bodySample int case restful.BodyParameterKind: if bodySample != nil { ret.In = "body" - ret.Schema, err = o.toSchema(util.GetCanonicalTypeName(bodySample)) + ret.Schema, err = o.toSchema(getCanonicalTypeName(bodySample)) return ret, err } else { // There is not enough information in the body parameter to build the definition. diff --git a/vendor/k8s.io/kube-openapi/pkg/common/common.go b/vendor/k8s.io/kube-openapi/pkg/common/common.go index 7d5534b24e..0d235876de 100644 --- a/vendor/k8s.io/kube-openapi/pkg/common/common.go +++ b/vendor/k8s.io/kube-openapi/pkg/common/common.go @@ -59,12 +59,6 @@ type Config struct { // will show up as ... "responses" : {"default" : $DefaultResponse} in the spec. DefaultResponse *spec.Response - // ResponseDefinitions will be added to "responses" under the top-level swagger object. This is an object - // that holds responses definitions that can be used across operations. This property does not define - // global responses for all operations. For more info please refer: - // https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#fixed-fields - ResponseDefinitions map[string]spec.Response - // CommonResponses will be added as a response to all operation specs. This is a good place to add common // responses such as authorization failed. CommonResponses map[int]spec.Response diff --git a/vendor/k8s.io/kube-openapi/pkg/generators/api_linter.go b/vendor/k8s.io/kube-openapi/pkg/generators/api_linter.go index f732858875..9270d26320 100644 --- a/vendor/k8s.io/kube-openapi/pkg/generators/api_linter.go +++ b/vendor/k8s.io/kube-openapi/pkg/generators/api_linter.go @@ -17,114 +17,16 @@ limitations under the License. package generators import ( - "bytes" "fmt" "io" - "io/ioutil" - "os" - "sort" "k8s.io/kube-openapi/pkg/generators/rules" - "k8s.io/gengo/generator" + "github.com/golang/glog" "k8s.io/gengo/types" - "k8s.io/klog" ) -const apiViolationFileType = "api-violation" - -type apiViolationFile struct { - // Since our file actually is unrelated to the package structure, use a - // path that hasn't been mangled by the framework. - unmangledPath string -} - -func (a apiViolationFile) AssembleFile(f *generator.File, path string) error { - path = a.unmangledPath - klog.V(2).Infof("Assembling file %q", path) - if path == "-" { - _, err := io.Copy(os.Stdout, &f.Body) - return err - } - - output, err := os.Create(path) - if err != nil { - return err - } - defer output.Close() - _, err = io.Copy(output, &f.Body) - return err -} - -func (a apiViolationFile) VerifyFile(f *generator.File, path string) error { - if path == "-" { - // Nothing to verify against. - return nil - } - path = a.unmangledPath - - formatted := f.Body.Bytes() - existing, err := ioutil.ReadFile(path) - if err != nil { - return fmt.Errorf("unable to read file %q for comparison: %v", path, err) - } - if bytes.Compare(formatted, existing) == 0 { - return nil - } - - // Be nice and find the first place where they differ - // (Copied from gengo's default file type) - i := 0 - for i < len(formatted) && i < len(existing) && formatted[i] == existing[i] { - i++ - } - eDiff, fDiff := existing[i:], formatted[i:] - if len(eDiff) > 100 { - eDiff = eDiff[:100] - } - if len(fDiff) > 100 { - fDiff = fDiff[:100] - } - return fmt.Errorf("output for %q differs; first existing/expected diff: \n %q\n %q", path, string(eDiff), string(fDiff)) -} - -func newAPIViolationGen() *apiViolationGen { - return &apiViolationGen{ - linter: newAPILinter(), - } -} - -type apiViolationGen struct { - generator.DefaultGen - - linter *apiLinter -} - -func (v *apiViolationGen) FileType() string { return apiViolationFileType } -func (v *apiViolationGen) Filename() string { - return "this file is ignored by the file assembler" -} - -func (v *apiViolationGen) GenerateType(c *generator.Context, t *types.Type, w io.Writer) error { - klog.V(5).Infof("validating API rules for type %v", t) - if err := v.linter.validate(t); err != nil { - return err - } - return nil -} - -// Finalize prints the API rule violations to report file (if specified from -// arguments) or stdout (default) -func (v *apiViolationGen) Finalize(c *generator.Context, w io.Writer) error { - // NOTE: we don't return error here because we assume that the report file will - // get evaluated afterwards to determine if error should be raised. For example, - // you can have make rules that compare the report file with existing known - // violations (whitelist) and determine no error if no change is detected. - v.linter.report(w) - return nil -} - -// apiLinter is the framework hosting multiple API rules and recording API rule +// apiLinter is the framework hosting mutliple API rules and recording API rule // violations type apiLinter struct { // API rules that implement APIRule interface and output API rule violations @@ -138,7 +40,6 @@ func newAPILinter() *apiLinter { return &apiLinter{ rules: []APIRule{ &rules.NamesMatch{}, - &rules.OmitEmptyMatchCase{}, }, } } @@ -156,25 +57,6 @@ type apiViolation struct { field string } -// apiViolations implements sort.Interface for []apiViolation based on the fields: rule, -// packageName, typeName and field. -type apiViolations []apiViolation - -func (a apiViolations) Len() int { return len(a) } -func (a apiViolations) Swap(i, j int) { a[i], a[j] = a[j], a[i] } -func (a apiViolations) Less(i, j int) bool { - if a[i].rule != a[j].rule { - return a[i].rule < a[j].rule - } - if a[i].packageName != a[j].packageName { - return a[i].packageName < a[j].packageName - } - if a[i].typeName != a[j].typeName { - return a[i].typeName < a[j].typeName - } - return a[i].field < a[j].field -} - // APIRule is the interface for validating API rule on Go types type APIRule interface { // Validate evaluates API rule on type t and returns a list of field names in @@ -189,7 +71,7 @@ type APIRule interface { // validate runs all API rules on type t and records any API rule violation func (l *apiLinter) validate(t *types.Type) error { for _, r := range l.rules { - klog.V(5).Infof("validating API rule %v for type %v", r.Name(), t) + glog.V(5).Infof("validating API rule %v for type %v", r.Name(), t) fields, err := r.Validate(t) if err != nil { return err @@ -208,7 +90,6 @@ func (l *apiLinter) validate(t *types.Type) error { // report prints any API rule violation to writer w and returns error if violation exists func (l *apiLinter) report(w io.Writer) error { - sort.Sort(apiViolations(l.violations)) for _, v := range l.violations { fmt.Fprintf(w, "API rule violation: %s,%s,%s,%s\n", v.rule, v.packageName, v.typeName, v.field) } diff --git a/vendor/k8s.io/kube-openapi/pkg/generators/config.go b/vendor/k8s.io/kube-openapi/pkg/generators/config.go deleted file mode 100644 index 33cd9eb5a8..0000000000 --- a/vendor/k8s.io/kube-openapi/pkg/generators/config.go +++ /dev/null @@ -1,91 +0,0 @@ -/* -Copyright 2018 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 generators - -import ( - "fmt" - "path/filepath" - - "k8s.io/gengo/args" - "k8s.io/gengo/generator" - "k8s.io/gengo/namer" - "k8s.io/gengo/types" - "k8s.io/klog" - - generatorargs "k8s.io/kube-openapi/cmd/openapi-gen/args" -) - -type identityNamer struct{} - -func (_ identityNamer) Name(t *types.Type) string { - return t.Name.String() -} - -var _ namer.Namer = identityNamer{} - -// NameSystems returns the name system used by the generators in this package. -func NameSystems() namer.NameSystems { - return namer.NameSystems{ - "raw": namer.NewRawNamer("", nil), - "sorting_namer": identityNamer{}, - } -} - -// DefaultNameSystem returns the default name system for ordering the types to be -// processed by the generators in this package. -func DefaultNameSystem() string { - return "sorting_namer" -} - -func Packages(context *generator.Context, arguments *args.GeneratorArgs) generator.Packages { - boilerplate, err := arguments.LoadGoBoilerplate() - if err != nil { - klog.Fatalf("Failed loading boilerplate: %v", err) - } - header := append([]byte(fmt.Sprintf("// +build !%s\n\n", arguments.GeneratedBuildTag)), boilerplate...) - header = append(header, []byte( - ` -// This file was autogenerated by openapi-gen. Do not edit it manually! - -`)...) - - reportPath := "-" - if customArgs, ok := arguments.CustomArgs.(*generatorargs.CustomArgs); ok { - reportPath = customArgs.ReportFilename - } - context.FileTypes[apiViolationFileType] = apiViolationFile{ - unmangledPath: reportPath, - } - - return generator.Packages{ - &generator.DefaultPackage{ - PackageName: filepath.Base(arguments.OutputPackagePath), - PackagePath: arguments.OutputPackagePath, - HeaderText: header, - GeneratorFunc: func(c *generator.Context) (generators []generator.Generator) { - return []generator.Generator{ - newOpenAPIGen( - arguments.OutputFileBaseName, - arguments.OutputPackagePath, - ), - newAPIViolationGen(), - } - }, - FilterFunc: apiTypeFilterFunc, - }, - } -} diff --git a/vendor/k8s.io/kube-openapi/pkg/generators/extension.go b/vendor/k8s.io/kube-openapi/pkg/generators/extension.go index 14eab18f6b..befe38db24 100644 --- a/vendor/k8s.io/kube-openapi/pkg/generators/extension.go +++ b/vendor/k8s.io/kube-openapi/pkg/generators/extension.go @@ -36,20 +36,20 @@ type extensionAttributes struct { // Extension tag to openapi extension attributes var tagToExtension = map[string]extensionAttributes{ - "patchMergeKey": { + "patchMergeKey": extensionAttributes{ xName: "x-kubernetes-patch-merge-key", kind: types.Slice, }, - "patchStrategy": { + "patchStrategy": extensionAttributes{ xName: "x-kubernetes-patch-strategy", kind: types.Slice, allowedValues: sets.NewString("merge", "retainKeys"), }, - "listMapKey": { + "listMapKey": extensionAttributes{ xName: "x-kubernetes-list-map-keys", kind: types.Slice, }, - "listType": { + "listType": extensionAttributes{ xName: "x-kubernetes-list-type", kind: types.Slice, allowedValues: sets.NewString("atomic", "set", "map"), diff --git a/vendor/k8s.io/kube-openapi/pkg/generators/openapi.go b/vendor/k8s.io/kube-openapi/pkg/generators/openapi.go index 11d42b6d33..d6c6275a78 100644 --- a/vendor/k8s.io/kube-openapi/pkg/generators/openapi.go +++ b/vendor/k8s.io/kube-openapi/pkg/generators/openapi.go @@ -20,17 +20,20 @@ import ( "bytes" "fmt" "io" + "os" "path/filepath" "reflect" "sort" "strings" + "k8s.io/gengo/args" "k8s.io/gengo/generator" "k8s.io/gengo/namer" "k8s.io/gengo/types" + generatorargs "k8s.io/kube-openapi/cmd/openapi-gen/args" openapi "k8s.io/kube-openapi/pkg/common" - "k8s.io/klog" + "github.com/golang/glog" ) // This is the comment tag that carries parameters for open API generation. @@ -85,19 +88,69 @@ func hasOptionalTag(m *types.Member) bool { return hasOptionalCommentTag || hasOptionalJsonTag } -func apiTypeFilterFunc(c *generator.Context, t *types.Type) bool { - // There is a conflict between this codegen and codecgen, we should avoid types generated for codecgen - if strings.HasPrefix(t.Name.Name, "codecSelfer") { - return false +type identityNamer struct{} + +func (_ identityNamer) Name(t *types.Type) string { + return t.Name.String() +} + +var _ namer.Namer = identityNamer{} + +// NameSystems returns the name system used by the generators in this package. +func NameSystems() namer.NameSystems { + return namer.NameSystems{ + "raw": namer.NewRawNamer("", nil), + "sorting_namer": identityNamer{}, } - pkg := c.Universe.Package(t.Name.Package) - if hasOpenAPITagValue(pkg.Comments, tagValueTrue) { - return !hasOpenAPITagValue(t.CommentLines, tagValueFalse) +} + +// DefaultNameSystem returns the default name system for ordering the types to be +// processed by the generators in this package. +func DefaultNameSystem() string { + return "sorting_namer" +} + +func Packages(context *generator.Context, arguments *args.GeneratorArgs) generator.Packages { + boilerplate, err := arguments.LoadGoBoilerplate() + if err != nil { + glog.Fatalf("Failed loading boilerplate: %v", err) } - if hasOpenAPITagValue(t.CommentLines, tagValueTrue) { - return true + header := append([]byte(fmt.Sprintf("// +build !%s\n\n", arguments.GeneratedBuildTag)), boilerplate...) + header = append(header, []byte( + ` +// This file was autogenerated by openapi-gen. Do not edit it manually! + +`)...) + + reportFilename := "-" + if customArgs, ok := arguments.CustomArgs.(*generatorargs.CustomArgs); ok { + reportFilename = customArgs.ReportFilename + } + + return generator.Packages{ + &generator.DefaultPackage{ + PackageName: filepath.Base(arguments.OutputPackagePath), + PackagePath: arguments.OutputPackagePath, + HeaderText: header, + GeneratorFunc: func(c *generator.Context) (generators []generator.Generator) { + return []generator.Generator{NewOpenAPIGen(arguments.OutputFileBaseName, arguments.OutputPackagePath, context, newAPILinter(), reportFilename)} + }, + FilterFunc: func(c *generator.Context, t *types.Type) bool { + // There is a conflict between this codegen and codecgen, we should avoid types generated for codecgen + if strings.HasPrefix(t.Name.Name, "codecSelfer") { + return false + } + pkg := context.Universe.Package(t.Name.Package) + if hasOpenAPITagValue(pkg.Comments, tagValueTrue) { + return !hasOpenAPITagValue(t.CommentLines, tagValueFalse) + } + if hasOpenAPITagValue(t.CommentLines, tagValueTrue) { + return true + } + return false + }, + }, } - return false } const ( @@ -109,17 +162,24 @@ const ( type openAPIGen struct { generator.DefaultGen // TargetPackage is the package that will get GetOpenAPIDefinitions function returns all open API definitions. - targetPackage string - imports namer.ImportTracker + targetPackage string + imports namer.ImportTracker + types []*types.Type + context *generator.Context + linter *apiLinter + reportFilename string } -func newOpenAPIGen(sanitizedName string, targetPackage string) generator.Generator { +func NewOpenAPIGen(sanitizedName string, targetPackage string, context *generator.Context, linter *apiLinter, reportFilename string) generator.Generator { return &openAPIGen{ DefaultGen: generator.DefaultGen{ OptionalName: sanitizedName, }, - imports: generator.NewImportTracker(), - targetPackage: targetPackage, + imports: generator.NewImportTracker(), + targetPackage: targetPackage, + context: context, + linter: linter, + reportFilename: reportFilename, } } @@ -138,6 +198,15 @@ func (g *openAPIGen) Namers(c *generator.Context) namer.NameSystems { } } +func (g *openAPIGen) Filter(c *generator.Context, t *types.Type) bool { + // There is a conflict between this codegen and codecgen, we should avoid types generated for codecgen + if strings.HasPrefix(t.Name.Name, "codecSelfer") { + return false + } + g.types = append(g.types, t) + return true +} + func (g *openAPIGen) isOtherPackage(pkg string) bool { if pkg == g.targetPackage { return false @@ -170,7 +239,7 @@ func (g *openAPIGen) Init(c *generator.Context, w io.Writer) error { sw.Do("func GetOpenAPIDefinitions(ref $.ReferenceCallback|raw$) map[string]$.OpenAPIDefinition|raw$ {\n", argsFromType(nil)) sw.Do("return map[string]$.OpenAPIDefinition|raw${\n", argsFromType(nil)) - for _, t := range c.Order { + for _, t := range g.types { err := newOpenAPITypeWriter(sw).generateCall(t) if err != nil { return err @@ -184,7 +253,11 @@ func (g *openAPIGen) Init(c *generator.Context, w io.Writer) error { } func (g *openAPIGen) GenerateType(c *generator.Context, t *types.Type, w io.Writer) error { - klog.V(5).Infof("generating for type %v", t) + glog.V(5).Infof("validating API rules for type %v", t) + if err := g.linter.validate(t); err != nil { + return err + } + glog.V(5).Infof("generating for type %v", t) sw := generator.NewSnippetWriter(w, c, "$", "$") err := newOpenAPITypeWriter(sw).generate(t) if err != nil { @@ -289,7 +362,7 @@ func (g openAPITypeWriter) generateMembers(t *types.Type, required []string) ([] required = append(required, name) } if err = g.generateProperty(&m, t); err != nil { - klog.Errorf("Error when generating: %v, %v\n", name, m) + glog.Errorf("Error when generating: %v, %v\n", name, m) return required, err } } @@ -376,7 +449,7 @@ func (g openAPITypeWriter) generateStructExtensions(t *types.Type) error { // Initially, we will only log struct extension errors. if len(errors) > 0 { for _, e := range errors { - klog.V(2).Infof("[%s]: %s\n", t.String(), e) + glog.V(2).Infof("[%s]: %s\n", t.String(), e) } } // TODO(seans3): Validate struct extensions here. @@ -392,7 +465,7 @@ func (g openAPITypeWriter) generateMemberExtensions(m *types.Member, parent *typ if len(errors) > 0 { errorPrefix := fmt.Sprintf("[%s] %s:", parent.String(), m.String()) for _, e := range errors { - klog.V(2).Infof("%s %s\n", errorPrefix, e) + glog.V(2).Infof("%s %s\n", errorPrefix, e) } } g.emitExtensions(extensions) @@ -605,3 +678,27 @@ func (g openAPITypeWriter) generateSliceProperty(t *types.Type) error { g.Do("},\n},\n},\n", nil) return nil } + +// Finalize prints the API rule violations to report file (if specified from arguments) or stdout (default) +func (g *openAPIGen) Finalize(c *generator.Context, w io.Writer) error { + // If report file isn't specified, return error to force user to choose either stdout ("-") or a file name + if len(g.reportFilename) == 0 { + return fmt.Errorf("empty report file name: please provide a valid file name or use the default \"-\" (stdout)") + } + // If stdout is specified, print violations and return error + if g.reportFilename == "-" { + return g.linter.report(os.Stdout) + } + // Otherwise, print violations to report file and return nil + f, err := os.Create(g.reportFilename) + if err != nil { + return err + } + defer f.Close() + g.linter.report(f) + // NOTE: we don't return error here because we assume that the report file will + // get evaluated afterwards to determine if error should be raised. For example, + // you can have make rules that compare the report file with existing known + // violations (whitelist) and determine no error if no change is detected. + return nil +} diff --git a/vendor/k8s.io/kube-openapi/pkg/generators/rules/omitempty_match_case.go b/vendor/k8s.io/kube-openapi/pkg/generators/rules/omitempty_match_case.go deleted file mode 100644 index dd37ad8a57..0000000000 --- a/vendor/k8s.io/kube-openapi/pkg/generators/rules/omitempty_match_case.go +++ /dev/null @@ -1,64 +0,0 @@ -/* -Copyright 2018 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 rules - -import ( - "reflect" - "strings" - - "k8s.io/gengo/types" -) - -// OmitEmptyMatchCase implements APIRule interface. -// "omitempty" must appear verbatim (no case variants). -type OmitEmptyMatchCase struct{} - -func (n *OmitEmptyMatchCase) Name() string { - return "omitempty_match_case" -} - -func (n *OmitEmptyMatchCase) Validate(t *types.Type) ([]string, error) { - fields := make([]string, 0) - - // Only validate struct type and ignore the rest - switch t.Kind { - case types.Struct: - for _, m := range t.Members { - goName := m.Name - jsonTag, ok := reflect.StructTag(m.Tags).Lookup("json") - if !ok { - continue - } - - parts := strings.Split(jsonTag, ",") - if len(parts) < 2 { - // no tags other than name - continue - } - if parts[0] == "-" { - // not serialized - continue - } - for _, part := range parts[1:] { - if strings.EqualFold(part, "omitempty") && part != "omitempty" { - fields = append(fields, goName) - } - } - } - } - return fields, nil -} diff --git a/vendor/k8s.io/kube-openapi/pkg/schemaconv/smd.go b/vendor/k8s.io/kube-openapi/pkg/schemaconv/smd.go deleted file mode 100644 index a885527c72..0000000000 --- a/vendor/k8s.io/kube-openapi/pkg/schemaconv/smd.go +++ /dev/null @@ -1,242 +0,0 @@ -/* -Copyright 2017 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 schemaconv - -import ( - "errors" - "fmt" - "path" - "strings" - - "k8s.io/kube-openapi/pkg/util/proto" - "sigs.k8s.io/structured-merge-diff/schema" -) - -// ToSchema converts openapi definitions into a schema suitable for structured -// merge (i.e. kubectl apply v2). -func ToSchema(models proto.Models) (*schema.Schema, error) { - c := convert{ - input: models, - output: &schema.Schema{}, - } - if err := c.convertAll(); err != nil { - return nil, err - } - - return c.output, nil -} - -type convert struct { - input proto.Models - output *schema.Schema - - currentName string - current *schema.Atom - errorMessages []string -} - -func (c *convert) push(name string, a *schema.Atom) *convert { - return &convert{ - input: c.input, - output: c.output, - currentName: name, - current: a, - } -} - -func (c *convert) top() *schema.Atom { return c.current } - -func (c *convert) pop(c2 *convert) { - c.errorMessages = append(c.errorMessages, c2.errorMessages...) -} - -func (c *convert) convertAll() error { - for _, name := range c.input.ListModels() { - model := c.input.LookupModel(name) - c.insertTypeDef(name, model) - } - if len(c.errorMessages) > 0 { - return errors.New(strings.Join(c.errorMessages, "\n")) - } - return nil -} - -func (c *convert) reportError(format string, args ...interface{}) { - c.errorMessages = append(c.errorMessages, - c.currentName+": "+fmt.Sprintf(format, args...), - ) -} - -func (c *convert) insertTypeDef(name string, model proto.Schema) { - def := schema.TypeDef{ - Name: name, - } - c2 := c.push(name, &def.Atom) - model.Accept(c2) - c.pop(c2) - if def.Atom == (schema.Atom{}) { - // This could happen if there were a top-level reference. - return - } - c.output.Types = append(c.output.Types, def) -} - -func (c *convert) makeRef(model proto.Schema) schema.TypeRef { - var tr schema.TypeRef - if r, ok := model.(*proto.Ref); ok { - // reference a named type - _, n := path.Split(r.Reference()) - tr.NamedType = &n - } else { - // compute the type inline - c2 := c.push("inlined in "+c.currentName, &tr.Inlined) - model.Accept(c2) - c.pop(c2) - - if tr == (schema.TypeRef{}) { - // emit warning? - tr.Inlined.Untyped = &schema.Untyped{} - } - } - return tr -} - -func (c *convert) VisitKind(k *proto.Kind) { - a := c.top() - a.Struct = &schema.Struct{} - for _, name := range k.FieldOrder { - member := k.Fields[name] - tr := c.makeRef(member) - a.Struct.Fields = append(a.Struct.Fields, schema.StructField{ - Name: name, - Type: tr, - }) - } - - // TODO: Get element relationship when we start adding it to the spec. -} - -func toStringSlice(o interface{}) (out []string, ok bool) { - switch t := o.(type) { - case []interface{}: - for _, v := range t { - switch vt := v.(type) { - case string: - out = append(out, vt) - } - } - return out, true - } - return nil, false -} - -func (c *convert) VisitArray(a *proto.Array) { - atom := c.top() - atom.List = &schema.List{ - ElementRelationship: schema.Atomic, - } - l := atom.List - l.ElementType = c.makeRef(a.SubType) - - ext := a.GetExtensions() - - if val, ok := ext["x-kubernetes-list-type"]; ok { - if val == "atomic" { - l.ElementRelationship = schema.Atomic - } else if val == "set" { - l.ElementRelationship = schema.Associative - } else if val == "map" { - l.ElementRelationship = schema.Associative - if keys, ok := ext["x-kubernetes-list-map-keys"]; ok { - if keyNames, ok := toStringSlice(keys); ok { - l.Keys = keyNames - } else { - c.reportError("uninterpreted map keys: %#v", keys) - } - } else { - c.reportError("missing map keys") - } - } else { - c.reportError("unknown list type %v", val) - l.ElementRelationship = schema.Atomic - } - } else if val, ok := ext["x-kubernetes-patch-strategy"]; ok { - if val == "merge" || val == "merge,retainKeys" { - l.ElementRelationship = schema.Associative - if key, ok := ext["x-kubernetes-patch-merge-key"]; ok { - if keyName, ok := key.(string); ok { - l.Keys = []string{keyName} - } else { - c.reportError("uninterpreted merge key: %#v", key) - } - } else { - // It's not an error for this to be absent, it - // means it's a set. - } - } else if val == "retainKeys" { - } else { - c.reportError("unknown patch strategy %v", val) - l.ElementRelationship = schema.Atomic - } - } -} - -func (c *convert) VisitMap(m *proto.Map) { - a := c.top() - a.Map = &schema.Map{} - a.Map.ElementType = c.makeRef(m.SubType) - - // TODO: Get element relationship when we start putting it into the - // spec. -} - -func (c *convert) VisitPrimitive(p *proto.Primitive) { - a := c.top() - ptr := func(s schema.Scalar) *schema.Scalar { return &s } - switch p.Type { - case proto.Integer: - a.Scalar = ptr(schema.Numeric) - case proto.Number: - a.Scalar = ptr(schema.Numeric) - case proto.String: - switch p.Format { - case "": - a.Scalar = ptr(schema.String) - case "byte": - // byte really means []byte and is encoded as a string. - a.Scalar = ptr(schema.String) - case "int-or-string": - a.Untyped = &schema.Untyped{} - case "date-time": - a.Untyped = &schema.Untyped{} - default: - a.Untyped = &schema.Untyped{} - } - case proto.Boolean: - a.Scalar = ptr(schema.Boolean) - default: - a.Untyped = &schema.Untyped{} - } -} - -func (c *convert) VisitArbitrary(a *proto.Arbitrary) { - c.top().Untyped = &schema.Untyped{} -} - -func (c *convert) VisitReference(proto.Reference) { - // Do nothing, we handle references specially -} diff --git a/vendor/k8s.io/kube-openapi/pkg/util/proto/document.go b/vendor/k8s.io/kube-openapi/pkg/util/proto/document.go index 890a39399f..a57dcd363f 100644 --- a/vendor/k8s.io/kube-openapi/pkg/util/proto/document.go +++ b/vendor/k8s.io/kube-openapi/pkg/util/proto/document.go @@ -196,24 +196,20 @@ func (d *Definitions) parseKind(s *openapi_v2.Schema, path *Path) (Schema, error } fields := map[string]Schema{} - fieldOrder := []string{} for _, namedSchema := range s.GetProperties().GetAdditionalProperties() { var err error - name := namedSchema.GetName() - path := path.FieldPath(name) - fields[name], err = d.ParseSchema(namedSchema.GetValue(), &path) + path := path.FieldPath(namedSchema.GetName()) + fields[namedSchema.GetName()], err = d.ParseSchema(namedSchema.GetValue(), &path) if err != nil { return nil, err } - fieldOrder = append(fieldOrder, name) } return &Kind{ BaseSchema: d.parseBaseSchema(s, path), RequiredFields: s.GetRequired(), Fields: fields, - FieldOrder: fieldOrder, }, nil } diff --git a/vendor/k8s.io/kube-openapi/pkg/util/proto/openapi.go b/vendor/k8s.io/kube-openapi/pkg/util/proto/openapi.go index 46643aa508..f26b5ef881 100644 --- a/vendor/k8s.io/kube-openapi/pkg/util/proto/openapi.go +++ b/vendor/k8s.io/kube-openapi/pkg/util/proto/openapi.go @@ -173,8 +173,6 @@ type Kind struct { RequiredFields []string // Maps field names to types. Fields map[string]Schema - // FieldOrder reports the canonical order for the fields. - FieldOrder []string } var _ Schema = &Kind{} diff --git a/vendor/k8s.io/kube-openapi/pkg/util/util.go b/vendor/k8s.io/kube-openapi/pkg/util/util.go index c5c42cd44c..bcc0c4d4bb 100644 --- a/vendor/k8s.io/kube-openapi/pkg/util/util.go +++ b/vendor/k8s.io/kube-openapi/pkg/util/util.go @@ -16,10 +16,7 @@ limitations under the License. package util -import ( - "reflect" - "strings" -) +import "strings" // ToCanonicalName converts Golang package/type name into canonical OpenAPI name. // Examples: @@ -40,20 +37,3 @@ func ToCanonicalName(name string) string { } return strings.Join(nameParts, ".") } - -// GetCanonicalTypeName will find the canonical type name of a sample object, removing -// the "vendor" part of the path -func GetCanonicalTypeName(model interface{}) string { - t := reflect.TypeOf(model) - if t.Kind() == reflect.Ptr { - t = t.Elem() - } - if t.PkgPath() == "" { - return t.Name() - } - path := t.PkgPath() - if strings.Contains(path, "/vendor/") { - path = path[strings.Index(path, "/vendor/")+len("/vendor/"):] - } - return path + "." + t.Name() -} diff --git a/vendor/k8s.io/kube-openapi/test/integration/builder/main.go b/vendor/k8s.io/kube-openapi/test/integration/builder/main.go index d4acacfc44..7008c574c4 100644 --- a/vendor/k8s.io/kube-openapi/test/integration/builder/main.go +++ b/vendor/k8s.io/kube-openapi/test/integration/builder/main.go @@ -18,11 +18,11 @@ package main import ( "encoding/json" + "fmt" "io/ioutil" "log" "os" - "github.com/emicklei/go-restful" "github.com/go-openapi/spec" "k8s.io/kube-openapi/pkg/builder" "k8s.io/kube-openapi/pkg/common" @@ -53,26 +53,15 @@ func main() { // Create a minimal builder config, then call the builder with the definition names. config := createOpenAPIBuilderConfig() config.GetDefinitions = generated.GetOpenAPIDefinitions - // Build the Paths using a simple WebService for the final spec - swagger, serr := builder.BuildOpenAPISpec(createWebServices(), config) + swagger, serr := builder.BuildOpenAPIDefinitionsForResources(config, defNames...) if serr != nil { log.Fatalf("ERROR: %s", serr.Error()) } - // Generate the definitions for the passed type names to put in the final spec. - // Note that in reality one should run BuildOpenAPISpec to build the entire spec. We - // separate the steps of building Paths and building Definitions here, because we - // only have a simple WebService which doesn't wire the definitions up. - definitionSwagger, err := builder.BuildOpenAPIDefinitionsForResources(config, defNames...) - if err != nil { - log.Fatalf("ERROR: %s", err.Error()) - } - // Copy the generated definitions into the final swagger. - swagger.Definitions = definitionSwagger.Definitions // Marshal the swagger spec into JSON, then write it out. specBytes, err := json.MarshalIndent(swagger, " ", " ") if err != nil { - log.Fatalf("json marshal error: %s", err.Error()) + panic(fmt.Sprintf("json marshal error: %s", err.Error())) } err = ioutil.WriteFile(swaggerFilename, specBytes, 0644) if err != nil { @@ -92,25 +81,5 @@ func createOpenAPIBuilderConfig() *common.Config { Version: "1.0", }, }, - ResponseDefinitions: map[string]spec.Response{ - "NotFound": spec.Response{ - ResponseProps: spec.ResponseProps{ - Description: "Entity not found.", - }, - }, - }, - CommonResponses: map[int]spec.Response{ - 404: *spec.ResponseRef("#/responses/NotFound"), - }, } } - -// createWebServices hard-codes a simple WebService which only defines a GET path -// for testing. -func createWebServices() []*restful.WebService { - w := new(restful.WebService) - // Define a dummy GET /test endpoint - w = w.Route(w.GET("test"). - To(func(*restful.Request, *restful.Response) {})) - return []*restful.WebService{w} -} diff --git a/vendor/k8s.io/kube-openapi/test/integration/pkg/generated/openapi_generated.go b/vendor/k8s.io/kube-openapi/test/integration/pkg/generated/openapi_generated.go index b687ed05c6..43705ccec7 100644 --- a/vendor/k8s.io/kube-openapi/test/integration/pkg/generated/openapi_generated.go +++ b/vendor/k8s.io/kube-openapi/test/integration/pkg/generated/openapi_generated.go @@ -1,5 +1,3 @@ -// +build !ignore_autogenerated - /* Copyright The Kubernetes Authors. @@ -16,263 +14,12 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by openapi-gen.go. DO NOT EDIT. - -// This file was autogenerated by openapi-gen. Do not edit it manually! - package generated import ( - spec "github.com/go-openapi/spec" common "k8s.io/kube-openapi/pkg/common" ) func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition { - return map[string]common.OpenAPIDefinition{ - "./testdata/dummytype.Bar": schema__testdata_dummytype_Bar(ref), - "./testdata/dummytype.Baz": schema__testdata_dummytype_Baz(ref), - "./testdata/dummytype.Foo": schema__testdata_dummytype_Foo(ref), - "./testdata/dummytype.Waldo": schema__testdata_dummytype_Waldo(ref), - "./testdata/listtype.AtomicList": schema__testdata_listtype_AtomicList(ref), - "./testdata/listtype.Item": schema__testdata_listtype_Item(ref), - "./testdata/listtype.MapList": schema__testdata_listtype_MapList(ref), - "./testdata/listtype.SetList": schema__testdata_listtype_SetList(ref), - } -} - -func schema__testdata_dummytype_Bar(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Properties: map[string]spec.Schema{ - "ViolationBehind": { - SchemaProps: spec.SchemaProps{ - Type: []string{"boolean"}, - Format: "", - }, - }, - "Violation": { - SchemaProps: spec.SchemaProps{ - Type: []string{"boolean"}, - Format: "", - }, - }, - }, - Required: []string{"ViolationBehind", "Violation"}, - }, - }, - Dependencies: []string{}, - } -} - -func schema__testdata_dummytype_Baz(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Properties: map[string]spec.Schema{ - "Violation": { - SchemaProps: spec.SchemaProps{ - Type: []string{"boolean"}, - Format: "", - }, - }, - "ViolationBehind": { - SchemaProps: spec.SchemaProps{ - Type: []string{"boolean"}, - Format: "", - }, - }, - }, - Required: []string{"Violation", "ViolationBehind"}, - }, - }, - Dependencies: []string{}, - } -} - -func schema__testdata_dummytype_Foo(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Properties: map[string]spec.Schema{ - "Second": { - SchemaProps: spec.SchemaProps{ - Type: []string{"string"}, - Format: "", - }, - }, - "First": { - SchemaProps: spec.SchemaProps{ - Type: []string{"integer"}, - Format: "int32", - }, - }, - }, - Required: []string{"Second", "First"}, - }, - }, - Dependencies: []string{}, - } -} - -func schema__testdata_dummytype_Waldo(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Properties: map[string]spec.Schema{ - "First": { - SchemaProps: spec.SchemaProps{ - Type: []string{"integer"}, - Format: "int32", - }, - }, - "Second": { - SchemaProps: spec.SchemaProps{ - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"First", "Second"}, - }, - }, - Dependencies: []string{}, - } -} - -func schema__testdata_listtype_AtomicList(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Properties: map[string]spec.Schema{ - "Field": { - VendorExtensible: spec.VendorExtensible{ - Extensions: spec.Extensions{ - "x-kubernetes-list-type": "atomic", - }, - }, - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - }, - Required: []string{"Field"}, - }, - }, - Dependencies: []string{}, - } -} - -func schema__testdata_listtype_Item(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Properties: map[string]spec.Schema{ - "Protocol": { - SchemaProps: spec.SchemaProps{ - Type: []string{"string"}, - Format: "", - }, - }, - "Port": { - SchemaProps: spec.SchemaProps{ - Type: []string{"integer"}, - Format: "int32", - }, - }, - "a": { - SchemaProps: spec.SchemaProps{ - Type: []string{"integer"}, - Format: "int32", - }, - }, - "b": { - SchemaProps: spec.SchemaProps{ - Type: []string{"integer"}, - Format: "int32", - }, - }, - "c": { - SchemaProps: spec.SchemaProps{ - Type: []string{"integer"}, - Format: "int32", - }, - }, - }, - Required: []string{"Protocol", "Port"}, - }, - }, - Dependencies: []string{}, - } -} - -func schema__testdata_listtype_MapList(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Properties: map[string]spec.Schema{ - "Field": { - VendorExtensible: spec.VendorExtensible{ - Extensions: spec.Extensions{ - "x-kubernetes-list-map-keys": "port", - "x-kubernetes-list-type": "map", - }, - }, - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Ref: ref("./testdata/listtype.Item"), - }, - }, - }, - }, - }, - }, - Required: []string{"Field"}, - }, - }, - Dependencies: []string{ - "./testdata/listtype.Item"}, - } -} - -func schema__testdata_listtype_SetList(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Properties: map[string]spec.Schema{ - "Field": { - VendorExtensible: spec.VendorExtensible{ - Extensions: spec.Extensions{ - "x-kubernetes-list-type": "set", - }, - }, - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - }, - Required: []string{"Field"}, - }, - }, - Dependencies: []string{}, - } + return map[string]common.OpenAPIDefinition{} } diff --git a/vendor/k8s.io/kube-openapi/test/integration/testdata/dummytype/alpha.go b/vendor/k8s.io/kube-openapi/test/integration/testdata/dummytype/alpha.go deleted file mode 100644 index f3e50b4a5a..0000000000 --- a/vendor/k8s.io/kube-openapi/test/integration/testdata/dummytype/alpha.go +++ /dev/null @@ -1,36 +0,0 @@ -// The package is intended for testing the openapi-gen API rule -// checker. The API rule violations are in format of: -// -// `{rule-name},{package},{type},{(optional) field}` -// -// The checker should sort the violations before -// reporting to a file or stderr. -// -// We have the dummytype package separately from the listtype -// package to test the sorting behavior on package level, e.g. -// -// -i "./testdata/listtype,./testdata/dummytype" -// -i "./testdata/dummytype,./testdata/listtype" -// -// The violations from dummytype should always come first in -// report. - -package dummytype - -// +k8s:openapi-gen=true -type Foo struct { - Second string - First int -} - -// +k8s:openapi-gen=true -type Bar struct { - ViolationBehind bool - Violation bool -} - -// +k8s:openapi-gen=true -type Baz struct { - Violation bool - ViolationBehind bool -} diff --git a/vendor/k8s.io/kube-openapi/test/integration/testdata/dummytype/beta.go b/vendor/k8s.io/kube-openapi/test/integration/testdata/dummytype/beta.go deleted file mode 100644 index c029f40e1c..0000000000 --- a/vendor/k8s.io/kube-openapi/test/integration/testdata/dummytype/beta.go +++ /dev/null @@ -1,24 +0,0 @@ -// The package is intended for testing the openapi-gen API rule -// checker. The API rule violations are in format of: -// -// `{rule-name},{package},{type},{(optional) field}` -// -// The checker should sort the violations before -// reporting to a file or stderr. -// -// We have the dummytype package separately from the listtype -// package to test the sorting behavior on package level, e.g. -// -// -i "./testdata/listtype,./testdata/dummytype" -// -i "./testdata/dummytype,./testdata/listtype" -// -// The violations from dummytype should always come first in -// report. - -package dummytype - -// +k8s:openapi-gen=true -type Waldo struct { - First int - Second string -} diff --git a/vendor/k8s.io/kube-openapi/test/integration/testdata/listtype/map-list.go b/vendor/k8s.io/kube-openapi/test/integration/testdata/listtype/map-list.go index e456c6b4bc..bb1f693d1b 100644 --- a/vendor/k8s.io/kube-openapi/test/integration/testdata/listtype/map-list.go +++ b/vendor/k8s.io/kube-openapi/test/integration/testdata/listtype/map-list.go @@ -1,20 +1,14 @@ package listtype +// +k8s:openapi-gen=true +type Item struct { + Port int + Protocol string +} + // +k8s:openapi-gen=true type MapList struct { // +listType=map // +listMapKey=port Field []Item } - -// +k8s:openapi-gen=true -type Item struct { - Protocol string - Port int - // +optional - A int `json:"a"` - // +optional - B int `json:"b,omitempty"` - // +optional - C int `json:"c,omitEmpty"` -}