mirror of
https://github.com/prometheus-operator/prometheus-operator.git
synced 2025-04-21 11:48:53 +00:00
Vendor the crd-validation packages
This commit is contained in:
parent
d727d03c0c
commit
33bf31dc08
3 changed files with 17 additions and 22 deletions
pkg
|
@ -16,8 +16,6 @@ package v1
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
crdutils "github.com/coreos/prometheus-operator/pkg/k8sutil/crdvalidation"
|
||||
extensionsobj "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
"k8s.io/client-go/dynamic"
|
||||
|
@ -52,8 +50,6 @@ var DefaultCrdKinds CrdKinds = CrdKinds{
|
|||
Alertmanager: CrdKind{Plural: AlertmanagerName, Kind: AlertmanagersKind},
|
||||
}
|
||||
|
||||
var CrdValidationDefinitions map[string]*extensionsobj.JSONSchemaProps = crdutils.GetOpenAPICrdDefinitions(GetOpenAPIDefinitions)
|
||||
|
||||
// Implement the flag.Value interface
|
||||
func (crdkinds *CrdKinds) String() string {
|
||||
return crdkinds.KindsString
|
||||
|
|
|
@ -1,20 +1,18 @@
|
|||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
// 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.
|
||||
|
||||
// This file was autogenerated by openapi-gen. Do not edit it manually!
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ import (
|
|||
"net/url"
|
||||
"time"
|
||||
|
||||
crdutils "github.com/ant31/crd-validation/pkg"
|
||||
monitoringv1 "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1"
|
||||
"github.com/coreos/prometheus-operator/pkg/client/monitoring/v1alpha1"
|
||||
version "github.com/hashicorp/go-version"
|
||||
|
@ -236,11 +237,11 @@ func NewPrometheusCustomResourceDefinition(crdkind monitoringv1.CrdKind, group s
|
|||
}
|
||||
|
||||
func addValidationSpec(crd *extensionsobj.CustomResourceDefinition, specDefinitionName string) {
|
||||
crd.Spec.Validation = &extensionsobj.CustomResourceValidation{
|
||||
OpenAPIV3Schema: monitoringv1.CrdValidationDefinitions[specDefinitionName],
|
||||
}
|
||||
crd.Spec.Validation = crdutils.GetCustomResourceValidation(specDefinitionName, monitoringv1.GetOpenAPIDefinitions)
|
||||
|
||||
}
|
||||
|
||||
// NewServiceMonitorCustomResourceDefinition creates the ServiceMonitor CRD API resource
|
||||
func NewServiceMonitorCustomResourceDefinition(crdkind monitoringv1.CrdKind, group string, labels map[string]string, validation bool) *extensionsobj.CustomResourceDefinition {
|
||||
crd := &extensionsobj.CustomResourceDefinition{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue