mirror of
https://github.com/prometheus-operator/prometheus-operator.git
synced 2025-04-21 03:38:43 +00:00
*: update to client-go 2.0 release
This commit is contained in:
parent
8dfc9d768e
commit
2c59137d92
596 changed files with 165668 additions and 76827 deletions
Documentation
cmd/apidocgen
pkg
alertmanager
client/monitoring/v1alpha1
k8sutil
prometheus
test/e2e
third_party
vendor
github.com
blang/semver
pborman/uuid
k8s.io
apimachinery
client-go
LICENSE
discovery
dynamic
kubernetes
clientset.godoc.goimport_known_versions.go
typed
apps/v1beta1
authentication/v1beta1
authorization/v1beta1
autoscaling/v1
batch
certificates/v1alpha1
|
@ -18,7 +18,7 @@ Describes an Alertmanager cluster.
|
|||
|
||||
| Field | Description | Scheme | Required |
|
||||
| ----- | ----------- | ------ | -------- |
|
||||
| metadata | Standard object’s metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata | [metav1.ObjectMeta](https://kubernetes.io/docs/api-reference/v1/definitions/#_v1_objectmeta) | false |
|
||||
| metadata | Standard object’s metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata | [v1.ObjectMeta](https://kubernetes.io/docs/api-reference/v1/definitions/#_v1_objectmeta) | false |
|
||||
| spec | Specification of the desired behavior of the Alertmanager cluster. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status | [AlertmanagerSpec](#alertmanagerspec) | true |
|
||||
| status | 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: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status | *[AlertmanagerStatus](#alertmanagerstatus) | false |
|
||||
|
||||
|
@ -39,7 +39,7 @@ A list of Alertmanagers.
|
|||
|
||||
| Field | Description | Scheme | Required |
|
||||
| ----- | ----------- | ------ | -------- |
|
||||
| metadata | Standard list metadata More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata | [metav1.ListMeta](https://kubernetes.io/docs/api-reference/v1/definitions/#_unversioned_listmeta) | false |
|
||||
| metadata | Standard list metadata More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata | [unversioned.ListMeta](https://kubernetes.io/docs/api-reference/v1/definitions/#_unversioned_listmeta) | false |
|
||||
| items | List of Alertmanagers | [][Alertmanager](#alertmanager) | true |
|
||||
|
||||
## AlertmanagerSpec
|
||||
|
@ -97,7 +97,7 @@ Prometheus defines a Prometheus deployment.
|
|||
|
||||
| Field | Description | Scheme | Required |
|
||||
| ----- | ----------- | ------ | -------- |
|
||||
| metadata | Standard object’s metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata | [metav1.ObjectMeta](https://kubernetes.io/docs/api-reference/v1/definitions/#_v1_objectmeta) | false |
|
||||
| metadata | Standard object’s metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata | [v1.ObjectMeta](https://kubernetes.io/docs/api-reference/v1/definitions/#_v1_objectmeta) | false |
|
||||
| spec | Specification of the desired behavior of the Prometheus cluster. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status | [PrometheusSpec](#prometheusspec) | true |
|
||||
| status | 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: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status | *[PrometheusStatus](#prometheusstatus) | false |
|
||||
|
||||
|
@ -107,7 +107,7 @@ PrometheusList is a list of Prometheuses.
|
|||
|
||||
| Field | Description | Scheme | Required |
|
||||
| ----- | ----------- | ------ | -------- |
|
||||
| metadata | Standard list metadata More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata | [metav1.ListMeta](https://kubernetes.io/docs/api-reference/v1/definitions/#_unversioned_listmeta) | false |
|
||||
| metadata | Standard list metadata More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata | [unversioned.ListMeta](https://kubernetes.io/docs/api-reference/v1/definitions/#_unversioned_listmeta) | false |
|
||||
| items | List of Prometheuses | []*[Prometheus](#prometheus) | true |
|
||||
|
||||
## PrometheusSpec
|
||||
|
@ -116,7 +116,7 @@ Specification of the desired behavior of the Prometheus cluster. More info: http
|
|||
|
||||
| Field | Description | Scheme | Required |
|
||||
| ----- | ----------- | ------ | -------- |
|
||||
| serviceMonitorSelector | ServiceMonitors to be selected for target discovery. | *[metav1.LabelSelector](https://kubernetes.io/docs/api-reference/v1/definitions/#_unversioned_labelselector) | false |
|
||||
| serviceMonitorSelector | ServiceMonitors to be selected for target discovery. | *[unversioned.LabelSelector](https://kubernetes.io/docs/api-reference/v1/definitions/#_unversioned_labelselector) | false |
|
||||
| version | Version of Prometheus to be deployed. | string | false |
|
||||
| paused | When a Prometheus deployment is paused, no actions except for deletion will be performed on the underlying objects. | bool | false |
|
||||
| baseImage | Base image to use for a Prometheus deployment. | string | false |
|
||||
|
@ -125,7 +125,7 @@ Specification of the desired behavior of the Prometheus cluster. More info: http
|
|||
| externalUrl | 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. | string | false |
|
||||
| routePrefix | 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`. | string | false |
|
||||
| storage | Storage spec to specify how storage shall be used. | *[StorageSpec](#storagespec) | false |
|
||||
| ruleSelector | A selector to select which ConfigMaps to mount for loading rule files from. | *[metav1.LabelSelector](https://kubernetes.io/docs/api-reference/v1/definitions/#_unversioned_labelselector) | false |
|
||||
| ruleSelector | A selector to select which ConfigMaps to mount for loading rule files from. | *[unversioned.LabelSelector](https://kubernetes.io/docs/api-reference/v1/definitions/#_unversioned_labelselector) | false |
|
||||
| alerting | Define details regarding alerting. | [AlertingSpec](#alertingspec) | false |
|
||||
| resources | Define resources requests and limits for single Pods. | [v1.ResourceRequirements](https://kubernetes.io/docs/api-reference/v1/definitions/#_v1_resourcerequirements) | false |
|
||||
| nodeSelector | Define which Nodes the Pods are scheduled on. | map[string]string | false |
|
||||
|
@ -149,7 +149,7 @@ ServiceMonitor defines monitoring for a set of services.
|
|||
|
||||
| Field | Description | Scheme | Required |
|
||||
| ----- | ----------- | ------ | -------- |
|
||||
| metadata | Standard object’s metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata | [metav1.ObjectMeta](https://kubernetes.io/docs/api-reference/v1/definitions/#_v1_objectmeta) | false |
|
||||
| metadata | Standard object’s metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata | [v1.ObjectMeta](https://kubernetes.io/docs/api-reference/v1/definitions/#_v1_objectmeta) | false |
|
||||
| spec | Specification of desired Service selection for target discrovery by Prometheus. | [ServiceMonitorSpec](#servicemonitorspec) | true |
|
||||
|
||||
## ServiceMonitorList
|
||||
|
@ -158,7 +158,7 @@ A list of ServiceMonitors.
|
|||
|
||||
| Field | Description | Scheme | Required |
|
||||
| ----- | ----------- | ------ | -------- |
|
||||
| metadata | Standard list metadata More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata | [metav1.ListMeta](https://kubernetes.io/docs/api-reference/v1/definitions/#_unversioned_listmeta) | false |
|
||||
| metadata | Standard list metadata More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata | [unversioned.ListMeta](https://kubernetes.io/docs/api-reference/v1/definitions/#_unversioned_listmeta) | false |
|
||||
| items | List of ServiceMonitors | []*[ServiceMonitor](#servicemonitor) | true |
|
||||
|
||||
## ServiceMonitorSpec
|
||||
|
@ -169,7 +169,7 @@ ServiceMonitorSpec contains specification parameters for a ServiceMonitor.
|
|||
| ----- | ----------- | ------ | -------- |
|
||||
| jobLabel | The label to use to retrieve the job name from. | string | false |
|
||||
| endpoints | A list of endpoints allowed as part of this ServiceMonitor. | [][Endpoint](#endpoint) | false |
|
||||
| selector | Selector to select Endpoints objects. | [metav1.LabelSelector](https://kubernetes.io/docs/api-reference/v1/definitions/#_unversioned_labelselector) | true |
|
||||
| selector | Selector to select Endpoints objects. | [unversioned.LabelSelector](https://kubernetes.io/docs/api-reference/v1/definitions/#_unversioned_labelselector) | true |
|
||||
| namespaceSelector | Selector to select which namespaces the Endpoints objects are discovered from. | [NamespaceSelector](#namespaceselector) | false |
|
||||
|
||||
## StorageSpec
|
||||
|
@ -179,7 +179,7 @@ StorageSpec defines the configured storage for a group Prometheus servers.
|
|||
| Field | Description | Scheme | Required |
|
||||
| ----- | ----------- | ------ | -------- |
|
||||
| class | Name of the StorageClass to use when requesting storage provisioning. More info: https://kubernetes.io/docs/user-guide/persistent-volumes/#storageclasses | string | true |
|
||||
| selector | A label query over volumes to consider for binding. | *[metav1.LabelSelector](https://kubernetes.io/docs/api-reference/v1/definitions/#_unversioned_labelselector) | true |
|
||||
| selector | A label query over volumes to consider for binding. | *[unversioned.LabelSelector](https://kubernetes.io/docs/api-reference/v1/definitions/#_unversioned_labelselector) | true |
|
||||
| resources | Resources represents the minimum resources the volume should have. More info: http://kubernetes.io/docs/user-guide/persistent-volumes#resources | [v1.ResourceRequirements](https://kubernetes.io/docs/api-reference/v1/definitions/#_v1_resourcerequirements) | true |
|
||||
|
||||
## TLSConfig
|
||||
|
|
|
@ -36,10 +36,10 @@ This Document documents the types introduced by the Prometheus Operator to be co
|
|||
|
||||
var (
|
||||
links = map[string]string{
|
||||
"metav1.ObjectMeta": "https://kubernetes.io/docs/api-reference/v1/definitions/#_v1_objectmeta",
|
||||
"metav1.ListMeta": "https://kubernetes.io/docs/api-reference/v1/definitions/#_unversioned_listmeta",
|
||||
"metav1.LabelSelector": "https://kubernetes.io/docs/api-reference/v1/definitions/#_unversioned_labelselector",
|
||||
"v1.ResourceRequirements": "https://kubernetes.io/docs/api-reference/v1/definitions/#_v1_resourcerequirements",
|
||||
"v1.ObjectMeta": "https://kubernetes.io/docs/api-reference/v1/definitions/#_v1_objectmeta",
|
||||
"unversioned.ListMeta": "https://kubernetes.io/docs/api-reference/v1/definitions/#_unversioned_listmeta",
|
||||
"unversioned.LabelSelector": "https://kubernetes.io/docs/api-reference/v1/definitions/#_unversioned_labelselector",
|
||||
"v1.ResourceRequirements": "https://kubernetes.io/docs/api-reference/v1/definitions/#_v1_resourcerequirements",
|
||||
}
|
||||
|
||||
selfLinks = map[string]string{}
|
||||
|
|
|
@ -24,21 +24,19 @@ import (
|
|||
"github.com/coreos/prometheus-operator/pkg/k8sutil"
|
||||
"github.com/coreos/prometheus-operator/pkg/prometheus"
|
||||
|
||||
"github.com/coreos/prometheus-operator/third_party/workqueue"
|
||||
"github.com/go-kit/kit/log"
|
||||
"github.com/pkg/errors"
|
||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/api/meta"
|
||||
apimetav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/fields"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
"k8s.io/client-go/pkg/api"
|
||||
apierrors "k8s.io/client-go/pkg/api/errors"
|
||||
"k8s.io/client-go/pkg/api/meta"
|
||||
"k8s.io/client-go/pkg/api/v1"
|
||||
"k8s.io/client-go/pkg/apis/apps/v1beta1"
|
||||
extensionsobj "k8s.io/client-go/pkg/apis/extensions/v1beta1"
|
||||
"k8s.io/client-go/pkg/util/workqueue"
|
||||
"k8s.io/client-go/pkg/fields"
|
||||
"k8s.io/client-go/pkg/labels"
|
||||
utilruntime "k8s.io/client-go/pkg/util/runtime"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
|
@ -166,7 +164,7 @@ func (c *Operator) keyFunc(obj interface{}) (string, bool) {
|
|||
return k, true
|
||||
}
|
||||
|
||||
func (c *Operator) getObject(obj interface{}) (apimetav1.Object, bool) {
|
||||
func (c *Operator) getObject(obj interface{}) (meta.Object, bool) {
|
||||
ts, ok := obj.(cache.DeletedFinalStateUnknown)
|
||||
if ok {
|
||||
obj = ts.Obj
|
||||
|
@ -378,8 +376,8 @@ func (c *Operator) sync(key string) error {
|
|||
return c.syncVersion(am)
|
||||
}
|
||||
|
||||
func ListOptions(name string) metav1.ListOptions {
|
||||
return metav1.ListOptions{
|
||||
func ListOptions(name string) v1.ListOptions {
|
||||
return v1.ListOptions{
|
||||
LabelSelector: fields.SelectorFromSet(fields.Set(map[string]string{
|
||||
"app": "alertmanager",
|
||||
"alertmanager": name,
|
||||
|
@ -505,7 +503,7 @@ func (c *Operator) destroyAlertmanager(key string) error {
|
|||
func (c *Operator) createTPRs() error {
|
||||
tprs := []*extensionsobj.ThirdPartyResource{
|
||||
{
|
||||
ObjectMeta: apimetav1.ObjectMeta{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
Name: tprAlertmanager,
|
||||
},
|
||||
Versions: []extensionsobj.APIVersion{
|
||||
|
|
|
@ -19,7 +19,6 @@ import (
|
|||
"net/url"
|
||||
"path"
|
||||
|
||||
apimetav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/client-go/pkg/api/resource"
|
||||
"k8s.io/client-go/pkg/api/v1"
|
||||
"k8s.io/client-go/pkg/apis/apps/v1beta1"
|
||||
|
@ -54,7 +53,7 @@ func makeStatefulSet(am *v1alpha1.Alertmanager, old *v1beta1.StatefulSet, config
|
|||
}
|
||||
|
||||
statefulset := &v1beta1.StatefulSet{
|
||||
ObjectMeta: apimetav1.ObjectMeta{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
Name: prefixedName(am.Name),
|
||||
Labels: am.ObjectMeta.Labels,
|
||||
Annotations: am.ObjectMeta.Annotations,
|
||||
|
@ -70,7 +69,7 @@ func makeStatefulSet(am *v1alpha1.Alertmanager, old *v1beta1.StatefulSet, config
|
|||
})
|
||||
} else {
|
||||
pvc := v1.PersistentVolumeClaim{
|
||||
ObjectMeta: apimetav1.ObjectMeta{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
Name: volumeName(am.Name),
|
||||
},
|
||||
Spec: v1.PersistentVolumeClaimSpec{
|
||||
|
@ -95,7 +94,7 @@ func makeStatefulSet(am *v1alpha1.Alertmanager, old *v1beta1.StatefulSet, config
|
|||
|
||||
func makeStatefulSetService(p *v1alpha1.Alertmanager) *v1.Service {
|
||||
svc := &v1.Service{
|
||||
ObjectMeta: apimetav1.ObjectMeta{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
Name: governingServiceName,
|
||||
Labels: map[string]string{
|
||||
"operated-alertmanager": "true",
|
||||
|
@ -160,7 +159,7 @@ func makeStatefulSetSpec(a *v1alpha1.Alertmanager, config Config) v1beta1.Statef
|
|||
ServiceName: governingServiceName,
|
||||
Replicas: a.Spec.Replicas,
|
||||
Template: v1.PodTemplateSpec{
|
||||
ObjectMeta: apimetav1.ObjectMeta{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
"app": "alertmanager",
|
||||
"alertmanager": a.Name,
|
||||
|
|
|
@ -18,12 +18,12 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/watch"
|
||||
"k8s.io/client-go/dynamic"
|
||||
"k8s.io/client-go/pkg/api"
|
||||
"k8s.io/client-go/pkg/api/unversioned"
|
||||
"k8s.io/client-go/pkg/api/v1"
|
||||
"k8s.io/client-go/pkg/runtime"
|
||||
"k8s.io/client-go/pkg/watch"
|
||||
"k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
|
@ -41,8 +41,8 @@ type AlertmanagerInterface interface {
|
|||
Get(name string) (*Alertmanager, error)
|
||||
Update(*Alertmanager) (*Alertmanager, error)
|
||||
Delete(name string, options *v1.DeleteOptions) error
|
||||
List(opts metav1.ListOptions) (runtime.Object, error)
|
||||
Watch(opts metav1.ListOptions) (watch.Interface, error)
|
||||
List(opts api.ListOptions) (runtime.Object, error)
|
||||
Watch(opts api.ListOptions) (watch.Interface, error)
|
||||
}
|
||||
|
||||
type alertmanagers struct {
|
||||
|
@ -55,7 +55,7 @@ func newAlertmanagers(r rest.Interface, c *dynamic.Client, namespace string) *al
|
|||
return &alertmanagers{
|
||||
r,
|
||||
c.Resource(
|
||||
&metav1.APIResource{
|
||||
&unversioned.APIResource{
|
||||
Kind: TPRAlertmanagersKind,
|
||||
Name: TPRAlertmanagerName,
|
||||
Namespaced: true,
|
||||
|
@ -106,7 +106,7 @@ func (a *alertmanagers) Delete(name string, options *v1.DeleteOptions) error {
|
|||
return a.client.Delete(name, options)
|
||||
}
|
||||
|
||||
func (a *alertmanagers) List(opts metav1.ListOptions) (runtime.Object, error) {
|
||||
func (a *alertmanagers) List(opts api.ListOptions) (runtime.Object, error) {
|
||||
req := a.restClient.Get().
|
||||
Namespace(a.ns).
|
||||
Resource("alertmanagers").
|
||||
|
@ -121,7 +121,7 @@ func (a *alertmanagers) List(opts metav1.ListOptions) (runtime.Object, error) {
|
|||
return &p, json.Unmarshal(b, &p)
|
||||
}
|
||||
|
||||
func (a *alertmanagers) Watch(opts metav1.ListOptions) (watch.Interface, error) {
|
||||
func (a *alertmanagers) Watch(opts api.ListOptions) (watch.Interface, error) {
|
||||
r, err := a.restClient.Get().
|
||||
Prefix("watch").
|
||||
Namespace(a.ns).
|
||||
|
@ -139,7 +139,7 @@ func (a *alertmanagers) Watch(opts metav1.ListOptions) (watch.Interface, error)
|
|||
}
|
||||
|
||||
// AlertmanagerFromUnstructured unmarshals an Alertmanager object from dynamic client's unstructured
|
||||
func AlertmanagerFromUnstructured(r *unstructured.Unstructured) (*Alertmanager, error) {
|
||||
func AlertmanagerFromUnstructured(r *runtime.Unstructured) (*Alertmanager, error) {
|
||||
b, err := json.Marshal(r.Object)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -154,14 +154,14 @@ func AlertmanagerFromUnstructured(r *unstructured.Unstructured) (*Alertmanager,
|
|||
}
|
||||
|
||||
// UnstructuredFromAlertmanager marshals an Alertmanager object into dynamic client's unstructured
|
||||
func UnstructuredFromAlertmanager(a *Alertmanager) (*unstructured.Unstructured, error) {
|
||||
func UnstructuredFromAlertmanager(a *Alertmanager) (*runtime.Unstructured, error) {
|
||||
a.TypeMeta.Kind = TPRAlertmanagersKind
|
||||
a.TypeMeta.APIVersion = TPRGroup + "/" + TPRVersion
|
||||
b, err := json.Marshal(a)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var r unstructured.Unstructured
|
||||
var r runtime.Unstructured
|
||||
if err := json.Unmarshal(b, &r.Object); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -15,10 +15,10 @@
|
|||
package v1alpha1
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
"k8s.io/client-go/dynamic"
|
||||
"k8s.io/client-go/pkg/api"
|
||||
"k8s.io/client-go/pkg/api/unversioned"
|
||||
"k8s.io/client-go/pkg/runtime/serializer"
|
||||
"k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
|
@ -72,7 +72,7 @@ func NewForConfig(c *rest.Config) (*MonitoringV1alpha1Client, error) {
|
|||
}
|
||||
|
||||
func setConfigDefaults(config *rest.Config) {
|
||||
config.GroupVersion = &schema.GroupVersion{
|
||||
config.GroupVersion = &unversioned.GroupVersion{
|
||||
Group: TPRGroup,
|
||||
Version: TPRVersion,
|
||||
}
|
||||
|
|
|
@ -17,12 +17,12 @@ package v1alpha1
|
|||
import (
|
||||
"encoding/json"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/watch"
|
||||
"k8s.io/client-go/dynamic"
|
||||
"k8s.io/client-go/pkg/api"
|
||||
"k8s.io/client-go/pkg/api/unversioned"
|
||||
"k8s.io/client-go/pkg/api/v1"
|
||||
"k8s.io/client-go/pkg/runtime"
|
||||
"k8s.io/client-go/pkg/watch"
|
||||
"k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
|
@ -40,8 +40,8 @@ type PrometheusInterface interface {
|
|||
Get(name string) (*Prometheus, error)
|
||||
Update(*Prometheus) (*Prometheus, error)
|
||||
Delete(name string, options *v1.DeleteOptions) error
|
||||
List(opts metav1.ListOptions) (runtime.Object, error)
|
||||
Watch(opts metav1.ListOptions) (watch.Interface, error)
|
||||
List(opts api.ListOptions) (runtime.Object, error)
|
||||
Watch(opts api.ListOptions) (watch.Interface, error)
|
||||
}
|
||||
|
||||
type prometheuses struct {
|
||||
|
@ -54,7 +54,7 @@ func newPrometheuses(r rest.Interface, c *dynamic.Client, namespace string) *pro
|
|||
return &prometheuses{
|
||||
r,
|
||||
c.Resource(
|
||||
&metav1.APIResource{
|
||||
&unversioned.APIResource{
|
||||
Kind: TPRPrometheusesKind,
|
||||
Name: TPRPrometheusName,
|
||||
Namespaced: true,
|
||||
|
@ -105,7 +105,7 @@ func (p *prometheuses) Delete(name string, options *v1.DeleteOptions) error {
|
|||
return p.client.Delete(name, options)
|
||||
}
|
||||
|
||||
func (p *prometheuses) List(opts metav1.ListOptions) (runtime.Object, error) {
|
||||
func (p *prometheuses) List(opts api.ListOptions) (runtime.Object, error) {
|
||||
req := p.restClient.Get().
|
||||
Namespace(p.ns).
|
||||
Resource("prometheuses").
|
||||
|
@ -120,7 +120,7 @@ func (p *prometheuses) List(opts metav1.ListOptions) (runtime.Object, error) {
|
|||
return &prom, json.Unmarshal(b, &prom)
|
||||
}
|
||||
|
||||
func (p *prometheuses) Watch(opts metav1.ListOptions) (watch.Interface, error) {
|
||||
func (p *prometheuses) Watch(opts api.ListOptions) (watch.Interface, error) {
|
||||
r, err := p.restClient.Get().
|
||||
Prefix("watch").
|
||||
Namespace(p.ns).
|
||||
|
@ -138,7 +138,7 @@ func (p *prometheuses) Watch(opts metav1.ListOptions) (watch.Interface, error) {
|
|||
}
|
||||
|
||||
// PrometheusFromUnstructured unmarshals a Prometheus object from dynamic client's unstructured
|
||||
func PrometheusFromUnstructured(r *unstructured.Unstructured) (*Prometheus, error) {
|
||||
func PrometheusFromUnstructured(r *runtime.Unstructured) (*Prometheus, error) {
|
||||
b, err := json.Marshal(r.Object)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -153,14 +153,14 @@ func PrometheusFromUnstructured(r *unstructured.Unstructured) (*Prometheus, erro
|
|||
}
|
||||
|
||||
// UnstructuredFromPrometheus marshals a Prometheus object into dynamic client's unstructured
|
||||
func UnstructuredFromPrometheus(p *Prometheus) (*unstructured.Unstructured, error) {
|
||||
func UnstructuredFromPrometheus(p *Prometheus) (*runtime.Unstructured, error) {
|
||||
p.TypeMeta.Kind = TPRPrometheusesKind
|
||||
p.TypeMeta.APIVersion = TPRGroup + "/" + TPRVersion
|
||||
b, err := json.Marshal(p)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var r unstructured.Unstructured
|
||||
var r runtime.Unstructured
|
||||
if err := json.Unmarshal(b, &r.Object); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -17,12 +17,12 @@ package v1alpha1
|
|||
import (
|
||||
"encoding/json"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/watch"
|
||||
"k8s.io/client-go/dynamic"
|
||||
"k8s.io/client-go/pkg/api"
|
||||
"k8s.io/client-go/pkg/api/unversioned"
|
||||
"k8s.io/client-go/pkg/api/v1"
|
||||
"k8s.io/client-go/pkg/runtime"
|
||||
"k8s.io/client-go/pkg/watch"
|
||||
"k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
|
@ -40,8 +40,8 @@ type ServiceMonitorInterface interface {
|
|||
Get(name string) (*ServiceMonitor, error)
|
||||
Update(*ServiceMonitor) (*ServiceMonitor, error)
|
||||
Delete(name string, options *v1.DeleteOptions) error
|
||||
List(opts metav1.ListOptions) (runtime.Object, error)
|
||||
Watch(opts metav1.ListOptions) (watch.Interface, error)
|
||||
List(opts api.ListOptions) (runtime.Object, error)
|
||||
Watch(opts api.ListOptions) (watch.Interface, error)
|
||||
}
|
||||
|
||||
type servicemonitors struct {
|
||||
|
@ -54,7 +54,7 @@ func newServiceMonitors(r rest.Interface, c *dynamic.Client, namespace string) *
|
|||
return &servicemonitors{
|
||||
r,
|
||||
c.Resource(
|
||||
&metav1.APIResource{
|
||||
&unversioned.APIResource{
|
||||
Kind: TPRServiceMonitorsKind,
|
||||
Name: TPRServiceMonitorName,
|
||||
Namespaced: true,
|
||||
|
@ -105,7 +105,7 @@ func (s *servicemonitors) Delete(name string, options *v1.DeleteOptions) error {
|
|||
return s.client.Delete(name, options)
|
||||
}
|
||||
|
||||
func (s *servicemonitors) List(opts metav1.ListOptions) (runtime.Object, error) {
|
||||
func (s *servicemonitors) List(opts api.ListOptions) (runtime.Object, error) {
|
||||
req := s.restClient.Get().
|
||||
Namespace(s.ns).
|
||||
Resource("servicemonitors").
|
||||
|
@ -120,7 +120,7 @@ func (s *servicemonitors) List(opts metav1.ListOptions) (runtime.Object, error)
|
|||
return &sm, json.Unmarshal(b, &sm)
|
||||
}
|
||||
|
||||
func (s *servicemonitors) Watch(opts metav1.ListOptions) (watch.Interface, error) {
|
||||
func (s *servicemonitors) Watch(opts api.ListOptions) (watch.Interface, error) {
|
||||
r, err := s.restClient.Get().
|
||||
Prefix("watch").
|
||||
Namespace(s.ns).
|
||||
|
@ -138,7 +138,7 @@ func (s *servicemonitors) Watch(opts metav1.ListOptions) (watch.Interface, error
|
|||
}
|
||||
|
||||
// ServiceMonitorFromUnstructured unmarshals a ServiceMonitor object from dynamic client's unstructured
|
||||
func ServiceMonitorFromUnstructured(r *unstructured.Unstructured) (*ServiceMonitor, error) {
|
||||
func ServiceMonitorFromUnstructured(r *runtime.Unstructured) (*ServiceMonitor, error) {
|
||||
b, err := json.Marshal(r.Object)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -153,14 +153,14 @@ func ServiceMonitorFromUnstructured(r *unstructured.Unstructured) (*ServiceMonit
|
|||
}
|
||||
|
||||
// UnstructuredFromServiceMonitor marshals a ServiceMonitor object into dynamic client's unstructured
|
||||
func UnstructuredFromServiceMonitor(s *ServiceMonitor) (*unstructured.Unstructured, error) {
|
||||
func UnstructuredFromServiceMonitor(s *ServiceMonitor) (*runtime.Unstructured, error) {
|
||||
s.TypeMeta.Kind = TPRServiceMonitorsKind
|
||||
s.TypeMeta.APIVersion = TPRGroup + "/" + TPRVersion
|
||||
b, err := json.Marshal(s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var r unstructured.Unstructured
|
||||
var r runtime.Unstructured
|
||||
if err := json.Unmarshal(b, &r.Object); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -15,17 +15,17 @@
|
|||
package v1alpha1
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/client-go/pkg/api/unversioned"
|
||||
"k8s.io/client-go/pkg/api/v1"
|
||||
"k8s.io/client-go/pkg/util/intstr"
|
||||
)
|
||||
|
||||
// Prometheus defines a Prometheus deployment.
|
||||
type Prometheus struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
unversioned.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"`
|
||||
v1.ObjectMeta `json:"metadata,omitempty"`
|
||||
// Specification of the desired behavior of the Prometheus cluster. More info:
|
||||
// http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status
|
||||
Spec PrometheusSpec `json:"spec"`
|
||||
|
@ -38,10 +38,10 @@ type Prometheus struct {
|
|||
|
||||
// PrometheusList is a list of Prometheuses.
|
||||
type PrometheusList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
unversioned.TypeMeta `json:",inline"`
|
||||
// Standard list metadata
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
unversioned.ListMeta `json:"metadata,omitempty"`
|
||||
// List of Prometheuses
|
||||
Items []*Prometheus `json:"items"`
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ type PrometheusList struct {
|
|||
// http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status
|
||||
type PrometheusSpec struct {
|
||||
// ServiceMonitors to be selected for target discovery.
|
||||
ServiceMonitorSelector *metav1.LabelSelector `json:"serviceMonitorSelector,omitempty"`
|
||||
ServiceMonitorSelector *unversioned.LabelSelector `json:"serviceMonitorSelector,omitempty"`
|
||||
// Version of Prometheus to be deployed.
|
||||
Version string `json:"version,omitempty"`
|
||||
// When a Prometheus deployment is paused, no actions except for deletion
|
||||
|
@ -74,7 +74,7 @@ type PrometheusSpec struct {
|
|||
// Storage spec to specify how storage shall be used.
|
||||
Storage *StorageSpec `json:"storage,omitempty"`
|
||||
// A selector to select which ConfigMaps to mount for loading rule files from.
|
||||
RuleSelector *metav1.LabelSelector `json:"ruleSelector,omitempty"`
|
||||
RuleSelector *unversioned.LabelSelector `json:"ruleSelector,omitempty"`
|
||||
// Define details regarding alerting.
|
||||
Alerting AlertingSpec `json:"alerting,omitempty"`
|
||||
// Define resources requests and limits for single Pods.
|
||||
|
@ -122,7 +122,7 @@ type StorageSpec struct {
|
|||
// info: https://kubernetes.io/docs/user-guide/persistent-volumes/#storageclasses
|
||||
Class string `json:"class"`
|
||||
// A label query over volumes to consider for binding.
|
||||
Selector *metav1.LabelSelector `json:"selector"`
|
||||
Selector *unversioned.LabelSelector `json:"selector"`
|
||||
// Resources represents the minimum resources the volume should have. More
|
||||
// info: http://kubernetes.io/docs/user-guide/persistent-volumes#resources
|
||||
Resources v1.ResourceRequirements `json:"resources"`
|
||||
|
@ -143,10 +143,10 @@ type AlertmanagerEndpoints struct {
|
|||
|
||||
// ServiceMonitor defines monitoring for a set of services.
|
||||
type ServiceMonitor struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
unversioned.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"`
|
||||
v1.ObjectMeta `json:"metadata,omitempty"`
|
||||
// Specification of desired Service selection for target discrovery by
|
||||
// Prometheus.
|
||||
Spec ServiceMonitorSpec `json:"spec"`
|
||||
|
@ -159,7 +159,7 @@ type ServiceMonitorSpec struct {
|
|||
// A list of endpoints allowed as part of this ServiceMonitor.
|
||||
Endpoints []Endpoint `json:"endpoints,omitempty"`
|
||||
// Selector to select Endpoints objects.
|
||||
Selector metav1.LabelSelector `json:"selector"`
|
||||
Selector unversioned.LabelSelector `json:"selector"`
|
||||
// Selector to select which namespaces the Endpoints objects are discovered from.
|
||||
NamespaceSelector NamespaceSelector `json:"namespaceSelector,omitempty"`
|
||||
}
|
||||
|
@ -198,20 +198,20 @@ type TLSConfig struct {
|
|||
|
||||
// A list of ServiceMonitors.
|
||||
type ServiceMonitorList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
unversioned.TypeMeta `json:",inline"`
|
||||
// Standard list metadata
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
unversioned.ListMeta `json:"metadata,omitempty"`
|
||||
// List of ServiceMonitors
|
||||
Items []*ServiceMonitor `json:"items"`
|
||||
}
|
||||
|
||||
// Describes an Alertmanager cluster.
|
||||
type Alertmanager struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
unversioned.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"`
|
||||
v1.ObjectMeta `json:"metadata,omitempty"`
|
||||
// Specification of the desired behavior of the Alertmanager cluster. More info:
|
||||
// http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status
|
||||
Spec AlertmanagerSpec `json:"spec"`
|
||||
|
@ -252,10 +252,10 @@ type AlertmanagerSpec struct {
|
|||
|
||||
// A list of Alertmanagers.
|
||||
type AlertmanagerList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
unversioned.TypeMeta `json:",inline"`
|
||||
// Standard list metadata
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
unversioned.ListMeta `json:"metadata,omitempty"`
|
||||
// List of Alertmanagers
|
||||
Items []Alertmanager `json:"items"`
|
||||
}
|
||||
|
@ -290,7 +290,7 @@ type NamespaceSelector struct {
|
|||
// List of namespace names.
|
||||
MatchNames []string `json:"matchNames,omitempty"`
|
||||
|
||||
// TODO(fabxc): this should embed metav1.LabelSelector eventually.
|
||||
// TODO(fabxc): this should embed unversioned.LabelSelector eventually.
|
||||
// Currently the selector is only used for namespaces which require more complex
|
||||
// implementation to support label selections.
|
||||
}
|
||||
|
|
|
@ -21,11 +21,11 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
clientv1 "k8s.io/client-go/kubernetes/typed/core/v1"
|
||||
apierrors "k8s.io/client-go/pkg/api/errors"
|
||||
"k8s.io/client-go/pkg/api/unversioned"
|
||||
"k8s.io/client-go/pkg/api/v1"
|
||||
"k8s.io/client-go/pkg/util/wait"
|
||||
"k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
|
@ -106,14 +106,14 @@ func IsResourceNotFoundError(err error) bool {
|
|||
if !ok {
|
||||
return false
|
||||
}
|
||||
if se.Status().Code == http.StatusNotFound && se.Status().Reason == metav1.StatusReasonNotFound {
|
||||
if se.Status().Code == http.StatusNotFound && se.Status().Reason == unversioned.StatusReasonNotFound {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func CreateOrUpdateService(sclient clientv1.ServiceInterface, svc *v1.Service) error {
|
||||
service, err := sclient.Get(svc.Name, metav1.GetOptions{})
|
||||
service, err := sclient.Get(svc.Name)
|
||||
if err != nil && !apierrors.IsNotFound(err) {
|
||||
return errors.Wrap(err, "retrieving service object failed")
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ func CreateOrUpdateService(sclient clientv1.ServiceInterface, svc *v1.Service) e
|
|||
}
|
||||
|
||||
func CreateOrUpdateEndpoints(eclient clientv1.EndpointsInterface, eps *v1.Endpoints) error {
|
||||
endpoints, err := eclient.Get(eps.Name, metav1.GetOptions{})
|
||||
endpoints, err := eclient.Get(eps.Name)
|
||||
if err != nil && !apierrors.IsNotFound(err) {
|
||||
return errors.Wrap(err, "retrieving existing kubelet endpoints object failed")
|
||||
}
|
||||
|
|
|
@ -23,21 +23,20 @@ import (
|
|||
"github.com/coreos/prometheus-operator/pkg/client/monitoring/v1alpha1"
|
||||
"github.com/coreos/prometheus-operator/pkg/k8sutil"
|
||||
|
||||
"github.com/coreos/prometheus-operator/third_party/workqueue"
|
||||
"github.com/go-kit/kit/log"
|
||||
"github.com/pkg/errors"
|
||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/api/meta"
|
||||
apimetav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/fields"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
"k8s.io/client-go/pkg/api"
|
||||
apierrors "k8s.io/client-go/pkg/api/errors"
|
||||
"k8s.io/client-go/pkg/api/meta"
|
||||
"k8s.io/client-go/pkg/api/unversioned"
|
||||
"k8s.io/client-go/pkg/api/v1"
|
||||
"k8s.io/client-go/pkg/apis/apps/v1beta1"
|
||||
extensionsobj "k8s.io/client-go/pkg/apis/extensions/v1beta1"
|
||||
"k8s.io/client-go/pkg/util/workqueue"
|
||||
"k8s.io/client-go/pkg/fields"
|
||||
"k8s.io/client-go/pkg/labels"
|
||||
utilruntime "k8s.io/client-go/pkg/util/runtime"
|
||||
"k8s.io/client-go/rest"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
@ -285,7 +284,7 @@ func (c *Operator) handleUpdateNode(old, cur interface{}) { c.syncNodeEndpoints(
|
|||
|
||||
func (c *Operator) syncNodeEndpoints() {
|
||||
eps := &v1.Endpoints{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
Name: c.kubeletObjectName,
|
||||
Labels: map[string]string{
|
||||
"k8s-app": "kubelet",
|
||||
|
@ -322,7 +321,7 @@ func (c *Operator) syncNodeEndpoints() {
|
|||
})
|
||||
|
||||
svc := &v1.Service{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
Name: c.kubeletObjectName,
|
||||
Labels: map[string]string{
|
||||
"k8s-app": "kubelet",
|
||||
|
@ -416,7 +415,7 @@ func (c *Operator) handleConfigMapUpdate(old, cur interface{}) {
|
|||
}
|
||||
}
|
||||
|
||||
func (c *Operator) getObject(obj interface{}) (apimetav1.Object, bool) {
|
||||
func (c *Operator) getObject(obj interface{}) (meta.Object, bool) {
|
||||
ts, ok := obj.(cache.DeletedFinalStateUnknown)
|
||||
if ok {
|
||||
obj = ts.Obj
|
||||
|
@ -626,7 +625,7 @@ func (c *Operator) sync(key string) error {
|
|||
func (c *Operator) ruleFileConfigMaps(p *v1alpha1.Prometheus) ([]*v1.ConfigMap, error) {
|
||||
res := []*v1.ConfigMap{}
|
||||
|
||||
ruleSelector, err := metav1.LabelSelectorAsSelector(p.Spec.RuleSelector)
|
||||
ruleSelector, err := unversioned.LabelSelectorAsSelector(p.Spec.RuleSelector)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -641,8 +640,8 @@ func (c *Operator) ruleFileConfigMaps(p *v1alpha1.Prometheus) ([]*v1.ConfigMap,
|
|||
return res, nil
|
||||
}
|
||||
|
||||
func ListOptions(name string) metav1.ListOptions {
|
||||
return metav1.ListOptions{
|
||||
func ListOptions(name string) v1.ListOptions {
|
||||
return v1.ListOptions{
|
||||
LabelSelector: fields.SelectorFromSet(fields.Set(map[string]string{
|
||||
"app": "prometheus",
|
||||
"prometheus": name,
|
||||
|
@ -794,7 +793,7 @@ func (c *Operator) createConfig(p *v1alpha1.Prometheus, ruleFileConfigMaps []*v1
|
|||
s.Data["prometheus.yaml"] = []byte(conf)
|
||||
sClient := c.kclient.CoreV1().Secrets(p.Namespace)
|
||||
|
||||
_, err = sClient.Get(s.Name, metav1.GetOptions{})
|
||||
_, err = sClient.Get(s.Name)
|
||||
if apierrors.IsNotFound(err) {
|
||||
_, err = sClient.Create(s)
|
||||
} else if err == nil {
|
||||
|
@ -807,7 +806,7 @@ func (c *Operator) selectServiceMonitors(p *v1alpha1.Prometheus) (map[string]*v1
|
|||
// Selectors might overlap. Deduplicate them along the keyFunc.
|
||||
res := make(map[string]*v1alpha1.ServiceMonitor)
|
||||
|
||||
selector, err := metav1.LabelSelectorAsSelector(p.Spec.ServiceMonitorSelector)
|
||||
selector, err := unversioned.LabelSelectorAsSelector(p.Spec.ServiceMonitorSelector)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -827,7 +826,7 @@ func (c *Operator) selectServiceMonitors(p *v1alpha1.Prometheus) (map[string]*v1
|
|||
func (c *Operator) createTPRs() error {
|
||||
tprs := []*extensionsobj.ThirdPartyResource{
|
||||
{
|
||||
ObjectMeta: apimetav1.ObjectMeta{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
Name: tprServiceMonitor,
|
||||
},
|
||||
Versions: []extensionsobj.APIVersion{
|
||||
|
@ -836,7 +835,7 @@ func (c *Operator) createTPRs() error {
|
|||
Description: "Prometheus monitoring for a service",
|
||||
},
|
||||
{
|
||||
ObjectMeta: apimetav1.ObjectMeta{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
Name: tprPrometheus,
|
||||
},
|
||||
Versions: []extensionsobj.APIVersion{
|
||||
|
|
|
@ -20,7 +20,7 @@ import (
|
|||
"strings"
|
||||
|
||||
yaml "gopkg.in/yaml.v2"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/client-go/pkg/api/unversioned"
|
||||
|
||||
"github.com/coreos/prometheus-operator/pkg/client/monitoring/v1alpha1"
|
||||
)
|
||||
|
@ -129,25 +129,25 @@ func generateServiceMonitorConfig(m *v1alpha1.ServiceMonitor, ep v1alpha1.Endpoi
|
|||
// `In`, `NotIn`, `Exists`, and `DoesNotExist`, into relabeling rules.
|
||||
for _, exp := range m.Spec.Selector.MatchExpressions {
|
||||
switch exp.Operator {
|
||||
case metav1.LabelSelectorOpIn:
|
||||
case unversioned.LabelSelectorOpIn:
|
||||
relabelings = append(relabelings, map[string]interface{}{
|
||||
"action": "keep",
|
||||
"source_labels": []string{"__meta_kubernetes_service_label_" + sanitizeLabelName(exp.Key)},
|
||||
"regex": strings.Join(exp.Values, "|"),
|
||||
})
|
||||
case metav1.LabelSelectorOpNotIn:
|
||||
case unversioned.LabelSelectorOpNotIn:
|
||||
relabelings = append(relabelings, map[string]interface{}{
|
||||
"action": "drop",
|
||||
"source_labels": []string{"__meta_kubernetes_service_label_" + sanitizeLabelName(exp.Key)},
|
||||
"regex": strings.Join(exp.Values, "|"),
|
||||
})
|
||||
case metav1.LabelSelectorOpExists:
|
||||
case unversioned.LabelSelectorOpExists:
|
||||
relabelings = append(relabelings, map[string]interface{}{
|
||||
"action": "keep",
|
||||
"source_labels": []string{"__meta_kubernetes_service_label_" + sanitizeLabelName(exp.Key)},
|
||||
"regex": ".+",
|
||||
})
|
||||
case metav1.LabelSelectorOpDoesNotExist:
|
||||
case unversioned.LabelSelectorOpDoesNotExist:
|
||||
relabelings = append(relabelings, map[string]interface{}{
|
||||
"action": "drop",
|
||||
"source_labels": []string{"__meta_kubernetes_service_label_" + sanitizeLabelName(exp.Key)},
|
||||
|
|
|
@ -18,7 +18,8 @@ import (
|
|||
"testing"
|
||||
|
||||
promconfig "github.com/prometheus/prometheus/config"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/client-go/pkg/api/unversioned"
|
||||
"k8s.io/client-go/pkg/api/v1"
|
||||
|
||||
"github.com/coreos/prometheus-operator/pkg/client/monitoring/v1alpha1"
|
||||
)
|
||||
|
@ -27,16 +28,16 @@ func TestConfigGenerationNonNamespacedAnnotation(t *testing.T) {
|
|||
p := &v1alpha1.Prometheus{}
|
||||
smons := map[string]*v1alpha1.ServiceMonitor{
|
||||
"1": &v1alpha1.ServiceMonitor{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
Name: "test",
|
||||
Namespace: "test",
|
||||
},
|
||||
Spec: v1alpha1.ServiceMonitorSpec{
|
||||
Selector: metav1.LabelSelector{
|
||||
MatchExpressions: []metav1.LabelSelectorRequirement{
|
||||
metav1.LabelSelectorRequirement{
|
||||
Selector: unversioned.LabelSelector{
|
||||
MatchExpressions: []unversioned.LabelSelectorRequirement{
|
||||
unversioned.LabelSelectorRequirement{
|
||||
Key: "k8s-app",
|
||||
Operator: metav1.LabelSelectorOpExists,
|
||||
Operator: unversioned.LabelSelectorOpExists,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
@ -21,7 +21,6 @@ import (
|
|||
"net/url"
|
||||
"path"
|
||||
|
||||
apimetav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/client-go/pkg/api/resource"
|
||||
"k8s.io/client-go/pkg/api/v1"
|
||||
"k8s.io/client-go/pkg/apis/apps/v1beta1"
|
||||
|
@ -70,7 +69,7 @@ func makeStatefulSet(p v1alpha1.Prometheus, old *v1beta1.StatefulSet, config *Co
|
|||
}
|
||||
|
||||
statefulset := &v1beta1.StatefulSet{
|
||||
ObjectMeta: apimetav1.ObjectMeta{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
Name: prefixedName(p.Name),
|
||||
Labels: p.ObjectMeta.Labels,
|
||||
Annotations: p.ObjectMeta.Annotations,
|
||||
|
@ -86,7 +85,7 @@ func makeStatefulSet(p v1alpha1.Prometheus, old *v1beta1.StatefulSet, config *Co
|
|||
})
|
||||
} else {
|
||||
pvc := v1.PersistentVolumeClaim{
|
||||
ObjectMeta: apimetav1.ObjectMeta{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
Name: volumeName(p.Name),
|
||||
},
|
||||
Spec: v1.PersistentVolumeClaimSpec{
|
||||
|
@ -165,7 +164,7 @@ func makeConfigSecret(name string, configMaps []*v1.ConfigMap) (*v1.Secret, erro
|
|||
}
|
||||
|
||||
return &v1.Secret{
|
||||
ObjectMeta: apimetav1.ObjectMeta{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
Name: configSecretName(name),
|
||||
Labels: managedByOperatorLabels,
|
||||
},
|
||||
|
@ -178,7 +177,7 @@ func makeConfigSecret(name string, configMaps []*v1.ConfigMap) (*v1.Secret, erro
|
|||
|
||||
func makeStatefulSetService(p *v1alpha1.Prometheus) *v1.Service {
|
||||
svc := &v1.Service{
|
||||
ObjectMeta: apimetav1.ObjectMeta{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
Name: governingServiceName,
|
||||
Labels: map[string]string{
|
||||
"operated-prometheus": "true",
|
||||
|
@ -305,7 +304,7 @@ func makeStatefulSetSpec(p v1alpha1.Prometheus, c *Config, ruleConfigMaps []*v1.
|
|||
ServiceName: governingServiceName,
|
||||
Replicas: p.Spec.Replicas,
|
||||
Template: v1.PodTemplateSpec{
|
||||
ObjectMeta: apimetav1.ObjectMeta{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
"app": "prometheus",
|
||||
"prometheus": p.Name,
|
||||
|
|
|
@ -18,7 +18,6 @@ import (
|
|||
"reflect"
|
||||
"testing"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/client-go/pkg/api/v1"
|
||||
|
||||
"github.com/coreos/prometheus-operator/pkg/client/monitoring/v1alpha1"
|
||||
|
@ -39,7 +38,7 @@ func TestStatefulSetLabelingAndAnnotations(t *testing.T) {
|
|||
}
|
||||
|
||||
sset := makeStatefulSet(v1alpha1.Prometheus{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
Labels: labels,
|
||||
Annotations: annotations,
|
||||
},
|
||||
|
|
|
@ -17,7 +17,6 @@ package e2e
|
|||
import (
|
||||
"fmt"
|
||||
"github.com/coreos/prometheus-operator/pkg/client/monitoring/v1alpha1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/client-go/pkg/api/v1"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
@ -195,7 +194,7 @@ func TestExposingAlertmanagerWithIngress(t *testing.T) {
|
|||
func TestMeshInitialization(t *testing.T) {
|
||||
var amountAlertmanagers int32 = 3
|
||||
alertmanager := &v1alpha1.Alertmanager{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
Name: "test",
|
||||
},
|
||||
Spec: v1alpha1.AlertmanagerSpec{
|
||||
|
@ -264,7 +263,7 @@ receivers:
|
|||
`
|
||||
|
||||
cfg := &v1.Secret{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
Name: fmt.Sprintf("alertmanager-%s", alertmanager.Name),
|
||||
},
|
||||
Data: map[string][]byte{
|
||||
|
|
|
@ -21,10 +21,9 @@ import (
|
|||
"os"
|
||||
"time"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/yaml"
|
||||
"k8s.io/client-go/pkg/api/v1"
|
||||
"k8s.io/client-go/pkg/util/intstr"
|
||||
"k8s.io/client-go/pkg/util/yaml"
|
||||
|
||||
"github.com/coreos/prometheus-operator/pkg/alertmanager"
|
||||
"github.com/coreos/prometheus-operator/pkg/client/monitoring/v1alpha1"
|
||||
|
@ -46,7 +45,7 @@ receivers:
|
|||
|
||||
func (f *Framework) MakeBasicAlertmanager(name string, replicas int32) *v1alpha1.Alertmanager {
|
||||
return &v1alpha1.Alertmanager{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
Name: name,
|
||||
},
|
||||
Spec: v1alpha1.AlertmanagerSpec{
|
||||
|
@ -63,7 +62,7 @@ func (f *Framework) MakeAlertmanagerNodePortService(name, group string, nodePort
|
|||
|
||||
func (f *Framework) MakeAlertmanagerService(name, group string, serviceType v1.ServiceType) *v1.Service {
|
||||
service := &v1.Service{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
Name: fmt.Sprintf("alertmanager-%s", name),
|
||||
Labels: map[string]string{
|
||||
"group": group,
|
||||
|
|
|
@ -21,12 +21,11 @@ import (
|
|||
"path/filepath"
|
||||
"time"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/fields"
|
||||
"k8s.io/apimachinery/pkg/util/yaml"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
"k8s.io/client-go/pkg/api/v1"
|
||||
"k8s.io/client-go/pkg/apis/extensions/v1beta1"
|
||||
"k8s.io/client-go/pkg/fields"
|
||||
"k8s.io/client-go/pkg/util/yaml"
|
||||
"k8s.io/client-go/rest"
|
||||
"k8s.io/client-go/tools/clientcmd"
|
||||
|
||||
|
@ -67,7 +66,7 @@ func New(ns, kubeconfig, opImage, ip string) (*Framework, error) {
|
|||
}
|
||||
|
||||
namespace, err := cli.Core().Namespaces().Create(&v1.Namespace{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
Name: ns,
|
||||
},
|
||||
})
|
||||
|
@ -125,7 +124,7 @@ func (f *Framework) setupPrometheusOperator(opImage string) error {
|
|||
return err
|
||||
}
|
||||
|
||||
opts := metav1.ListOptions{LabelSelector: fields.SelectorFromSet(fields.Set(deploy.Spec.Template.ObjectMeta.Labels)).String()}
|
||||
opts := v1.ListOptions{LabelSelector: fields.SelectorFromSet(fields.Set(deploy.Spec.Template.ObjectMeta.Labels)).String()}
|
||||
err = f.WaitForPodsReady(1, opts)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -173,7 +172,7 @@ func (f *Framework) Teardown() error {
|
|||
|
||||
// WaitForPodsReady waits for a selection of Pods to be running and each
|
||||
// container to pass its readiness check.
|
||||
func (f *Framework) WaitForPodsReady(expectedReplicas int, opts metav1.ListOptions) error {
|
||||
func (f *Framework) WaitForPodsReady(expectedReplicas int, opts v1.ListOptions) error {
|
||||
return f.Poll(time.Minute*2, time.Second, func() (bool, error) {
|
||||
pl, err := f.KubeClient.Core().Pods(f.Namespace.Name).List(opts)
|
||||
if err != nil {
|
||||
|
@ -199,7 +198,7 @@ func (f *Framework) WaitForPodsReady(expectedReplicas int, opts metav1.ListOptio
|
|||
})
|
||||
}
|
||||
|
||||
func (f *Framework) WaitForPodsRunImage(expectedReplicas int, image string, opts metav1.ListOptions) error {
|
||||
func (f *Framework) WaitForPodsRunImage(expectedReplicas int, image string, opts v1.ListOptions) error {
|
||||
return f.Poll(time.Minute*5, time.Second, func() (bool, error) {
|
||||
pl, err := f.KubeClient.Core().Pods(f.Namespace.Name).List(opts)
|
||||
if err != nil {
|
||||
|
|
|
@ -15,18 +15,17 @@
|
|||
package framework
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/yaml"
|
||||
"k8s.io/client-go/pkg/api/v1"
|
||||
"k8s.io/client-go/pkg/apis/extensions/v1beta1"
|
||||
"k8s.io/client-go/pkg/util/intstr"
|
||||
"k8s.io/client-go/pkg/util/yaml"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
func (f *Framework) MakeBasicIngress(serviceName string, servicePort int) *v1beta1.Ingress {
|
||||
return &v1beta1.Ingress{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
Name: "monitoring",
|
||||
},
|
||||
Spec: v1beta1.IngressSpec{
|
||||
|
@ -124,7 +123,7 @@ func (f *Framework) GetIngressIP(ingressName string) (*string, error) {
|
|||
var ingress *v1beta1.Ingress
|
||||
err := f.Poll(time.Minute*5, time.Millisecond*500, func() (bool, error) {
|
||||
var err error
|
||||
ingress, err = f.KubeClient.Extensions().Ingresses(f.Namespace.Name).Get(ingressName, metav1.GetOptions{})
|
||||
ingress, err = f.KubeClient.Extensions().Ingresses(f.Namespace.Name).Get(ingressName)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
|
|
@ -21,8 +21,8 @@ import (
|
|||
"net/http"
|
||||
"time"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/client-go/pkg/api/resource"
|
||||
"k8s.io/client-go/pkg/api/unversioned"
|
||||
"k8s.io/client-go/pkg/api/v1"
|
||||
"k8s.io/client-go/pkg/util/intstr"
|
||||
|
||||
|
@ -32,17 +32,17 @@ import (
|
|||
|
||||
func (f *Framework) MakeBasicPrometheus(name, group string, replicas int32) *v1alpha1.Prometheus {
|
||||
return &v1alpha1.Prometheus{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
Name: name,
|
||||
},
|
||||
Spec: v1alpha1.PrometheusSpec{
|
||||
Replicas: &replicas,
|
||||
ServiceMonitorSelector: &metav1.LabelSelector{
|
||||
ServiceMonitorSelector: &unversioned.LabelSelector{
|
||||
MatchLabels: map[string]string{
|
||||
"group": group,
|
||||
},
|
||||
},
|
||||
RuleSelector: &metav1.LabelSelector{
|
||||
RuleSelector: &unversioned.LabelSelector{
|
||||
MatchLabels: map[string]string{
|
||||
"role": "rulefile",
|
||||
},
|
||||
|
@ -70,14 +70,14 @@ func (f *Framework) AddAlertingToPrometheus(p *v1alpha1.Prometheus, name string)
|
|||
|
||||
func (f *Framework) MakeBasicServiceMonitor(name string) *v1alpha1.ServiceMonitor {
|
||||
return &v1alpha1.ServiceMonitor{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
Name: name,
|
||||
Labels: map[string]string{
|
||||
"group": name,
|
||||
},
|
||||
},
|
||||
Spec: v1alpha1.ServiceMonitorSpec{
|
||||
Selector: metav1.LabelSelector{
|
||||
Selector: unversioned.LabelSelector{
|
||||
MatchLabels: map[string]string{
|
||||
"group": name,
|
||||
},
|
||||
|
@ -100,7 +100,7 @@ func (f *Framework) MakeBasicPrometheusNodePortService(name, group string, nodeP
|
|||
|
||||
func (f *Framework) MakePrometheusService(name, group string, serviceType v1.ServiceType) *v1.Service {
|
||||
service := &v1.Service{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
Name: fmt.Sprintf("prometheus-%s", name),
|
||||
Labels: map[string]string{
|
||||
"group": group,
|
||||
|
|
|
@ -15,9 +15,8 @@
|
|||
package framework
|
||||
|
||||
import (
|
||||
apimetav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/yaml"
|
||||
"k8s.io/client-go/pkg/api/v1"
|
||||
"k8s.io/client-go/pkg/util/yaml"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
@ -75,7 +74,7 @@ func scaleDownReplicationController(f *Framework, rC v1.ReplicationController) e
|
|||
}
|
||||
|
||||
return f.Poll(time.Minute*5, time.Second, func() (bool, error) {
|
||||
currentRC, err := rCAPI.Get(rC.Name, apimetav1.GetOptions{})
|
||||
currentRC, err := rCAPI.Get(rC.Name)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
package framework
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/client-go/pkg/api/v1"
|
||||
"time"
|
||||
)
|
||||
|
@ -33,7 +32,7 @@ func (f *Framework) CreateServiceAndWaitUntilReady(service *v1.Service) error {
|
|||
|
||||
func (f *Framework) WaitForServiceReady(serviceName string) error {
|
||||
err := f.Poll(time.Minute*5, time.Second, func() (bool, error) {
|
||||
endpoints, err := f.KubeClient.CoreV1().Endpoints(f.Namespace.Name).Get(serviceName, metav1.GetOptions{})
|
||||
endpoints, err := f.KubeClient.CoreV1().Endpoints(f.Namespace.Name).Get(serviceName)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
|
|
@ -25,8 +25,6 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
apimetav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/client-go/pkg/api/resource"
|
||||
"k8s.io/client-go/pkg/api/v1"
|
||||
|
||||
|
@ -107,7 +105,7 @@ func TestPrometheusReloadConfig(t *testing.T) {
|
|||
name := "test"
|
||||
replicas := int32(1)
|
||||
p := &v1alpha1.Prometheus{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
Name: name,
|
||||
},
|
||||
Spec: v1alpha1.PrometheusSpec{
|
||||
|
@ -133,7 +131,7 @@ scrape_configs:
|
|||
`
|
||||
|
||||
cfg := &v1.Secret{
|
||||
ObjectMeta: apimetav1.ObjectMeta{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
Name: fmt.Sprintf("prometheus-%s", name),
|
||||
},
|
||||
Data: map[string][]byte{
|
||||
|
@ -194,7 +192,7 @@ func TestPrometheusReloadRules(t *testing.T) {
|
|||
name := "test"
|
||||
|
||||
ruleFileConfigMap := &v1.ConfigMap{
|
||||
ObjectMeta: apimetav1.ObjectMeta{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
Name: fmt.Sprintf("prometheus-%s-rules", name),
|
||||
Labels: map[string]string{
|
||||
"role": "rulefile",
|
||||
|
@ -284,7 +282,7 @@ func TestPrometheusDiscovery(t *testing.T) {
|
|||
}
|
||||
|
||||
log.Print("Validating Prometheus config Secret was created")
|
||||
_, err := framework.KubeClient.CoreV1().Secrets(framework.Namespace.Name).Get(fmt.Sprintf("prometheus-%s", prometheusName), apimetav1.GetOptions{})
|
||||
_, err := framework.KubeClient.CoreV1().Secrets(framework.Namespace.Name).Get(fmt.Sprintf("prometheus-%s", prometheusName))
|
||||
if err != nil {
|
||||
t.Fatalf("Generated Secret could not be retrieved: ", err)
|
||||
}
|
||||
|
@ -340,7 +338,7 @@ func TestPrometheusAlertmanagerDiscovery(t *testing.T) {
|
|||
}
|
||||
|
||||
log.Print("Validating Prometheus config Secret was created")
|
||||
_, err := framework.KubeClient.CoreV1().Secrets(framework.Namespace.Name).Get(fmt.Sprintf("prometheus-%s", prometheusName), apimetav1.GetOptions{})
|
||||
_, err := framework.KubeClient.CoreV1().Secrets(framework.Namespace.Name).Get(fmt.Sprintf("prometheus-%s", prometheusName))
|
||||
if err != nil {
|
||||
t.Fatalf("Generated Secret could not be retrieved: ", err)
|
||||
}
|
||||
|
|
0
third_party/.keep
vendored
Normal file
0
third_party/.keep
vendored
Normal file
327
third_party/clock/clock.go
vendored
Normal file
327
third_party/clock/clock.go
vendored
Normal file
|
@ -0,0 +1,327 @@
|
|||
/*
|
||||
Copyright 2014 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 clock
|
||||
|
||||
import (
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Clock allows for injecting fake or real clocks into code that
|
||||
// needs to do arbitrary things based on time.
|
||||
type Clock interface {
|
||||
Now() time.Time
|
||||
Since(time.Time) time.Duration
|
||||
After(d time.Duration) <-chan time.Time
|
||||
NewTimer(d time.Duration) Timer
|
||||
Sleep(d time.Duration)
|
||||
Tick(d time.Duration) <-chan time.Time
|
||||
}
|
||||
|
||||
var (
|
||||
_ = Clock(RealClock{})
|
||||
_ = Clock(&FakeClock{})
|
||||
_ = Clock(&IntervalClock{})
|
||||
)
|
||||
|
||||
// RealClock really calls time.Now()
|
||||
type RealClock struct{}
|
||||
|
||||
// Now returns the current time.
|
||||
func (RealClock) Now() time.Time {
|
||||
return time.Now()
|
||||
}
|
||||
|
||||
// Since returns time since the specified timestamp.
|
||||
func (RealClock) Since(ts time.Time) time.Duration {
|
||||
return time.Since(ts)
|
||||
}
|
||||
|
||||
// Same as time.After(d).
|
||||
func (RealClock) After(d time.Duration) <-chan time.Time {
|
||||
return time.After(d)
|
||||
}
|
||||
|
||||
func (RealClock) NewTimer(d time.Duration) Timer {
|
||||
return &realTimer{
|
||||
timer: time.NewTimer(d),
|
||||
}
|
||||
}
|
||||
|
||||
func (RealClock) Tick(d time.Duration) <-chan time.Time {
|
||||
return time.Tick(d)
|
||||
}
|
||||
|
||||
func (RealClock) Sleep(d time.Duration) {
|
||||
time.Sleep(d)
|
||||
}
|
||||
|
||||
// FakeClock implements Clock, but returns an arbitrary time.
|
||||
type FakeClock struct {
|
||||
lock sync.RWMutex
|
||||
time time.Time
|
||||
|
||||
// waiters are waiting for the fake time to pass their specified time
|
||||
waiters []fakeClockWaiter
|
||||
}
|
||||
|
||||
type fakeClockWaiter struct {
|
||||
targetTime time.Time
|
||||
stepInterval time.Duration
|
||||
skipIfBlocked bool
|
||||
destChan chan time.Time
|
||||
fired bool
|
||||
}
|
||||
|
||||
func NewFakeClock(t time.Time) *FakeClock {
|
||||
return &FakeClock{
|
||||
time: t,
|
||||
}
|
||||
}
|
||||
|
||||
// Now returns f's time.
|
||||
func (f *FakeClock) Now() time.Time {
|
||||
f.lock.RLock()
|
||||
defer f.lock.RUnlock()
|
||||
return f.time
|
||||
}
|
||||
|
||||
// Since returns time since the time in f.
|
||||
func (f *FakeClock) Since(ts time.Time) time.Duration {
|
||||
f.lock.RLock()
|
||||
defer f.lock.RUnlock()
|
||||
return f.time.Sub(ts)
|
||||
}
|
||||
|
||||
// Fake version of time.After(d).
|
||||
func (f *FakeClock) After(d time.Duration) <-chan time.Time {
|
||||
f.lock.Lock()
|
||||
defer f.lock.Unlock()
|
||||
stopTime := f.time.Add(d)
|
||||
ch := make(chan time.Time, 1) // Don't block!
|
||||
f.waiters = append(f.waiters, fakeClockWaiter{
|
||||
targetTime: stopTime,
|
||||
destChan: ch,
|
||||
})
|
||||
return ch
|
||||
}
|
||||
|
||||
// Fake version of time.NewTimer(d).
|
||||
func (f *FakeClock) NewTimer(d time.Duration) Timer {
|
||||
f.lock.Lock()
|
||||
defer f.lock.Unlock()
|
||||
stopTime := f.time.Add(d)
|
||||
ch := make(chan time.Time, 1) // Don't block!
|
||||
timer := &fakeTimer{
|
||||
fakeClock: f,
|
||||
waiter: fakeClockWaiter{
|
||||
targetTime: stopTime,
|
||||
destChan: ch,
|
||||
},
|
||||
}
|
||||
f.waiters = append(f.waiters, timer.waiter)
|
||||
return timer
|
||||
}
|
||||
|
||||
func (f *FakeClock) Tick(d time.Duration) <-chan time.Time {
|
||||
f.lock.Lock()
|
||||
defer f.lock.Unlock()
|
||||
tickTime := f.time.Add(d)
|
||||
ch := make(chan time.Time, 1) // hold one tick
|
||||
f.waiters = append(f.waiters, fakeClockWaiter{
|
||||
targetTime: tickTime,
|
||||
stepInterval: d,
|
||||
skipIfBlocked: true,
|
||||
destChan: ch,
|
||||
})
|
||||
|
||||
return ch
|
||||
}
|
||||
|
||||
// Move clock by Duration, notify anyone that's called After, Tick, or NewTimer
|
||||
func (f *FakeClock) Step(d time.Duration) {
|
||||
f.lock.Lock()
|
||||
defer f.lock.Unlock()
|
||||
f.setTimeLocked(f.time.Add(d))
|
||||
}
|
||||
|
||||
// Sets the time.
|
||||
func (f *FakeClock) SetTime(t time.Time) {
|
||||
f.lock.Lock()
|
||||
defer f.lock.Unlock()
|
||||
f.setTimeLocked(t)
|
||||
}
|
||||
|
||||
// Actually changes the time and checks any waiters. f must be write-locked.
|
||||
func (f *FakeClock) setTimeLocked(t time.Time) {
|
||||
f.time = t
|
||||
newWaiters := make([]fakeClockWaiter, 0, len(f.waiters))
|
||||
for i := range f.waiters {
|
||||
w := &f.waiters[i]
|
||||
if !w.targetTime.After(t) {
|
||||
|
||||
if w.skipIfBlocked {
|
||||
select {
|
||||
case w.destChan <- t:
|
||||
w.fired = true
|
||||
default:
|
||||
}
|
||||
} else {
|
||||
w.destChan <- t
|
||||
w.fired = true
|
||||
}
|
||||
|
||||
if w.stepInterval > 0 {
|
||||
for !w.targetTime.After(t) {
|
||||
w.targetTime = w.targetTime.Add(w.stepInterval)
|
||||
}
|
||||
newWaiters = append(newWaiters, *w)
|
||||
}
|
||||
|
||||
} else {
|
||||
newWaiters = append(newWaiters, f.waiters[i])
|
||||
}
|
||||
}
|
||||
f.waiters = newWaiters
|
||||
}
|
||||
|
||||
// Returns true if After has been called on f but not yet satisfied (so you can
|
||||
// write race-free tests).
|
||||
func (f *FakeClock) HasWaiters() bool {
|
||||
f.lock.RLock()
|
||||
defer f.lock.RUnlock()
|
||||
return len(f.waiters) > 0
|
||||
}
|
||||
|
||||
func (f *FakeClock) Sleep(d time.Duration) {
|
||||
f.Step(d)
|
||||
}
|
||||
|
||||
// IntervalClock implements Clock, but each invocation of Now steps the clock forward the specified duration
|
||||
type IntervalClock struct {
|
||||
Time time.Time
|
||||
Duration time.Duration
|
||||
}
|
||||
|
||||
// Now returns i's time.
|
||||
func (i *IntervalClock) Now() time.Time {
|
||||
i.Time = i.Time.Add(i.Duration)
|
||||
return i.Time
|
||||
}
|
||||
|
||||
// Since returns time since the time in i.
|
||||
func (i *IntervalClock) Since(ts time.Time) time.Duration {
|
||||
return i.Time.Sub(ts)
|
||||
}
|
||||
|
||||
// Unimplemented, will panic.
|
||||
// TODO: make interval clock use FakeClock so this can be implemented.
|
||||
func (*IntervalClock) After(d time.Duration) <-chan time.Time {
|
||||
panic("IntervalClock doesn't implement After")
|
||||
}
|
||||
|
||||
// Unimplemented, will panic.
|
||||
// TODO: make interval clock use FakeClock so this can be implemented.
|
||||
func (*IntervalClock) NewTimer(d time.Duration) Timer {
|
||||
panic("IntervalClock doesn't implement NewTimer")
|
||||
}
|
||||
|
||||
// Unimplemented, will panic.
|
||||
// TODO: make interval clock use FakeClock so this can be implemented.
|
||||
func (*IntervalClock) Tick(d time.Duration) <-chan time.Time {
|
||||
panic("IntervalClock doesn't implement Tick")
|
||||
}
|
||||
|
||||
func (*IntervalClock) Sleep(d time.Duration) {
|
||||
panic("IntervalClock doesn't implement Sleep")
|
||||
}
|
||||
|
||||
// Timer allows for injecting fake or real timers into code that
|
||||
// needs to do arbitrary things based on time.
|
||||
type Timer interface {
|
||||
C() <-chan time.Time
|
||||
Stop() bool
|
||||
Reset(d time.Duration) bool
|
||||
}
|
||||
|
||||
var (
|
||||
_ = Timer(&realTimer{})
|
||||
_ = Timer(&fakeTimer{})
|
||||
)
|
||||
|
||||
// realTimer is backed by an actual time.Timer.
|
||||
type realTimer struct {
|
||||
timer *time.Timer
|
||||
}
|
||||
|
||||
// C returns the underlying timer's channel.
|
||||
func (r *realTimer) C() <-chan time.Time {
|
||||
return r.timer.C
|
||||
}
|
||||
|
||||
// Stop calls Stop() on the underlying timer.
|
||||
func (r *realTimer) Stop() bool {
|
||||
return r.timer.Stop()
|
||||
}
|
||||
|
||||
// Reset calls Reset() on the underlying timer.
|
||||
func (r *realTimer) Reset(d time.Duration) bool {
|
||||
return r.timer.Reset(d)
|
||||
}
|
||||
|
||||
// fakeTimer implements Timer based on a FakeClock.
|
||||
type fakeTimer struct {
|
||||
fakeClock *FakeClock
|
||||
waiter fakeClockWaiter
|
||||
}
|
||||
|
||||
// C returns the channel that notifies when this timer has fired.
|
||||
func (f *fakeTimer) C() <-chan time.Time {
|
||||
return f.waiter.destChan
|
||||
}
|
||||
|
||||
// Stop stops the timer and returns true if the timer has not yet fired, or false otherwise.
|
||||
func (f *fakeTimer) Stop() bool {
|
||||
f.fakeClock.lock.Lock()
|
||||
defer f.fakeClock.lock.Unlock()
|
||||
|
||||
newWaiters := make([]fakeClockWaiter, 0, len(f.fakeClock.waiters))
|
||||
for i := range f.fakeClock.waiters {
|
||||
w := &f.fakeClock.waiters[i]
|
||||
if w != &f.waiter {
|
||||
newWaiters = append(newWaiters, *w)
|
||||
}
|
||||
}
|
||||
|
||||
f.fakeClock.waiters = newWaiters
|
||||
|
||||
return !f.waiter.fired
|
||||
}
|
||||
|
||||
// Reset resets the timer to the fake clock's "now" + d. It returns true if the timer has not yet
|
||||
// fired, or false otherwise.
|
||||
func (f *fakeTimer) Reset(d time.Duration) bool {
|
||||
f.fakeClock.lock.Lock()
|
||||
defer f.fakeClock.lock.Unlock()
|
||||
|
||||
active := !f.waiter.fired
|
||||
|
||||
f.waiter.fired = false
|
||||
f.waiter.targetTime = f.fakeClock.time.Add(d)
|
||||
|
||||
return active
|
||||
}
|
|
@ -20,8 +20,8 @@ import (
|
|||
"sort"
|
||||
"time"
|
||||
|
||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||
"k8s.io/client-go/util/clock"
|
||||
"github.com/coreos/prometheus-operator/third_party/clock"
|
||||
utilruntime "k8s.io/client-go/pkg/util/runtime"
|
||||
)
|
||||
|
||||
// DelayingInterface is an Interface that can Add an item at a later time. This makes it easier to
|
|
@ -19,7 +19,7 @@ package workqueue
|
|||
import (
|
||||
"sync"
|
||||
|
||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||
utilruntime "k8s.io/client-go/pkg/util/runtime"
|
||||
)
|
||||
|
||||
type DoWorkPieceFunc func(piece int)
|
22
vendor/github.com/blang/semver/LICENSE
generated
vendored
Normal file
22
vendor/github.com/blang/semver/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
The MIT License
|
||||
|
||||
Copyright (c) 2014 Benedikt Lang <github at benediktlang.de>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
142
vendor/github.com/blang/semver/README.md
generated
vendored
Normal file
142
vendor/github.com/blang/semver/README.md
generated
vendored
Normal file
|
@ -0,0 +1,142 @@
|
|||
semver for golang [](https://drone.io/github.com/blang/semver/latest) [](https://godoc.org/github.com/blang/semver) [](https://coveralls.io/r/blang/semver?branch=master)
|
||||
======
|
||||
|
||||
semver is a [Semantic Versioning](http://semver.org/) library written in golang. It fully covers spec version `2.0.0`.
|
||||
|
||||
Usage
|
||||
-----
|
||||
```bash
|
||||
$ go get github.com/blang/semver
|
||||
```
|
||||
Note: Always vendor your dependencies or fix on a specific version tag.
|
||||
|
||||
```go
|
||||
import github.com/blang/semver
|
||||
v1, err := semver.Make("1.0.0-beta")
|
||||
v2, err := semver.Make("2.0.0-beta")
|
||||
v1.Compare(v2)
|
||||
```
|
||||
|
||||
Also check the [GoDocs](http://godoc.org/github.com/blang/semver).
|
||||
|
||||
Why should I use this lib?
|
||||
-----
|
||||
|
||||
- Fully spec compatible
|
||||
- No reflection
|
||||
- No regex
|
||||
- Fully tested (Coverage >99%)
|
||||
- Readable parsing/validation errors
|
||||
- Fast (See [Benchmarks](#benchmarks))
|
||||
- Only Stdlib
|
||||
- Uses values instead of pointers
|
||||
- Many features, see below
|
||||
|
||||
|
||||
Features
|
||||
-----
|
||||
|
||||
- Parsing and validation at all levels
|
||||
- Comparator-like comparisons
|
||||
- Compare Helper Methods
|
||||
- InPlace manipulation
|
||||
- Sortable (implements sort.Interface)
|
||||
- database/sql compatible (sql.Scanner/Valuer)
|
||||
- encoding/json compatible (json.Marshaler/Unmarshaler)
|
||||
|
||||
|
||||
Example
|
||||
-----
|
||||
|
||||
Have a look at full examples in [examples/main.go](examples/main.go)
|
||||
|
||||
```go
|
||||
import github.com/blang/semver
|
||||
|
||||
v, err := semver.Make("0.0.1-alpha.preview+123.github")
|
||||
fmt.Printf("Major: %d\n", v.Major)
|
||||
fmt.Printf("Minor: %d\n", v.Minor)
|
||||
fmt.Printf("Patch: %d\n", v.Patch)
|
||||
fmt.Printf("Pre: %s\n", v.Pre)
|
||||
fmt.Printf("Build: %s\n", v.Build)
|
||||
|
||||
// Prerelease versions array
|
||||
if len(v.Pre) > 0 {
|
||||
fmt.Println("Prerelease versions:")
|
||||
for i, pre := range v.Pre {
|
||||
fmt.Printf("%d: %q\n", i, pre)
|
||||
}
|
||||
}
|
||||
|
||||
// Build meta data array
|
||||
if len(v.Build) > 0 {
|
||||
fmt.Println("Build meta data:")
|
||||
for i, build := range v.Build {
|
||||
fmt.Printf("%d: %q\n", i, build)
|
||||
}
|
||||
}
|
||||
|
||||
v001, err := semver.Make("0.0.1")
|
||||
// Compare using helpers: v.GT(v2), v.LT, v.GTE, v.LTE
|
||||
v001.GT(v) == true
|
||||
v.LT(v001) == true
|
||||
v.GTE(v) == true
|
||||
v.LTE(v) == true
|
||||
|
||||
// Or use v.Compare(v2) for comparisons (-1, 0, 1):
|
||||
v001.Compare(v) == 1
|
||||
v.Compare(v001) == -1
|
||||
v.Compare(v) == 0
|
||||
|
||||
// Manipulate Version in place:
|
||||
v.Pre[0], err = semver.NewPRVersion("beta")
|
||||
if err != nil {
|
||||
fmt.Printf("Error parsing pre release version: %q", err)
|
||||
}
|
||||
|
||||
fmt.Println("\nValidate versions:")
|
||||
v.Build[0] = "?"
|
||||
|
||||
err = v.Validate()
|
||||
if err != nil {
|
||||
fmt.Printf("Validation failed: %s\n", err)
|
||||
}
|
||||
```
|
||||
|
||||
Benchmarks
|
||||
-----
|
||||
|
||||
BenchmarkParseSimple 5000000 328 ns/op 49 B/op 1 allocs/op
|
||||
BenchmarkParseComplex 1000000 2105 ns/op 263 B/op 7 allocs/op
|
||||
BenchmarkParseAverage 1000000 1301 ns/op 168 B/op 4 allocs/op
|
||||
BenchmarkStringSimple 10000000 130 ns/op 5 B/op 1 allocs/op
|
||||
BenchmarkStringLarger 5000000 280 ns/op 32 B/op 2 allocs/op
|
||||
BenchmarkStringComplex 3000000 512 ns/op 80 B/op 3 allocs/op
|
||||
BenchmarkStringAverage 5000000 387 ns/op 47 B/op 2 allocs/op
|
||||
BenchmarkValidateSimple 500000000 7.92 ns/op 0 B/op 0 allocs/op
|
||||
BenchmarkValidateComplex 2000000 923 ns/op 0 B/op 0 allocs/op
|
||||
BenchmarkValidateAverage 5000000 452 ns/op 0 B/op 0 allocs/op
|
||||
BenchmarkCompareSimple 100000000 11.2 ns/op 0 B/op 0 allocs/op
|
||||
BenchmarkCompareComplex 50000000 40.9 ns/op 0 B/op 0 allocs/op
|
||||
BenchmarkCompareAverage 50000000 43.8 ns/op 0 B/op 0 allocs/op
|
||||
BenchmarkSort 5000000 436 ns/op 259 B/op 2 allocs/op
|
||||
|
||||
See benchmark cases at [semver_test.go](semver_test.go)
|
||||
|
||||
|
||||
Motivation
|
||||
-----
|
||||
|
||||
I simply couldn't find any lib supporting the full spec. Others were just wrong or used reflection and regex which i don't like.
|
||||
|
||||
|
||||
Contribution
|
||||
-----
|
||||
|
||||
Feel free to make a pull request. For bigger changes create a issue first to discuss about it.
|
||||
|
||||
|
||||
License
|
||||
-----
|
||||
|
||||
See [LICENSE](LICENSE) file.
|
23
vendor/github.com/blang/semver/json.go
generated
vendored
Normal file
23
vendor/github.com/blang/semver/json.go
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
package semver
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// MarshalJSON implements the encoding/json.Marshaler interface.
|
||||
func (v Version) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(v.String())
|
||||
}
|
||||
|
||||
// UnmarshalJSON implements the encoding/json.Unmarshaler interface.
|
||||
func (v *Version) UnmarshalJSON(data []byte) (err error) {
|
||||
var versionString string
|
||||
|
||||
if err = json.Unmarshal(data, &versionString); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
*v, err = Parse(versionString)
|
||||
|
||||
return
|
||||
}
|
395
vendor/github.com/blang/semver/semver.go
generated
vendored
Normal file
395
vendor/github.com/blang/semver/semver.go
generated
vendored
Normal file
|
@ -0,0 +1,395 @@
|
|||
package semver
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
const (
|
||||
numbers string = "0123456789"
|
||||
alphas = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-"
|
||||
alphanum = alphas + numbers
|
||||
)
|
||||
|
||||
// SpecVersion is the latest fully supported spec version of semver
|
||||
var SpecVersion = Version{
|
||||
Major: 2,
|
||||
Minor: 0,
|
||||
Patch: 0,
|
||||
}
|
||||
|
||||
// Version represents a semver compatible version
|
||||
type Version struct {
|
||||
Major uint64
|
||||
Minor uint64
|
||||
Patch uint64
|
||||
Pre []PRVersion
|
||||
Build []string //No Precendence
|
||||
}
|
||||
|
||||
// Version to string
|
||||
func (v Version) String() string {
|
||||
b := make([]byte, 0, 5)
|
||||
b = strconv.AppendUint(b, v.Major, 10)
|
||||
b = append(b, '.')
|
||||
b = strconv.AppendUint(b, v.Minor, 10)
|
||||
b = append(b, '.')
|
||||
b = strconv.AppendUint(b, v.Patch, 10)
|
||||
|
||||
if len(v.Pre) > 0 {
|
||||
b = append(b, '-')
|
||||
b = append(b, v.Pre[0].String()...)
|
||||
|
||||
for _, pre := range v.Pre[1:] {
|
||||
b = append(b, '.')
|
||||
b = append(b, pre.String()...)
|
||||
}
|
||||
}
|
||||
|
||||
if len(v.Build) > 0 {
|
||||
b = append(b, '+')
|
||||
b = append(b, v.Build[0]...)
|
||||
|
||||
for _, build := range v.Build[1:] {
|
||||
b = append(b, '.')
|
||||
b = append(b, build...)
|
||||
}
|
||||
}
|
||||
|
||||
return string(b)
|
||||
}
|
||||
|
||||
// Equals checks if v is equal to o.
|
||||
func (v Version) Equals(o Version) bool {
|
||||
return (v.Compare(o) == 0)
|
||||
}
|
||||
|
||||
// EQ checks if v is equal to o.
|
||||
func (v Version) EQ(o Version) bool {
|
||||
return (v.Compare(o) == 0)
|
||||
}
|
||||
|
||||
// NE checks if v is not equal to o.
|
||||
func (v Version) NE(o Version) bool {
|
||||
return (v.Compare(o) != 0)
|
||||
}
|
||||
|
||||
// GT checks if v is greater than o.
|
||||
func (v Version) GT(o Version) bool {
|
||||
return (v.Compare(o) == 1)
|
||||
}
|
||||
|
||||
// GTE checks if v is greater than or equal to o.
|
||||
func (v Version) GTE(o Version) bool {
|
||||
return (v.Compare(o) >= 0)
|
||||
}
|
||||
|
||||
// GE checks if v is greater than or equal to o.
|
||||
func (v Version) GE(o Version) bool {
|
||||
return (v.Compare(o) >= 0)
|
||||
}
|
||||
|
||||
// LT checks if v is less than o.
|
||||
func (v Version) LT(o Version) bool {
|
||||
return (v.Compare(o) == -1)
|
||||
}
|
||||
|
||||
// LTE checks if v is less than or equal to o.
|
||||
func (v Version) LTE(o Version) bool {
|
||||
return (v.Compare(o) <= 0)
|
||||
}
|
||||
|
||||
// LE checks if v is less than or equal to o.
|
||||
func (v Version) LE(o Version) bool {
|
||||
return (v.Compare(o) <= 0)
|
||||
}
|
||||
|
||||
// Compare compares Versions v to o:
|
||||
// -1 == v is less than o
|
||||
// 0 == v is equal to o
|
||||
// 1 == v is greater than o
|
||||
func (v Version) Compare(o Version) int {
|
||||
if v.Major != o.Major {
|
||||
if v.Major > o.Major {
|
||||
return 1
|
||||
}
|
||||
return -1
|
||||
}
|
||||
if v.Minor != o.Minor {
|
||||
if v.Minor > o.Minor {
|
||||
return 1
|
||||
}
|
||||
return -1
|
||||
}
|
||||
if v.Patch != o.Patch {
|
||||
if v.Patch > o.Patch {
|
||||
return 1
|
||||
}
|
||||
return -1
|
||||
}
|
||||
|
||||
// Quick comparison if a version has no prerelease versions
|
||||
if len(v.Pre) == 0 && len(o.Pre) == 0 {
|
||||
return 0
|
||||
} else if len(v.Pre) == 0 && len(o.Pre) > 0 {
|
||||
return 1
|
||||
} else if len(v.Pre) > 0 && len(o.Pre) == 0 {
|
||||
return -1
|
||||
}
|
||||
|
||||
i := 0
|
||||
for ; i < len(v.Pre) && i < len(o.Pre); i++ {
|
||||
if comp := v.Pre[i].Compare(o.Pre[i]); comp == 0 {
|
||||
continue
|
||||
} else if comp == 1 {
|
||||
return 1
|
||||
} else {
|
||||
return -1
|
||||
}
|
||||
}
|
||||
|
||||
// If all pr versions are the equal but one has further prversion, this one greater
|
||||
if i == len(v.Pre) && i == len(o.Pre) {
|
||||
return 0
|
||||
} else if i == len(v.Pre) && i < len(o.Pre) {
|
||||
return -1
|
||||
} else {
|
||||
return 1
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Validate validates v and returns error in case
|
||||
func (v Version) Validate() error {
|
||||
// Major, Minor, Patch already validated using uint64
|
||||
|
||||
for _, pre := range v.Pre {
|
||||
if !pre.IsNum { //Numeric prerelease versions already uint64
|
||||
if len(pre.VersionStr) == 0 {
|
||||
return fmt.Errorf("Prerelease can not be empty %q", pre.VersionStr)
|
||||
}
|
||||
if !containsOnly(pre.VersionStr, alphanum) {
|
||||
return fmt.Errorf("Invalid character(s) found in prerelease %q", pre.VersionStr)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for _, build := range v.Build {
|
||||
if len(build) == 0 {
|
||||
return fmt.Errorf("Build meta data can not be empty %q", build)
|
||||
}
|
||||
if !containsOnly(build, alphanum) {
|
||||
return fmt.Errorf("Invalid character(s) found in build meta data %q", build)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// New is an alias for Parse and returns a pointer, parses version string and returns a validated Version or error
|
||||
func New(s string) (vp *Version, err error) {
|
||||
v, err := Parse(s)
|
||||
vp = &v
|
||||
return
|
||||
}
|
||||
|
||||
// Make is an alias for Parse, parses version string and returns a validated Version or error
|
||||
func Make(s string) (Version, error) {
|
||||
return Parse(s)
|
||||
}
|
||||
|
||||
// Parse parses version string and returns a validated Version or error
|
||||
func Parse(s string) (Version, error) {
|
||||
if len(s) == 0 {
|
||||
return Version{}, errors.New("Version string empty")
|
||||
}
|
||||
|
||||
// Split into major.minor.(patch+pr+meta)
|
||||
parts := strings.SplitN(s, ".", 3)
|
||||
if len(parts) != 3 {
|
||||
return Version{}, errors.New("No Major.Minor.Patch elements found")
|
||||
}
|
||||
|
||||
// Major
|
||||
if !containsOnly(parts[0], numbers) {
|
||||
return Version{}, fmt.Errorf("Invalid character(s) found in major number %q", parts[0])
|
||||
}
|
||||
if hasLeadingZeroes(parts[0]) {
|
||||
return Version{}, fmt.Errorf("Major number must not contain leading zeroes %q", parts[0])
|
||||
}
|
||||
major, err := strconv.ParseUint(parts[0], 10, 64)
|
||||
if err != nil {
|
||||
return Version{}, err
|
||||
}
|
||||
|
||||
// Minor
|
||||
if !containsOnly(parts[1], numbers) {
|
||||
return Version{}, fmt.Errorf("Invalid character(s) found in minor number %q", parts[1])
|
||||
}
|
||||
if hasLeadingZeroes(parts[1]) {
|
||||
return Version{}, fmt.Errorf("Minor number must not contain leading zeroes %q", parts[1])
|
||||
}
|
||||
minor, err := strconv.ParseUint(parts[1], 10, 64)
|
||||
if err != nil {
|
||||
return Version{}, err
|
||||
}
|
||||
|
||||
v := Version{}
|
||||
v.Major = major
|
||||
v.Minor = minor
|
||||
|
||||
var build, prerelease []string
|
||||
patchStr := parts[2]
|
||||
|
||||
if buildIndex := strings.IndexRune(patchStr, '+'); buildIndex != -1 {
|
||||
build = strings.Split(patchStr[buildIndex+1:], ".")
|
||||
patchStr = patchStr[:buildIndex]
|
||||
}
|
||||
|
||||
if preIndex := strings.IndexRune(patchStr, '-'); preIndex != -1 {
|
||||
prerelease = strings.Split(patchStr[preIndex+1:], ".")
|
||||
patchStr = patchStr[:preIndex]
|
||||
}
|
||||
|
||||
if !containsOnly(patchStr, numbers) {
|
||||
return Version{}, fmt.Errorf("Invalid character(s) found in patch number %q", patchStr)
|
||||
}
|
||||
if hasLeadingZeroes(patchStr) {
|
||||
return Version{}, fmt.Errorf("Patch number must not contain leading zeroes %q", patchStr)
|
||||
}
|
||||
patch, err := strconv.ParseUint(patchStr, 10, 64)
|
||||
if err != nil {
|
||||
return Version{}, err
|
||||
}
|
||||
|
||||
v.Patch = patch
|
||||
|
||||
// Prerelease
|
||||
for _, prstr := range prerelease {
|
||||
parsedPR, err := NewPRVersion(prstr)
|
||||
if err != nil {
|
||||
return Version{}, err
|
||||
}
|
||||
v.Pre = append(v.Pre, parsedPR)
|
||||
}
|
||||
|
||||
// Build meta data
|
||||
for _, str := range build {
|
||||
if len(str) == 0 {
|
||||
return Version{}, errors.New("Build meta data is empty")
|
||||
}
|
||||
if !containsOnly(str, alphanum) {
|
||||
return Version{}, fmt.Errorf("Invalid character(s) found in build meta data %q", str)
|
||||
}
|
||||
v.Build = append(v.Build, str)
|
||||
}
|
||||
|
||||
return v, nil
|
||||
}
|
||||
|
||||
// MustParse is like Parse but panics if the version cannot be parsed.
|
||||
func MustParse(s string) Version {
|
||||
v, err := Parse(s)
|
||||
if err != nil {
|
||||
panic(`semver: Parse(` + s + `): ` + err.Error())
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// PRVersion represents a PreRelease Version
|
||||
type PRVersion struct {
|
||||
VersionStr string
|
||||
VersionNum uint64
|
||||
IsNum bool
|
||||
}
|
||||
|
||||
// NewPRVersion creates a new valid prerelease version
|
||||
func NewPRVersion(s string) (PRVersion, error) {
|
||||
if len(s) == 0 {
|
||||
return PRVersion{}, errors.New("Prerelease is empty")
|
||||
}
|
||||
v := PRVersion{}
|
||||
if containsOnly(s, numbers) {
|
||||
if hasLeadingZeroes(s) {
|
||||
return PRVersion{}, fmt.Errorf("Numeric PreRelease version must not contain leading zeroes %q", s)
|
||||
}
|
||||
num, err := strconv.ParseUint(s, 10, 64)
|
||||
|
||||
// Might never be hit, but just in case
|
||||
if err != nil {
|
||||
return PRVersion{}, err
|
||||
}
|
||||
v.VersionNum = num
|
||||
v.IsNum = true
|
||||
} else if containsOnly(s, alphanum) {
|
||||
v.VersionStr = s
|
||||
v.IsNum = false
|
||||
} else {
|
||||
return PRVersion{}, fmt.Errorf("Invalid character(s) found in prerelease %q", s)
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
|
||||
// IsNumeric checks if prerelease-version is numeric
|
||||
func (v PRVersion) IsNumeric() bool {
|
||||
return v.IsNum
|
||||
}
|
||||
|
||||
// Compare compares two PreRelease Versions v and o:
|
||||
// -1 == v is less than o
|
||||
// 0 == v is equal to o
|
||||
// 1 == v is greater than o
|
||||
func (v PRVersion) Compare(o PRVersion) int {
|
||||
if v.IsNum && !o.IsNum {
|
||||
return -1
|
||||
} else if !v.IsNum && o.IsNum {
|
||||
return 1
|
||||
} else if v.IsNum && o.IsNum {
|
||||
if v.VersionNum == o.VersionNum {
|
||||
return 0
|
||||
} else if v.VersionNum > o.VersionNum {
|
||||
return 1
|
||||
} else {
|
||||
return -1
|
||||
}
|
||||
} else { // both are Alphas
|
||||
if v.VersionStr == o.VersionStr {
|
||||
return 0
|
||||
} else if v.VersionStr > o.VersionStr {
|
||||
return 1
|
||||
} else {
|
||||
return -1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PreRelease version to string
|
||||
func (v PRVersion) String() string {
|
||||
if v.IsNum {
|
||||
return strconv.FormatUint(v.VersionNum, 10)
|
||||
}
|
||||
return v.VersionStr
|
||||
}
|
||||
|
||||
func containsOnly(s string, set string) bool {
|
||||
return strings.IndexFunc(s, func(r rune) bool {
|
||||
return !strings.ContainsRune(set, r)
|
||||
}) == -1
|
||||
}
|
||||
|
||||
func hasLeadingZeroes(s string) bool {
|
||||
return len(s) > 1 && s[0] == '0'
|
||||
}
|
||||
|
||||
// NewBuildVersion creates a new valid build version
|
||||
func NewBuildVersion(s string) (string, error) {
|
||||
if len(s) == 0 {
|
||||
return "", errors.New("Buildversion is empty")
|
||||
}
|
||||
if !containsOnly(s, alphanum) {
|
||||
return "", fmt.Errorf("Invalid character(s) found in build meta data %q", s)
|
||||
}
|
||||
return s, nil
|
||||
}
|
28
vendor/github.com/blang/semver/sort.go
generated
vendored
Normal file
28
vendor/github.com/blang/semver/sort.go
generated
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
package semver
|
||||
|
||||
import (
|
||||
"sort"
|
||||
)
|
||||
|
||||
// Versions represents multiple versions.
|
||||
type Versions []Version
|
||||
|
||||
// Len returns length of version collection
|
||||
func (s Versions) Len() int {
|
||||
return len(s)
|
||||
}
|
||||
|
||||
// Swap swaps two versions inside the collection by its indices
|
||||
func (s Versions) Swap(i, j int) {
|
||||
s[i], s[j] = s[j], s[i]
|
||||
}
|
||||
|
||||
// Less checks if version at index i is less than version at index j
|
||||
func (s Versions) Less(i, j int) bool {
|
||||
return s[i].LT(s[j])
|
||||
}
|
||||
|
||||
// Sort sorts a slice of versions
|
||||
func Sort(versions []Version) {
|
||||
sort.Sort(Versions(versions))
|
||||
}
|
30
vendor/github.com/blang/semver/sql.go
generated
vendored
Normal file
30
vendor/github.com/blang/semver/sql.go
generated
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
package semver
|
||||
|
||||
import (
|
||||
"database/sql/driver"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// Scan implements the database/sql.Scanner interface.
|
||||
func (v *Version) Scan(src interface{}) (err error) {
|
||||
var str string
|
||||
switch src := src.(type) {
|
||||
case string:
|
||||
str = src
|
||||
case []byte:
|
||||
str = string(src)
|
||||
default:
|
||||
return fmt.Errorf("Version.Scan: cannot convert %T to string.", src)
|
||||
}
|
||||
|
||||
if t, err := Parse(str); err == nil {
|
||||
*v = t
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// Value implements the database/sql/driver.Valuer interface.
|
||||
func (v Version) Value() (driver.Value, error) {
|
||||
return v.String(), nil
|
||||
}
|
1
vendor/github.com/pborman/uuid/CONTRIBUTORS
generated
vendored
Normal file
1
vendor/github.com/pborman/uuid/CONTRIBUTORS
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
Paul Borman <borman@google.com>
|
27
vendor/github.com/pborman/uuid/LICENSE
generated
vendored
Normal file
27
vendor/github.com/pborman/uuid/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
Copyright (c) 2009,2014 Google Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Google Inc. nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
84
vendor/github.com/pborman/uuid/dce.go
generated
vendored
Executable file
84
vendor/github.com/pborman/uuid/dce.go
generated
vendored
Executable file
|
@ -0,0 +1,84 @@
|
|||
// Copyright 2011 Google Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package uuid
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
// A Domain represents a Version 2 domain
|
||||
type Domain byte
|
||||
|
||||
// Domain constants for DCE Security (Version 2) UUIDs.
|
||||
const (
|
||||
Person = Domain(0)
|
||||
Group = Domain(1)
|
||||
Org = Domain(2)
|
||||
)
|
||||
|
||||
// NewDCESecurity returns a DCE Security (Version 2) UUID.
|
||||
//
|
||||
// The domain should be one of Person, Group or Org.
|
||||
// On a POSIX system the id should be the users UID for the Person
|
||||
// domain and the users GID for the Group. The meaning of id for
|
||||
// the domain Org or on non-POSIX systems is site defined.
|
||||
//
|
||||
// For a given domain/id pair the same token may be returned for up to
|
||||
// 7 minutes and 10 seconds.
|
||||
func NewDCESecurity(domain Domain, id uint32) UUID {
|
||||
uuid := NewUUID()
|
||||
if uuid != nil {
|
||||
uuid[6] = (uuid[6] & 0x0f) | 0x20 // Version 2
|
||||
uuid[9] = byte(domain)
|
||||
binary.BigEndian.PutUint32(uuid[0:], id)
|
||||
}
|
||||
return uuid
|
||||
}
|
||||
|
||||
// NewDCEPerson returns a DCE Security (Version 2) UUID in the person
|
||||
// domain with the id returned by os.Getuid.
|
||||
//
|
||||
// NewDCEPerson(Person, uint32(os.Getuid()))
|
||||
func NewDCEPerson() UUID {
|
||||
return NewDCESecurity(Person, uint32(os.Getuid()))
|
||||
}
|
||||
|
||||
// NewDCEGroup returns a DCE Security (Version 2) UUID in the group
|
||||
// domain with the id returned by os.Getgid.
|
||||
//
|
||||
// NewDCEGroup(Group, uint32(os.Getgid()))
|
||||
func NewDCEGroup() UUID {
|
||||
return NewDCESecurity(Group, uint32(os.Getgid()))
|
||||
}
|
||||
|
||||
// Domain returns the domain for a Version 2 UUID or false.
|
||||
func (uuid UUID) Domain() (Domain, bool) {
|
||||
if v, _ := uuid.Version(); v != 2 {
|
||||
return 0, false
|
||||
}
|
||||
return Domain(uuid[9]), true
|
||||
}
|
||||
|
||||
// Id returns the id for a Version 2 UUID or false.
|
||||
func (uuid UUID) Id() (uint32, bool) {
|
||||
if v, _ := uuid.Version(); v != 2 {
|
||||
return 0, false
|
||||
}
|
||||
return binary.BigEndian.Uint32(uuid[0:4]), true
|
||||
}
|
||||
|
||||
func (d Domain) String() string {
|
||||
switch d {
|
||||
case Person:
|
||||
return "Person"
|
||||
case Group:
|
||||
return "Group"
|
||||
case Org:
|
||||
return "Org"
|
||||
}
|
||||
return fmt.Sprintf("Domain%d", int(d))
|
||||
}
|
8
vendor/github.com/pborman/uuid/doc.go
generated
vendored
Executable file
8
vendor/github.com/pborman/uuid/doc.go
generated
vendored
Executable file
|
@ -0,0 +1,8 @@
|
|||
// Copyright 2011 Google Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// The uuid package generates and inspects UUIDs.
|
||||
//
|
||||
// UUIDs are based on RFC 4122 and DCE 1.1: Authentication and Security Services.
|
||||
package uuid
|
53
vendor/github.com/pborman/uuid/hash.go
generated
vendored
Normal file
53
vendor/github.com/pborman/uuid/hash.go
generated
vendored
Normal file
|
@ -0,0 +1,53 @@
|
|||
// Copyright 2011 Google Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package uuid
|
||||
|
||||
import (
|
||||
"crypto/md5"
|
||||
"crypto/sha1"
|
||||
"hash"
|
||||
)
|
||||
|
||||
// Well known Name Space IDs and UUIDs
|
||||
var (
|
||||
NameSpace_DNS = Parse("6ba7b810-9dad-11d1-80b4-00c04fd430c8")
|
||||
NameSpace_URL = Parse("6ba7b811-9dad-11d1-80b4-00c04fd430c8")
|
||||
NameSpace_OID = Parse("6ba7b812-9dad-11d1-80b4-00c04fd430c8")
|
||||
NameSpace_X500 = Parse("6ba7b814-9dad-11d1-80b4-00c04fd430c8")
|
||||
NIL = Parse("00000000-0000-0000-0000-000000000000")
|
||||
)
|
||||
|
||||
// NewHash returns a new UUID dervied from the hash of space concatenated with
|
||||
// data generated by h. The hash should be at least 16 byte in length. The
|
||||
// first 16 bytes of the hash are used to form the UUID. The version of the
|
||||
// UUID will be the lower 4 bits of version. NewHash is used to implement
|
||||
// NewMD5 and NewSHA1.
|
||||
func NewHash(h hash.Hash, space UUID, data []byte, version int) UUID {
|
||||
h.Reset()
|
||||
h.Write(space)
|
||||
h.Write([]byte(data))
|
||||
s := h.Sum(nil)
|
||||
uuid := make([]byte, 16)
|
||||
copy(uuid, s)
|
||||
uuid[6] = (uuid[6] & 0x0f) | uint8((version&0xf)<<4)
|
||||
uuid[8] = (uuid[8] & 0x3f) | 0x80 // RFC 4122 variant
|
||||
return uuid
|
||||
}
|
||||
|
||||
// NewMD5 returns a new MD5 (Version 3) UUID based on the
|
||||
// supplied name space and data.
|
||||
//
|
||||
// NewHash(md5.New(), space, data, 3)
|
||||
func NewMD5(space UUID, data []byte) UUID {
|
||||
return NewHash(md5.New(), space, data, 3)
|
||||
}
|
||||
|
||||
// NewSHA1 returns a new SHA1 (Version 5) UUID based on the
|
||||
// supplied name space and data.
|
||||
//
|
||||
// NewHash(sha1.New(), space, data, 5)
|
||||
func NewSHA1(space UUID, data []byte) UUID {
|
||||
return NewHash(sha1.New(), space, data, 5)
|
||||
}
|
30
vendor/github.com/pborman/uuid/json.go
generated
vendored
Normal file
30
vendor/github.com/pborman/uuid/json.go
generated
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
// Copyright 2014 Google Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package uuid
|
||||
|
||||
import "errors"
|
||||
|
||||
func (u UUID) MarshalJSON() ([]byte, error) {
|
||||
if len(u) == 0 {
|
||||
return []byte(`""`), nil
|
||||
}
|
||||
return []byte(`"` + u.String() + `"`), nil
|
||||
}
|
||||
|
||||
func (u *UUID) UnmarshalJSON(data []byte) error {
|
||||
if len(data) == 0 || string(data) == `""` {
|
||||
return nil
|
||||
}
|
||||
if len(data) < 2 || data[0] != '"' || data[len(data)-1] != '"' {
|
||||
return errors.New("invalid UUID format")
|
||||
}
|
||||
data = data[1 : len(data)-1]
|
||||
uu := Parse(string(data))
|
||||
if uu == nil {
|
||||
return errors.New("invalid UUID format")
|
||||
}
|
||||
*u = uu
|
||||
return nil
|
||||
}
|
101
vendor/github.com/pborman/uuid/node.go
generated
vendored
Executable file
101
vendor/github.com/pborman/uuid/node.go
generated
vendored
Executable file
|
@ -0,0 +1,101 @@
|
|||
// Copyright 2011 Google Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package uuid
|
||||
|
||||
import "net"
|
||||
|
||||
var (
|
||||
interfaces []net.Interface // cached list of interfaces
|
||||
ifname string // name of interface being used
|
||||
nodeID []byte // hardware for version 1 UUIDs
|
||||
)
|
||||
|
||||
// NodeInterface returns the name of the interface from which the NodeID was
|
||||
// derived. The interface "user" is returned if the NodeID was set by
|
||||
// SetNodeID.
|
||||
func NodeInterface() string {
|
||||
return ifname
|
||||
}
|
||||
|
||||
// SetNodeInterface selects the hardware address to be used for Version 1 UUIDs.
|
||||
// If name is "" then the first usable interface found will be used or a random
|
||||
// Node ID will be generated. If a named interface cannot be found then false
|
||||
// is returned.
|
||||
//
|
||||
// SetNodeInterface never fails when name is "".
|
||||
func SetNodeInterface(name string) bool {
|
||||
if interfaces == nil {
|
||||
var err error
|
||||
interfaces, err = net.Interfaces()
|
||||
if err != nil && name != "" {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
for _, ifs := range interfaces {
|
||||
if len(ifs.HardwareAddr) >= 6 && (name == "" || name == ifs.Name) {
|
||||
if setNodeID(ifs.HardwareAddr) {
|
||||
ifname = ifs.Name
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// We found no interfaces with a valid hardware address. If name
|
||||
// does not specify a specific interface generate a random Node ID
|
||||
// (section 4.1.6)
|
||||
if name == "" {
|
||||
if nodeID == nil {
|
||||
nodeID = make([]byte, 6)
|
||||
}
|
||||
randomBits(nodeID)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// NodeID returns a slice of a copy of the current Node ID, setting the Node ID
|
||||
// if not already set.
|
||||
func NodeID() []byte {
|
||||
if nodeID == nil {
|
||||
SetNodeInterface("")
|
||||
}
|
||||
nid := make([]byte, 6)
|
||||
copy(nid, nodeID)
|
||||
return nid
|
||||
}
|
||||
|
||||
// SetNodeID sets the Node ID to be used for Version 1 UUIDs. The first 6 bytes
|
||||
// of id are used. If id is less than 6 bytes then false is returned and the
|
||||
// Node ID is not set.
|
||||
func SetNodeID(id []byte) bool {
|
||||
if setNodeID(id) {
|
||||
ifname = "user"
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func setNodeID(id []byte) bool {
|
||||
if len(id) < 6 {
|
||||
return false
|
||||
}
|
||||
if nodeID == nil {
|
||||
nodeID = make([]byte, 6)
|
||||
}
|
||||
copy(nodeID, id)
|
||||
return true
|
||||
}
|
||||
|
||||
// NodeID returns the 6 byte node id encoded in uuid. It returns nil if uuid is
|
||||
// not valid. The NodeID is only well defined for version 1 and 2 UUIDs.
|
||||
func (uuid UUID) NodeID() []byte {
|
||||
if len(uuid) != 16 {
|
||||
return nil
|
||||
}
|
||||
node := make([]byte, 6)
|
||||
copy(node, uuid[10:])
|
||||
return node
|
||||
}
|
132
vendor/github.com/pborman/uuid/time.go
generated
vendored
Executable file
132
vendor/github.com/pborman/uuid/time.go
generated
vendored
Executable file
|
@ -0,0 +1,132 @@
|
|||
// Copyright 2014 Google Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package uuid
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
// A Time represents a time as the number of 100's of nanoseconds since 15 Oct
|
||||
// 1582.
|
||||
type Time int64
|
||||
|
||||
const (
|
||||
lillian = 2299160 // Julian day of 15 Oct 1582
|
||||
unix = 2440587 // Julian day of 1 Jan 1970
|
||||
epoch = unix - lillian // Days between epochs
|
||||
g1582 = epoch * 86400 // seconds between epochs
|
||||
g1582ns100 = g1582 * 10000000 // 100s of a nanoseconds between epochs
|
||||
)
|
||||
|
||||
var (
|
||||
mu sync.Mutex
|
||||
lasttime uint64 // last time we returned
|
||||
clock_seq uint16 // clock sequence for this run
|
||||
|
||||
timeNow = time.Now // for testing
|
||||
)
|
||||
|
||||
// UnixTime converts t the number of seconds and nanoseconds using the Unix
|
||||
// epoch of 1 Jan 1970.
|
||||
func (t Time) UnixTime() (sec, nsec int64) {
|
||||
sec = int64(t - g1582ns100)
|
||||
nsec = (sec % 10000000) * 100
|
||||
sec /= 10000000
|
||||
return sec, nsec
|
||||
}
|
||||
|
||||
// GetTime returns the current Time (100s of nanoseconds since 15 Oct 1582) and
|
||||
// clock sequence as well as adjusting the clock sequence as needed. An error
|
||||
// is returned if the current time cannot be determined.
|
||||
func GetTime() (Time, uint16, error) {
|
||||
defer mu.Unlock()
|
||||
mu.Lock()
|
||||
return getTime()
|
||||
}
|
||||
|
||||
func getTime() (Time, uint16, error) {
|
||||
t := timeNow()
|
||||
|
||||
// If we don't have a clock sequence already, set one.
|
||||
if clock_seq == 0 {
|
||||
setClockSequence(-1)
|
||||
}
|
||||
now := uint64(t.UnixNano()/100) + g1582ns100
|
||||
|
||||
// If time has gone backwards with this clock sequence then we
|
||||
// increment the clock sequence
|
||||
if now <= lasttime {
|
||||
clock_seq = ((clock_seq + 1) & 0x3fff) | 0x8000
|
||||
}
|
||||
lasttime = now
|
||||
return Time(now), clock_seq, nil
|
||||
}
|
||||
|
||||
// ClockSequence returns the current clock sequence, generating one if not
|
||||
// already set. The clock sequence is only used for Version 1 UUIDs.
|
||||
//
|
||||
// The uuid package does not use global static storage for the clock sequence or
|
||||
// the last time a UUID was generated. Unless SetClockSequence a new random
|
||||
// clock sequence is generated the first time a clock sequence is requested by
|
||||
// ClockSequence, GetTime, or NewUUID. (section 4.2.1.1) sequence is generated
|
||||
// for
|
||||
func ClockSequence() int {
|
||||
defer mu.Unlock()
|
||||
mu.Lock()
|
||||
return clockSequence()
|
||||
}
|
||||
|
||||
func clockSequence() int {
|
||||
if clock_seq == 0 {
|
||||
setClockSequence(-1)
|
||||
}
|
||||
return int(clock_seq & 0x3fff)
|
||||
}
|
||||
|
||||
// SetClockSeq sets the clock sequence to the lower 14 bits of seq. Setting to
|
||||
// -1 causes a new sequence to be generated.
|
||||
func SetClockSequence(seq int) {
|
||||
defer mu.Unlock()
|
||||
mu.Lock()
|
||||
setClockSequence(seq)
|
||||
}
|
||||
|
||||
func setClockSequence(seq int) {
|
||||
if seq == -1 {
|
||||
var b [2]byte
|
||||
randomBits(b[:]) // clock sequence
|
||||
seq = int(b[0])<<8 | int(b[1])
|
||||
}
|
||||
old_seq := clock_seq
|
||||
clock_seq = uint16(seq&0x3fff) | 0x8000 // Set our variant
|
||||
if old_seq != clock_seq {
|
||||
lasttime = 0
|
||||
}
|
||||
}
|
||||
|
||||
// Time returns the time in 100s of nanoseconds since 15 Oct 1582 encoded in
|
||||
// uuid. It returns false if uuid is not valid. The time is only well defined
|
||||
// for version 1 and 2 UUIDs.
|
||||
func (uuid UUID) Time() (Time, bool) {
|
||||
if len(uuid) != 16 {
|
||||
return 0, false
|
||||
}
|
||||
time := int64(binary.BigEndian.Uint32(uuid[0:4]))
|
||||
time |= int64(binary.BigEndian.Uint16(uuid[4:6])) << 32
|
||||
time |= int64(binary.BigEndian.Uint16(uuid[6:8])&0xfff) << 48
|
||||
return Time(time), true
|
||||
}
|
||||
|
||||
// ClockSequence returns the clock sequence encoded in uuid. It returns false
|
||||
// if uuid is not valid. The clock sequence is only well defined for version 1
|
||||
// and 2 UUIDs.
|
||||
func (uuid UUID) ClockSequence() (int, bool) {
|
||||
if len(uuid) != 16 {
|
||||
return 0, false
|
||||
}
|
||||
return int(binary.BigEndian.Uint16(uuid[8:10])) & 0x3fff, true
|
||||
}
|
43
vendor/github.com/pborman/uuid/util.go
generated
vendored
Normal file
43
vendor/github.com/pborman/uuid/util.go
generated
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
// Copyright 2011 Google Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package uuid
|
||||
|
||||
import (
|
||||
"io"
|
||||
)
|
||||
|
||||
// randomBits completely fills slice b with random data.
|
||||
func randomBits(b []byte) {
|
||||
if _, err := io.ReadFull(rander, b); err != nil {
|
||||
panic(err.Error()) // rand should never fail
|
||||
}
|
||||
}
|
||||
|
||||
// xvalues returns the value of a byte as a hexadecimal digit or 255.
|
||||
var xvalues = []byte{
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 255, 255, 255, 255, 255, 255,
|
||||
255, 10, 11, 12, 13, 14, 15, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 10, 11, 12, 13, 14, 15, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
}
|
||||
|
||||
// xtob converts the the first two hex bytes of x into a byte.
|
||||
func xtob(x string) (byte, bool) {
|
||||
b1 := xvalues[x[0]]
|
||||
b2 := xvalues[x[1]]
|
||||
return (b1 << 4) | b2, b1 != 255 && b2 != 255
|
||||
}
|
163
vendor/github.com/pborman/uuid/uuid.go
generated
vendored
Executable file
163
vendor/github.com/pborman/uuid/uuid.go
generated
vendored
Executable file
|
@ -0,0 +1,163 @@
|
|||
// Copyright 2011 Google Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package uuid
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"crypto/rand"
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// A UUID is a 128 bit (16 byte) Universal Unique IDentifier as defined in RFC
|
||||
// 4122.
|
||||
type UUID []byte
|
||||
|
||||
// A Version represents a UUIDs version.
|
||||
type Version byte
|
||||
|
||||
// A Variant represents a UUIDs variant.
|
||||
type Variant byte
|
||||
|
||||
// Constants returned by Variant.
|
||||
const (
|
||||
Invalid = Variant(iota) // Invalid UUID
|
||||
RFC4122 // The variant specified in RFC4122
|
||||
Reserved // Reserved, NCS backward compatibility.
|
||||
Microsoft // Reserved, Microsoft Corporation backward compatibility.
|
||||
Future // Reserved for future definition.
|
||||
)
|
||||
|
||||
var rander = rand.Reader // random function
|
||||
|
||||
// New returns a new random (version 4) UUID as a string. It is a convenience
|
||||
// function for NewRandom().String().
|
||||
func New() string {
|
||||
return NewRandom().String()
|
||||
}
|
||||
|
||||
// Parse decodes s into a UUID or returns nil. Both the UUID form of
|
||||
// xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx and
|
||||
// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx are decoded.
|
||||
func Parse(s string) UUID {
|
||||
if len(s) == 36+9 {
|
||||
if strings.ToLower(s[:9]) != "urn:uuid:" {
|
||||
return nil
|
||||
}
|
||||
s = s[9:]
|
||||
} else if len(s) != 36 {
|
||||
return nil
|
||||
}
|
||||
if s[8] != '-' || s[13] != '-' || s[18] != '-' || s[23] != '-' {
|
||||
return nil
|
||||
}
|
||||
uuid := make([]byte, 16)
|
||||
for i, x := range []int{
|
||||
0, 2, 4, 6,
|
||||
9, 11,
|
||||
14, 16,
|
||||
19, 21,
|
||||
24, 26, 28, 30, 32, 34} {
|
||||
if v, ok := xtob(s[x:]); !ok {
|
||||
return nil
|
||||
} else {
|
||||
uuid[i] = v
|
||||
}
|
||||
}
|
||||
return uuid
|
||||
}
|
||||
|
||||
// Equal returns true if uuid1 and uuid2 are equal.
|
||||
func Equal(uuid1, uuid2 UUID) bool {
|
||||
return bytes.Equal(uuid1, uuid2)
|
||||
}
|
||||
|
||||
// String returns the string form of uuid, xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
|
||||
// , or "" if uuid is invalid.
|
||||
func (uuid UUID) String() string {
|
||||
if uuid == nil || len(uuid) != 16 {
|
||||
return ""
|
||||
}
|
||||
b := []byte(uuid)
|
||||
return fmt.Sprintf("%08x-%04x-%04x-%04x-%012x",
|
||||
b[:4], b[4:6], b[6:8], b[8:10], b[10:])
|
||||
}
|
||||
|
||||
// URN returns the RFC 2141 URN form of uuid,
|
||||
// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, or "" if uuid is invalid.
|
||||
func (uuid UUID) URN() string {
|
||||
if uuid == nil || len(uuid) != 16 {
|
||||
return ""
|
||||
}
|
||||
b := []byte(uuid)
|
||||
return fmt.Sprintf("urn:uuid:%08x-%04x-%04x-%04x-%012x",
|
||||
b[:4], b[4:6], b[6:8], b[8:10], b[10:])
|
||||
}
|
||||
|
||||
// Variant returns the variant encoded in uuid. It returns Invalid if
|
||||
// uuid is invalid.
|
||||
func (uuid UUID) Variant() Variant {
|
||||
if len(uuid) != 16 {
|
||||
return Invalid
|
||||
}
|
||||
switch {
|
||||
case (uuid[8] & 0xc0) == 0x80:
|
||||
return RFC4122
|
||||
case (uuid[8] & 0xe0) == 0xc0:
|
||||
return Microsoft
|
||||
case (uuid[8] & 0xe0) == 0xe0:
|
||||
return Future
|
||||
default:
|
||||
return Reserved
|
||||
}
|
||||
panic("unreachable")
|
||||
}
|
||||
|
||||
// Version returns the verison of uuid. It returns false if uuid is not
|
||||
// valid.
|
||||
func (uuid UUID) Version() (Version, bool) {
|
||||
if len(uuid) != 16 {
|
||||
return 0, false
|
||||
}
|
||||
return Version(uuid[6] >> 4), true
|
||||
}
|
||||
|
||||
func (v Version) String() string {
|
||||
if v > 15 {
|
||||
return fmt.Sprintf("BAD_VERSION_%d", v)
|
||||
}
|
||||
return fmt.Sprintf("VERSION_%d", v)
|
||||
}
|
||||
|
||||
func (v Variant) String() string {
|
||||
switch v {
|
||||
case RFC4122:
|
||||
return "RFC4122"
|
||||
case Reserved:
|
||||
return "Reserved"
|
||||
case Microsoft:
|
||||
return "Microsoft"
|
||||
case Future:
|
||||
return "Future"
|
||||
case Invalid:
|
||||
return "Invalid"
|
||||
}
|
||||
return fmt.Sprintf("BadVariant%d", int(v))
|
||||
}
|
||||
|
||||
// SetRand sets the random number generator to r, which implents io.Reader.
|
||||
// If r.Read returns an error when the package requests random data then
|
||||
// a panic will be issued.
|
||||
//
|
||||
// Calling SetRand with nil sets the random number generator to the default
|
||||
// generator.
|
||||
func SetRand(r io.Reader) {
|
||||
if r == nil {
|
||||
rander = rand.Reader
|
||||
return
|
||||
}
|
||||
rander = r
|
||||
}
|
41
vendor/github.com/pborman/uuid/version1.go
generated
vendored
Normal file
41
vendor/github.com/pborman/uuid/version1.go
generated
vendored
Normal file
|
@ -0,0 +1,41 @@
|
|||
// Copyright 2011 Google Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package uuid
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
)
|
||||
|
||||
// NewUUID returns a Version 1 UUID based on the current NodeID and clock
|
||||
// sequence, and the current time. If the NodeID has not been set by SetNodeID
|
||||
// or SetNodeInterface then it will be set automatically. If the NodeID cannot
|
||||
// be set NewUUID returns nil. If clock sequence has not been set by
|
||||
// SetClockSequence then it will be set automatically. If GetTime fails to
|
||||
// return the current NewUUID returns nil.
|
||||
func NewUUID() UUID {
|
||||
if nodeID == nil {
|
||||
SetNodeInterface("")
|
||||
}
|
||||
|
||||
now, seq, err := GetTime()
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
uuid := make([]byte, 16)
|
||||
|
||||
time_low := uint32(now & 0xffffffff)
|
||||
time_mid := uint16((now >> 32) & 0xffff)
|
||||
time_hi := uint16((now >> 48) & 0x0fff)
|
||||
time_hi |= 0x1000 // Version 1
|
||||
|
||||
binary.BigEndian.PutUint32(uuid[0:], time_low)
|
||||
binary.BigEndian.PutUint16(uuid[4:], time_mid)
|
||||
binary.BigEndian.PutUint16(uuid[6:], time_hi)
|
||||
binary.BigEndian.PutUint16(uuid[8:], seq)
|
||||
copy(uuid[10:], nodeID)
|
||||
|
||||
return uuid
|
||||
}
|
25
vendor/github.com/pborman/uuid/version4.go
generated
vendored
Normal file
25
vendor/github.com/pborman/uuid/version4.go
generated
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
// Copyright 2011 Google Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package uuid
|
||||
|
||||
// Random returns a Random (Version 4) UUID or panics.
|
||||
//
|
||||
// The strength of the UUIDs is based on the strength of the crypto/rand
|
||||
// package.
|
||||
//
|
||||
// A note about uniqueness derived from from the UUID Wikipedia entry:
|
||||
//
|
||||
// Randomly generated UUIDs have 122 random bits. One's annual risk of being
|
||||
// hit by a meteorite is estimated to be one chance in 17 billion, that
|
||||
// means the probability is about 0.00000000006 (6 × 10−11),
|
||||
// equivalent to the odds of creating a few tens of trillions of UUIDs in a
|
||||
// year and having one duplicate.
|
||||
func NewRandom() UUID {
|
||||
uuid := make([]byte, 16)
|
||||
randomBits([]byte(uuid))
|
||||
uuid[6] = (uuid[6] & 0x0f) | 0x40 // Version 4
|
||||
uuid[8] = (uuid[8] & 0x3f) | 0x80 // Variant is 10
|
||||
return uuid
|
||||
}
|
202
vendor/k8s.io/apimachinery/LICENSE
generated
vendored
202
vendor/k8s.io/apimachinery/LICENSE
generated
vendored
|
@ -1,202 +0,0 @@
|
|||
|
||||
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.
|
27
vendor/k8s.io/apimachinery/pkg/api/errors/OWNERS
generated
vendored
27
vendor/k8s.io/apimachinery/pkg/api/errors/OWNERS
generated
vendored
|
@ -1,27 +0,0 @@
|
|||
reviewers:
|
||||
- thockin
|
||||
- lavalamp
|
||||
- smarterclayton
|
||||
- wojtek-t
|
||||
- deads2k
|
||||
- brendandburns
|
||||
- derekwaynecarr
|
||||
- caesarxuchao
|
||||
- mikedanese
|
||||
- liggitt
|
||||
- nikhiljindal
|
||||
- gmarek
|
||||
- erictune
|
||||
- saad-ali
|
||||
- janetkuo
|
||||
- timstclair
|
||||
- eparis
|
||||
- timothysc
|
||||
- dims
|
||||
- spxtr
|
||||
- hongchaodeng
|
||||
- krousey
|
||||
- satnam6502
|
||||
- cjcullen
|
||||
- david-mcmahon
|
||||
- goltermann
|
26
vendor/k8s.io/apimachinery/pkg/api/meta/OWNERS
generated
vendored
26
vendor/k8s.io/apimachinery/pkg/api/meta/OWNERS
generated
vendored
|
@ -1,26 +0,0 @@
|
|||
reviewers:
|
||||
- thockin
|
||||
- smarterclayton
|
||||
- wojtek-t
|
||||
- deads2k
|
||||
- brendandburns
|
||||
- derekwaynecarr
|
||||
- caesarxuchao
|
||||
- mikedanese
|
||||
- liggitt
|
||||
- nikhiljindal
|
||||
- gmarek
|
||||
- kargakis
|
||||
- janetkuo
|
||||
- ncdc
|
||||
- eparis
|
||||
- dims
|
||||
- krousey
|
||||
- markturansky
|
||||
- fabioy
|
||||
- resouer
|
||||
- david-mcmahon
|
||||
- mfojtik
|
||||
- jianhuiz
|
||||
- feihujiang
|
||||
- ghodss
|
33
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/OWNERS
generated
vendored
33
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/OWNERS
generated
vendored
|
@ -1,33 +0,0 @@
|
|||
reviewers:
|
||||
- thockin
|
||||
- smarterclayton
|
||||
- wojtek-t
|
||||
- deads2k
|
||||
- brendandburns
|
||||
- caesarxuchao
|
||||
- liggitt
|
||||
- nikhiljindal
|
||||
- gmarek
|
||||
- erictune
|
||||
- davidopp
|
||||
- sttts
|
||||
- quinton-hoole
|
||||
- kargakis
|
||||
- luxas
|
||||
- janetkuo
|
||||
- justinsb
|
||||
- ncdc
|
||||
- timothysc
|
||||
- soltysh
|
||||
- dims
|
||||
- madhusudancs
|
||||
- hongchaodeng
|
||||
- krousey
|
||||
- mml
|
||||
- mbohlool
|
||||
- david-mcmahon
|
||||
- therc
|
||||
- mqliang
|
||||
- kevin-wangzefeng
|
||||
- jianhuiz
|
||||
- feihujiang
|
148
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/group_version.go
generated
vendored
148
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/group_version.go
generated
vendored
|
@ -1,148 +0,0 @@
|
|||
/*
|
||||
Copyright 2015 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 v1
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
// 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
|
||||
//
|
||||
// +protobuf.options.(gogoproto.goproto_stringer)=false
|
||||
type GroupResource struct {
|
||||
Group string `protobuf:"bytes,1,opt,name=group"`
|
||||
Resource string `protobuf:"bytes,2,opt,name=resource"`
|
||||
}
|
||||
|
||||
func (gr *GroupResource) String() string {
|
||||
if len(gr.Group) == 0 {
|
||||
return gr.Resource
|
||||
}
|
||||
return gr.Resource + "." + gr.Group
|
||||
}
|
||||
|
||||
// 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
|
||||
//
|
||||
// +protobuf.options.(gogoproto.goproto_stringer)=false
|
||||
type GroupVersionResource struct {
|
||||
Group string `protobuf:"bytes,1,opt,name=group"`
|
||||
Version string `protobuf:"bytes,2,opt,name=version"`
|
||||
Resource string `protobuf:"bytes,3,opt,name=resource"`
|
||||
}
|
||||
|
||||
func (gvr *GroupVersionResource) String() string {
|
||||
return strings.Join([]string{gvr.Group, "/", gvr.Version, ", Resource=", gvr.Resource}, "")
|
||||
}
|
||||
|
||||
// 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
|
||||
//
|
||||
// +protobuf.options.(gogoproto.goproto_stringer)=false
|
||||
type GroupKind struct {
|
||||
Group string `protobuf:"bytes,1,opt,name=group"`
|
||||
Kind string `protobuf:"bytes,2,opt,name=kind"`
|
||||
}
|
||||
|
||||
func (gk *GroupKind) String() string {
|
||||
if len(gk.Group) == 0 {
|
||||
return gk.Kind
|
||||
}
|
||||
return gk.Kind + "." + gk.Group
|
||||
}
|
||||
|
||||
// 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
|
||||
//
|
||||
// +protobuf.options.(gogoproto.goproto_stringer)=false
|
||||
type GroupVersionKind struct {
|
||||
Group string `protobuf:"bytes,1,opt,name=group"`
|
||||
Version string `protobuf:"bytes,2,opt,name=version"`
|
||||
Kind string `protobuf:"bytes,3,opt,name=kind"`
|
||||
}
|
||||
|
||||
func (gvk GroupVersionKind) String() string {
|
||||
return gvk.Group + "/" + gvk.Version + ", Kind=" + gvk.Kind
|
||||
}
|
||||
|
||||
// GroupVersion contains the "group" and the "version", which uniquely identifies the API.
|
||||
//
|
||||
// +protobuf.options.(gogoproto.goproto_stringer)=false
|
||||
type GroupVersion struct {
|
||||
Group string `protobuf:"bytes,1,opt,name=group"`
|
||||
Version string `protobuf:"bytes,2,opt,name=version"`
|
||||
}
|
||||
|
||||
// Empty returns true if group and version are empty
|
||||
func (gv GroupVersion) Empty() bool {
|
||||
return len(gv.Group) == 0 && len(gv.Version) == 0
|
||||
}
|
||||
|
||||
// String puts "group" and "version" into a single "group/version" string. For the legacy v1
|
||||
// it returns "v1".
|
||||
func (gv GroupVersion) String() string {
|
||||
// special case the internal apiVersion for the legacy kube types
|
||||
if gv.Empty() {
|
||||
return ""
|
||||
}
|
||||
|
||||
// special case of "v1" for backward compatibility
|
||||
if len(gv.Group) == 0 && gv.Version == "v1" {
|
||||
return gv.Version
|
||||
}
|
||||
if len(gv.Group) > 0 {
|
||||
return gv.Group + "/" + gv.Version
|
||||
}
|
||||
return gv.Version
|
||||
}
|
||||
|
||||
// MarshalJSON implements the json.Marshaller interface.
|
||||
func (gv GroupVersion) MarshalJSON() ([]byte, error) {
|
||||
s := gv.String()
|
||||
if strings.Count(s, "/") > 1 {
|
||||
return []byte{}, fmt.Errorf("illegal GroupVersion %v: contains more than one /", s)
|
||||
}
|
||||
return json.Marshal(s)
|
||||
}
|
||||
|
||||
func (gv *GroupVersion) unmarshal(value []byte) error {
|
||||
var s string
|
||||
if err := json.Unmarshal(value, &s); err != nil {
|
||||
return err
|
||||
}
|
||||
parsed, err := schema.ParseGroupVersion(s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
gv.Group, gv.Version = parsed.Group, parsed.Version
|
||||
return nil
|
||||
}
|
||||
|
||||
// UnmarshalJSON implements the json.Unmarshaller interface.
|
||||
func (gv *GroupVersion) UnmarshalJSON(value []byte) error {
|
||||
return gv.unmarshal(value)
|
||||
}
|
||||
|
||||
// UnmarshalTEXT implements the Ugorji's encoding.TextUnmarshaler interface.
|
||||
func (gv *GroupVersion) UnmarshalText(value []byte) error {
|
||||
return gv.unmarshal(value)
|
||||
}
|
75
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/labels.go
generated
vendored
75
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/labels.go
generated
vendored
|
@ -1,75 +0,0 @@
|
|||
/*
|
||||
Copyright 2016 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 v1
|
||||
|
||||
// Clones the given selector and returns a new selector with the given key and value added.
|
||||
// Returns the given selector, if labelKey is empty.
|
||||
func CloneSelectorAndAddLabel(selector *LabelSelector, labelKey, labelValue string) *LabelSelector {
|
||||
if labelKey == "" {
|
||||
// Don't need to add a label.
|
||||
return selector
|
||||
}
|
||||
|
||||
// Clone.
|
||||
newSelector := new(LabelSelector)
|
||||
|
||||
// TODO(madhusudancs): Check if you can use deepCopy_extensions_LabelSelector here.
|
||||
newSelector.MatchLabels = make(map[string]string)
|
||||
if selector.MatchLabels != nil {
|
||||
for key, val := range selector.MatchLabels {
|
||||
newSelector.MatchLabels[key] = val
|
||||
}
|
||||
}
|
||||
newSelector.MatchLabels[labelKey] = labelValue
|
||||
|
||||
if selector.MatchExpressions != nil {
|
||||
newMExps := make([]LabelSelectorRequirement, len(selector.MatchExpressions))
|
||||
for i, me := range selector.MatchExpressions {
|
||||
newMExps[i].Key = me.Key
|
||||
newMExps[i].Operator = me.Operator
|
||||
if me.Values != nil {
|
||||
newMExps[i].Values = make([]string, len(me.Values))
|
||||
copy(newMExps[i].Values, me.Values)
|
||||
} else {
|
||||
newMExps[i].Values = nil
|
||||
}
|
||||
}
|
||||
newSelector.MatchExpressions = newMExps
|
||||
} else {
|
||||
newSelector.MatchExpressions = nil
|
||||
}
|
||||
|
||||
return newSelector
|
||||
}
|
||||
|
||||
// AddLabelToSelector returns a selector with the given key and value added to the given selector's MatchLabels.
|
||||
func AddLabelToSelector(selector *LabelSelector, labelKey, labelValue string) *LabelSelector {
|
||||
if labelKey == "" {
|
||||
// Don't need to add a label.
|
||||
return selector
|
||||
}
|
||||
if selector.MatchLabels == nil {
|
||||
selector.MatchLabels = make(map[string]string)
|
||||
}
|
||||
selector.MatchLabels[labelKey] = labelValue
|
||||
return selector
|
||||
}
|
||||
|
||||
// SelectorHasLabel checks if the given selector contains the given label key in its MatchLabels
|
||||
func SelectorHasLabel(selector *LabelSelector, labelKey string) bool {
|
||||
return len(selector.MatchLabels[labelKey]) > 0
|
||||
}
|
201
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/meta.go
generated
vendored
201
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/meta.go
generated
vendored
|
@ -1,201 +0,0 @@
|
|||
/*
|
||||
Copyright 2016 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 v1
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/conversion"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
)
|
||||
|
||||
// ObjectMetaFor returns a pointer to a provided object's ObjectMeta.
|
||||
// TODO: allow runtime.Unknown to extract this object
|
||||
// TODO: Remove this function and use meta.ObjectMetaAccessor() instead.
|
||||
func ObjectMetaFor(obj runtime.Object) (*ObjectMeta, error) {
|
||||
v, err := conversion.EnforcePtr(obj)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var meta *ObjectMeta
|
||||
err = runtime.FieldPtr(v, "ObjectMeta", &meta)
|
||||
return meta, err
|
||||
}
|
||||
|
||||
// ListMetaFor returns a pointer to a provided object's ListMeta,
|
||||
// or an error if the object does not have that pointer.
|
||||
// TODO: allow runtime.Unknown to extract this object
|
||||
// TODO: Remove this function and use meta.ObjectMetaAccessor() instead.
|
||||
func ListMetaFor(obj runtime.Object) (*ListMeta, error) {
|
||||
v, err := conversion.EnforcePtr(obj)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var meta *ListMeta
|
||||
err = runtime.FieldPtr(v, "ListMeta", &meta)
|
||||
return meta, err
|
||||
}
|
||||
|
||||
// TODO: move this, Object, List, and Type to a different package
|
||||
type ObjectMetaAccessor interface {
|
||||
GetObjectMeta() Object
|
||||
}
|
||||
|
||||
// Object lets you work with object metadata from any of the versioned or
|
||||
// internal API objects. Attempting to set or retrieve a field on an object that does
|
||||
// not support that field (Name, UID, Namespace on lists) will be a no-op and return
|
||||
// a default value.
|
||||
type Object interface {
|
||||
GetNamespace() string
|
||||
SetNamespace(namespace string)
|
||||
GetName() string
|
||||
SetName(name string)
|
||||
GetGenerateName() string
|
||||
SetGenerateName(name string)
|
||||
GetUID() types.UID
|
||||
SetUID(uid types.UID)
|
||||
GetResourceVersion() string
|
||||
SetResourceVersion(version string)
|
||||
GetSelfLink() string
|
||||
SetSelfLink(selfLink string)
|
||||
GetCreationTimestamp() Time
|
||||
SetCreationTimestamp(timestamp Time)
|
||||
GetDeletionTimestamp() *Time
|
||||
SetDeletionTimestamp(timestamp *Time)
|
||||
GetLabels() map[string]string
|
||||
SetLabels(labels map[string]string)
|
||||
GetAnnotations() map[string]string
|
||||
SetAnnotations(annotations map[string]string)
|
||||
GetFinalizers() []string
|
||||
SetFinalizers(finalizers []string)
|
||||
GetOwnerReferences() []OwnerReference
|
||||
SetOwnerReferences([]OwnerReference)
|
||||
GetClusterName() string
|
||||
SetClusterName(clusterName string)
|
||||
}
|
||||
|
||||
// ListMetaAccessor retrieves the list interface from an object
|
||||
type ListMetaAccessor interface {
|
||||
GetListMeta() List
|
||||
}
|
||||
|
||||
// List lets you work with list metadata from any of the versioned or
|
||||
// internal API objects. Attempting to set or retrieve a field on an object that does
|
||||
// not support that field will be a no-op and return a default value.
|
||||
// TODO: move this, and TypeMeta and ListMeta, to a different package
|
||||
type List interface {
|
||||
GetResourceVersion() string
|
||||
SetResourceVersion(version string)
|
||||
GetSelfLink() string
|
||||
SetSelfLink(selfLink string)
|
||||
}
|
||||
|
||||
// Type exposes the type and APIVersion of versioned or internal API objects.
|
||||
// TODO: move this, and TypeMeta and ListMeta, to a different package
|
||||
type Type interface {
|
||||
GetAPIVersion() string
|
||||
SetAPIVersion(version string)
|
||||
GetKind() string
|
||||
SetKind(kind string)
|
||||
}
|
||||
|
||||
func (meta *ListMeta) GetResourceVersion() string { return meta.ResourceVersion }
|
||||
func (meta *ListMeta) SetResourceVersion(version string) { meta.ResourceVersion = version }
|
||||
func (meta *ListMeta) GetSelfLink() string { return meta.SelfLink }
|
||||
func (meta *ListMeta) SetSelfLink(selfLink string) { meta.SelfLink = selfLink }
|
||||
|
||||
func (obj *TypeMeta) GetObjectKind() schema.ObjectKind { return obj }
|
||||
|
||||
// SetGroupVersionKind satisfies the ObjectKind interface for all objects that embed TypeMeta
|
||||
func (obj *TypeMeta) SetGroupVersionKind(gvk schema.GroupVersionKind) {
|
||||
obj.APIVersion, obj.Kind = gvk.ToAPIVersionAndKind()
|
||||
}
|
||||
|
||||
// GroupVersionKind satisfies the ObjectKind interface for all objects that embed TypeMeta
|
||||
func (obj *TypeMeta) GroupVersionKind() schema.GroupVersionKind {
|
||||
return schema.FromAPIVersionAndKind(obj.APIVersion, obj.Kind)
|
||||
}
|
||||
|
||||
func (obj *ListMeta) GetListMeta() List { return obj }
|
||||
|
||||
func (obj *ObjectMeta) GetObjectMeta() Object { return obj }
|
||||
|
||||
// Namespace implements metav1.Object for any object with an ObjectMeta typed field. Allows
|
||||
// fast, direct access to metadata fields for API objects.
|
||||
func (meta *ObjectMeta) GetNamespace() string { return meta.Namespace }
|
||||
func (meta *ObjectMeta) SetNamespace(namespace string) { meta.Namespace = namespace }
|
||||
func (meta *ObjectMeta) GetName() string { return meta.Name }
|
||||
func (meta *ObjectMeta) SetName(name string) { meta.Name = name }
|
||||
func (meta *ObjectMeta) GetGenerateName() string { return meta.GenerateName }
|
||||
func (meta *ObjectMeta) SetGenerateName(generateName string) { meta.GenerateName = generateName }
|
||||
func (meta *ObjectMeta) GetUID() types.UID { return meta.UID }
|
||||
func (meta *ObjectMeta) SetUID(uid types.UID) { meta.UID = uid }
|
||||
func (meta *ObjectMeta) GetResourceVersion() string { return meta.ResourceVersion }
|
||||
func (meta *ObjectMeta) SetResourceVersion(version string) { meta.ResourceVersion = version }
|
||||
func (meta *ObjectMeta) GetSelfLink() string { return meta.SelfLink }
|
||||
func (meta *ObjectMeta) SetSelfLink(selfLink string) { meta.SelfLink = selfLink }
|
||||
func (meta *ObjectMeta) GetCreationTimestamp() Time { return meta.CreationTimestamp }
|
||||
func (meta *ObjectMeta) SetCreationTimestamp(creationTimestamp Time) {
|
||||
meta.CreationTimestamp = creationTimestamp
|
||||
}
|
||||
func (meta *ObjectMeta) GetDeletionTimestamp() *Time { return meta.DeletionTimestamp }
|
||||
func (meta *ObjectMeta) SetDeletionTimestamp(deletionTimestamp *Time) {
|
||||
meta.DeletionTimestamp = deletionTimestamp
|
||||
}
|
||||
func (meta *ObjectMeta) GetLabels() map[string]string { return meta.Labels }
|
||||
func (meta *ObjectMeta) SetLabels(labels map[string]string) { meta.Labels = labels }
|
||||
func (meta *ObjectMeta) GetAnnotations() map[string]string { return meta.Annotations }
|
||||
func (meta *ObjectMeta) SetAnnotations(annotations map[string]string) { meta.Annotations = annotations }
|
||||
func (meta *ObjectMeta) GetFinalizers() []string { return meta.Finalizers }
|
||||
func (meta *ObjectMeta) SetFinalizers(finalizers []string) { meta.Finalizers = finalizers }
|
||||
|
||||
func (meta *ObjectMeta) GetOwnerReferences() []OwnerReference {
|
||||
ret := make([]OwnerReference, len(meta.OwnerReferences))
|
||||
for i := 0; i < len(meta.OwnerReferences); i++ {
|
||||
ret[i].Kind = meta.OwnerReferences[i].Kind
|
||||
ret[i].Name = meta.OwnerReferences[i].Name
|
||||
ret[i].UID = meta.OwnerReferences[i].UID
|
||||
ret[i].APIVersion = meta.OwnerReferences[i].APIVersion
|
||||
if meta.OwnerReferences[i].Controller != nil {
|
||||
value := *meta.OwnerReferences[i].Controller
|
||||
ret[i].Controller = &value
|
||||
}
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
func (meta *ObjectMeta) SetOwnerReferences(references []OwnerReference) {
|
||||
newReferences := make([]OwnerReference, len(references))
|
||||
for i := 0; i < len(references); i++ {
|
||||
newReferences[i].Kind = references[i].Kind
|
||||
newReferences[i].Name = references[i].Name
|
||||
newReferences[i].UID = references[i].UID
|
||||
newReferences[i].APIVersion = references[i].APIVersion
|
||||
if references[i].Controller != nil {
|
||||
value := *references[i].Controller
|
||||
newReferences[i].Controller = &value
|
||||
}
|
||||
}
|
||||
meta.OwnerReferences = newReferences
|
||||
}
|
||||
|
||||
func (meta *ObjectMeta) GetClusterName() string {
|
||||
return meta.ClusterName
|
||||
}
|
||||
func (meta *ObjectMeta) SetClusterName(clusterName string) {
|
||||
meta.ClusterName = clusterName
|
||||
}
|
69
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/register.go
generated
vendored
69
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/register.go
generated
vendored
|
@ -1,69 +0,0 @@
|
|||
/*
|
||||
Copyright 2014 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 v1
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
// GroupName is the group name for this API.
|
||||
const GroupName = "meta.k8s.io"
|
||||
|
||||
// SchemeGroupVersion is group version used to register these objects
|
||||
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1"}
|
||||
|
||||
// WatchEventKind is name reserved for serializing watch events.
|
||||
const WatchEventKind = "WatchEvent"
|
||||
|
||||
// Kind takes an unqualified kind and returns a Group qualified GroupKind
|
||||
func Kind(kind string) schema.GroupKind {
|
||||
return SchemeGroupVersion.WithKind(kind).GroupKind()
|
||||
}
|
||||
|
||||
// AddToGroupVersion registers common meta types into schemas.
|
||||
func AddToGroupVersion(scheme *runtime.Scheme, groupVersion schema.GroupVersion) {
|
||||
scheme.AddKnownTypeWithName(groupVersion.WithKind(WatchEventKind), &WatchEvent{})
|
||||
scheme.AddKnownTypeWithName(
|
||||
schema.GroupVersion{Group: groupVersion.Group, Version: runtime.APIVersionInternal}.WithKind(WatchEventKind),
|
||||
&InternalEvent{},
|
||||
)
|
||||
scheme.AddKnownTypes(groupVersion,
|
||||
&ListOptions{},
|
||||
&ExportOptions{},
|
||||
&GetOptions{},
|
||||
&DeleteOptions{},
|
||||
)
|
||||
scheme.AddConversionFuncs(
|
||||
Convert_versioned_Event_to_watch_Event,
|
||||
Convert_versioned_InternalEvent_to_versioned_Event,
|
||||
Convert_watch_Event_to_versioned_Event,
|
||||
Convert_versioned_Event_to_versioned_InternalEvent,
|
||||
)
|
||||
}
|
||||
|
||||
// scheme is the registry for the common types that adhere to the meta v1 API spec.
|
||||
var scheme = runtime.NewScheme()
|
||||
|
||||
// ParameterCodec knows about query parameters used with the meta v1 API spec.
|
||||
var ParameterCodec = runtime.NewParameterCodec(scheme)
|
||||
|
||||
func init() {
|
||||
scheme.AddUnversionedTypes(SchemeGroupVersion,
|
||||
&ListOptions{},
|
||||
)
|
||||
}
|
539
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.deepcopy.go
generated
vendored
539
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.deepcopy.go
generated
vendored
|
@ -1,539 +0,0 @@
|
|||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// This file was autogenerated by deepcopy-gen. Do not edit it manually!
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
conversion "k8s.io/apimachinery/pkg/conversion"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
reflect "reflect"
|
||||
)
|
||||
|
||||
// GetGeneratedDeepCopyFuncs returns the generated funcs, since we aren't registering them.
|
||||
func GetGeneratedDeepCopyFuncs() []conversion.GeneratedDeepCopyFunc {
|
||||
return []conversion.GeneratedDeepCopyFunc{
|
||||
{Fn: DeepCopy_v1_APIGroup, InType: reflect.TypeOf(&APIGroup{})},
|
||||
{Fn: DeepCopy_v1_APIGroupList, InType: reflect.TypeOf(&APIGroupList{})},
|
||||
{Fn: DeepCopy_v1_APIResource, InType: reflect.TypeOf(&APIResource{})},
|
||||
{Fn: DeepCopy_v1_APIResourceList, InType: reflect.TypeOf(&APIResourceList{})},
|
||||
{Fn: DeepCopy_v1_APIVersions, InType: reflect.TypeOf(&APIVersions{})},
|
||||
{Fn: DeepCopy_v1_DeleteOptions, InType: reflect.TypeOf(&DeleteOptions{})},
|
||||
{Fn: DeepCopy_v1_Duration, InType: reflect.TypeOf(&Duration{})},
|
||||
{Fn: DeepCopy_v1_ExportOptions, InType: reflect.TypeOf(&ExportOptions{})},
|
||||
{Fn: DeepCopy_v1_GetOptions, InType: reflect.TypeOf(&GetOptions{})},
|
||||
{Fn: DeepCopy_v1_GroupKind, InType: reflect.TypeOf(&GroupKind{})},
|
||||
{Fn: DeepCopy_v1_GroupResource, InType: reflect.TypeOf(&GroupResource{})},
|
||||
{Fn: DeepCopy_v1_GroupVersion, InType: reflect.TypeOf(&GroupVersion{})},
|
||||
{Fn: DeepCopy_v1_GroupVersionForDiscovery, InType: reflect.TypeOf(&GroupVersionForDiscovery{})},
|
||||
{Fn: DeepCopy_v1_GroupVersionKind, InType: reflect.TypeOf(&GroupVersionKind{})},
|
||||
{Fn: DeepCopy_v1_GroupVersionResource, InType: reflect.TypeOf(&GroupVersionResource{})},
|
||||
{Fn: DeepCopy_v1_InternalEvent, InType: reflect.TypeOf(&InternalEvent{})},
|
||||
{Fn: DeepCopy_v1_LabelSelector, InType: reflect.TypeOf(&LabelSelector{})},
|
||||
{Fn: DeepCopy_v1_LabelSelectorRequirement, InType: reflect.TypeOf(&LabelSelectorRequirement{})},
|
||||
{Fn: DeepCopy_v1_ListMeta, InType: reflect.TypeOf(&ListMeta{})},
|
||||
{Fn: DeepCopy_v1_ListOptions, InType: reflect.TypeOf(&ListOptions{})},
|
||||
{Fn: DeepCopy_v1_ObjectMeta, InType: reflect.TypeOf(&ObjectMeta{})},
|
||||
{Fn: DeepCopy_v1_OwnerReference, InType: reflect.TypeOf(&OwnerReference{})},
|
||||
{Fn: DeepCopy_v1_Patch, InType: reflect.TypeOf(&Patch{})},
|
||||
{Fn: DeepCopy_v1_Preconditions, InType: reflect.TypeOf(&Preconditions{})},
|
||||
{Fn: DeepCopy_v1_RootPaths, InType: reflect.TypeOf(&RootPaths{})},
|
||||
{Fn: DeepCopy_v1_ServerAddressByClientCIDR, InType: reflect.TypeOf(&ServerAddressByClientCIDR{})},
|
||||
{Fn: DeepCopy_v1_Status, InType: reflect.TypeOf(&Status{})},
|
||||
{Fn: DeepCopy_v1_StatusCause, InType: reflect.TypeOf(&StatusCause{})},
|
||||
{Fn: DeepCopy_v1_StatusDetails, InType: reflect.TypeOf(&StatusDetails{})},
|
||||
{Fn: DeepCopy_v1_Time, InType: reflect.TypeOf(&Time{})},
|
||||
{Fn: DeepCopy_v1_Timestamp, InType: reflect.TypeOf(&Timestamp{})},
|
||||
{Fn: DeepCopy_v1_TypeMeta, InType: reflect.TypeOf(&TypeMeta{})},
|
||||
{Fn: DeepCopy_v1_WatchEvent, InType: reflect.TypeOf(&WatchEvent{})},
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_v1_APIGroup(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*APIGroup)
|
||||
out := out.(*APIGroup)
|
||||
*out = *in
|
||||
if in.Versions != nil {
|
||||
in, out := &in.Versions, &out.Versions
|
||||
*out = make([]GroupVersionForDiscovery, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.ServerAddressByClientCIDRs != nil {
|
||||
in, out := &in.ServerAddressByClientCIDRs, &out.ServerAddressByClientCIDRs
|
||||
*out = make([]ServerAddressByClientCIDR, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_v1_APIGroupList(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*APIGroupList)
|
||||
out := out.(*APIGroupList)
|
||||
*out = *in
|
||||
if in.Groups != nil {
|
||||
in, out := &in.Groups, &out.Groups
|
||||
*out = make([]APIGroup, len(*in))
|
||||
for i := range *in {
|
||||
if newVal, err := c.DeepCopy(&(*in)[i]); err != nil {
|
||||
return err
|
||||
} else {
|
||||
(*out)[i] = *newVal.(*APIGroup)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_v1_APIResource(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*APIResource)
|
||||
out := out.(*APIResource)
|
||||
*out = *in
|
||||
if in.Verbs != nil {
|
||||
in, out := &in.Verbs, &out.Verbs
|
||||
*out = make(Verbs, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_v1_APIResourceList(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*APIResourceList)
|
||||
out := out.(*APIResourceList)
|
||||
*out = *in
|
||||
if in.APIResources != nil {
|
||||
in, out := &in.APIResources, &out.APIResources
|
||||
*out = make([]APIResource, len(*in))
|
||||
for i := range *in {
|
||||
if newVal, err := c.DeepCopy(&(*in)[i]); err != nil {
|
||||
return err
|
||||
} else {
|
||||
(*out)[i] = *newVal.(*APIResource)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_v1_APIVersions(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*APIVersions)
|
||||
out := out.(*APIVersions)
|
||||
*out = *in
|
||||
if in.Versions != nil {
|
||||
in, out := &in.Versions, &out.Versions
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.ServerAddressByClientCIDRs != nil {
|
||||
in, out := &in.ServerAddressByClientCIDRs, &out.ServerAddressByClientCIDRs
|
||||
*out = make([]ServerAddressByClientCIDR, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_v1_DeleteOptions(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*DeleteOptions)
|
||||
out := out.(*DeleteOptions)
|
||||
*out = *in
|
||||
if in.GracePeriodSeconds != nil {
|
||||
in, out := &in.GracePeriodSeconds, &out.GracePeriodSeconds
|
||||
*out = new(int64)
|
||||
**out = **in
|
||||
}
|
||||
if in.Preconditions != nil {
|
||||
in, out := &in.Preconditions, &out.Preconditions
|
||||
if newVal, err := c.DeepCopy(*in); err != nil {
|
||||
return err
|
||||
} else {
|
||||
*out = newVal.(*Preconditions)
|
||||
}
|
||||
}
|
||||
if in.OrphanDependents != nil {
|
||||
in, out := &in.OrphanDependents, &out.OrphanDependents
|
||||
*out = new(bool)
|
||||
**out = **in
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_v1_Duration(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*Duration)
|
||||
out := out.(*Duration)
|
||||
*out = *in
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_v1_ExportOptions(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*ExportOptions)
|
||||
out := out.(*ExportOptions)
|
||||
*out = *in
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_v1_GetOptions(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*GetOptions)
|
||||
out := out.(*GetOptions)
|
||||
*out = *in
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_v1_GroupKind(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*GroupKind)
|
||||
out := out.(*GroupKind)
|
||||
*out = *in
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_v1_GroupResource(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*GroupResource)
|
||||
out := out.(*GroupResource)
|
||||
*out = *in
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_v1_GroupVersion(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*GroupVersion)
|
||||
out := out.(*GroupVersion)
|
||||
*out = *in
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_v1_GroupVersionForDiscovery(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*GroupVersionForDiscovery)
|
||||
out := out.(*GroupVersionForDiscovery)
|
||||
*out = *in
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_v1_GroupVersionKind(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*GroupVersionKind)
|
||||
out := out.(*GroupVersionKind)
|
||||
*out = *in
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_v1_GroupVersionResource(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*GroupVersionResource)
|
||||
out := out.(*GroupVersionResource)
|
||||
*out = *in
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_v1_InternalEvent(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*InternalEvent)
|
||||
out := out.(*InternalEvent)
|
||||
*out = *in
|
||||
// in.Object is kind 'Interface'
|
||||
if in.Object != nil {
|
||||
if newVal, err := c.DeepCopy(&in.Object); err != nil {
|
||||
return err
|
||||
} else {
|
||||
out.Object = *newVal.(*runtime.Object)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_v1_LabelSelector(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*LabelSelector)
|
||||
out := out.(*LabelSelector)
|
||||
*out = *in
|
||||
if in.MatchLabels != nil {
|
||||
in, out := &in.MatchLabels, &out.MatchLabels
|
||||
*out = make(map[string]string)
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
if in.MatchExpressions != nil {
|
||||
in, out := &in.MatchExpressions, &out.MatchExpressions
|
||||
*out = make([]LabelSelectorRequirement, len(*in))
|
||||
for i := range *in {
|
||||
if newVal, err := c.DeepCopy(&(*in)[i]); err != nil {
|
||||
return err
|
||||
} else {
|
||||
(*out)[i] = *newVal.(*LabelSelectorRequirement)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_v1_LabelSelectorRequirement(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*LabelSelectorRequirement)
|
||||
out := out.(*LabelSelectorRequirement)
|
||||
*out = *in
|
||||
if in.Values != nil {
|
||||
in, out := &in.Values, &out.Values
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_v1_ListMeta(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*ListMeta)
|
||||
out := out.(*ListMeta)
|
||||
*out = *in
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_v1_ListOptions(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*ListOptions)
|
||||
out := out.(*ListOptions)
|
||||
*out = *in
|
||||
if in.TimeoutSeconds != nil {
|
||||
in, out := &in.TimeoutSeconds, &out.TimeoutSeconds
|
||||
*out = new(int64)
|
||||
**out = **in
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_v1_ObjectMeta(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*ObjectMeta)
|
||||
out := out.(*ObjectMeta)
|
||||
*out = *in
|
||||
out.CreationTimestamp = in.CreationTimestamp.DeepCopy()
|
||||
if in.DeletionTimestamp != nil {
|
||||
in, out := &in.DeletionTimestamp, &out.DeletionTimestamp
|
||||
*out = new(Time)
|
||||
**out = (*in).DeepCopy()
|
||||
}
|
||||
if in.DeletionGracePeriodSeconds != nil {
|
||||
in, out := &in.DeletionGracePeriodSeconds, &out.DeletionGracePeriodSeconds
|
||||
*out = new(int64)
|
||||
**out = **in
|
||||
}
|
||||
if in.Labels != nil {
|
||||
in, out := &in.Labels, &out.Labels
|
||||
*out = make(map[string]string)
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
if in.Annotations != nil {
|
||||
in, out := &in.Annotations, &out.Annotations
|
||||
*out = make(map[string]string)
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
if in.OwnerReferences != nil {
|
||||
in, out := &in.OwnerReferences, &out.OwnerReferences
|
||||
*out = make([]OwnerReference, len(*in))
|
||||
for i := range *in {
|
||||
if newVal, err := c.DeepCopy(&(*in)[i]); err != nil {
|
||||
return err
|
||||
} else {
|
||||
(*out)[i] = *newVal.(*OwnerReference)
|
||||
}
|
||||
}
|
||||
}
|
||||
if in.Finalizers != nil {
|
||||
in, out := &in.Finalizers, &out.Finalizers
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_v1_OwnerReference(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*OwnerReference)
|
||||
out := out.(*OwnerReference)
|
||||
*out = *in
|
||||
if in.Controller != nil {
|
||||
in, out := &in.Controller, &out.Controller
|
||||
*out = new(bool)
|
||||
**out = **in
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_v1_Patch(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*Patch)
|
||||
out := out.(*Patch)
|
||||
*out = *in
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_v1_Preconditions(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*Preconditions)
|
||||
out := out.(*Preconditions)
|
||||
*out = *in
|
||||
if in.UID != nil {
|
||||
in, out := &in.UID, &out.UID
|
||||
*out = new(types.UID)
|
||||
**out = **in
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_v1_RootPaths(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*RootPaths)
|
||||
out := out.(*RootPaths)
|
||||
*out = *in
|
||||
if in.Paths != nil {
|
||||
in, out := &in.Paths, &out.Paths
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_v1_ServerAddressByClientCIDR(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*ServerAddressByClientCIDR)
|
||||
out := out.(*ServerAddressByClientCIDR)
|
||||
*out = *in
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_v1_Status(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*Status)
|
||||
out := out.(*Status)
|
||||
*out = *in
|
||||
if in.Details != nil {
|
||||
in, out := &in.Details, &out.Details
|
||||
if newVal, err := c.DeepCopy(*in); err != nil {
|
||||
return err
|
||||
} else {
|
||||
*out = newVal.(*StatusDetails)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_v1_StatusCause(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*StatusCause)
|
||||
out := out.(*StatusCause)
|
||||
*out = *in
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_v1_StatusDetails(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*StatusDetails)
|
||||
out := out.(*StatusDetails)
|
||||
*out = *in
|
||||
if in.Causes != nil {
|
||||
in, out := &in.Causes, &out.Causes
|
||||
*out = make([]StatusCause, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_v1_Time(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*Time)
|
||||
out := out.(*Time)
|
||||
*out = in.DeepCopy()
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_v1_Timestamp(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*Timestamp)
|
||||
out := out.(*Timestamp)
|
||||
*out = *in
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_v1_TypeMeta(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*TypeMeta)
|
||||
out := out.(*TypeMeta)
|
||||
*out = *in
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_v1_WatchEvent(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*WatchEvent)
|
||||
out := out.(*WatchEvent)
|
||||
*out = *in
|
||||
if newVal, err := c.DeepCopy(&in.Object); err != nil {
|
||||
return err
|
||||
} else {
|
||||
out.Object = *newVal.(*runtime.RawExtension)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
32
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.defaults.go
generated
vendored
32
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.defaults.go
generated
vendored
|
@ -1,32 +0,0 @@
|
|||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// This file was autogenerated by defaulter-gen. Do not edit it manually!
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
// RegisterDefaults adds defaulters functions to the given scheme.
|
||||
// Public to allow building arbitrary schemes.
|
||||
// All generated defaulters are covering - they call all nested defaulters.
|
||||
func RegisterDefaults(scheme *runtime.Scheme) error {
|
||||
return nil
|
||||
}
|
10
vendor/k8s.io/apimachinery/pkg/conversion/OWNERS
generated
vendored
10
vendor/k8s.io/apimachinery/pkg/conversion/OWNERS
generated
vendored
|
@ -1,10 +0,0 @@
|
|||
approvers:
|
||||
- derekwaynecarr
|
||||
- lavalamp
|
||||
- smarterclayton
|
||||
- wojtek-t
|
||||
reviewers:
|
||||
- derekwaynecarr
|
||||
- lavalamp
|
||||
- smarterclayton
|
||||
- wojtek-t
|
19
vendor/k8s.io/apimachinery/pkg/runtime/OWNERS
generated
vendored
19
vendor/k8s.io/apimachinery/pkg/runtime/OWNERS
generated
vendored
|
@ -1,19 +0,0 @@
|
|||
approvers:
|
||||
- caesarxuchao
|
||||
- deads2k
|
||||
- lavalamp
|
||||
- smarterclayton
|
||||
reviewers:
|
||||
- lavalamp
|
||||
- smarterclayton
|
||||
- wojtek-t
|
||||
- deads2k
|
||||
- derekwaynecarr
|
||||
- caesarxuchao
|
||||
- mikedanese
|
||||
- nikhiljindal
|
||||
- gmarek
|
||||
- krousey
|
||||
- timothysc
|
||||
- piosz
|
||||
- mbohlool
|
60
vendor/k8s.io/apimachinery/pkg/runtime/schema/generated.pb.go
generated
vendored
60
vendor/k8s.io/apimachinery/pkg/runtime/schema/generated.pb.go
generated
vendored
|
@ -1,60 +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.
|
||||
*/
|
||||
|
||||
// Code generated by protoc-gen-gogo.
|
||||
// source: k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/runtime/schema/generated.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
/*
|
||||
Package schema is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/runtime/schema/generated.proto
|
||||
|
||||
It has these top-level messages:
|
||||
*/
|
||||
package schema
|
||||
|
||||
import proto "github.com/gogo/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
const _ = proto.GoGoProtoPackageIsVersion1
|
||||
|
||||
var fileDescriptorGenerated = []byte{
|
||||
// 215 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x6c, 0xce, 0xb1, 0x4e, 0xc4, 0x30,
|
||||
0x0c, 0xc6, 0xf1, 0x76, 0x61, 0x60, 0x64, 0xec, 0xe0, 0x11, 0xb1, 0x10, 0x0b, 0x26, 0x66, 0x5e,
|
||||
0x80, 0x9d, 0x2d, 0xed, 0x99, 0xd4, 0x2a, 0x8d, 0x23, 0xc7, 0x41, 0x62, 0xe3, 0x11, 0x78, 0xac,
|
||||
0x1b, 0x6f, 0x64, 0xa4, 0xe5, 0x45, 0x10, 0xcd, 0x0d, 0xe8, 0x60, 0xcb, 0xa7, 0xe8, 0x67, 0xfd,
|
||||
0xcf, 0x1f, 0xa6, 0xbb, 0xec, 0x58, 0x70, 0x2a, 0x3d, 0x69, 0x24, 0xa3, 0x8c, 0x2f, 0x14, 0x77,
|
||||
0xa2, 0x78, 0xfc, 0xf0, 0x89, 0x67, 0x3f, 0x8c, 0x1c, 0x49, 0x5f, 0x31, 0x4d, 0x01, 0xb5, 0x44,
|
||||
0xe3, 0x99, 0x30, 0x0f, 0x23, 0xcd, 0x1e, 0x03, 0x45, 0x52, 0x6f, 0xb4, 0x73, 0x49, 0xc5, 0xe4,
|
||||
0xe2, 0xb2, 0x3a, 0xf7, 0xdb, 0xb9, 0x34, 0x05, 0x77, 0x74, 0xae, 0xba, 0xee, 0x3a, 0xb0, 0x8d,
|
||||
0xa5, 0x77, 0x83, 0xcc, 0x18, 0x24, 0x08, 0x6e, 0xbc, 0x2f, 0x4f, 0xdb, 0xda, 0xc6, 0xf6, 0xaa,
|
||||
0x67, 0xbb, 0xdb, 0xbf, 0x9d, 0x3f, 0x31, 0x3e, 0x31, 0x2a, 0x65, 0x29, 0x3a, 0xd0, 0x69, 0x4a,
|
||||
0x77, 0xf3, 0xbf, 0x29, 0xc6, 0xcf, 0xc8, 0xd1, 0xb2, 0xe9, 0x29, 0xb9, 0xbf, 0xda, 0x2f, 0xd0,
|
||||
0x1c, 0x16, 0x68, 0x3e, 0x16, 0x68, 0xde, 0x56, 0x68, 0xf7, 0x2b, 0xb4, 0x87, 0x15, 0xda, 0xcf,
|
||||
0x15, 0xda, 0xf7, 0x2f, 0x68, 0x1e, 0xcf, 0x6a, 0xff, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x86,
|
||||
0xae, 0x35, 0x6c, 0x39, 0x01, 0x00, 0x00,
|
||||
}
|
40
vendor/k8s.io/apimachinery/pkg/runtime/schema/interfaces.go
generated
vendored
40
vendor/k8s.io/apimachinery/pkg/runtime/schema/interfaces.go
generated
vendored
|
@ -1,40 +0,0 @@
|
|||
/*
|
||||
Copyright 2016 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 schema
|
||||
|
||||
// All objects that are serialized from a Scheme encode their type information. This interface is used
|
||||
// by serialization to set type information from the Scheme onto the serialized version of an object.
|
||||
// For objects that cannot be serialized or have unique requirements, this interface may be a no-op.
|
||||
type ObjectKind interface {
|
||||
// SetGroupVersionKind sets or clears the intended serialized kind of an object. Passing kind nil
|
||||
// should clear the current setting.
|
||||
SetGroupVersionKind(kind GroupVersionKind)
|
||||
// GroupVersionKind returns the stored group, version, and kind of an object, or nil if the object does
|
||||
// not expose or provide these fields.
|
||||
GroupVersionKind() GroupVersionKind
|
||||
}
|
||||
|
||||
// EmptyObjectKind implements the ObjectKind interface as a noop
|
||||
var EmptyObjectKind = emptyObjectKind{}
|
||||
|
||||
type emptyObjectKind struct{}
|
||||
|
||||
// SetGroupVersionKind implements the ObjectKind interface
|
||||
func (emptyObjectKind) SetGroupVersionKind(gvk GroupVersionKind) {}
|
||||
|
||||
// GroupVersionKind implements the ObjectKind interface
|
||||
func (emptyObjectKind) GroupVersionKind() GroupVersionKind { return GroupVersionKind{} }
|
28
vendor/k8s.io/apimachinery/pkg/types/patch.go
generated
vendored
28
vendor/k8s.io/apimachinery/pkg/types/patch.go
generated
vendored
|
@ -1,28 +0,0 @@
|
|||
/*
|
||||
Copyright 2015 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 types
|
||||
|
||||
// Similarly to above, these are constants to support HTTP PATCH utilized by
|
||||
// both the client and server that didn't make sense for a whole package to be
|
||||
// dedicated to.
|
||||
type PatchType string
|
||||
|
||||
const (
|
||||
JSONPatchType PatchType = "application/json-patch+json"
|
||||
MergePatchType PatchType = "application/merge-patch+json"
|
||||
StrategicMergePatchType PatchType = "application/strategic-merge-patch+json"
|
||||
)
|
18
vendor/k8s.io/apimachinery/pkg/version/doc.go
generated
vendored
18
vendor/k8s.io/apimachinery/pkg/version/doc.go
generated
vendored
|
@ -1,18 +0,0 @@
|
|||
/*
|
||||
Copyright 2014 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 version supplies the type for version information collected at build time.
|
||||
package version
|
37
vendor/k8s.io/apimachinery/pkg/version/types.go
generated
vendored
37
vendor/k8s.io/apimachinery/pkg/version/types.go
generated
vendored
|
@ -1,37 +0,0 @@
|
|||
/*
|
||||
Copyright 2014 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 version
|
||||
|
||||
// Info contains versioning information.
|
||||
// TODO: Add []string of api versions supported? It's still unclear
|
||||
// how we'll want to distribute that information.
|
||||
type Info struct {
|
||||
Major string `json:"major"`
|
||||
Minor string `json:"minor"`
|
||||
GitVersion string `json:"gitVersion"`
|
||||
GitCommit string `json:"gitCommit"`
|
||||
GitTreeState string `json:"gitTreeState"`
|
||||
BuildDate string `json:"buildDate"`
|
||||
GoVersion string `json:"goVersion"`
|
||||
Compiler string `json:"compiler"`
|
||||
Platform string `json:"platform"`
|
||||
}
|
||||
|
||||
// String returns info as a human-friendly version string.
|
||||
func (info Info) String() string {
|
||||
return info.GitVersion
|
||||
}
|
2
vendor/k8s.io/client-go/LICENSE
generated
vendored
2
vendor/k8s.io/client-go/LICENSE
generated
vendored
|
@ -187,7 +187,7 @@
|
|||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
Copyright 2014 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.
|
||||
|
|
256
vendor/k8s.io/client-go/discovery/discovery_client.go
generated
vendored
256
vendor/k8s.io/client-go/discovery/discovery_client.go
generated
vendored
|
@ -25,24 +25,20 @@ import (
|
|||
|
||||
"github.com/emicklei/go-restful/swagger"
|
||||
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
"k8s.io/apimachinery/pkg/version"
|
||||
"k8s.io/client-go/pkg/api"
|
||||
"k8s.io/client-go/pkg/api/errors"
|
||||
"k8s.io/client-go/pkg/api/unversioned"
|
||||
"k8s.io/client-go/pkg/api/v1"
|
||||
restclient "k8s.io/client-go/rest"
|
||||
"k8s.io/client-go/pkg/runtime"
|
||||
"k8s.io/client-go/pkg/runtime/serializer"
|
||||
"k8s.io/client-go/pkg/version"
|
||||
"k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
// defaultRetries is the number of times a resource discovery is repeated if an api group disappears on the fly (e.g. ThirdPartyResources).
|
||||
const defaultRetries = 2
|
||||
|
||||
// DiscoveryInterface holds the methods that discover server-supported API groups,
|
||||
// versions and resources.
|
||||
type DiscoveryInterface interface {
|
||||
RESTClient() restclient.Interface
|
||||
RESTClient() rest.Interface
|
||||
ServerGroupsInterface
|
||||
ServerResourcesInterface
|
||||
ServerVersionInterface
|
||||
|
@ -62,21 +58,21 @@ type CachedDiscoveryInterface interface {
|
|||
type ServerGroupsInterface interface {
|
||||
// ServerGroups returns the supported groups, with information like supported versions and the
|
||||
// preferred version.
|
||||
ServerGroups() (*metav1.APIGroupList, error)
|
||||
ServerGroups() (*unversioned.APIGroupList, error)
|
||||
}
|
||||
|
||||
// ServerResourcesInterface has methods for obtaining supported resources on the API server
|
||||
type ServerResourcesInterface interface {
|
||||
// ServerResourcesForGroupVersion returns the supported resources for a group and version.
|
||||
ServerResourcesForGroupVersion(groupVersion string) (*metav1.APIResourceList, error)
|
||||
ServerResourcesForGroupVersion(groupVersion string) (*unversioned.APIResourceList, error)
|
||||
// ServerResources returns the supported resources for all groups and versions.
|
||||
ServerResources() ([]*metav1.APIResourceList, error)
|
||||
ServerResources() (map[string]*unversioned.APIResourceList, error)
|
||||
// ServerPreferredResources returns the supported resources with the version preferred by the
|
||||
// server.
|
||||
ServerPreferredResources() ([]*metav1.APIResourceList, error)
|
||||
ServerPreferredResources() ([]unversioned.GroupVersionResource, error)
|
||||
// ServerPreferredNamespacedResources returns the supported namespaced resources with the
|
||||
// version preferred by the server.
|
||||
ServerPreferredNamespacedResources() ([]*metav1.APIResourceList, error)
|
||||
ServerPreferredNamespacedResources() ([]unversioned.GroupVersionResource, error)
|
||||
}
|
||||
|
||||
// ServerVersionInterface has a method for retrieving the server's version.
|
||||
|
@ -88,23 +84,23 @@ type ServerVersionInterface interface {
|
|||
// SwaggerSchemaInterface has a method to retrieve the swagger schema.
|
||||
type SwaggerSchemaInterface interface {
|
||||
// SwaggerSchema retrieves and parses the swagger API schema the server supports.
|
||||
SwaggerSchema(version schema.GroupVersion) (*swagger.ApiDeclaration, error)
|
||||
SwaggerSchema(version unversioned.GroupVersion) (*swagger.ApiDeclaration, error)
|
||||
}
|
||||
|
||||
// DiscoveryClient implements the functions that discover server-supported API groups,
|
||||
// versions and resources.
|
||||
type DiscoveryClient struct {
|
||||
restClient restclient.Interface
|
||||
restClient rest.Interface
|
||||
|
||||
LegacyPrefix string
|
||||
}
|
||||
|
||||
// Convert metav1.APIVersions to metav1.APIGroup. APIVersions is used by legacy v1, so
|
||||
// Convert unversioned.APIVersions to unversioned.APIGroup. APIVersions is used by legacy v1, so
|
||||
// group would be "".
|
||||
func apiVersionsToAPIGroup(apiVersions *metav1.APIVersions) (apiGroup metav1.APIGroup) {
|
||||
groupVersions := []metav1.GroupVersionForDiscovery{}
|
||||
func apiVersionsToAPIGroup(apiVersions *unversioned.APIVersions) (apiGroup unversioned.APIGroup) {
|
||||
groupVersions := []unversioned.GroupVersionForDiscovery{}
|
||||
for _, version := range apiVersions.Versions {
|
||||
groupVersion := metav1.GroupVersionForDiscovery{
|
||||
groupVersion := unversioned.GroupVersionForDiscovery{
|
||||
GroupVersion: version,
|
||||
Version: version,
|
||||
}
|
||||
|
@ -118,11 +114,11 @@ func apiVersionsToAPIGroup(apiVersions *metav1.APIVersions) (apiGroup metav1.API
|
|||
|
||||
// ServerGroups returns the supported groups, with information like supported versions and the
|
||||
// preferred version.
|
||||
func (d *DiscoveryClient) ServerGroups() (apiGroupList *metav1.APIGroupList, err error) {
|
||||
func (d *DiscoveryClient) ServerGroups() (apiGroupList *unversioned.APIGroupList, err error) {
|
||||
// Get the groupVersions exposed at /api
|
||||
v := &metav1.APIVersions{}
|
||||
v := &unversioned.APIVersions{}
|
||||
err = d.restClient.Get().AbsPath(d.LegacyPrefix).Do().Into(v)
|
||||
apiGroup := metav1.APIGroup{}
|
||||
apiGroup := unversioned.APIGroup{}
|
||||
if err == nil {
|
||||
apiGroup = apiVersionsToAPIGroup(v)
|
||||
}
|
||||
|
@ -131,14 +127,14 @@ func (d *DiscoveryClient) ServerGroups() (apiGroupList *metav1.APIGroupList, err
|
|||
}
|
||||
|
||||
// Get the groupVersions exposed at /apis
|
||||
apiGroupList = &metav1.APIGroupList{}
|
||||
apiGroupList = &unversioned.APIGroupList{}
|
||||
err = d.restClient.Get().AbsPath("/apis").Do().Into(apiGroupList)
|
||||
if err != nil && !errors.IsNotFound(err) && !errors.IsForbidden(err) {
|
||||
return nil, err
|
||||
}
|
||||
// to be compatible with a v1.0 server, if it's a 403 or 404, ignore and return whatever we got from /api
|
||||
if err != nil && (errors.IsNotFound(err) || errors.IsForbidden(err)) {
|
||||
apiGroupList = &metav1.APIGroupList{}
|
||||
apiGroupList = &unversioned.APIGroupList{}
|
||||
}
|
||||
|
||||
// append the group retrieved from /api to the list
|
||||
|
@ -147,7 +143,7 @@ func (d *DiscoveryClient) ServerGroups() (apiGroupList *metav1.APIGroupList, err
|
|||
}
|
||||
|
||||
// ServerResourcesForGroupVersion returns the supported resources for a group and version.
|
||||
func (d *DiscoveryClient) ServerResourcesForGroupVersion(groupVersion string) (resources *metav1.APIResourceList, err error) {
|
||||
func (d *DiscoveryClient) ServerResourcesForGroupVersion(groupVersion string) (resources *unversioned.APIResourceList, err error) {
|
||||
url := url.URL{}
|
||||
if len(groupVersion) == 0 {
|
||||
return nil, fmt.Errorf("groupVersion shouldn't be empty")
|
||||
|
@ -157,9 +153,7 @@ func (d *DiscoveryClient) ServerResourcesForGroupVersion(groupVersion string) (r
|
|||
} else {
|
||||
url.Path = "/apis/" + groupVersion
|
||||
}
|
||||
resources = &metav1.APIResourceList{
|
||||
GroupVersion: groupVersion,
|
||||
}
|
||||
resources = &unversioned.APIResourceList{}
|
||||
err = d.restClient.Get().AbsPath(url.String()).Do().Into(resources)
|
||||
if err != nil {
|
||||
// ignore 403 or 404 error to be compatible with an v1.0 server.
|
||||
|
@ -171,49 +165,28 @@ func (d *DiscoveryClient) ServerResourcesForGroupVersion(groupVersion string) (r
|
|||
return resources, nil
|
||||
}
|
||||
|
||||
// serverResources returns the supported resources for all groups and versions.
|
||||
func (d *DiscoveryClient) serverResources(failEarly bool) ([]*metav1.APIResourceList, error) {
|
||||
// ServerResources returns the supported resources for all groups and versions.
|
||||
func (d *DiscoveryClient) ServerResources() (map[string]*unversioned.APIResourceList, error) {
|
||||
apiGroups, err := d.ServerGroups()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
result := []*metav1.APIResourceList{}
|
||||
failedGroups := make(map[schema.GroupVersion]error)
|
||||
|
||||
for _, apiGroup := range apiGroups.Groups {
|
||||
for _, version := range apiGroup.Versions {
|
||||
gv := schema.GroupVersion{Group: apiGroup.Name, Version: version.Version}
|
||||
resources, err := d.ServerResourcesForGroupVersion(version.GroupVersion)
|
||||
if err != nil {
|
||||
// TODO: maybe restrict this to NotFound errors
|
||||
failedGroups[gv] = err
|
||||
if failEarly {
|
||||
return nil, &ErrGroupDiscoveryFailed{Groups: failedGroups}
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
result = append(result, resources)
|
||||
groupVersions := unversioned.ExtractGroupVersions(apiGroups)
|
||||
result := map[string]*unversioned.APIResourceList{}
|
||||
for _, groupVersion := range groupVersions {
|
||||
resources, err := d.ServerResourcesForGroupVersion(groupVersion)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
result[groupVersion] = resources
|
||||
}
|
||||
|
||||
if len(failedGroups) == 0 {
|
||||
return result, nil
|
||||
}
|
||||
|
||||
return result, &ErrGroupDiscoveryFailed{Groups: failedGroups}
|
||||
}
|
||||
|
||||
// ServerResources returns the supported resources for all groups and versions.
|
||||
func (d *DiscoveryClient) ServerResources() ([]*metav1.APIResourceList, error) {
|
||||
return withRetries(defaultRetries, d.serverResources)
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// ErrGroupDiscoveryFailed is returned if one or more API groups fail to load.
|
||||
type ErrGroupDiscoveryFailed struct {
|
||||
// Groups is a list of the groups that failed to load and the error cause
|
||||
Groups map[schema.GroupVersion]error
|
||||
Groups map[unversioned.GroupVersion]error
|
||||
}
|
||||
|
||||
// Error implements the error interface
|
||||
|
@ -233,86 +206,78 @@ func IsGroupDiscoveryFailedError(err error) bool {
|
|||
return err != nil && ok
|
||||
}
|
||||
|
||||
// serverPreferredResources returns the supported resources with the version preferred by the server.
|
||||
func (d *DiscoveryClient) serverPreferredResources(failEarly bool) ([]*metav1.APIResourceList, error) {
|
||||
serverGroupList, err := d.ServerGroups()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// serverPreferredResources returns the supported resources with the version preferred by the
|
||||
// server. If namespaced is true, only namespaced resources will be returned.
|
||||
func (d *DiscoveryClient) serverPreferredResources(namespaced bool) ([]unversioned.GroupVersionResource, error) {
|
||||
// retry in case the groups supported by the server change after ServerGroup() returns.
|
||||
const maxRetries = 2
|
||||
var failedGroups map[unversioned.GroupVersion]error
|
||||
var results []unversioned.GroupVersionResource
|
||||
var resources map[unversioned.GroupResource]string
|
||||
RetrieveGroups:
|
||||
for i := 0; i < maxRetries; i++ {
|
||||
results = []unversioned.GroupVersionResource{}
|
||||
resources = map[unversioned.GroupResource]string{}
|
||||
failedGroups = make(map[unversioned.GroupVersion]error)
|
||||
serverGroupList, err := d.ServerGroups()
|
||||
if err != nil {
|
||||
return results, err
|
||||
}
|
||||
|
||||
result := []*metav1.APIResourceList{}
|
||||
failedGroups := make(map[schema.GroupVersion]error)
|
||||
|
||||
grVersions := map[schema.GroupResource]string{} // selected version of a GroupResource
|
||||
grApiResources := map[schema.GroupResource]*metav1.APIResource{} // selected APIResource for a GroupResource
|
||||
gvApiResourceLists := map[schema.GroupVersion]*metav1.APIResourceList{} // blueprint for a APIResourceList for later grouping
|
||||
|
||||
for _, apiGroup := range serverGroupList.Groups {
|
||||
for _, version := range apiGroup.Versions {
|
||||
groupVersion := schema.GroupVersion{Group: apiGroup.Name, Version: version.Version}
|
||||
apiResourceList, err := d.ServerResourcesForGroupVersion(version.GroupVersion)
|
||||
if err != nil {
|
||||
// TODO: maybe restrict this to NotFound errors
|
||||
failedGroups[groupVersion] = err
|
||||
if failEarly {
|
||||
return nil, &ErrGroupDiscoveryFailed{Groups: failedGroups}
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
// create empty list which is filled later in another loop
|
||||
emptyApiResourceList := metav1.APIResourceList{
|
||||
GroupVersion: version.GroupVersion,
|
||||
}
|
||||
gvApiResourceLists[groupVersion] = &emptyApiResourceList
|
||||
result = append(result, &emptyApiResourceList)
|
||||
|
||||
for i := range apiResourceList.APIResources {
|
||||
apiResource := &apiResourceList.APIResources[i]
|
||||
if strings.Contains(apiResource.Name, "/") {
|
||||
for _, apiGroup := range serverGroupList.Groups {
|
||||
versions := apiGroup.Versions
|
||||
for _, version := range versions {
|
||||
groupVersion := unversioned.GroupVersion{Group: apiGroup.Name, Version: version.Version}
|
||||
apiResourceList, err := d.ServerResourcesForGroupVersion(version.GroupVersion)
|
||||
if err != nil {
|
||||
if i < maxRetries-1 {
|
||||
continue RetrieveGroups
|
||||
}
|
||||
failedGroups[groupVersion] = err
|
||||
continue
|
||||
}
|
||||
gv := schema.GroupResource{Group: apiGroup.Name, Resource: apiResource.Name}
|
||||
if _, ok := grApiResources[gv]; ok && version.Version != apiGroup.PreferredVersion.Version {
|
||||
// only override with preferred version
|
||||
continue
|
||||
for _, apiResource := range apiResourceList.APIResources {
|
||||
// ignore the root scoped resources if "namespaced" is true.
|
||||
if namespaced && !apiResource.Namespaced {
|
||||
continue
|
||||
}
|
||||
if strings.Contains(apiResource.Name, "/") {
|
||||
continue
|
||||
}
|
||||
gvr := groupVersion.WithResource(apiResource.Name)
|
||||
if _, ok := resources[gvr.GroupResource()]; ok {
|
||||
if gvr.Version != apiGroup.PreferredVersion.Version {
|
||||
continue
|
||||
}
|
||||
// remove previous entry, because it will be replaced with a preferred one
|
||||
for i := range results {
|
||||
if results[i].GroupResource() == gvr.GroupResource() {
|
||||
results = append(results[:i], results[i+1:]...)
|
||||
}
|
||||
}
|
||||
}
|
||||
resources[gvr.GroupResource()] = gvr.Version
|
||||
results = append(results, gvr)
|
||||
}
|
||||
grVersions[gv] = version.Version
|
||||
grApiResources[gv] = apiResource
|
||||
}
|
||||
}
|
||||
if len(failedGroups) == 0 {
|
||||
return results, nil
|
||||
}
|
||||
}
|
||||
|
||||
// group selected APIResources according to GroupVersion into APIResourceLists
|
||||
for groupResource, apiResource := range grApiResources {
|
||||
version := grVersions[groupResource]
|
||||
groupVersion := schema.GroupVersion{Group: groupResource.Group, Version: version}
|
||||
apiResourceList := gvApiResourceLists[groupVersion]
|
||||
apiResourceList.APIResources = append(apiResourceList.APIResources, *apiResource)
|
||||
}
|
||||
|
||||
if len(failedGroups) == 0 {
|
||||
return result, nil
|
||||
}
|
||||
|
||||
return result, &ErrGroupDiscoveryFailed{Groups: failedGroups}
|
||||
return results, &ErrGroupDiscoveryFailed{Groups: failedGroups}
|
||||
}
|
||||
|
||||
// ServerPreferredResources returns the supported resources with the version preferred by the
|
||||
// server.
|
||||
func (d *DiscoveryClient) ServerPreferredResources() ([]*metav1.APIResourceList, error) {
|
||||
return withRetries(defaultRetries, func(retryEarly bool) ([]*metav1.APIResourceList, error) {
|
||||
return d.serverPreferredResources(retryEarly)
|
||||
})
|
||||
func (d *DiscoveryClient) ServerPreferredResources() ([]unversioned.GroupVersionResource, error) {
|
||||
return d.serverPreferredResources(false)
|
||||
}
|
||||
|
||||
// ServerPreferredNamespacedResources returns the supported namespaced resources with the
|
||||
// version preferred by the server.
|
||||
func (d *DiscoveryClient) ServerPreferredNamespacedResources() ([]*metav1.APIResourceList, error) {
|
||||
all, err := d.ServerPreferredResources()
|
||||
return FilteredBy(ResourcePredicateFunc(func(groupVersion string, r *metav1.APIResource) bool {
|
||||
return r.Namespaced
|
||||
}), all), err
|
||||
func (d *DiscoveryClient) ServerPreferredNamespacedResources() ([]unversioned.GroupVersionResource, error) {
|
||||
return d.serverPreferredResources(true)
|
||||
}
|
||||
|
||||
// ServerVersion retrieves and parses the server's version (git version).
|
||||
|
@ -330,7 +295,7 @@ func (d *DiscoveryClient) ServerVersion() (*version.Info, error) {
|
|||
}
|
||||
|
||||
// SwaggerSchema retrieves and parses the swagger API schema the server supports.
|
||||
func (d *DiscoveryClient) SwaggerSchema(version schema.GroupVersion) (*swagger.ApiDeclaration, error) {
|
||||
func (d *DiscoveryClient) SwaggerSchema(version unversioned.GroupVersion) (*swagger.ApiDeclaration, error) {
|
||||
if version.Empty() {
|
||||
return nil, fmt.Errorf("groupVersion cannot be empty")
|
||||
}
|
||||
|
@ -339,7 +304,7 @@ func (d *DiscoveryClient) SwaggerSchema(version schema.GroupVersion) (*swagger.A
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
groupVersions := metav1.ExtractGroupVersions(groupList)
|
||||
groupVersions := unversioned.ExtractGroupVersions(groupList)
|
||||
// This check also takes care the case that kubectl is newer than the running endpoint
|
||||
if stringDoesntExistIn(version.String(), groupVersions) {
|
||||
return nil, fmt.Errorf("API version: %v is not supported by the server. Use one of: %v", version, groupVersions)
|
||||
|
@ -363,48 +328,31 @@ func (d *DiscoveryClient) SwaggerSchema(version schema.GroupVersion) (*swagger.A
|
|||
return &schema, nil
|
||||
}
|
||||
|
||||
// withRetries retries the given recovery function in case the groups supported by the server change after ServerGroup() returns.
|
||||
func withRetries(maxRetries int, f func(failEarly bool) ([]*metav1.APIResourceList, error)) ([]*metav1.APIResourceList, error) {
|
||||
var result []*metav1.APIResourceList
|
||||
var err error
|
||||
for i := 0; i < maxRetries; i++ {
|
||||
failEarly := i < maxRetries-1
|
||||
result, err = f(failEarly)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if _, ok := err.(*ErrGroupDiscoveryFailed); !ok {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return result, err
|
||||
}
|
||||
|
||||
func setDiscoveryDefaults(config *restclient.Config) error {
|
||||
func setDiscoveryDefaults(config *rest.Config) error {
|
||||
config.APIPath = ""
|
||||
config.GroupVersion = nil
|
||||
codec := runtime.NoopEncoder{Decoder: api.Codecs.UniversalDecoder()}
|
||||
config.NegotiatedSerializer = serializer.NegotiatedSerializerWrapper(runtime.SerializerInfo{Serializer: codec})
|
||||
if len(config.UserAgent) == 0 {
|
||||
config.UserAgent = restclient.DefaultKubernetesUserAgent()
|
||||
config.UserAgent = rest.DefaultKubernetesUserAgent()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewDiscoveryClientForConfig creates a new DiscoveryClient for the given config. This client
|
||||
// can be used to discover supported resources in the API server.
|
||||
func NewDiscoveryClientForConfig(c *restclient.Config) (*DiscoveryClient, error) {
|
||||
func NewDiscoveryClientForConfig(c *rest.Config) (*DiscoveryClient, error) {
|
||||
config := *c
|
||||
if err := setDiscoveryDefaults(&config); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client, err := restclient.UnversionedRESTClientFor(&config)
|
||||
client, err := rest.UnversionedRESTClientFor(&config)
|
||||
return &DiscoveryClient{restClient: client, LegacyPrefix: "/api"}, err
|
||||
}
|
||||
|
||||
// NewDiscoveryClientForConfig creates a new DiscoveryClient for the given config. If
|
||||
// there is an error, it panics.
|
||||
func NewDiscoveryClientForConfigOrDie(c *restclient.Config) *DiscoveryClient {
|
||||
func NewDiscoveryClientForConfigOrDie(c *rest.Config) *DiscoveryClient {
|
||||
client, err := NewDiscoveryClientForConfig(c)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
@ -414,7 +362,7 @@ func NewDiscoveryClientForConfigOrDie(c *restclient.Config) *DiscoveryClient {
|
|||
}
|
||||
|
||||
// New creates a new DiscoveryClient for the given RESTClient.
|
||||
func NewDiscoveryClient(c restclient.Interface) *DiscoveryClient {
|
||||
func NewDiscoveryClient(c rest.Interface) *DiscoveryClient {
|
||||
return &DiscoveryClient{restClient: c, LegacyPrefix: "/api"}
|
||||
}
|
||||
|
||||
|
@ -429,7 +377,7 @@ func stringDoesntExistIn(str string, slice []string) bool {
|
|||
|
||||
// RESTClient returns a RESTClient that is used to communicate
|
||||
// with API server by this client implementation.
|
||||
func (c *DiscoveryClient) RESTClient() restclient.Interface {
|
||||
func (c *DiscoveryClient) RESTClient() rest.Interface {
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
|
|
61
vendor/k8s.io/client-go/discovery/helper.go
generated
vendored
61
vendor/k8s.io/client-go/discovery/helper.go
generated
vendored
|
@ -19,9 +19,8 @@ package discovery
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
"k8s.io/client-go/pkg/api/unversioned"
|
||||
"k8s.io/client-go/pkg/util/sets"
|
||||
"k8s.io/client-go/pkg/version"
|
||||
// Import solely to initialize client auth plugins.
|
||||
_ "k8s.io/client-go/plugin/pkg/client/auth"
|
||||
|
@ -50,7 +49,7 @@ func MatchesServerVersion(client DiscoveryInterface) error {
|
|||
// preference.
|
||||
// - If version is provided and the server does not support it,
|
||||
// return an error.
|
||||
func NegotiateVersion(client DiscoveryInterface, requiredGV *schema.GroupVersion, clientRegisteredGVs []schema.GroupVersion) (*schema.GroupVersion, error) {
|
||||
func NegotiateVersion(client DiscoveryInterface, requiredGV *unversioned.GroupVersion, clientRegisteredGVs []unversioned.GroupVersion) (*unversioned.GroupVersion, error) {
|
||||
clientVersions := sets.String{}
|
||||
for _, gv := range clientRegisteredGVs {
|
||||
clientVersions.Insert(gv.String())
|
||||
|
@ -61,7 +60,7 @@ func NegotiateVersion(client DiscoveryInterface, requiredGV *schema.GroupVersion
|
|||
// not a negotiation specific error.
|
||||
return nil, err
|
||||
}
|
||||
versions := metav1.ExtractGroupVersions(groups)
|
||||
versions := unversioned.ExtractGroupVersions(groups)
|
||||
serverVersions := sets.String{}
|
||||
for _, v := range versions {
|
||||
serverVersions.Insert(v)
|
||||
|
@ -108,55 +107,3 @@ func NegotiateVersion(client DiscoveryInterface, requiredGV *schema.GroupVersion
|
|||
return nil, fmt.Errorf("failed to negotiate an api version; server supports: %v, client supports: %v",
|
||||
serverVersions, clientVersions)
|
||||
}
|
||||
|
||||
// GroupVersionResources converts APIResourceLists to the GroupVersionResources.
|
||||
func GroupVersionResources(rls []*metav1.APIResourceList) (map[schema.GroupVersionResource]struct{}, error) {
|
||||
gvrs := map[schema.GroupVersionResource]struct{}{}
|
||||
for _, rl := range rls {
|
||||
gv, err := schema.ParseGroupVersion(rl.GroupVersion)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for i := range rl.APIResources {
|
||||
gvrs[schema.GroupVersionResource{Group: gv.Group, Version: gv.Version, Resource: rl.APIResources[i].Name}] = struct{}{}
|
||||
}
|
||||
}
|
||||
return gvrs, nil
|
||||
}
|
||||
|
||||
// FilteredBy filters by the given predicate. Empty APIResourceLists are dropped.
|
||||
func FilteredBy(pred ResourcePredicate, rls []*metav1.APIResourceList) []*metav1.APIResourceList {
|
||||
result := []*metav1.APIResourceList{}
|
||||
for _, rl := range rls {
|
||||
filtered := *rl
|
||||
filtered.APIResources = nil
|
||||
for i := range rl.APIResources {
|
||||
if pred.Match(rl.GroupVersion, &rl.APIResources[i]) {
|
||||
filtered.APIResources = append(filtered.APIResources, rl.APIResources[i])
|
||||
}
|
||||
}
|
||||
if filtered.APIResources != nil {
|
||||
result = append(result, &filtered)
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
type ResourcePredicate interface {
|
||||
Match(groupVersion string, r *metav1.APIResource) bool
|
||||
}
|
||||
|
||||
type ResourcePredicateFunc func(groupVersion string, r *metav1.APIResource) bool
|
||||
|
||||
func (fn ResourcePredicateFunc) Match(groupVersion string, r *metav1.APIResource) bool {
|
||||
return fn(groupVersion, r)
|
||||
}
|
||||
|
||||
// SupportsAllVerbs is a predicate matching a resource iff all given verbs are supported.
|
||||
type SupportsAllVerbs struct {
|
||||
Verbs []string
|
||||
}
|
||||
|
||||
func (p SupportsAllVerbs) Match(groupVersion string, r *metav1.APIResource) bool {
|
||||
return sets.NewString([]string(r.Verbs)...).HasAll(p.Verbs...)
|
||||
}
|
||||
|
|
49
vendor/k8s.io/client-go/discovery/restmapper.go
generated
vendored
49
vendor/k8s.io/client-go/discovery/restmapper.go
generated
vendored
|
@ -20,10 +20,9 @@ import (
|
|||
"fmt"
|
||||
"sync"
|
||||
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/api/meta"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/client-go/pkg/api/errors"
|
||||
"k8s.io/client-go/pkg/api/meta"
|
||||
"k8s.io/client-go/pkg/api/unversioned"
|
||||
|
||||
"github.com/golang/glog"
|
||||
)
|
||||
|
@ -31,10 +30,10 @@ import (
|
|||
// APIGroupResources is an API group with a mapping of versions to
|
||||
// resources.
|
||||
type APIGroupResources struct {
|
||||
Group metav1.APIGroup
|
||||
Group unversioned.APIGroup
|
||||
// A mapping of version string to a slice of APIResources for
|
||||
// that version.
|
||||
VersionedResources map[string][]metav1.APIResource
|
||||
VersionedResources map[string][]unversioned.APIResource
|
||||
}
|
||||
|
||||
// NewRESTMapper returns a PriorityRESTMapper based on the discovered
|
||||
|
@ -43,8 +42,8 @@ func NewRESTMapper(groupResources []*APIGroupResources, versionInterfaces meta.V
|
|||
unionMapper := meta.MultiRESTMapper{}
|
||||
|
||||
var groupPriority []string
|
||||
var resourcePriority []schema.GroupVersionResource
|
||||
var kindPriority []schema.GroupVersionKind
|
||||
var resourcePriority []unversioned.GroupVersionResource
|
||||
var kindPriority []unversioned.GroupVersionKind
|
||||
|
||||
for _, group := range groupResources {
|
||||
groupPriority = append(groupPriority, group.Group.Name)
|
||||
|
@ -52,13 +51,13 @@ func NewRESTMapper(groupResources []*APIGroupResources, versionInterfaces meta.V
|
|||
if len(group.Group.PreferredVersion.Version) != 0 {
|
||||
preferred := group.Group.PreferredVersion.Version
|
||||
if _, ok := group.VersionedResources[preferred]; ok {
|
||||
resourcePriority = append(resourcePriority, schema.GroupVersionResource{
|
||||
resourcePriority = append(resourcePriority, unversioned.GroupVersionResource{
|
||||
Group: group.Group.Name,
|
||||
Version: group.Group.PreferredVersion.Version,
|
||||
Resource: meta.AnyResource,
|
||||
})
|
||||
|
||||
kindPriority = append(kindPriority, schema.GroupVersionKind{
|
||||
kindPriority = append(kindPriority, unversioned.GroupVersionKind{
|
||||
Group: group.Group.Name,
|
||||
Version: group.Group.PreferredVersion.Version,
|
||||
Kind: meta.AnyKind,
|
||||
|
@ -72,8 +71,8 @@ func NewRESTMapper(groupResources []*APIGroupResources, versionInterfaces meta.V
|
|||
continue
|
||||
}
|
||||
|
||||
gv := schema.GroupVersion{Group: group.Group.Name, Version: discoveryVersion.Version}
|
||||
versionMapper := meta.NewDefaultRESTMapper([]schema.GroupVersion{gv}, versionInterfaces)
|
||||
gv := unversioned.GroupVersion{Group: group.Group.Name, Version: discoveryVersion.Version}
|
||||
versionMapper := meta.NewDefaultRESTMapper([]unversioned.GroupVersion{gv}, versionInterfaces)
|
||||
|
||||
for _, resource := range resources {
|
||||
scope := meta.RESTScopeNamespace
|
||||
|
@ -91,12 +90,12 @@ func NewRESTMapper(groupResources []*APIGroupResources, versionInterfaces meta.V
|
|||
}
|
||||
|
||||
for _, group := range groupPriority {
|
||||
resourcePriority = append(resourcePriority, schema.GroupVersionResource{
|
||||
resourcePriority = append(resourcePriority, unversioned.GroupVersionResource{
|
||||
Group: group,
|
||||
Version: meta.AnyVersion,
|
||||
Resource: meta.AnyResource,
|
||||
})
|
||||
kindPriority = append(kindPriority, schema.GroupVersionKind{
|
||||
kindPriority = append(kindPriority, unversioned.GroupVersionKind{
|
||||
Group: group,
|
||||
Version: meta.AnyVersion,
|
||||
Kind: meta.AnyKind,
|
||||
|
@ -121,7 +120,7 @@ func GetAPIGroupResources(cl DiscoveryInterface) ([]*APIGroupResources, error) {
|
|||
for _, group := range apiGroups.Groups {
|
||||
groupResources := &APIGroupResources{
|
||||
Group: group,
|
||||
VersionedResources: make(map[string][]metav1.APIResource),
|
||||
VersionedResources: make(map[string][]unversioned.APIResource),
|
||||
}
|
||||
for _, version := range group.Versions {
|
||||
resources, err := cl.ServerResourcesForGroupVersion(version.GroupVersion)
|
||||
|
@ -189,10 +188,10 @@ func (d *DeferredDiscoveryRESTMapper) Reset() {
|
|||
|
||||
// KindFor takes a partial resource and returns back the single match.
|
||||
// It returns an error if there are multiple matches.
|
||||
func (d *DeferredDiscoveryRESTMapper) KindFor(resource schema.GroupVersionResource) (gvk schema.GroupVersionKind, err error) {
|
||||
func (d *DeferredDiscoveryRESTMapper) KindFor(resource unversioned.GroupVersionResource) (gvk unversioned.GroupVersionKind, err error) {
|
||||
del, err := d.getDelegate()
|
||||
if err != nil {
|
||||
return schema.GroupVersionKind{}, err
|
||||
return unversioned.GroupVersionKind{}, err
|
||||
}
|
||||
gvk, err = del.KindFor(resource)
|
||||
if err != nil && !d.cl.Fresh() {
|
||||
|
@ -204,7 +203,7 @@ func (d *DeferredDiscoveryRESTMapper) KindFor(resource schema.GroupVersionResour
|
|||
|
||||
// KindsFor takes a partial resource and returns back the list of
|
||||
// potential kinds in priority order.
|
||||
func (d *DeferredDiscoveryRESTMapper) KindsFor(resource schema.GroupVersionResource) (gvks []schema.GroupVersionKind, err error) {
|
||||
func (d *DeferredDiscoveryRESTMapper) KindsFor(resource unversioned.GroupVersionResource) (gvks []unversioned.GroupVersionKind, err error) {
|
||||
del, err := d.getDelegate()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -219,10 +218,10 @@ func (d *DeferredDiscoveryRESTMapper) KindsFor(resource schema.GroupVersionResou
|
|||
|
||||
// ResourceFor takes a partial resource and returns back the single
|
||||
// match. It returns an error if there are multiple matches.
|
||||
func (d *DeferredDiscoveryRESTMapper) ResourceFor(input schema.GroupVersionResource) (gvr schema.GroupVersionResource, err error) {
|
||||
func (d *DeferredDiscoveryRESTMapper) ResourceFor(input unversioned.GroupVersionResource) (gvr unversioned.GroupVersionResource, err error) {
|
||||
del, err := d.getDelegate()
|
||||
if err != nil {
|
||||
return schema.GroupVersionResource{}, err
|
||||
return unversioned.GroupVersionResource{}, err
|
||||
}
|
||||
gvr, err = del.ResourceFor(input)
|
||||
if err != nil && !d.cl.Fresh() {
|
||||
|
@ -234,7 +233,7 @@ func (d *DeferredDiscoveryRESTMapper) ResourceFor(input schema.GroupVersionResou
|
|||
|
||||
// ResourcesFor takes a partial resource and returns back the list of
|
||||
// potential resource in priority order.
|
||||
func (d *DeferredDiscoveryRESTMapper) ResourcesFor(input schema.GroupVersionResource) (gvrs []schema.GroupVersionResource, err error) {
|
||||
func (d *DeferredDiscoveryRESTMapper) ResourcesFor(input unversioned.GroupVersionResource) (gvrs []unversioned.GroupVersionResource, err error) {
|
||||
del, err := d.getDelegate()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -249,7 +248,7 @@ func (d *DeferredDiscoveryRESTMapper) ResourcesFor(input schema.GroupVersionReso
|
|||
|
||||
// RESTMapping identifies a preferred resource mapping for the
|
||||
// provided group kind.
|
||||
func (d *DeferredDiscoveryRESTMapper) RESTMapping(gk schema.GroupKind, versions ...string) (m *meta.RESTMapping, err error) {
|
||||
func (d *DeferredDiscoveryRESTMapper) RESTMapping(gk unversioned.GroupKind, versions ...string) (m *meta.RESTMapping, err error) {
|
||||
del, err := d.getDelegate()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -265,15 +264,15 @@ func (d *DeferredDiscoveryRESTMapper) RESTMapping(gk schema.GroupKind, versions
|
|||
// RESTMappings returns the RESTMappings for the provided group kind
|
||||
// in a rough internal preferred order. If no kind is found, it will
|
||||
// return a NoResourceMatchError.
|
||||
func (d *DeferredDiscoveryRESTMapper) RESTMappings(gk schema.GroupKind, versions ...string) (ms []*meta.RESTMapping, err error) {
|
||||
func (d *DeferredDiscoveryRESTMapper) RESTMappings(gk unversioned.GroupKind) (ms []*meta.RESTMapping, err error) {
|
||||
del, err := d.getDelegate()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ms, err = del.RESTMappings(gk, versions...)
|
||||
ms, err = del.RESTMappings(gk)
|
||||
if len(ms) == 0 && !d.cl.Fresh() {
|
||||
d.Reset()
|
||||
ms, err = d.RESTMappings(gk, versions...)
|
||||
ms, err = d.RESTMappings(gk)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
30
vendor/k8s.io/client-go/discovery/unstructured.go
generated
vendored
30
vendor/k8s.io/client-go/discovery/unstructured.go
generated
vendored
|
@ -19,20 +19,20 @@ package discovery
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/client-go/pkg/api/unversioned"
|
||||
"k8s.io/client-go/pkg/runtime"
|
||||
)
|
||||
|
||||
// UnstructuredObjectTyper provides a runtime.ObjectTyper implmentation for
|
||||
// runtime.Unstructured object based on discovery information.
|
||||
type UnstructuredObjectTyper struct {
|
||||
registered map[schema.GroupVersionKind]bool
|
||||
registered map[unversioned.GroupVersionKind]bool
|
||||
}
|
||||
|
||||
// NewUnstructuredObjectTyper returns a runtime.ObjectTyper for
|
||||
// unstructred objects based on discovery information.
|
||||
func NewUnstructuredObjectTyper(groupResources []*APIGroupResources) *UnstructuredObjectTyper {
|
||||
dot := &UnstructuredObjectTyper{registered: make(map[schema.GroupVersionKind]bool)}
|
||||
dot := &UnstructuredObjectTyper{registered: make(map[unversioned.GroupVersionKind]bool)}
|
||||
for _, group := range groupResources {
|
||||
for _, discoveryVersion := range group.Group.Versions {
|
||||
resources, ok := group.VersionedResources[discoveryVersion.Version]
|
||||
|
@ -40,7 +40,7 @@ func NewUnstructuredObjectTyper(groupResources []*APIGroupResources) *Unstructur
|
|||
continue
|
||||
}
|
||||
|
||||
gv := schema.GroupVersion{Group: group.Group.Name, Version: discoveryVersion.Version}
|
||||
gv := unversioned.GroupVersion{Group: group.Group.Name, Version: discoveryVersion.Version}
|
||||
for _, resource := range resources {
|
||||
dot.registered[gv.WithKind(resource.Kind)] = true
|
||||
}
|
||||
|
@ -50,39 +50,39 @@ func NewUnstructuredObjectTyper(groupResources []*APIGroupResources) *Unstructur
|
|||
}
|
||||
|
||||
// ObjectKind returns the group,version,kind of the provided object, or an error
|
||||
// if the object in not runtime.Unstructured or has no group,version,kind
|
||||
// if the object in not *runtime.Unstructured or has no group,version,kind
|
||||
// information.
|
||||
func (d *UnstructuredObjectTyper) ObjectKind(obj runtime.Object) (schema.GroupVersionKind, error) {
|
||||
if _, ok := obj.(runtime.Unstructured); !ok {
|
||||
return schema.GroupVersionKind{}, fmt.Errorf("type %T is invalid for dynamic object typer", obj)
|
||||
func (d *UnstructuredObjectTyper) ObjectKind(obj runtime.Object) (unversioned.GroupVersionKind, error) {
|
||||
if _, ok := obj.(*runtime.Unstructured); !ok {
|
||||
return unversioned.GroupVersionKind{}, fmt.Errorf("type %T is invalid for dynamic object typer", obj)
|
||||
}
|
||||
|
||||
return obj.GetObjectKind().GroupVersionKind(), nil
|
||||
}
|
||||
|
||||
// ObjectKinds returns a slice of one element with the group,version,kind of the
|
||||
// provided object, or an error if the object is not runtime.Unstructured or
|
||||
// provided object, or an error if the object is not *runtime.Unstructured or
|
||||
// has no group,version,kind information. unversionedType will always be false
|
||||
// because runtime.Unstructured object should always have group,version,kind
|
||||
// information set.
|
||||
func (d *UnstructuredObjectTyper) ObjectKinds(obj runtime.Object) (gvks []schema.GroupVersionKind, unversionedType bool, err error) {
|
||||
func (d *UnstructuredObjectTyper) ObjectKinds(obj runtime.Object) (gvks []unversioned.GroupVersionKind, unversionedType bool, err error) {
|
||||
gvk, err := d.ObjectKind(obj)
|
||||
if err != nil {
|
||||
return nil, false, err
|
||||
}
|
||||
|
||||
return []schema.GroupVersionKind{gvk}, false, nil
|
||||
return []unversioned.GroupVersionKind{gvk}, false, nil
|
||||
}
|
||||
|
||||
// Recognizes returns true if the provided group,version,kind was in the
|
||||
// discovery information.
|
||||
func (d *UnstructuredObjectTyper) Recognizes(gvk schema.GroupVersionKind) bool {
|
||||
func (d *UnstructuredObjectTyper) Recognizes(gvk unversioned.GroupVersionKind) bool {
|
||||
return d.registered[gvk]
|
||||
}
|
||||
|
||||
// IsUnversioned returns false always because runtime.Unstructured objects
|
||||
// IsUnversioned returns false always because *runtime.Unstructured objects
|
||||
// should always have group,version,kind information set. ok will be true if the
|
||||
// object's group,version,kind is api.Registry.
|
||||
// object's group,version,kind is registered.
|
||||
func (d *UnstructuredObjectTyper) IsUnversioned(obj runtime.Object) (unversioned bool, ok bool) {
|
||||
gvk, err := d.ObjectKind(obj)
|
||||
if err != nil {
|
||||
|
|
71
vendor/k8s.io/client-go/dynamic/client.go
generated
vendored
71
vendor/k8s.io/client-go/dynamic/client.go
generated
vendored
|
@ -26,30 +26,27 @@ import (
|
|||
"net/url"
|
||||
"strings"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
"k8s.io/apimachinery/pkg/conversion/queryparams"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/apimachinery/pkg/watch"
|
||||
"k8s.io/client-go/pkg/api"
|
||||
"k8s.io/client-go/pkg/api/unversioned"
|
||||
"k8s.io/client-go/pkg/api/v1"
|
||||
restclient "k8s.io/client-go/rest"
|
||||
"k8s.io/client-go/util/flowcontrol"
|
||||
"k8s.io/client-go/pkg/conversion/queryparams"
|
||||
"k8s.io/client-go/pkg/runtime"
|
||||
"k8s.io/client-go/pkg/runtime/serializer"
|
||||
"k8s.io/client-go/pkg/util/flowcontrol"
|
||||
"k8s.io/client-go/pkg/watch"
|
||||
"k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
// Client is a Kubernetes client that allows you to access metadata
|
||||
// and manipulate metadata of a Kubernetes API group.
|
||||
type Client struct {
|
||||
cl *restclient.RESTClient
|
||||
cl *rest.RESTClient
|
||||
parameterCodec runtime.ParameterCodec
|
||||
}
|
||||
|
||||
// NewClient returns a new client based on the passed in config. The
|
||||
// codec is ignored, as the dynamic client uses it's own codec.
|
||||
func NewClient(conf *restclient.Config) (*Client, error) {
|
||||
func NewClient(conf *rest.Config) (*Client, error) {
|
||||
// avoid changing the original config
|
||||
confCopy := *conf
|
||||
conf = &confCopy
|
||||
|
@ -66,10 +63,10 @@ func NewClient(conf *restclient.Config) (*Client, error) {
|
|||
}
|
||||
|
||||
if len(conf.UserAgent) == 0 {
|
||||
conf.UserAgent = restclient.DefaultKubernetesUserAgent()
|
||||
conf.UserAgent = rest.DefaultKubernetesUserAgent()
|
||||
}
|
||||
|
||||
cl, err := restclient.RESTClientFor(conf)
|
||||
cl, err := rest.RESTClientFor(conf)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -85,7 +82,7 @@ func (c *Client) GetRateLimiter() flowcontrol.RateLimiter {
|
|||
// Resource returns an API interface to the specified resource for this client's
|
||||
// group and version. If resource is not a namespaced resource, then namespace
|
||||
// is ignored. The ResourceClient inherits the parameter codec of c.
|
||||
func (c *Client) Resource(resource *metav1.APIResource, namespace string) *ResourceClient {
|
||||
func (c *Client) Resource(resource *unversioned.APIResource, namespace string) *ResourceClient {
|
||||
return &ResourceClient{
|
||||
cl: c.cl,
|
||||
resource: resource,
|
||||
|
@ -105,8 +102,8 @@ func (c *Client) ParameterCodec(parameterCodec runtime.ParameterCodec) *Client {
|
|||
// ResourceClient is an API interface to a specific resource under a
|
||||
// dynamic client.
|
||||
type ResourceClient struct {
|
||||
cl *restclient.RESTClient
|
||||
resource *metav1.APIResource
|
||||
cl *rest.RESTClient
|
||||
resource *unversioned.APIResource
|
||||
ns string
|
||||
parameterCodec runtime.ParameterCodec
|
||||
}
|
||||
|
@ -126,8 +123,8 @@ func (rc *ResourceClient) List(opts runtime.Object) (runtime.Object, error) {
|
|||
}
|
||||
|
||||
// Get gets the resource with the specified name.
|
||||
func (rc *ResourceClient) Get(name string) (*unstructured.Unstructured, error) {
|
||||
result := new(unstructured.Unstructured)
|
||||
func (rc *ResourceClient) Get(name string) (*runtime.Unstructured, error) {
|
||||
result := new(runtime.Unstructured)
|
||||
err := rc.cl.Get().
|
||||
NamespaceIfScoped(rc.ns, rc.resource.Namespaced).
|
||||
Resource(rc.resource.Name).
|
||||
|
@ -164,8 +161,8 @@ func (rc *ResourceClient) DeleteCollection(deleteOptions *v1.DeleteOptions, list
|
|||
}
|
||||
|
||||
// Create creates the provided resource.
|
||||
func (rc *ResourceClient) Create(obj *unstructured.Unstructured) (*unstructured.Unstructured, error) {
|
||||
result := new(unstructured.Unstructured)
|
||||
func (rc *ResourceClient) Create(obj *runtime.Unstructured) (*runtime.Unstructured, error) {
|
||||
result := new(runtime.Unstructured)
|
||||
err := rc.cl.Post().
|
||||
NamespaceIfScoped(rc.ns, rc.resource.Namespaced).
|
||||
Resource(rc.resource.Name).
|
||||
|
@ -176,8 +173,8 @@ func (rc *ResourceClient) Create(obj *unstructured.Unstructured) (*unstructured.
|
|||
}
|
||||
|
||||
// Update updates the provided resource.
|
||||
func (rc *ResourceClient) Update(obj *unstructured.Unstructured) (*unstructured.Unstructured, error) {
|
||||
result := new(unstructured.Unstructured)
|
||||
func (rc *ResourceClient) Update(obj *runtime.Unstructured) (*runtime.Unstructured, error) {
|
||||
result := new(runtime.Unstructured)
|
||||
if len(obj.GetName()) == 0 {
|
||||
return result, errors.New("object missing name")
|
||||
}
|
||||
|
@ -205,8 +202,8 @@ func (rc *ResourceClient) Watch(opts runtime.Object) (watch.Interface, error) {
|
|||
Watch()
|
||||
}
|
||||
|
||||
func (rc *ResourceClient) Patch(name string, pt types.PatchType, data []byte) (*unstructured.Unstructured, error) {
|
||||
result := new(unstructured.Unstructured)
|
||||
func (rc *ResourceClient) Patch(name string, pt api.PatchType, data []byte) (*runtime.Unstructured, error) {
|
||||
result := new(runtime.Unstructured)
|
||||
err := rc.cl.Patch(pt).
|
||||
NamespaceIfScoped(rc.ns, rc.resource.Namespaced).
|
||||
Resource(rc.resource.Name).
|
||||
|
@ -221,14 +218,14 @@ func (rc *ResourceClient) Patch(name string, pt types.PatchType, data []byte) (*
|
|||
// with special handling for Status objects.
|
||||
type dynamicCodec struct{}
|
||||
|
||||
func (dynamicCodec) Decode(data []byte, gvk *schema.GroupVersionKind, obj runtime.Object) (runtime.Object, *schema.GroupVersionKind, error) {
|
||||
obj, gvk, err := unstructured.UnstructuredJSONScheme.Decode(data, gvk, obj)
|
||||
func (dynamicCodec) Decode(data []byte, gvk *unversioned.GroupVersionKind, obj runtime.Object) (runtime.Object, *unversioned.GroupVersionKind, error) {
|
||||
obj, gvk, err := runtime.UnstructuredJSONScheme.Decode(data, gvk, obj)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
if _, ok := obj.(*metav1.Status); !ok && strings.ToLower(gvk.Kind) == "status" {
|
||||
obj = &metav1.Status{}
|
||||
if _, ok := obj.(*unversioned.Status); !ok && strings.ToLower(gvk.Kind) == "status" {
|
||||
obj = &unversioned.Status{}
|
||||
err := json.Unmarshal(data, obj)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
|
@ -239,11 +236,11 @@ func (dynamicCodec) Decode(data []byte, gvk *schema.GroupVersionKind, obj runtim
|
|||
}
|
||||
|
||||
func (dynamicCodec) Encode(obj runtime.Object, w io.Writer) error {
|
||||
return unstructured.UnstructuredJSONScheme.Encode(obj, w)
|
||||
return runtime.UnstructuredJSONScheme.Encode(obj, w)
|
||||
}
|
||||
|
||||
// ContentConfig returns a restclient.ContentConfig for dynamic types.
|
||||
func ContentConfig() restclient.ContentConfig {
|
||||
// ContentConfig returns a rest.ContentConfig for dynamic types.
|
||||
func ContentConfig() rest.ContentConfig {
|
||||
var jsonInfo runtime.SerializerInfo
|
||||
// TODO: api.Codecs here should become "pkg/apis/server/scheme" which is the minimal core you need
|
||||
// to talk to a kubernetes server
|
||||
|
@ -256,7 +253,7 @@ func ContentConfig() restclient.ContentConfig {
|
|||
|
||||
jsonInfo.Serializer = dynamicCodec{}
|
||||
jsonInfo.PrettySerializer = nil
|
||||
return restclient.ContentConfig{
|
||||
return rest.ContentConfig{
|
||||
AcceptContentTypes: runtime.ContentTypeJSON,
|
||||
ContentType: runtime.ContentTypeJSON,
|
||||
NegotiatedSerializer: serializer.NegotiatedSerializerWrapper(jsonInfo),
|
||||
|
@ -267,11 +264,11 @@ func ContentConfig() restclient.ContentConfig {
|
|||
// parameters without trying to convert to the target version.
|
||||
type parameterCodec struct{}
|
||||
|
||||
func (parameterCodec) EncodeParameters(obj runtime.Object, to schema.GroupVersion) (url.Values, error) {
|
||||
func (parameterCodec) EncodeParameters(obj runtime.Object, to unversioned.GroupVersion) (url.Values, error) {
|
||||
return queryparams.Convert(obj)
|
||||
}
|
||||
|
||||
func (parameterCodec) DecodeParameters(parameters url.Values, from schema.GroupVersion, into runtime.Object) error {
|
||||
func (parameterCodec) DecodeParameters(parameters url.Values, from unversioned.GroupVersion, into runtime.Object) error {
|
||||
return errors.New("DecodeParameters not implemented on dynamic parameterCodec")
|
||||
}
|
||||
|
||||
|
@ -279,7 +276,7 @@ var defaultParameterEncoder runtime.ParameterCodec = parameterCodec{}
|
|||
|
||||
type versionedParameterEncoderWithV1Fallback struct{}
|
||||
|
||||
func (versionedParameterEncoderWithV1Fallback) EncodeParameters(obj runtime.Object, to schema.GroupVersion) (url.Values, error) {
|
||||
func (versionedParameterEncoderWithV1Fallback) EncodeParameters(obj runtime.Object, to unversioned.GroupVersion) (url.Values, error) {
|
||||
ret, err := api.ParameterCodec.EncodeParameters(obj, to)
|
||||
if err != nil && runtime.IsNotRegisteredError(err) {
|
||||
// fallback to v1
|
||||
|
@ -288,7 +285,7 @@ func (versionedParameterEncoderWithV1Fallback) EncodeParameters(obj runtime.Obje
|
|||
return ret, err
|
||||
}
|
||||
|
||||
func (versionedParameterEncoderWithV1Fallback) DecodeParameters(parameters url.Values, from schema.GroupVersion, into runtime.Object) error {
|
||||
func (versionedParameterEncoderWithV1Fallback) DecodeParameters(parameters url.Values, from unversioned.GroupVersion, into runtime.Object) error {
|
||||
return errors.New("DecodeParameters not implemented on versionedParameterEncoderWithV1Fallback")
|
||||
}
|
||||
|
||||
|
|
28
vendor/k8s.io/client-go/dynamic/client_pool.go
generated
vendored
28
vendor/k8s.io/client-go/dynamic/client_pool.go
generated
vendored
|
@ -19,27 +19,27 @@ package dynamic
|
|||
import (
|
||||
"sync"
|
||||
|
||||
"k8s.io/apimachinery/pkg/api/meta"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
restclient "k8s.io/client-go/rest"
|
||||
"k8s.io/client-go/pkg/api/meta"
|
||||
"k8s.io/client-go/pkg/api/unversioned"
|
||||
"k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
// ClientPool manages a pool of dynamic clients.
|
||||
type ClientPool interface {
|
||||
// ClientForGroupVersionKind returns a client configured for the specified groupVersionResource.
|
||||
// Resource may be empty.
|
||||
ClientForGroupVersionResource(resource schema.GroupVersionResource) (*Client, error)
|
||||
ClientForGroupVersionResource(resource unversioned.GroupVersionResource) (*Client, error)
|
||||
// ClientForGroupVersionKind returns a client configured for the specified groupVersionKind.
|
||||
// Kind may be empty.
|
||||
ClientForGroupVersionKind(kind schema.GroupVersionKind) (*Client, error)
|
||||
ClientForGroupVersionKind(kind unversioned.GroupVersionKind) (*Client, error)
|
||||
}
|
||||
|
||||
// APIPathResolverFunc knows how to convert a groupVersion to its API path. The Kind field is
|
||||
// optional.
|
||||
type APIPathResolverFunc func(kind schema.GroupVersionKind) string
|
||||
type APIPathResolverFunc func(kind unversioned.GroupVersionKind) string
|
||||
|
||||
// LegacyAPIPathResolverFunc can resolve paths properly with the legacy API.
|
||||
func LegacyAPIPathResolverFunc(kind schema.GroupVersionKind) string {
|
||||
func LegacyAPIPathResolverFunc(kind unversioned.GroupVersionKind) string {
|
||||
if len(kind.Group) == 0 {
|
||||
return "/api"
|
||||
}
|
||||
|
@ -50,8 +50,8 @@ func LegacyAPIPathResolverFunc(kind schema.GroupVersionKind) string {
|
|||
// is asked to retrieve. This type is thread safe.
|
||||
type clientPoolImpl struct {
|
||||
lock sync.RWMutex
|
||||
config *restclient.Config
|
||||
clients map[schema.GroupVersion]*Client
|
||||
config *rest.Config
|
||||
clients map[unversioned.GroupVersion]*Client
|
||||
apiPathResolverFunc APIPathResolverFunc
|
||||
mapper meta.RESTMapper
|
||||
}
|
||||
|
@ -59,12 +59,12 @@ type clientPoolImpl struct {
|
|||
// NewClientPool returns a ClientPool from the specified config. It reuses clients for the the same
|
||||
// group version. It is expected this type may be wrapped by specific logic that special cases certain
|
||||
// resources or groups.
|
||||
func NewClientPool(config *restclient.Config, mapper meta.RESTMapper, apiPathResolverFunc APIPathResolverFunc) ClientPool {
|
||||
func NewClientPool(config *rest.Config, mapper meta.RESTMapper, apiPathResolverFunc APIPathResolverFunc) ClientPool {
|
||||
confCopy := *config
|
||||
|
||||
return &clientPoolImpl{
|
||||
config: &confCopy,
|
||||
clients: map[schema.GroupVersion]*Client{},
|
||||
clients: map[unversioned.GroupVersion]*Client{},
|
||||
apiPathResolverFunc: apiPathResolverFunc,
|
||||
mapper: mapper,
|
||||
}
|
||||
|
@ -72,11 +72,11 @@ func NewClientPool(config *restclient.Config, mapper meta.RESTMapper, apiPathRes
|
|||
|
||||
// ClientForGroupVersionResource uses the provided RESTMapper to identify the appropriate resource. Resource may
|
||||
// be empty. If no matching kind is found the underlying client for that group is still returned.
|
||||
func (c *clientPoolImpl) ClientForGroupVersionResource(resource schema.GroupVersionResource) (*Client, error) {
|
||||
func (c *clientPoolImpl) ClientForGroupVersionResource(resource unversioned.GroupVersionResource) (*Client, error) {
|
||||
kinds, err := c.mapper.KindsFor(resource)
|
||||
if err != nil {
|
||||
if meta.IsNoMatchError(err) {
|
||||
return c.ClientForGroupVersionKind(schema.GroupVersionKind{Group: resource.Group, Version: resource.Version})
|
||||
return c.ClientForGroupVersionKind(unversioned.GroupVersionKind{Group: resource.Group, Version: resource.Version})
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ func (c *clientPoolImpl) ClientForGroupVersionResource(resource schema.GroupVers
|
|||
|
||||
// ClientForGroupVersion returns a client for the specified groupVersion, creates one if none exists. Kind
|
||||
// in the GroupVersionKind may be empty.
|
||||
func (c *clientPoolImpl) ClientForGroupVersionKind(kind schema.GroupVersionKind) (*Client, error) {
|
||||
func (c *clientPoolImpl) ClientForGroupVersionKind(kind unversioned.GroupVersionKind) (*Client, error) {
|
||||
c.lock.Lock()
|
||||
defer c.lock.Unlock()
|
||||
|
||||
|
|
36
vendor/k8s.io/client-go/dynamic/dynamic_util.go
generated
vendored
36
vendor/k8s.io/client-go/dynamic/dynamic_util.go
generated
vendored
|
@ -19,27 +19,25 @@ package dynamic
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
"k8s.io/apimachinery/pkg/api/meta"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/client-go/pkg/api/meta"
|
||||
"k8s.io/client-go/pkg/api/unversioned"
|
||||
"k8s.io/client-go/pkg/runtime"
|
||||
)
|
||||
|
||||
// VersionInterfaces provides an object converter and metadata
|
||||
// accessor appropriate for use with unstructured objects.
|
||||
func VersionInterfaces(schema.GroupVersion) (*meta.VersionInterfaces, error) {
|
||||
func VersionInterfaces(unversioned.GroupVersion) (*meta.VersionInterfaces, error) {
|
||||
return &meta.VersionInterfaces{
|
||||
ObjectConvertor: &unstructured.UnstructuredObjectConverter{},
|
||||
ObjectConvertor: &runtime.UnstructuredObjectConverter{},
|
||||
MetadataAccessor: meta.NewAccessor(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// NewDiscoveryRESTMapper returns a RESTMapper based on discovery information.
|
||||
func NewDiscoveryRESTMapper(resources []*metav1.APIResourceList, versionFunc meta.VersionInterfacesFunc) (*meta.DefaultRESTMapper, error) {
|
||||
func NewDiscoveryRESTMapper(resources []*unversioned.APIResourceList, versionFunc meta.VersionInterfacesFunc) (*meta.DefaultRESTMapper, error) {
|
||||
rm := meta.NewDefaultRESTMapper(nil, versionFunc)
|
||||
for _, resourceList := range resources {
|
||||
gv, err := schema.ParseGroupVersion(resourceList.GroupVersion)
|
||||
gv, err := unversioned.ParseGroupVersion(resourceList.GroupVersion)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -57,16 +55,16 @@ func NewDiscoveryRESTMapper(resources []*metav1.APIResourceList, versionFunc met
|
|||
}
|
||||
|
||||
// ObjectTyper provides an ObjectTyper implementation for
|
||||
// unstructured.Unstructured object based on discovery information.
|
||||
// runtime.Unstructured object based on discovery information.
|
||||
type ObjectTyper struct {
|
||||
registered map[schema.GroupVersionKind]bool
|
||||
registered map[unversioned.GroupVersionKind]bool
|
||||
}
|
||||
|
||||
// NewObjectTyper constructs an ObjectTyper from discovery information.
|
||||
func NewObjectTyper(resources []*metav1.APIResourceList) (runtime.ObjectTyper, error) {
|
||||
ot := &ObjectTyper{registered: make(map[schema.GroupVersionKind]bool)}
|
||||
func NewObjectTyper(resources []*unversioned.APIResourceList) (runtime.ObjectTyper, error) {
|
||||
ot := &ObjectTyper{registered: make(map[unversioned.GroupVersionKind]bool)}
|
||||
for _, resourceList := range resources {
|
||||
gv, err := schema.ParseGroupVersion(resourceList.GroupVersion)
|
||||
gv, err := unversioned.ParseGroupVersion(resourceList.GroupVersion)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -80,17 +78,17 @@ func NewObjectTyper(resources []*metav1.APIResourceList) (runtime.ObjectTyper, e
|
|||
|
||||
// ObjectKinds returns a slice of one element with the
|
||||
// group,version,kind of the provided object, or an error if the
|
||||
// object is not *unstructured.Unstructured or has no group,version,kind
|
||||
// object is not *runtime.Unstructured or has no group,version,kind
|
||||
// information.
|
||||
func (ot *ObjectTyper) ObjectKinds(obj runtime.Object) ([]schema.GroupVersionKind, bool, error) {
|
||||
if _, ok := obj.(*unstructured.Unstructured); !ok {
|
||||
func (ot *ObjectTyper) ObjectKinds(obj runtime.Object) ([]unversioned.GroupVersionKind, bool, error) {
|
||||
if _, ok := obj.(*runtime.Unstructured); !ok {
|
||||
return nil, false, fmt.Errorf("type %T is invalid for dynamic object typer", obj)
|
||||
}
|
||||
return []schema.GroupVersionKind{obj.GetObjectKind().GroupVersionKind()}, false, nil
|
||||
return []unversioned.GroupVersionKind{obj.GetObjectKind().GroupVersionKind()}, false, nil
|
||||
}
|
||||
|
||||
// Recognizes returns true if the provided group,version,kind was in
|
||||
// the discovery information.
|
||||
func (ot *ObjectTyper) Recognizes(gvk schema.GroupVersionKind) bool {
|
||||
func (ot *ObjectTyper) Recognizes(gvk unversioned.GroupVersionKind) bool {
|
||||
return ot.registered[gvk]
|
||||
}
|
||||
|
|
143
vendor/k8s.io/client-go/kubernetes/clientset.go
generated
vendored
143
vendor/k8s.io/client-go/kubernetes/clientset.go
generated
vendored
|
@ -25,16 +25,15 @@ import (
|
|||
v1autoscaling "k8s.io/client-go/kubernetes/typed/autoscaling/v1"
|
||||
v1batch "k8s.io/client-go/kubernetes/typed/batch/v1"
|
||||
v2alpha1batch "k8s.io/client-go/kubernetes/typed/batch/v2alpha1"
|
||||
v1beta1certificates "k8s.io/client-go/kubernetes/typed/certificates/v1beta1"
|
||||
v1alpha1certificates "k8s.io/client-go/kubernetes/typed/certificates/v1alpha1"
|
||||
v1core "k8s.io/client-go/kubernetes/typed/core/v1"
|
||||
v1beta1extensions "k8s.io/client-go/kubernetes/typed/extensions/v1beta1"
|
||||
v1beta1policy "k8s.io/client-go/kubernetes/typed/policy/v1beta1"
|
||||
v1alpha1rbac "k8s.io/client-go/kubernetes/typed/rbac/v1alpha1"
|
||||
v1beta1rbac "k8s.io/client-go/kubernetes/typed/rbac/v1beta1"
|
||||
v1beta1storage "k8s.io/client-go/kubernetes/typed/storage/v1beta1"
|
||||
"k8s.io/client-go/pkg/util/flowcontrol"
|
||||
_ "k8s.io/client-go/plugin/pkg/client/auth"
|
||||
rest "k8s.io/client-go/rest"
|
||||
"k8s.io/client-go/util/flowcontrol"
|
||||
)
|
||||
|
||||
type Interface interface {
|
||||
|
@ -59,20 +58,18 @@ type Interface interface {
|
|||
Batch() v1batch.BatchV1Interface
|
||||
BatchV2alpha1() v2alpha1batch.BatchV2alpha1Interface
|
||||
|
||||
CertificatesV1beta1() v1beta1certificates.CertificatesV1beta1Interface
|
||||
CertificatesV1alpha1() v1alpha1certificates.CertificatesV1alpha1Interface
|
||||
// Deprecated: please explicitly pick a version if possible.
|
||||
Certificates() v1beta1certificates.CertificatesV1beta1Interface
|
||||
Certificates() v1alpha1certificates.CertificatesV1alpha1Interface
|
||||
ExtensionsV1beta1() v1beta1extensions.ExtensionsV1beta1Interface
|
||||
// Deprecated: please explicitly pick a version if possible.
|
||||
Extensions() v1beta1extensions.ExtensionsV1beta1Interface
|
||||
PolicyV1beta1() v1beta1policy.PolicyV1beta1Interface
|
||||
// Deprecated: please explicitly pick a version if possible.
|
||||
Policy() v1beta1policy.PolicyV1beta1Interface
|
||||
RbacV1beta1() v1beta1rbac.RbacV1beta1Interface
|
||||
// Deprecated: please explicitly pick a version if possible.
|
||||
Rbac() v1beta1rbac.RbacV1beta1Interface
|
||||
RbacV1alpha1() v1alpha1rbac.RbacV1alpha1Interface
|
||||
|
||||
// Deprecated: please explicitly pick a version if possible.
|
||||
Rbac() v1alpha1rbac.RbacV1alpha1Interface
|
||||
StorageV1beta1() v1beta1storage.StorageV1beta1Interface
|
||||
// Deprecated: please explicitly pick a version if possible.
|
||||
Storage() v1beta1storage.StorageV1beta1Interface
|
||||
|
@ -89,10 +86,9 @@ type Clientset struct {
|
|||
*v1autoscaling.AutoscalingV1Client
|
||||
*v1batch.BatchV1Client
|
||||
*v2alpha1batch.BatchV2alpha1Client
|
||||
*v1beta1certificates.CertificatesV1beta1Client
|
||||
*v1alpha1certificates.CertificatesV1alpha1Client
|
||||
*v1beta1extensions.ExtensionsV1beta1Client
|
||||
*v1beta1policy.PolicyV1beta1Client
|
||||
*v1beta1rbac.RbacV1beta1Client
|
||||
*v1alpha1rbac.RbacV1alpha1Client
|
||||
*v1beta1storage.StorageV1beta1Client
|
||||
}
|
||||
|
@ -207,21 +203,21 @@ func (c *Clientset) BatchV2alpha1() v2alpha1batch.BatchV2alpha1Interface {
|
|||
return c.BatchV2alpha1Client
|
||||
}
|
||||
|
||||
// CertificatesV1beta1 retrieves the CertificatesV1beta1Client
|
||||
func (c *Clientset) CertificatesV1beta1() v1beta1certificates.CertificatesV1beta1Interface {
|
||||
// CertificatesV1alpha1 retrieves the CertificatesV1alpha1Client
|
||||
func (c *Clientset) CertificatesV1alpha1() v1alpha1certificates.CertificatesV1alpha1Interface {
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
return c.CertificatesV1beta1Client
|
||||
return c.CertificatesV1alpha1Client
|
||||
}
|
||||
|
||||
// Deprecated: Certificates retrieves the default version of CertificatesClient.
|
||||
// Please explicitly pick a version.
|
||||
func (c *Clientset) Certificates() v1beta1certificates.CertificatesV1beta1Interface {
|
||||
func (c *Clientset) Certificates() v1alpha1certificates.CertificatesV1alpha1Interface {
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
return c.CertificatesV1beta1Client
|
||||
return c.CertificatesV1alpha1Client
|
||||
}
|
||||
|
||||
// ExtensionsV1beta1 retrieves the ExtensionsV1beta1Client
|
||||
|
@ -258,25 +254,17 @@ func (c *Clientset) Policy() v1beta1policy.PolicyV1beta1Interface {
|
|||
return c.PolicyV1beta1Client
|
||||
}
|
||||
|
||||
// RbacV1beta1 retrieves the RbacV1beta1Client
|
||||
func (c *Clientset) RbacV1beta1() v1beta1rbac.RbacV1beta1Interface {
|
||||
// RbacV1alpha1 retrieves the RbacV1alpha1Client
|
||||
func (c *Clientset) RbacV1alpha1() v1alpha1rbac.RbacV1alpha1Interface {
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
return c.RbacV1beta1Client
|
||||
return c.RbacV1alpha1Client
|
||||
}
|
||||
|
||||
// Deprecated: Rbac retrieves the default version of RbacClient.
|
||||
// Please explicitly pick a version.
|
||||
func (c *Clientset) Rbac() v1beta1rbac.RbacV1beta1Interface {
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
return c.RbacV1beta1Client
|
||||
}
|
||||
|
||||
// RbacV1alpha1 retrieves the RbacV1alpha1Client
|
||||
func (c *Clientset) RbacV1alpha1() v1alpha1rbac.RbacV1alpha1Interface {
|
||||
func (c *Clientset) Rbac() v1alpha1rbac.RbacV1alpha1Interface {
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
|
@ -302,9 +290,6 @@ func (c *Clientset) Storage() v1beta1storage.StorageV1beta1Interface {
|
|||
|
||||
// Discovery retrieves the DiscoveryClient
|
||||
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
return c.DiscoveryClient
|
||||
}
|
||||
|
||||
|
@ -314,108 +299,102 @@ func NewForConfig(c *rest.Config) (*Clientset, error) {
|
|||
if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 {
|
||||
configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst)
|
||||
}
|
||||
var cs Clientset
|
||||
var clientset Clientset
|
||||
var err error
|
||||
cs.CoreV1Client, err = v1core.NewForConfig(&configShallowCopy)
|
||||
clientset.CoreV1Client, err = v1core.NewForConfig(&configShallowCopy)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
cs.AppsV1beta1Client, err = v1beta1apps.NewForConfig(&configShallowCopy)
|
||||
clientset.AppsV1beta1Client, err = v1beta1apps.NewForConfig(&configShallowCopy)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
cs.AuthenticationV1beta1Client, err = v1beta1authentication.NewForConfig(&configShallowCopy)
|
||||
clientset.AuthenticationV1beta1Client, err = v1beta1authentication.NewForConfig(&configShallowCopy)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
cs.AuthorizationV1beta1Client, err = v1beta1authorization.NewForConfig(&configShallowCopy)
|
||||
clientset.AuthorizationV1beta1Client, err = v1beta1authorization.NewForConfig(&configShallowCopy)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
cs.AutoscalingV1Client, err = v1autoscaling.NewForConfig(&configShallowCopy)
|
||||
clientset.AutoscalingV1Client, err = v1autoscaling.NewForConfig(&configShallowCopy)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
cs.BatchV1Client, err = v1batch.NewForConfig(&configShallowCopy)
|
||||
clientset.BatchV1Client, err = v1batch.NewForConfig(&configShallowCopy)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
cs.BatchV2alpha1Client, err = v2alpha1batch.NewForConfig(&configShallowCopy)
|
||||
clientset.BatchV2alpha1Client, err = v2alpha1batch.NewForConfig(&configShallowCopy)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
cs.CertificatesV1beta1Client, err = v1beta1certificates.NewForConfig(&configShallowCopy)
|
||||
clientset.CertificatesV1alpha1Client, err = v1alpha1certificates.NewForConfig(&configShallowCopy)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
cs.ExtensionsV1beta1Client, err = v1beta1extensions.NewForConfig(&configShallowCopy)
|
||||
clientset.ExtensionsV1beta1Client, err = v1beta1extensions.NewForConfig(&configShallowCopy)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
cs.PolicyV1beta1Client, err = v1beta1policy.NewForConfig(&configShallowCopy)
|
||||
clientset.PolicyV1beta1Client, err = v1beta1policy.NewForConfig(&configShallowCopy)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
cs.RbacV1beta1Client, err = v1beta1rbac.NewForConfig(&configShallowCopy)
|
||||
clientset.RbacV1alpha1Client, err = v1alpha1rbac.NewForConfig(&configShallowCopy)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
cs.RbacV1alpha1Client, err = v1alpha1rbac.NewForConfig(&configShallowCopy)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
cs.StorageV1beta1Client, err = v1beta1storage.NewForConfig(&configShallowCopy)
|
||||
clientset.StorageV1beta1Client, err = v1beta1storage.NewForConfig(&configShallowCopy)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy)
|
||||
clientset.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy)
|
||||
if err != nil {
|
||||
glog.Errorf("failed to create the DiscoveryClient: %v", err)
|
||||
return nil, err
|
||||
}
|
||||
return &cs, nil
|
||||
return &clientset, 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.CoreV1Client = v1core.NewForConfigOrDie(c)
|
||||
cs.AppsV1beta1Client = v1beta1apps.NewForConfigOrDie(c)
|
||||
cs.AuthenticationV1beta1Client = v1beta1authentication.NewForConfigOrDie(c)
|
||||
cs.AuthorizationV1beta1Client = v1beta1authorization.NewForConfigOrDie(c)
|
||||
cs.AutoscalingV1Client = v1autoscaling.NewForConfigOrDie(c)
|
||||
cs.BatchV1Client = v1batch.NewForConfigOrDie(c)
|
||||
cs.BatchV2alpha1Client = v2alpha1batch.NewForConfigOrDie(c)
|
||||
cs.CertificatesV1beta1Client = v1beta1certificates.NewForConfigOrDie(c)
|
||||
cs.ExtensionsV1beta1Client = v1beta1extensions.NewForConfigOrDie(c)
|
||||
cs.PolicyV1beta1Client = v1beta1policy.NewForConfigOrDie(c)
|
||||
cs.RbacV1beta1Client = v1beta1rbac.NewForConfigOrDie(c)
|
||||
cs.RbacV1alpha1Client = v1alpha1rbac.NewForConfigOrDie(c)
|
||||
cs.StorageV1beta1Client = v1beta1storage.NewForConfigOrDie(c)
|
||||
var clientset Clientset
|
||||
clientset.CoreV1Client = v1core.NewForConfigOrDie(c)
|
||||
clientset.AppsV1beta1Client = v1beta1apps.NewForConfigOrDie(c)
|
||||
clientset.AuthenticationV1beta1Client = v1beta1authentication.NewForConfigOrDie(c)
|
||||
clientset.AuthorizationV1beta1Client = v1beta1authorization.NewForConfigOrDie(c)
|
||||
clientset.AutoscalingV1Client = v1autoscaling.NewForConfigOrDie(c)
|
||||
clientset.BatchV1Client = v1batch.NewForConfigOrDie(c)
|
||||
clientset.BatchV2alpha1Client = v2alpha1batch.NewForConfigOrDie(c)
|
||||
clientset.CertificatesV1alpha1Client = v1alpha1certificates.NewForConfigOrDie(c)
|
||||
clientset.ExtensionsV1beta1Client = v1beta1extensions.NewForConfigOrDie(c)
|
||||
clientset.PolicyV1beta1Client = v1beta1policy.NewForConfigOrDie(c)
|
||||
clientset.RbacV1alpha1Client = v1alpha1rbac.NewForConfigOrDie(c)
|
||||
clientset.StorageV1beta1Client = v1beta1storage.NewForConfigOrDie(c)
|
||||
|
||||
cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
|
||||
return &cs
|
||||
clientset.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
|
||||
return &clientset
|
||||
}
|
||||
|
||||
// New creates a new Clientset for the given RESTClient.
|
||||
func New(c rest.Interface) *Clientset {
|
||||
var cs Clientset
|
||||
cs.CoreV1Client = v1core.New(c)
|
||||
cs.AppsV1beta1Client = v1beta1apps.New(c)
|
||||
cs.AuthenticationV1beta1Client = v1beta1authentication.New(c)
|
||||
cs.AuthorizationV1beta1Client = v1beta1authorization.New(c)
|
||||
cs.AutoscalingV1Client = v1autoscaling.New(c)
|
||||
cs.BatchV1Client = v1batch.New(c)
|
||||
cs.BatchV2alpha1Client = v2alpha1batch.New(c)
|
||||
cs.CertificatesV1beta1Client = v1beta1certificates.New(c)
|
||||
cs.ExtensionsV1beta1Client = v1beta1extensions.New(c)
|
||||
cs.PolicyV1beta1Client = v1beta1policy.New(c)
|
||||
cs.RbacV1beta1Client = v1beta1rbac.New(c)
|
||||
cs.RbacV1alpha1Client = v1alpha1rbac.New(c)
|
||||
cs.StorageV1beta1Client = v1beta1storage.New(c)
|
||||
var clientset Clientset
|
||||
clientset.CoreV1Client = v1core.New(c)
|
||||
clientset.AppsV1beta1Client = v1beta1apps.New(c)
|
||||
clientset.AuthenticationV1beta1Client = v1beta1authentication.New(c)
|
||||
clientset.AuthorizationV1beta1Client = v1beta1authorization.New(c)
|
||||
clientset.AutoscalingV1Client = v1autoscaling.New(c)
|
||||
clientset.BatchV1Client = v1batch.New(c)
|
||||
clientset.BatchV2alpha1Client = v2alpha1batch.New(c)
|
||||
clientset.CertificatesV1alpha1Client = v1alpha1certificates.New(c)
|
||||
clientset.ExtensionsV1beta1Client = v1beta1extensions.New(c)
|
||||
clientset.PolicyV1beta1Client = v1beta1policy.New(c)
|
||||
clientset.RbacV1alpha1Client = v1alpha1rbac.New(c)
|
||||
clientset.StorageV1beta1Client = v1beta1storage.New(c)
|
||||
|
||||
cs.DiscoveryClient = discovery.NewDiscoveryClient(c)
|
||||
return &cs
|
||||
clientset.DiscoveryClient = discovery.NewDiscoveryClient(c)
|
||||
return &clientset
|
||||
}
|
||||
|
|
2
vendor/k8s.io/client-go/kubernetes/doc.go
generated
vendored
2
vendor/k8s.io/client-go/kubernetes/doc.go
generated
vendored
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1beta1,extensions/v1beta1,policy/v1beta1,rbac/v1beta1,rbac/v1alpha1,storage/v1beta1]
|
||||
// This package is generated by client-gen with arguments: --clientset-name=release_1_5 --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1alpha1,storage/v1beta1]
|
||||
|
||||
// This package has the automatically generated clientset.
|
||||
package kubernetes
|
||||
|
|
4
vendor/k8s.io/client-go/kubernetes/import_known_versions.go
generated
vendored
4
vendor/k8s.io/client-go/kubernetes/import_known_versions.go
generated
vendored
|
@ -20,8 +20,8 @@ package kubernetes
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
"k8s.io/client-go/pkg/api"
|
||||
_ "k8s.io/client-go/pkg/api/install"
|
||||
"k8s.io/client-go/pkg/apimachinery/registered"
|
||||
_ "k8s.io/client-go/pkg/apis/apps/install"
|
||||
_ "k8s.io/client-go/pkg/apis/authentication/install"
|
||||
_ "k8s.io/client-go/pkg/apis/authorization/install"
|
||||
|
@ -35,7 +35,7 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
if missingVersions := api.Registry.ValidateEnvRequestedVersions(); len(missingVersions) != 0 {
|
||||
if missingVersions := registered.ValidateEnvRequestedVersions(); len(missingVersions) != 0 {
|
||||
panic(fmt.Sprintf("KUBE_API_VERSIONS contains versions that are not installed: %q.", missingVersions))
|
||||
}
|
||||
}
|
||||
|
|
11
vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/apps_client.go
generated
vendored
11
vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/apps_client.go
generated
vendored
|
@ -18,9 +18,10 @@ package v1beta1
|
|||
|
||||
import (
|
||||
fmt "fmt"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
api "k8s.io/client-go/pkg/api"
|
||||
unversioned "k8s.io/client-go/pkg/api/unversioned"
|
||||
registered "k8s.io/client-go/pkg/apimachinery/registered"
|
||||
serializer "k8s.io/client-go/pkg/runtime/serializer"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
|
@ -29,7 +30,7 @@ type AppsV1beta1Interface interface {
|
|||
StatefulSetsGetter
|
||||
}
|
||||
|
||||
// AppsV1beta1Client is used to interact with features provided by the apps group.
|
||||
// AppsV1beta1Client is used to interact with features provided by the k8s.io/kubernetes/pkg/apimachinery/registered.Group group.
|
||||
type AppsV1beta1Client struct {
|
||||
restClient rest.Interface
|
||||
}
|
||||
|
@ -67,12 +68,12 @@ func New(c rest.Interface) *AppsV1beta1Client {
|
|||
}
|
||||
|
||||
func setConfigDefaults(config *rest.Config) error {
|
||||
gv, err := schema.ParseGroupVersion("apps/v1beta1")
|
||||
gv, err := unversioned.ParseGroupVersion("apps/v1beta1")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// if apps/v1beta1 is not enabled, return an error
|
||||
if !api.Registry.IsEnabledVersion(gv) {
|
||||
if !registered.IsEnabledVersion(gv) {
|
||||
return fmt.Errorf("apps/v1beta1 is not enabled")
|
||||
}
|
||||
config.APIPath = "/apis"
|
||||
|
|
2
vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/doc.go
generated
vendored
2
vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/doc.go
generated
vendored
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1beta1,extensions/v1beta1,policy/v1beta1,rbac/v1beta1,rbac/v1alpha1,storage/v1beta1]
|
||||
// This package is generated by client-gen with arguments: --clientset-name=release_1_5 --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1alpha1,storage/v1beta1]
|
||||
|
||||
// This package has the automatically generated typed clients.
|
||||
package v1beta1
|
||||
|
|
28
vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/statefulset.go
generated
vendored
28
vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/statefulset.go
generated
vendored
|
@ -17,12 +17,10 @@ limitations under the License.
|
|||
package v1beta1
|
||||
|
||||
import (
|
||||
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
api "k8s.io/client-go/pkg/api"
|
||||
v1 "k8s.io/client-go/pkg/api/v1"
|
||||
v1beta1 "k8s.io/client-go/pkg/apis/apps/v1beta1"
|
||||
watch "k8s.io/client-go/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
|
@ -38,11 +36,11 @@ type StatefulSetInterface interface {
|
|||
Update(*v1beta1.StatefulSet) (*v1beta1.StatefulSet, error)
|
||||
UpdateStatus(*v1beta1.StatefulSet) (*v1beta1.StatefulSet, error)
|
||||
Delete(name string, options *v1.DeleteOptions) error
|
||||
DeleteCollection(options *v1.DeleteOptions, listOptions meta_v1.ListOptions) error
|
||||
Get(name string, options meta_v1.GetOptions) (*v1beta1.StatefulSet, error)
|
||||
List(opts meta_v1.ListOptions) (*v1beta1.StatefulSetList, error)
|
||||
Watch(opts meta_v1.ListOptions) (watch.Interface, error)
|
||||
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.StatefulSet, err error)
|
||||
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
|
||||
Get(name string) (*v1beta1.StatefulSet, error)
|
||||
List(opts v1.ListOptions) (*v1beta1.StatefulSetList, error)
|
||||
Watch(opts v1.ListOptions) (watch.Interface, error)
|
||||
Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1beta1.StatefulSet, err error)
|
||||
StatefulSetExpansion
|
||||
}
|
||||
|
||||
|
@ -85,9 +83,6 @@ func (c *statefulSets) Update(statefulSet *v1beta1.StatefulSet) (result *v1beta1
|
|||
return
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclientstatus=false comment above the type to avoid generating UpdateStatus().
|
||||
|
||||
func (c *statefulSets) UpdateStatus(statefulSet *v1beta1.StatefulSet) (result *v1beta1.StatefulSet, err error) {
|
||||
result = &v1beta1.StatefulSet{}
|
||||
err = c.client.Put().
|
||||
|
@ -113,7 +108,7 @@ func (c *statefulSets) Delete(name string, options *v1.DeleteOptions) error {
|
|||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *statefulSets) DeleteCollection(options *v1.DeleteOptions, listOptions meta_v1.ListOptions) error {
|
||||
func (c *statefulSets) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("statefulsets").
|
||||
|
@ -124,20 +119,19 @@ func (c *statefulSets) DeleteCollection(options *v1.DeleteOptions, listOptions m
|
|||
}
|
||||
|
||||
// Get takes name of the statefulSet, and returns the corresponding statefulSet object, and an error if there is any.
|
||||
func (c *statefulSets) Get(name string, options meta_v1.GetOptions) (result *v1beta1.StatefulSet, err error) {
|
||||
func (c *statefulSets) Get(name string) (result *v1beta1.StatefulSet, err error) {
|
||||
result = &v1beta1.StatefulSet{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("statefulsets").
|
||||
Name(name).
|
||||
VersionedParams(&options, api.ParameterCodec).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of StatefulSets that match those selectors.
|
||||
func (c *statefulSets) List(opts meta_v1.ListOptions) (result *v1beta1.StatefulSetList, err error) {
|
||||
func (c *statefulSets) List(opts v1.ListOptions) (result *v1beta1.StatefulSetList, err error) {
|
||||
result = &v1beta1.StatefulSetList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
|
@ -149,7 +143,7 @@ func (c *statefulSets) List(opts meta_v1.ListOptions) (result *v1beta1.StatefulS
|
|||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested statefulSets.
|
||||
func (c *statefulSets) Watch(opts meta_v1.ListOptions) (watch.Interface, error) {
|
||||
func (c *statefulSets) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.client.Get().
|
||||
Prefix("watch").
|
||||
Namespace(c.ns).
|
||||
|
@ -159,7 +153,7 @@ func (c *statefulSets) Watch(opts meta_v1.ListOptions) (watch.Interface, error)
|
|||
}
|
||||
|
||||
// Patch applies the patch and returns the patched statefulSet.
|
||||
func (c *statefulSets) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.StatefulSet, err error) {
|
||||
func (c *statefulSets) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1beta1.StatefulSet, err error) {
|
||||
result = &v1beta1.StatefulSet{}
|
||||
err = c.client.Patch(pt).
|
||||
Namespace(c.ns).
|
||||
|
|
11
vendor/k8s.io/client-go/kubernetes/typed/authentication/v1beta1/authentication_client.go
generated
vendored
11
vendor/k8s.io/client-go/kubernetes/typed/authentication/v1beta1/authentication_client.go
generated
vendored
|
@ -18,9 +18,10 @@ package v1beta1
|
|||
|
||||
import (
|
||||
fmt "fmt"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
api "k8s.io/client-go/pkg/api"
|
||||
unversioned "k8s.io/client-go/pkg/api/unversioned"
|
||||
registered "k8s.io/client-go/pkg/apimachinery/registered"
|
||||
serializer "k8s.io/client-go/pkg/runtime/serializer"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
|
@ -29,7 +30,7 @@ type AuthenticationV1beta1Interface interface {
|
|||
TokenReviewsGetter
|
||||
}
|
||||
|
||||
// AuthenticationV1beta1Client is used to interact with features provided by the authentication.k8s.io group.
|
||||
// AuthenticationV1beta1Client is used to interact with features provided by the k8s.io/kubernetes/pkg/apimachinery/registered.Group group.
|
||||
type AuthenticationV1beta1Client struct {
|
||||
restClient rest.Interface
|
||||
}
|
||||
|
@ -67,12 +68,12 @@ func New(c rest.Interface) *AuthenticationV1beta1Client {
|
|||
}
|
||||
|
||||
func setConfigDefaults(config *rest.Config) error {
|
||||
gv, err := schema.ParseGroupVersion("authentication.k8s.io/v1beta1")
|
||||
gv, err := unversioned.ParseGroupVersion("authentication.k8s.io/v1beta1")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// if authentication.k8s.io/v1beta1 is not enabled, return an error
|
||||
if !api.Registry.IsEnabledVersion(gv) {
|
||||
if !registered.IsEnabledVersion(gv) {
|
||||
return fmt.Errorf("authentication.k8s.io/v1beta1 is not enabled")
|
||||
}
|
||||
config.APIPath = "/apis"
|
||||
|
|
2
vendor/k8s.io/client-go/kubernetes/typed/authentication/v1beta1/doc.go
generated
vendored
2
vendor/k8s.io/client-go/kubernetes/typed/authentication/v1beta1/doc.go
generated
vendored
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1beta1,extensions/v1beta1,policy/v1beta1,rbac/v1beta1,rbac/v1alpha1,storage/v1beta1]
|
||||
// This package is generated by client-gen with arguments: --clientset-name=release_1_5 --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1alpha1,storage/v1beta1]
|
||||
|
||||
// This package has the automatically generated typed clients.
|
||||
package v1beta1
|
||||
|
|
11
vendor/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/authorization_client.go
generated
vendored
11
vendor/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/authorization_client.go
generated
vendored
|
@ -18,9 +18,10 @@ package v1beta1
|
|||
|
||||
import (
|
||||
fmt "fmt"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
api "k8s.io/client-go/pkg/api"
|
||||
unversioned "k8s.io/client-go/pkg/api/unversioned"
|
||||
registered "k8s.io/client-go/pkg/apimachinery/registered"
|
||||
serializer "k8s.io/client-go/pkg/runtime/serializer"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
|
@ -31,7 +32,7 @@ type AuthorizationV1beta1Interface interface {
|
|||
SubjectAccessReviewsGetter
|
||||
}
|
||||
|
||||
// AuthorizationV1beta1Client is used to interact with features provided by the authorization.k8s.io group.
|
||||
// AuthorizationV1beta1Client is used to interact with features provided by the k8s.io/kubernetes/pkg/apimachinery/registered.Group group.
|
||||
type AuthorizationV1beta1Client struct {
|
||||
restClient rest.Interface
|
||||
}
|
||||
|
@ -77,12 +78,12 @@ func New(c rest.Interface) *AuthorizationV1beta1Client {
|
|||
}
|
||||
|
||||
func setConfigDefaults(config *rest.Config) error {
|
||||
gv, err := schema.ParseGroupVersion("authorization.k8s.io/v1beta1")
|
||||
gv, err := unversioned.ParseGroupVersion("authorization.k8s.io/v1beta1")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// if authorization.k8s.io/v1beta1 is not enabled, return an error
|
||||
if !api.Registry.IsEnabledVersion(gv) {
|
||||
if !registered.IsEnabledVersion(gv) {
|
||||
return fmt.Errorf("authorization.k8s.io/v1beta1 is not enabled")
|
||||
}
|
||||
config.APIPath = "/apis"
|
||||
|
|
2
vendor/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/doc.go
generated
vendored
2
vendor/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/doc.go
generated
vendored
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1beta1,extensions/v1beta1,policy/v1beta1,rbac/v1beta1,rbac/v1alpha1,storage/v1beta1]
|
||||
// This package is generated by client-gen with arguments: --clientset-name=release_1_5 --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1alpha1,storage/v1beta1]
|
||||
|
||||
// This package has the automatically generated typed clients.
|
||||
package v1beta1
|
||||
|
|
11
vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v1/autoscaling_client.go
generated
vendored
11
vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v1/autoscaling_client.go
generated
vendored
|
@ -18,9 +18,10 @@ package v1
|
|||
|
||||
import (
|
||||
fmt "fmt"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
api "k8s.io/client-go/pkg/api"
|
||||
unversioned "k8s.io/client-go/pkg/api/unversioned"
|
||||
registered "k8s.io/client-go/pkg/apimachinery/registered"
|
||||
serializer "k8s.io/client-go/pkg/runtime/serializer"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
|
@ -29,7 +30,7 @@ type AutoscalingV1Interface interface {
|
|||
HorizontalPodAutoscalersGetter
|
||||
}
|
||||
|
||||
// AutoscalingV1Client is used to interact with features provided by the autoscaling group.
|
||||
// AutoscalingV1Client is used to interact with features provided by the k8s.io/kubernetes/pkg/apimachinery/registered.Group group.
|
||||
type AutoscalingV1Client struct {
|
||||
restClient rest.Interface
|
||||
}
|
||||
|
@ -67,12 +68,12 @@ func New(c rest.Interface) *AutoscalingV1Client {
|
|||
}
|
||||
|
||||
func setConfigDefaults(config *rest.Config) error {
|
||||
gv, err := schema.ParseGroupVersion("autoscaling/v1")
|
||||
gv, err := unversioned.ParseGroupVersion("autoscaling/v1")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// if autoscaling/v1 is not enabled, return an error
|
||||
if !api.Registry.IsEnabledVersion(gv) {
|
||||
if !registered.IsEnabledVersion(gv) {
|
||||
return fmt.Errorf("autoscaling/v1 is not enabled")
|
||||
}
|
||||
config.APIPath = "/apis"
|
||||
|
|
2
vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v1/doc.go
generated
vendored
2
vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v1/doc.go
generated
vendored
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1beta1,extensions/v1beta1,policy/v1beta1,rbac/v1beta1,rbac/v1alpha1,storage/v1beta1]
|
||||
// This package is generated by client-gen with arguments: --clientset-name=release_1_5 --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1alpha1,storage/v1beta1]
|
||||
|
||||
// This package has the automatically generated typed clients.
|
||||
package v1
|
||||
|
|
28
vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v1/horizontalpodautoscaler.go
generated
vendored
28
vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v1/horizontalpodautoscaler.go
generated
vendored
|
@ -17,12 +17,10 @@ limitations under the License.
|
|||
package v1
|
||||
|
||||
import (
|
||||
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
api "k8s.io/client-go/pkg/api"
|
||||
api_v1 "k8s.io/client-go/pkg/api/v1"
|
||||
v1 "k8s.io/client-go/pkg/apis/autoscaling/v1"
|
||||
watch "k8s.io/client-go/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
|
@ -38,11 +36,11 @@ type HorizontalPodAutoscalerInterface interface {
|
|||
Update(*v1.HorizontalPodAutoscaler) (*v1.HorizontalPodAutoscaler, error)
|
||||
UpdateStatus(*v1.HorizontalPodAutoscaler) (*v1.HorizontalPodAutoscaler, error)
|
||||
Delete(name string, options *api_v1.DeleteOptions) error
|
||||
DeleteCollection(options *api_v1.DeleteOptions, listOptions meta_v1.ListOptions) error
|
||||
Get(name string, options meta_v1.GetOptions) (*v1.HorizontalPodAutoscaler, error)
|
||||
List(opts meta_v1.ListOptions) (*v1.HorizontalPodAutoscalerList, error)
|
||||
Watch(opts meta_v1.ListOptions) (watch.Interface, error)
|
||||
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.HorizontalPodAutoscaler, err error)
|
||||
DeleteCollection(options *api_v1.DeleteOptions, listOptions api_v1.ListOptions) error
|
||||
Get(name string) (*v1.HorizontalPodAutoscaler, error)
|
||||
List(opts api_v1.ListOptions) (*v1.HorizontalPodAutoscalerList, error)
|
||||
Watch(opts api_v1.ListOptions) (watch.Interface, error)
|
||||
Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1.HorizontalPodAutoscaler, err error)
|
||||
HorizontalPodAutoscalerExpansion
|
||||
}
|
||||
|
||||
|
@ -85,9 +83,6 @@ func (c *horizontalPodAutoscalers) Update(horizontalPodAutoscaler *v1.Horizontal
|
|||
return
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclientstatus=false comment above the type to avoid generating UpdateStatus().
|
||||
|
||||
func (c *horizontalPodAutoscalers) UpdateStatus(horizontalPodAutoscaler *v1.HorizontalPodAutoscaler) (result *v1.HorizontalPodAutoscaler, err error) {
|
||||
result = &v1.HorizontalPodAutoscaler{}
|
||||
err = c.client.Put().
|
||||
|
@ -113,7 +108,7 @@ func (c *horizontalPodAutoscalers) Delete(name string, options *api_v1.DeleteOpt
|
|||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *horizontalPodAutoscalers) DeleteCollection(options *api_v1.DeleteOptions, listOptions meta_v1.ListOptions) error {
|
||||
func (c *horizontalPodAutoscalers) DeleteCollection(options *api_v1.DeleteOptions, listOptions api_v1.ListOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("horizontalpodautoscalers").
|
||||
|
@ -124,20 +119,19 @@ func (c *horizontalPodAutoscalers) DeleteCollection(options *api_v1.DeleteOption
|
|||
}
|
||||
|
||||
// Get takes name of the horizontalPodAutoscaler, and returns the corresponding horizontalPodAutoscaler object, and an error if there is any.
|
||||
func (c *horizontalPodAutoscalers) Get(name string, options meta_v1.GetOptions) (result *v1.HorizontalPodAutoscaler, err error) {
|
||||
func (c *horizontalPodAutoscalers) Get(name string) (result *v1.HorizontalPodAutoscaler, err error) {
|
||||
result = &v1.HorizontalPodAutoscaler{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("horizontalpodautoscalers").
|
||||
Name(name).
|
||||
VersionedParams(&options, api.ParameterCodec).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of HorizontalPodAutoscalers that match those selectors.
|
||||
func (c *horizontalPodAutoscalers) List(opts meta_v1.ListOptions) (result *v1.HorizontalPodAutoscalerList, err error) {
|
||||
func (c *horizontalPodAutoscalers) List(opts api_v1.ListOptions) (result *v1.HorizontalPodAutoscalerList, err error) {
|
||||
result = &v1.HorizontalPodAutoscalerList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
|
@ -149,7 +143,7 @@ func (c *horizontalPodAutoscalers) List(opts meta_v1.ListOptions) (result *v1.Ho
|
|||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested horizontalPodAutoscalers.
|
||||
func (c *horizontalPodAutoscalers) Watch(opts meta_v1.ListOptions) (watch.Interface, error) {
|
||||
func (c *horizontalPodAutoscalers) Watch(opts api_v1.ListOptions) (watch.Interface, error) {
|
||||
return c.client.Get().
|
||||
Prefix("watch").
|
||||
Namespace(c.ns).
|
||||
|
@ -159,7 +153,7 @@ func (c *horizontalPodAutoscalers) Watch(opts meta_v1.ListOptions) (watch.Interf
|
|||
}
|
||||
|
||||
// Patch applies the patch and returns the patched horizontalPodAutoscaler.
|
||||
func (c *horizontalPodAutoscalers) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.HorizontalPodAutoscaler, err error) {
|
||||
func (c *horizontalPodAutoscalers) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1.HorizontalPodAutoscaler, err error) {
|
||||
result = &v1.HorizontalPodAutoscaler{}
|
||||
err = c.client.Patch(pt).
|
||||
Namespace(c.ns).
|
||||
|
|
11
vendor/k8s.io/client-go/kubernetes/typed/batch/v1/batch_client.go
generated
vendored
11
vendor/k8s.io/client-go/kubernetes/typed/batch/v1/batch_client.go
generated
vendored
|
@ -18,9 +18,10 @@ package v1
|
|||
|
||||
import (
|
||||
fmt "fmt"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
api "k8s.io/client-go/pkg/api"
|
||||
unversioned "k8s.io/client-go/pkg/api/unversioned"
|
||||
registered "k8s.io/client-go/pkg/apimachinery/registered"
|
||||
serializer "k8s.io/client-go/pkg/runtime/serializer"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
|
@ -29,7 +30,7 @@ type BatchV1Interface interface {
|
|||
JobsGetter
|
||||
}
|
||||
|
||||
// BatchV1Client is used to interact with features provided by the batch group.
|
||||
// BatchV1Client is used to interact with features provided by the k8s.io/kubernetes/pkg/apimachinery/registered.Group group.
|
||||
type BatchV1Client struct {
|
||||
restClient rest.Interface
|
||||
}
|
||||
|
@ -67,12 +68,12 @@ func New(c rest.Interface) *BatchV1Client {
|
|||
}
|
||||
|
||||
func setConfigDefaults(config *rest.Config) error {
|
||||
gv, err := schema.ParseGroupVersion("batch/v1")
|
||||
gv, err := unversioned.ParseGroupVersion("batch/v1")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// if batch/v1 is not enabled, return an error
|
||||
if !api.Registry.IsEnabledVersion(gv) {
|
||||
if !registered.IsEnabledVersion(gv) {
|
||||
return fmt.Errorf("batch/v1 is not enabled")
|
||||
}
|
||||
config.APIPath = "/apis"
|
||||
|
|
2
vendor/k8s.io/client-go/kubernetes/typed/batch/v1/doc.go
generated
vendored
2
vendor/k8s.io/client-go/kubernetes/typed/batch/v1/doc.go
generated
vendored
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1beta1,extensions/v1beta1,policy/v1beta1,rbac/v1beta1,rbac/v1alpha1,storage/v1beta1]
|
||||
// This package is generated by client-gen with arguments: --clientset-name=release_1_5 --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1alpha1,storage/v1beta1]
|
||||
|
||||
// This package has the automatically generated typed clients.
|
||||
package v1
|
||||
|
|
28
vendor/k8s.io/client-go/kubernetes/typed/batch/v1/job.go
generated
vendored
28
vendor/k8s.io/client-go/kubernetes/typed/batch/v1/job.go
generated
vendored
|
@ -17,12 +17,10 @@ limitations under the License.
|
|||
package v1
|
||||
|
||||
import (
|
||||
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
api "k8s.io/client-go/pkg/api"
|
||||
api_v1 "k8s.io/client-go/pkg/api/v1"
|
||||
v1 "k8s.io/client-go/pkg/apis/batch/v1"
|
||||
watch "k8s.io/client-go/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
|
@ -38,11 +36,11 @@ type JobInterface interface {
|
|||
Update(*v1.Job) (*v1.Job, error)
|
||||
UpdateStatus(*v1.Job) (*v1.Job, error)
|
||||
Delete(name string, options *api_v1.DeleteOptions) error
|
||||
DeleteCollection(options *api_v1.DeleteOptions, listOptions meta_v1.ListOptions) error
|
||||
Get(name string, options meta_v1.GetOptions) (*v1.Job, error)
|
||||
List(opts meta_v1.ListOptions) (*v1.JobList, error)
|
||||
Watch(opts meta_v1.ListOptions) (watch.Interface, error)
|
||||
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Job, err error)
|
||||
DeleteCollection(options *api_v1.DeleteOptions, listOptions api_v1.ListOptions) error
|
||||
Get(name string) (*v1.Job, error)
|
||||
List(opts api_v1.ListOptions) (*v1.JobList, error)
|
||||
Watch(opts api_v1.ListOptions) (watch.Interface, error)
|
||||
Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1.Job, err error)
|
||||
JobExpansion
|
||||
}
|
||||
|
||||
|
@ -85,9 +83,6 @@ func (c *jobs) Update(job *v1.Job) (result *v1.Job, err error) {
|
|||
return
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclientstatus=false comment above the type to avoid generating UpdateStatus().
|
||||
|
||||
func (c *jobs) UpdateStatus(job *v1.Job) (result *v1.Job, err error) {
|
||||
result = &v1.Job{}
|
||||
err = c.client.Put().
|
||||
|
@ -113,7 +108,7 @@ func (c *jobs) Delete(name string, options *api_v1.DeleteOptions) error {
|
|||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *jobs) DeleteCollection(options *api_v1.DeleteOptions, listOptions meta_v1.ListOptions) error {
|
||||
func (c *jobs) DeleteCollection(options *api_v1.DeleteOptions, listOptions api_v1.ListOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("jobs").
|
||||
|
@ -124,20 +119,19 @@ func (c *jobs) DeleteCollection(options *api_v1.DeleteOptions, listOptions meta_
|
|||
}
|
||||
|
||||
// Get takes name of the job, and returns the corresponding job object, and an error if there is any.
|
||||
func (c *jobs) Get(name string, options meta_v1.GetOptions) (result *v1.Job, err error) {
|
||||
func (c *jobs) Get(name string) (result *v1.Job, err error) {
|
||||
result = &v1.Job{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("jobs").
|
||||
Name(name).
|
||||
VersionedParams(&options, api.ParameterCodec).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of Jobs that match those selectors.
|
||||
func (c *jobs) List(opts meta_v1.ListOptions) (result *v1.JobList, err error) {
|
||||
func (c *jobs) List(opts api_v1.ListOptions) (result *v1.JobList, err error) {
|
||||
result = &v1.JobList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
|
@ -149,7 +143,7 @@ func (c *jobs) List(opts meta_v1.ListOptions) (result *v1.JobList, err error) {
|
|||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested jobs.
|
||||
func (c *jobs) Watch(opts meta_v1.ListOptions) (watch.Interface, error) {
|
||||
func (c *jobs) Watch(opts api_v1.ListOptions) (watch.Interface, error) {
|
||||
return c.client.Get().
|
||||
Prefix("watch").
|
||||
Namespace(c.ns).
|
||||
|
@ -159,7 +153,7 @@ func (c *jobs) Watch(opts meta_v1.ListOptions) (watch.Interface, error) {
|
|||
}
|
||||
|
||||
// Patch applies the patch and returns the patched job.
|
||||
func (c *jobs) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Job, err error) {
|
||||
func (c *jobs) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1.Job, err error) {
|
||||
result = &v1.Job{}
|
||||
err = c.client.Patch(pt).
|
||||
Namespace(c.ns).
|
||||
|
|
11
vendor/k8s.io/client-go/kubernetes/typed/batch/v2alpha1/batch_client.go
generated
vendored
11
vendor/k8s.io/client-go/kubernetes/typed/batch/v2alpha1/batch_client.go
generated
vendored
|
@ -18,9 +18,10 @@ package v2alpha1
|
|||
|
||||
import (
|
||||
fmt "fmt"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
api "k8s.io/client-go/pkg/api"
|
||||
unversioned "k8s.io/client-go/pkg/api/unversioned"
|
||||
registered "k8s.io/client-go/pkg/apimachinery/registered"
|
||||
serializer "k8s.io/client-go/pkg/runtime/serializer"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
|
@ -30,7 +31,7 @@ type BatchV2alpha1Interface interface {
|
|||
JobsGetter
|
||||
}
|
||||
|
||||
// BatchV2alpha1Client is used to interact with features provided by the batch group.
|
||||
// BatchV2alpha1Client is used to interact with features provided by the k8s.io/kubernetes/pkg/apimachinery/registered.Group group.
|
||||
type BatchV2alpha1Client struct {
|
||||
restClient rest.Interface
|
||||
}
|
||||
|
@ -72,12 +73,12 @@ func New(c rest.Interface) *BatchV2alpha1Client {
|
|||
}
|
||||
|
||||
func setConfigDefaults(config *rest.Config) error {
|
||||
gv, err := schema.ParseGroupVersion("batch/v2alpha1")
|
||||
gv, err := unversioned.ParseGroupVersion("batch/v2alpha1")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// if batch/v2alpha1 is not enabled, return an error
|
||||
if !api.Registry.IsEnabledVersion(gv) {
|
||||
if !registered.IsEnabledVersion(gv) {
|
||||
return fmt.Errorf("batch/v2alpha1 is not enabled")
|
||||
}
|
||||
config.APIPath = "/apis"
|
||||
|
|
28
vendor/k8s.io/client-go/kubernetes/typed/batch/v2alpha1/cronjob.go
generated
vendored
28
vendor/k8s.io/client-go/kubernetes/typed/batch/v2alpha1/cronjob.go
generated
vendored
|
@ -17,12 +17,10 @@ limitations under the License.
|
|||
package v2alpha1
|
||||
|
||||
import (
|
||||
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
api "k8s.io/client-go/pkg/api"
|
||||
v1 "k8s.io/client-go/pkg/api/v1"
|
||||
v2alpha1 "k8s.io/client-go/pkg/apis/batch/v2alpha1"
|
||||
watch "k8s.io/client-go/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
|
@ -38,11 +36,11 @@ type CronJobInterface interface {
|
|||
Update(*v2alpha1.CronJob) (*v2alpha1.CronJob, error)
|
||||
UpdateStatus(*v2alpha1.CronJob) (*v2alpha1.CronJob, error)
|
||||
Delete(name string, options *v1.DeleteOptions) error
|
||||
DeleteCollection(options *v1.DeleteOptions, listOptions meta_v1.ListOptions) error
|
||||
Get(name string, options meta_v1.GetOptions) (*v2alpha1.CronJob, error)
|
||||
List(opts meta_v1.ListOptions) (*v2alpha1.CronJobList, error)
|
||||
Watch(opts meta_v1.ListOptions) (watch.Interface, error)
|
||||
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v2alpha1.CronJob, err error)
|
||||
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
|
||||
Get(name string) (*v2alpha1.CronJob, error)
|
||||
List(opts v1.ListOptions) (*v2alpha1.CronJobList, error)
|
||||
Watch(opts v1.ListOptions) (watch.Interface, error)
|
||||
Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v2alpha1.CronJob, err error)
|
||||
CronJobExpansion
|
||||
}
|
||||
|
||||
|
@ -85,9 +83,6 @@ func (c *cronJobs) Update(cronJob *v2alpha1.CronJob) (result *v2alpha1.CronJob,
|
|||
return
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclientstatus=false comment above the type to avoid generating UpdateStatus().
|
||||
|
||||
func (c *cronJobs) UpdateStatus(cronJob *v2alpha1.CronJob) (result *v2alpha1.CronJob, err error) {
|
||||
result = &v2alpha1.CronJob{}
|
||||
err = c.client.Put().
|
||||
|
@ -113,7 +108,7 @@ func (c *cronJobs) Delete(name string, options *v1.DeleteOptions) error {
|
|||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *cronJobs) DeleteCollection(options *v1.DeleteOptions, listOptions meta_v1.ListOptions) error {
|
||||
func (c *cronJobs) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("cronjobs").
|
||||
|
@ -124,20 +119,19 @@ func (c *cronJobs) DeleteCollection(options *v1.DeleteOptions, listOptions meta_
|
|||
}
|
||||
|
||||
// Get takes name of the cronJob, and returns the corresponding cronJob object, and an error if there is any.
|
||||
func (c *cronJobs) Get(name string, options meta_v1.GetOptions) (result *v2alpha1.CronJob, err error) {
|
||||
func (c *cronJobs) Get(name string) (result *v2alpha1.CronJob, err error) {
|
||||
result = &v2alpha1.CronJob{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("cronjobs").
|
||||
Name(name).
|
||||
VersionedParams(&options, api.ParameterCodec).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of CronJobs that match those selectors.
|
||||
func (c *cronJobs) List(opts meta_v1.ListOptions) (result *v2alpha1.CronJobList, err error) {
|
||||
func (c *cronJobs) List(opts v1.ListOptions) (result *v2alpha1.CronJobList, err error) {
|
||||
result = &v2alpha1.CronJobList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
|
@ -149,7 +143,7 @@ func (c *cronJobs) List(opts meta_v1.ListOptions) (result *v2alpha1.CronJobList,
|
|||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested cronJobs.
|
||||
func (c *cronJobs) Watch(opts meta_v1.ListOptions) (watch.Interface, error) {
|
||||
func (c *cronJobs) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.client.Get().
|
||||
Prefix("watch").
|
||||
Namespace(c.ns).
|
||||
|
@ -159,7 +153,7 @@ func (c *cronJobs) Watch(opts meta_v1.ListOptions) (watch.Interface, error) {
|
|||
}
|
||||
|
||||
// Patch applies the patch and returns the patched cronJob.
|
||||
func (c *cronJobs) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v2alpha1.CronJob, err error) {
|
||||
func (c *cronJobs) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v2alpha1.CronJob, err error) {
|
||||
result = &v2alpha1.CronJob{}
|
||||
err = c.client.Patch(pt).
|
||||
Namespace(c.ns).
|
||||
|
|
2
vendor/k8s.io/client-go/kubernetes/typed/batch/v2alpha1/doc.go
generated
vendored
2
vendor/k8s.io/client-go/kubernetes/typed/batch/v2alpha1/doc.go
generated
vendored
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1beta1,extensions/v1beta1,policy/v1beta1,rbac/v1beta1,rbac/v1alpha1,storage/v1beta1]
|
||||
// This package is generated by client-gen with arguments: --clientset-name=release_1_5 --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1alpha1,storage/v1beta1]
|
||||
|
||||
// This package has the automatically generated typed clients.
|
||||
package v2alpha1
|
||||
|
|
28
vendor/k8s.io/client-go/kubernetes/typed/batch/v2alpha1/job.go
generated
vendored
28
vendor/k8s.io/client-go/kubernetes/typed/batch/v2alpha1/job.go
generated
vendored
|
@ -17,12 +17,10 @@ limitations under the License.
|
|||
package v2alpha1
|
||||
|
||||
import (
|
||||
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
api "k8s.io/client-go/pkg/api"
|
||||
v1 "k8s.io/client-go/pkg/api/v1"
|
||||
v2alpha1 "k8s.io/client-go/pkg/apis/batch/v2alpha1"
|
||||
watch "k8s.io/client-go/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
|
@ -38,11 +36,11 @@ type JobInterface interface {
|
|||
Update(*v2alpha1.Job) (*v2alpha1.Job, error)
|
||||
UpdateStatus(*v2alpha1.Job) (*v2alpha1.Job, error)
|
||||
Delete(name string, options *v1.DeleteOptions) error
|
||||
DeleteCollection(options *v1.DeleteOptions, listOptions meta_v1.ListOptions) error
|
||||
Get(name string, options meta_v1.GetOptions) (*v2alpha1.Job, error)
|
||||
List(opts meta_v1.ListOptions) (*v2alpha1.JobList, error)
|
||||
Watch(opts meta_v1.ListOptions) (watch.Interface, error)
|
||||
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v2alpha1.Job, err error)
|
||||
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
|
||||
Get(name string) (*v2alpha1.Job, error)
|
||||
List(opts v1.ListOptions) (*v2alpha1.JobList, error)
|
||||
Watch(opts v1.ListOptions) (watch.Interface, error)
|
||||
Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v2alpha1.Job, err error)
|
||||
JobExpansion
|
||||
}
|
||||
|
||||
|
@ -85,9 +83,6 @@ func (c *jobs) Update(job *v2alpha1.Job) (result *v2alpha1.Job, err error) {
|
|||
return
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclientstatus=false comment above the type to avoid generating UpdateStatus().
|
||||
|
||||
func (c *jobs) UpdateStatus(job *v2alpha1.Job) (result *v2alpha1.Job, err error) {
|
||||
result = &v2alpha1.Job{}
|
||||
err = c.client.Put().
|
||||
|
@ -113,7 +108,7 @@ func (c *jobs) Delete(name string, options *v1.DeleteOptions) error {
|
|||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *jobs) DeleteCollection(options *v1.DeleteOptions, listOptions meta_v1.ListOptions) error {
|
||||
func (c *jobs) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("jobs").
|
||||
|
@ -124,20 +119,19 @@ func (c *jobs) DeleteCollection(options *v1.DeleteOptions, listOptions meta_v1.L
|
|||
}
|
||||
|
||||
// Get takes name of the job, and returns the corresponding job object, and an error if there is any.
|
||||
func (c *jobs) Get(name string, options meta_v1.GetOptions) (result *v2alpha1.Job, err error) {
|
||||
func (c *jobs) Get(name string) (result *v2alpha1.Job, err error) {
|
||||
result = &v2alpha1.Job{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("jobs").
|
||||
Name(name).
|
||||
VersionedParams(&options, api.ParameterCodec).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of Jobs that match those selectors.
|
||||
func (c *jobs) List(opts meta_v1.ListOptions) (result *v2alpha1.JobList, err error) {
|
||||
func (c *jobs) List(opts v1.ListOptions) (result *v2alpha1.JobList, err error) {
|
||||
result = &v2alpha1.JobList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
|
@ -149,7 +143,7 @@ func (c *jobs) List(opts meta_v1.ListOptions) (result *v2alpha1.JobList, err err
|
|||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested jobs.
|
||||
func (c *jobs) Watch(opts meta_v1.ListOptions) (watch.Interface, error) {
|
||||
func (c *jobs) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.client.Get().
|
||||
Prefix("watch").
|
||||
Namespace(c.ns).
|
||||
|
@ -159,7 +153,7 @@ func (c *jobs) Watch(opts meta_v1.ListOptions) (watch.Interface, error) {
|
|||
}
|
||||
|
||||
// Patch applies the patch and returns the patched job.
|
||||
func (c *jobs) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v2alpha1.Job, err error) {
|
||||
func (c *jobs) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v2alpha1.Job, err error) {
|
||||
result = &v2alpha1.Job{}
|
||||
err = c.client.Patch(pt).
|
||||
Namespace(c.ns).
|
||||
|
|
|
@ -14,32 +14,33 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1beta1
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
fmt "fmt"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
api "k8s.io/client-go/pkg/api"
|
||||
unversioned "k8s.io/client-go/pkg/api/unversioned"
|
||||
registered "k8s.io/client-go/pkg/apimachinery/registered"
|
||||
serializer "k8s.io/client-go/pkg/runtime/serializer"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
type CertificatesV1beta1Interface interface {
|
||||
type CertificatesV1alpha1Interface interface {
|
||||
RESTClient() rest.Interface
|
||||
CertificateSigningRequestsGetter
|
||||
}
|
||||
|
||||
// CertificatesV1beta1Client is used to interact with features provided by the certificates.k8s.io group.
|
||||
type CertificatesV1beta1Client struct {
|
||||
// CertificatesV1alpha1Client is used to interact with features provided by the k8s.io/kubernetes/pkg/apimachinery/registered.Group group.
|
||||
type CertificatesV1alpha1Client struct {
|
||||
restClient rest.Interface
|
||||
}
|
||||
|
||||
func (c *CertificatesV1beta1Client) CertificateSigningRequests() CertificateSigningRequestInterface {
|
||||
func (c *CertificatesV1alpha1Client) CertificateSigningRequests() CertificateSigningRequestInterface {
|
||||
return newCertificateSigningRequests(c)
|
||||
}
|
||||
|
||||
// NewForConfig creates a new CertificatesV1beta1Client for the given config.
|
||||
func NewForConfig(c *rest.Config) (*CertificatesV1beta1Client, error) {
|
||||
// NewForConfig creates a new CertificatesV1alpha1Client for the given config.
|
||||
func NewForConfig(c *rest.Config) (*CertificatesV1alpha1Client, error) {
|
||||
config := *c
|
||||
if err := setConfigDefaults(&config); err != nil {
|
||||
return nil, err
|
||||
|
@ -48,12 +49,12 @@ func NewForConfig(c *rest.Config) (*CertificatesV1beta1Client, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &CertificatesV1beta1Client{client}, nil
|
||||
return &CertificatesV1alpha1Client{client}, nil
|
||||
}
|
||||
|
||||
// NewForConfigOrDie creates a new CertificatesV1beta1Client for the given config and
|
||||
// NewForConfigOrDie creates a new CertificatesV1alpha1Client for the given config and
|
||||
// panics if there is an error in the config.
|
||||
func NewForConfigOrDie(c *rest.Config) *CertificatesV1beta1Client {
|
||||
func NewForConfigOrDie(c *rest.Config) *CertificatesV1alpha1Client {
|
||||
client, err := NewForConfig(c)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
@ -61,19 +62,19 @@ func NewForConfigOrDie(c *rest.Config) *CertificatesV1beta1Client {
|
|||
return client
|
||||
}
|
||||
|
||||
// New creates a new CertificatesV1beta1Client for the given RESTClient.
|
||||
func New(c rest.Interface) *CertificatesV1beta1Client {
|
||||
return &CertificatesV1beta1Client{c}
|
||||
// New creates a new CertificatesV1alpha1Client for the given RESTClient.
|
||||
func New(c rest.Interface) *CertificatesV1alpha1Client {
|
||||
return &CertificatesV1alpha1Client{c}
|
||||
}
|
||||
|
||||
func setConfigDefaults(config *rest.Config) error {
|
||||
gv, err := schema.ParseGroupVersion("certificates.k8s.io/v1beta1")
|
||||
gv, err := unversioned.ParseGroupVersion("certificates.k8s.io/v1alpha1")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// if certificates.k8s.io/v1beta1 is not enabled, return an error
|
||||
if !api.Registry.IsEnabledVersion(gv) {
|
||||
return fmt.Errorf("certificates.k8s.io/v1beta1 is not enabled")
|
||||
// if certificates.k8s.io/v1alpha1 is not enabled, return an error
|
||||
if !registered.IsEnabledVersion(gv) {
|
||||
return fmt.Errorf("certificates.k8s.io/v1alpha1 is not enabled")
|
||||
}
|
||||
config.APIPath = "/apis"
|
||||
if config.UserAgent == "" {
|
||||
|
@ -89,7 +90,7 @@ func setConfigDefaults(config *rest.Config) error {
|
|||
|
||||
// RESTClient returns a RESTClient that is used to communicate
|
||||
// with API server by this client implementation.
|
||||
func (c *CertificatesV1beta1Client) RESTClient() rest.Interface {
|
||||
func (c *CertificatesV1alpha1Client) RESTClient() rest.Interface {
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
|
@ -14,15 +14,13 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1beta1
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
api "k8s.io/client-go/pkg/api"
|
||||
v1 "k8s.io/client-go/pkg/api/v1"
|
||||
v1beta1 "k8s.io/client-go/pkg/apis/certificates/v1beta1"
|
||||
v1alpha1 "k8s.io/client-go/pkg/apis/certificates/v1alpha1"
|
||||
watch "k8s.io/client-go/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
|
@ -34,15 +32,15 @@ type CertificateSigningRequestsGetter interface {
|
|||
|
||||
// CertificateSigningRequestInterface has methods to work with CertificateSigningRequest resources.
|
||||
type CertificateSigningRequestInterface interface {
|
||||
Create(*v1beta1.CertificateSigningRequest) (*v1beta1.CertificateSigningRequest, error)
|
||||
Update(*v1beta1.CertificateSigningRequest) (*v1beta1.CertificateSigningRequest, error)
|
||||
UpdateStatus(*v1beta1.CertificateSigningRequest) (*v1beta1.CertificateSigningRequest, error)
|
||||
Create(*v1alpha1.CertificateSigningRequest) (*v1alpha1.CertificateSigningRequest, error)
|
||||
Update(*v1alpha1.CertificateSigningRequest) (*v1alpha1.CertificateSigningRequest, error)
|
||||
UpdateStatus(*v1alpha1.CertificateSigningRequest) (*v1alpha1.CertificateSigningRequest, error)
|
||||
Delete(name string, options *v1.DeleteOptions) error
|
||||
DeleteCollection(options *v1.DeleteOptions, listOptions meta_v1.ListOptions) error
|
||||
Get(name string, options meta_v1.GetOptions) (*v1beta1.CertificateSigningRequest, error)
|
||||
List(opts meta_v1.ListOptions) (*v1beta1.CertificateSigningRequestList, error)
|
||||
Watch(opts meta_v1.ListOptions) (watch.Interface, error)
|
||||
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.CertificateSigningRequest, err error)
|
||||
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
|
||||
Get(name string) (*v1alpha1.CertificateSigningRequest, error)
|
||||
List(opts v1.ListOptions) (*v1alpha1.CertificateSigningRequestList, error)
|
||||
Watch(opts v1.ListOptions) (watch.Interface, error)
|
||||
Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1alpha1.CertificateSigningRequest, err error)
|
||||
CertificateSigningRequestExpansion
|
||||
}
|
||||
|
||||
|
@ -52,15 +50,15 @@ type certificateSigningRequests struct {
|
|||
}
|
||||
|
||||
// newCertificateSigningRequests returns a CertificateSigningRequests
|
||||
func newCertificateSigningRequests(c *CertificatesV1beta1Client) *certificateSigningRequests {
|
||||
func newCertificateSigningRequests(c *CertificatesV1alpha1Client) *certificateSigningRequests {
|
||||
return &certificateSigningRequests{
|
||||
client: c.RESTClient(),
|
||||
}
|
||||
}
|
||||
|
||||
// Create takes the representation of a certificateSigningRequest and creates it. Returns the server's representation of the certificateSigningRequest, and an error, if there is any.
|
||||
func (c *certificateSigningRequests) Create(certificateSigningRequest *v1beta1.CertificateSigningRequest) (result *v1beta1.CertificateSigningRequest, err error) {
|
||||
result = &v1beta1.CertificateSigningRequest{}
|
||||
func (c *certificateSigningRequests) Create(certificateSigningRequest *v1alpha1.CertificateSigningRequest) (result *v1alpha1.CertificateSigningRequest, err error) {
|
||||
result = &v1alpha1.CertificateSigningRequest{}
|
||||
err = c.client.Post().
|
||||
Resource("certificatesigningrequests").
|
||||
Body(certificateSigningRequest).
|
||||
|
@ -70,8 +68,8 @@ func (c *certificateSigningRequests) Create(certificateSigningRequest *v1beta1.C
|
|||
}
|
||||
|
||||
// Update takes the representation of a certificateSigningRequest and updates it. Returns the server's representation of the certificateSigningRequest, and an error, if there is any.
|
||||
func (c *certificateSigningRequests) Update(certificateSigningRequest *v1beta1.CertificateSigningRequest) (result *v1beta1.CertificateSigningRequest, err error) {
|
||||
result = &v1beta1.CertificateSigningRequest{}
|
||||
func (c *certificateSigningRequests) Update(certificateSigningRequest *v1alpha1.CertificateSigningRequest) (result *v1alpha1.CertificateSigningRequest, err error) {
|
||||
result = &v1alpha1.CertificateSigningRequest{}
|
||||
err = c.client.Put().
|
||||
Resource("certificatesigningrequests").
|
||||
Name(certificateSigningRequest.Name).
|
||||
|
@ -81,11 +79,8 @@ func (c *certificateSigningRequests) Update(certificateSigningRequest *v1beta1.C
|
|||
return
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclientstatus=false comment above the type to avoid generating UpdateStatus().
|
||||
|
||||
func (c *certificateSigningRequests) UpdateStatus(certificateSigningRequest *v1beta1.CertificateSigningRequest) (result *v1beta1.CertificateSigningRequest, err error) {
|
||||
result = &v1beta1.CertificateSigningRequest{}
|
||||
func (c *certificateSigningRequests) UpdateStatus(certificateSigningRequest *v1alpha1.CertificateSigningRequest) (result *v1alpha1.CertificateSigningRequest, err error) {
|
||||
result = &v1alpha1.CertificateSigningRequest{}
|
||||
err = c.client.Put().
|
||||
Resource("certificatesigningrequests").
|
||||
Name(certificateSigningRequest.Name).
|
||||
|
@ -107,7 +102,7 @@ func (c *certificateSigningRequests) Delete(name string, options *v1.DeleteOptio
|
|||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *certificateSigningRequests) DeleteCollection(options *v1.DeleteOptions, listOptions meta_v1.ListOptions) error {
|
||||
func (c *certificateSigningRequests) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||
return c.client.Delete().
|
||||
Resource("certificatesigningrequests").
|
||||
VersionedParams(&listOptions, api.ParameterCodec).
|
||||
|
@ -117,20 +112,19 @@ func (c *certificateSigningRequests) DeleteCollection(options *v1.DeleteOptions,
|
|||
}
|
||||
|
||||
// Get takes name of the certificateSigningRequest, and returns the corresponding certificateSigningRequest object, and an error if there is any.
|
||||
func (c *certificateSigningRequests) Get(name string, options meta_v1.GetOptions) (result *v1beta1.CertificateSigningRequest, err error) {
|
||||
result = &v1beta1.CertificateSigningRequest{}
|
||||
func (c *certificateSigningRequests) Get(name string) (result *v1alpha1.CertificateSigningRequest, err error) {
|
||||
result = &v1alpha1.CertificateSigningRequest{}
|
||||
err = c.client.Get().
|
||||
Resource("certificatesigningrequests").
|
||||
Name(name).
|
||||
VersionedParams(&options, api.ParameterCodec).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of CertificateSigningRequests that match those selectors.
|
||||
func (c *certificateSigningRequests) List(opts meta_v1.ListOptions) (result *v1beta1.CertificateSigningRequestList, err error) {
|
||||
result = &v1beta1.CertificateSigningRequestList{}
|
||||
func (c *certificateSigningRequests) List(opts v1.ListOptions) (result *v1alpha1.CertificateSigningRequestList, err error) {
|
||||
result = &v1alpha1.CertificateSigningRequestList{}
|
||||
err = c.client.Get().
|
||||
Resource("certificatesigningrequests").
|
||||
VersionedParams(&opts, api.ParameterCodec).
|
||||
|
@ -140,7 +134,7 @@ func (c *certificateSigningRequests) List(opts meta_v1.ListOptions) (result *v1b
|
|||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested certificateSigningRequests.
|
||||
func (c *certificateSigningRequests) Watch(opts meta_v1.ListOptions) (watch.Interface, error) {
|
||||
func (c *certificateSigningRequests) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.client.Get().
|
||||
Prefix("watch").
|
||||
Resource("certificatesigningrequests").
|
||||
|
@ -149,8 +143,8 @@ func (c *certificateSigningRequests) Watch(opts meta_v1.ListOptions) (watch.Inte
|
|||
}
|
||||
|
||||
// Patch applies the patch and returns the patched certificateSigningRequest.
|
||||
func (c *certificateSigningRequests) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.CertificateSigningRequest, err error) {
|
||||
result = &v1beta1.CertificateSigningRequest{}
|
||||
func (c *certificateSigningRequests) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1alpha1.CertificateSigningRequest, err error) {
|
||||
result = &v1alpha1.CertificateSigningRequest{}
|
||||
err = c.client.Patch(pt).
|
||||
Resource("certificatesigningrequests").
|
||||
SubResource(subresources...).
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
Copyright 2016 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.
|
||||
|
@ -14,10 +14,10 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1beta1
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
certificates "k8s.io/client-go/pkg/apis/certificates/v1beta1"
|
||||
certificates "k8s.io/client-go/pkg/apis/certificates/v1alpha1"
|
||||
)
|
||||
|
||||
type CertificateSigningRequestExpansion interface {
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1beta1,extensions/v1beta1,policy/v1beta1,rbac/v1beta1,rbac/v1alpha1,storage/v1beta1]
|
||||
// This package is generated by client-gen with arguments: --clientset-name=release_1_5 --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1alpha1,storage/v1beta1]
|
||||
|
||||
// This package has the automatically generated typed clients.
|
||||
package v1beta1
|
||||
package v1alpha1
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue