diff --git a/glide.lock b/glide.lock index 465b81dfd..50dc6a2b4 100644 --- a/glide.lock +++ b/glide.lock @@ -1,5 +1,5 @@ hash: 0bc2aba8e1684e2409f7c186b3365cc3ab511162b0592621ebba296149f1766a -updated: 2017-10-20T14:53:07.12617906-07:00 +updated: 2017-10-23T15:46:00.76099697-07:00 imports: - name: github.com/appscode/go version: c01120782e8b487d1c86ab4299241edfe36a3ca2 @@ -13,7 +13,7 @@ imports: - types - version - name: github.com/appscode/kutil - version: 6bc797dda352c4f8dfad7f0599574bba35724d12 + version: 4d8a2fab71adaeb35394044fae59b03735ea4e39 subpackages: - apps/v1beta1 - core/v1 @@ -217,6 +217,7 @@ imports: version: 1c05540f6879653db88113bc4a2b70aec4bd491f subpackages: - context + - context/ctxhttp - html - html/atom - html/charset @@ -296,7 +297,6 @@ imports: subpackages: - pkg/apis/apiextensions - pkg/apis/apiextensions/v1beta1 - - pkg/client/clientset/clientset - pkg/client/clientset/clientset/scheme - pkg/client/clientset/clientset/typed/apiextensions/v1beta1 - name: k8s.io/apimachinery @@ -434,7 +434,7 @@ imports: subpackages: - pkg/common - name: k8s.io/kubernetes - version: f38e43b221d08850172a9a4ea785a86a3ffa3b3a + version: 0b9efaeb34a2fc51ff8e4d34ad9bc6375459c4a4 subpackages: - pkg/api - pkg/api/helper diff --git a/pkg/migrator/migrate.go b/pkg/migrator/migrate.go index d2ba7bca9..ebc2c9dba 100644 --- a/pkg/migrator/migrate.go +++ b/pkg/migrator/migrate.go @@ -7,12 +7,12 @@ import ( "github.com/appscode/go/log" "github.com/appscode/kutil" - sapi "github.com/appscode/stash/apis/stash" - sapi_v1alpha1 "github.com/appscode/stash/apis/stash/v1alpha1" + "github.com/appscode/stash/apis/stash" + api "github.com/appscode/stash/apis/stash/v1alpha1" "github.com/hashicorp/go-version" extensions "k8s.io/api/extensions/v1beta1" - apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" - apiextensionsclient "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" + crd_api "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" + crd_cs "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1" kerr "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" @@ -27,12 +27,12 @@ type migrationState struct { type migrator struct { kubeClient kubernetes.Interface - apiExtKubeClient apiextensionsclient.Interface + apiExtKubeClient crd_cs.ApiextensionsV1beta1Interface migrationState *migrationState } -func NewMigrator(kubeClient kubernetes.Interface, apiExtKubeClient apiextensionsclient.Interface) *migrator { +func NewMigrator(kubeClient kubernetes.Interface, apiExtKubeClient crd_cs.ApiextensionsV1beta1Interface) *migrator { return &migrator{ migrationState: &migrationState{}, kubeClient: kubeClient, @@ -55,7 +55,7 @@ func (m *migrator) isMigrationNeeded() (bool, error) { if mv == 7 { _, err := m.kubeClient.ExtensionsV1beta1().ThirdPartyResources().Get( - sapi_v1alpha1.ResourceNameRestic+"."+sapi_v1alpha1.SchemeGroupVersion.Group, + api.ResourceNameRestic+"."+api.SchemeGroupVersion.Group, metav1.GetOptions{}, ) if err != nil { @@ -108,14 +108,14 @@ func (m *migrator) deleteTPRs() error { tprClient := m.kubeClient.ExtensionsV1beta1().ThirdPartyResources() deleteTPR := func(resourceName string) error { - name := resourceName + "." + sapi_v1alpha1.SchemeGroupVersion.Group + name := resourceName + "." + api.SchemeGroupVersion.Group if err := tprClient.Delete(name, &metav1.DeleteOptions{}); err != nil { return fmt.Errorf("failed to remove %s TPR", name) } return nil } - if err := deleteTPR(sapi_v1alpha1.ResourceNameRestic); err != nil { + if err := deleteTPR(api.ResourceNameRestic); err != nil { return err } @@ -123,29 +123,29 @@ func (m *migrator) deleteTPRs() error { } func (m *migrator) createCRDs() error { - crds := []*apiextensions.CustomResourceDefinition{ + crds := []*crd_api.CustomResourceDefinition{ { ObjectMeta: metav1.ObjectMeta{ - Name: sapi_v1alpha1.ResourceTypeRestic + "." + sapi_v1alpha1.SchemeGroupVersion.Group, + Name: api.ResourceTypeRestic + "." + api.SchemeGroupVersion.Group, Labels: map[string]string{"app": "stash"}, }, - Spec: apiextensions.CustomResourceDefinitionSpec{ - Group: sapi.GroupName, - Version: sapi_v1alpha1.SchemeGroupVersion.Version, - Scope: apiextensions.NamespaceScoped, - Names: apiextensions.CustomResourceDefinitionNames{ - Singular: sapi_v1alpha1.ResourceNameRestic, - Plural: sapi_v1alpha1.ResourceTypeRestic, - Kind: sapi_v1alpha1.ResourceKindRestic, + Spec: crd_api.CustomResourceDefinitionSpec{ + Group: stash.GroupName, + Version: api.SchemeGroupVersion.Version, + Scope: crd_api.NamespaceScoped, + Names: crd_api.CustomResourceDefinitionNames{ + Singular: api.ResourceNameRestic, + Plural: api.ResourceTypeRestic, + Kind: api.ResourceKindRestic, ShortNames: []string{"rst"}, }, }, }, } for _, crd := range crds { - _, err := m.apiExtKubeClient.ApiextensionsV1beta1().CustomResourceDefinitions().Get(crd.Name, metav1.GetOptions{}) + _, err := m.apiExtKubeClient.CustomResourceDefinitions().Get(crd.Name, metav1.GetOptions{}) if kerr.IsNotFound(err) { - _, err = m.apiExtKubeClient.ApiextensionsV1beta1().CustomResourceDefinitions().Create(crd) + _, err = m.apiExtKubeClient.CustomResourceDefinitions().Create(crd) if err != nil { return err } @@ -184,10 +184,10 @@ func (m *migrator) rollback() error { } func (m *migrator) deleteCRDs() error { - crdClient := m.apiExtKubeClient.ApiextensionsV1beta1().CustomResourceDefinitions() + crdClient := m.apiExtKubeClient.CustomResourceDefinitions() deleteCRD := func(resourceType string) error { - name := resourceType + "." + sapi_v1alpha1.SchemeGroupVersion.Group + name := resourceType + "." + api.SchemeGroupVersion.Group err := crdClient.Delete(name, &metav1.DeleteOptions{}) if err != nil { return fmt.Errorf(`Failed to delete CRD "%s""`, name) @@ -195,21 +195,21 @@ func (m *migrator) deleteCRDs() error { return nil } - if err := deleteCRD(sapi_v1alpha1.ResourceTypeRestic); err != nil { + if err := deleteCRD(api.ResourceTypeRestic); err != nil { return err } return nil } func (m *migrator) createTPRs() error { - if err := m.createTPR(sapi_v1alpha1.ResourceNameRestic); err != nil { + if err := m.createTPR(api.ResourceNameRestic); err != nil { return err } return nil } func (m *migrator) createTPR(resourceName string) error { - name := resourceName + "." + sapi_v1alpha1.SchemeGroupVersion.Group + name := resourceName + "." + api.SchemeGroupVersion.Group _, err := m.kubeClient.ExtensionsV1beta1().ThirdPartyResources().Get(name, metav1.GetOptions{}) if !kerr.IsNotFound(err) { return err @@ -228,7 +228,7 @@ func (m *migrator) createTPR(resourceName string) error { }, Versions: []extensions.APIVersion{ { - Name: sapi_v1alpha1.SchemeGroupVersion.Version, + Name: api.SchemeGroupVersion.Version, }, }, } diff --git a/vendor/github.com/appscode/kutil/core/v1/configmap.go b/vendor/github.com/appscode/kutil/core/v1/configmap.go index 9e6350815..b8820c8d2 100644 --- a/vendor/github.com/appscode/kutil/core/v1/configmap.go +++ b/vendor/github.com/appscode/kutil/core/v1/configmap.go @@ -6,7 +6,7 @@ import ( "github.com/appscode/kutil" "github.com/golang/glog" - apiv1 "k8s.io/api/core/v1" + core "k8s.io/api/core/v1" kerr "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" @@ -15,14 +15,14 @@ import ( "k8s.io/client-go/kubernetes" ) -func CreateOrPatchConfigMap(c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*apiv1.ConfigMap) *apiv1.ConfigMap) (*apiv1.ConfigMap, error) { +func CreateOrPatchConfigMap(c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*core.ConfigMap) *core.ConfigMap) (*core.ConfigMap, error) { cur, err := c.CoreV1().ConfigMaps(meta.Namespace).Get(meta.Name, metav1.GetOptions{}) if kerr.IsNotFound(err) { glog.V(3).Infof("Creating ConfigMap %s/%s.", meta.Namespace, meta.Name) - return c.CoreV1().ConfigMaps(meta.Namespace).Create(transform(&apiv1.ConfigMap{ + return c.CoreV1().ConfigMaps(meta.Namespace).Create(transform(&core.ConfigMap{ TypeMeta: metav1.TypeMeta{ Kind: "ConfigMap", - APIVersion: apiv1.SchemeGroupVersion.String(), + APIVersion: core.SchemeGroupVersion.String(), }, ObjectMeta: meta, })) @@ -32,7 +32,7 @@ func CreateOrPatchConfigMap(c kubernetes.Interface, meta metav1.ObjectMeta, tran return PatchConfigMap(c, cur, transform) } -func PatchConfigMap(c kubernetes.Interface, cur *apiv1.ConfigMap, transform func(*apiv1.ConfigMap) *apiv1.ConfigMap) (*apiv1.ConfigMap, error) { +func PatchConfigMap(c kubernetes.Interface, cur *core.ConfigMap, transform func(*core.ConfigMap) *core.ConfigMap) (*core.ConfigMap, error) { curJson, err := json.Marshal(cur) if err != nil { return nil, err @@ -43,7 +43,7 @@ func PatchConfigMap(c kubernetes.Interface, cur *apiv1.ConfigMap, transform func return nil, err } - patch, err := strategicpatch.CreateTwoWayMergePatch(curJson, modJson, apiv1.ConfigMap{}) + patch, err := strategicpatch.CreateTwoWayMergePatch(curJson, modJson, core.ConfigMap{}) if err != nil { return nil, err } @@ -54,7 +54,7 @@ func PatchConfigMap(c kubernetes.Interface, cur *apiv1.ConfigMap, transform func return c.CoreV1().ConfigMaps(cur.Namespace).Patch(cur.Name, types.StrategicMergePatchType, patch) } -func TryPatchConfigMap(c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*apiv1.ConfigMap) *apiv1.ConfigMap) (result *apiv1.ConfigMap, err error) { +func TryPatchConfigMap(c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*core.ConfigMap) *core.ConfigMap) (result *core.ConfigMap, err error) { attempt := 0 err = wait.PollImmediate(kutil.RetryInterval, kutil.RetryTimeout, func() (bool, error) { attempt++ @@ -75,7 +75,7 @@ func TryPatchConfigMap(c kubernetes.Interface, meta metav1.ObjectMeta, transform return } -func TryUpdateConfigMap(c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*apiv1.ConfigMap) *apiv1.ConfigMap) (result *apiv1.ConfigMap, err error) { +func TryUpdateConfigMap(c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*core.ConfigMap) *core.ConfigMap) (result *core.ConfigMap, err error) { attempt := 0 err = wait.PollImmediate(kutil.RetryInterval, kutil.RetryTimeout, func() (bool, error) { attempt++ diff --git a/vendor/github.com/appscode/kutil/core/v1/kubernetes.go b/vendor/github.com/appscode/kutil/core/v1/kubernetes.go index d2ad881a7..4a36fbfc9 100644 --- a/vendor/github.com/appscode/kutil/core/v1/kubernetes.go +++ b/vendor/github.com/appscode/kutil/core/v1/kubernetes.go @@ -6,13 +6,13 @@ import ( "reflect" "github.com/appscode/kutil" - apiv1 "k8s.io/api/core/v1" + core "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" ) func GetGroupVersionKind(v interface{}) schema.GroupVersionKind { - return apiv1.SchemeGroupVersion.WithKind(kutil.GetKind(v)) + return core.SchemeGroupVersion.WithKind(kutil.GetKind(v)) } func AssignTypeKind(v interface{}) error { @@ -21,60 +21,60 @@ func AssignTypeKind(v interface{}) error { } switch u := v.(type) { - case *apiv1.Pod: - u.APIVersion = apiv1.SchemeGroupVersion.String() + case *core.Pod: + u.APIVersion = core.SchemeGroupVersion.String() u.Kind = kutil.GetKind(v) return nil - case *apiv1.ReplicationController: - u.APIVersion = apiv1.SchemeGroupVersion.String() + case *core.ReplicationController: + u.APIVersion = core.SchemeGroupVersion.String() u.Kind = kutil.GetKind(v) return nil - case *apiv1.ConfigMap: - u.APIVersion = apiv1.SchemeGroupVersion.String() + case *core.ConfigMap: + u.APIVersion = core.SchemeGroupVersion.String() u.Kind = kutil.GetKind(v) return nil - case *apiv1.Secret: - u.APIVersion = apiv1.SchemeGroupVersion.String() + case *core.Secret: + u.APIVersion = core.SchemeGroupVersion.String() u.Kind = kutil.GetKind(v) return nil - case *apiv1.Service: - u.APIVersion = apiv1.SchemeGroupVersion.String() + case *core.Service: + u.APIVersion = core.SchemeGroupVersion.String() u.Kind = kutil.GetKind(v) return nil - case *apiv1.PersistentVolumeClaim: - u.APIVersion = apiv1.SchemeGroupVersion.String() + case *core.PersistentVolumeClaim: + u.APIVersion = core.SchemeGroupVersion.String() u.Kind = kutil.GetKind(v) return nil - case *apiv1.PersistentVolume: - u.APIVersion = apiv1.SchemeGroupVersion.String() + case *core.PersistentVolume: + u.APIVersion = core.SchemeGroupVersion.String() u.Kind = kutil.GetKind(v) return nil - case *apiv1.Node: - u.APIVersion = apiv1.SchemeGroupVersion.String() + case *core.Node: + u.APIVersion = core.SchemeGroupVersion.String() u.Kind = kutil.GetKind(v) return nil - case *apiv1.ServiceAccount: - u.APIVersion = apiv1.SchemeGroupVersion.String() + case *core.ServiceAccount: + u.APIVersion = core.SchemeGroupVersion.String() u.Kind = kutil.GetKind(v) return nil - case *apiv1.Namespace: - u.APIVersion = apiv1.SchemeGroupVersion.String() + case *core.Namespace: + u.APIVersion = core.SchemeGroupVersion.String() u.Kind = kutil.GetKind(v) return nil - case *apiv1.Endpoints: - u.APIVersion = apiv1.SchemeGroupVersion.String() + case *core.Endpoints: + u.APIVersion = core.SchemeGroupVersion.String() u.Kind = kutil.GetKind(v) return nil - case *apiv1.ComponentStatus: - u.APIVersion = apiv1.SchemeGroupVersion.String() + case *core.ComponentStatus: + u.APIVersion = core.SchemeGroupVersion.String() u.Kind = kutil.GetKind(v) return nil - case *apiv1.LimitRange: - u.APIVersion = apiv1.SchemeGroupVersion.String() + case *core.LimitRange: + u.APIVersion = core.SchemeGroupVersion.String() u.Kind = kutil.GetKind(v) return nil - case *apiv1.Event: - u.APIVersion = apiv1.SchemeGroupVersion.String() + case *core.Event: + u.APIVersion = core.SchemeGroupVersion.String() u.Kind = kutil.GetKind(v) return nil } @@ -125,7 +125,7 @@ func RemoveFinalizer(m metav1.ObjectMeta, finalizer string) metav1.ObjectMeta { return m } -func EnsureContainerDeleted(containers []apiv1.Container, name string) []apiv1.Container { +func EnsureContainerDeleted(containers []core.Container, name string) []core.Container { for i, c := range containers { if c.Name == name { return append(containers[:i], containers[i+1:]...) @@ -134,7 +134,7 @@ func EnsureContainerDeleted(containers []apiv1.Container, name string) []apiv1.C return containers } -func UpsertContainer(containers []apiv1.Container, nv apiv1.Container) []apiv1.Container { +func UpsertContainer(containers []core.Container, nv core.Container) []core.Container { for i, vol := range containers { if vol.Name == nv.Name { containers[i] = nv @@ -151,7 +151,7 @@ func GetString(m map[string]string, key string) string { return m[key] } -func UpsertVolume(volumes []apiv1.Volume, nv apiv1.Volume) []apiv1.Volume { +func UpsertVolume(volumes []core.Volume, nv core.Volume) []core.Volume { for i, vol := range volumes { if vol.Name == nv.Name { volumes[i] = nv @@ -161,7 +161,7 @@ func UpsertVolume(volumes []apiv1.Volume, nv apiv1.Volume) []apiv1.Volume { return append(volumes, nv) } -func EnsureVolumeDeleted(volumes []apiv1.Volume, name string) []apiv1.Volume { +func EnsureVolumeDeleted(volumes []core.Volume, name string) []core.Volume { for i, v := range volumes { if v.Name == name { return append(volumes[:i], volumes[i+1:]...) @@ -170,7 +170,7 @@ func EnsureVolumeDeleted(volumes []apiv1.Volume, name string) []apiv1.Volume { return volumes } -func UpsertVolumeMount(mounts []apiv1.VolumeMount, nv apiv1.VolumeMount) []apiv1.VolumeMount { +func UpsertVolumeMount(mounts []core.VolumeMount, nv core.VolumeMount) []core.VolumeMount { for i, vol := range mounts { if vol.Name == nv.Name { mounts[i] = nv @@ -180,7 +180,7 @@ func UpsertVolumeMount(mounts []apiv1.VolumeMount, nv apiv1.VolumeMount) []apiv1 return append(mounts, nv) } -func EnsureVolumeMountDeleted(mounts []apiv1.VolumeMount, name string) []apiv1.VolumeMount { +func EnsureVolumeMountDeleted(mounts []core.VolumeMount, name string) []core.VolumeMount { for i, v := range mounts { if v.Name == name { return append(mounts[:i], mounts[i+1:]...) @@ -189,7 +189,7 @@ func EnsureVolumeMountDeleted(mounts []apiv1.VolumeMount, name string) []apiv1.V return mounts } -func UpsertEnvVar(vars []apiv1.EnvVar, nv apiv1.EnvVar) []apiv1.EnvVar { +func UpsertEnvVar(vars []core.EnvVar, nv core.EnvVar) []core.EnvVar { for i, vol := range vars { if vol.Name == nv.Name { vars[i] = nv @@ -199,7 +199,7 @@ func UpsertEnvVar(vars []apiv1.EnvVar, nv apiv1.EnvVar) []apiv1.EnvVar { return append(vars, nv) } -func EnsureEnvVarDeleted(vars []apiv1.EnvVar, name string) []apiv1.EnvVar { +func EnsureEnvVarDeleted(vars []core.EnvVar, name string) []core.EnvVar { for i, v := range vars { if v.Name == name { return append(vars[:i], vars[i+1:]...) diff --git a/vendor/github.com/appscode/kutil/core/v1/pod.go b/vendor/github.com/appscode/kutil/core/v1/pod.go index 10fd0f260..1bad1bcd4 100644 --- a/vendor/github.com/appscode/kutil/core/v1/pod.go +++ b/vendor/github.com/appscode/kutil/core/v1/pod.go @@ -7,7 +7,7 @@ import ( "github.com/appscode/kutil" "github.com/golang/glog" - apiv1 "k8s.io/api/core/v1" + core "k8s.io/api/core/v1" kerr "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" @@ -16,14 +16,14 @@ import ( "k8s.io/client-go/kubernetes" ) -func CreateOrPatchPod(c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*apiv1.Pod) *apiv1.Pod) (*apiv1.Pod, error) { +func CreateOrPatchPod(c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*core.Pod) *core.Pod) (*core.Pod, error) { cur, err := c.CoreV1().Pods(meta.Namespace).Get(meta.Name, metav1.GetOptions{}) if kerr.IsNotFound(err) { glog.V(3).Infof("Creating Pod %s/%s.", meta.Namespace, meta.Name) - return c.CoreV1().Pods(meta.Namespace).Create(transform(&apiv1.Pod{ + return c.CoreV1().Pods(meta.Namespace).Create(transform(&core.Pod{ TypeMeta: metav1.TypeMeta{ Kind: "Pod", - APIVersion: apiv1.SchemeGroupVersion.String(), + APIVersion: core.SchemeGroupVersion.String(), }, ObjectMeta: meta, })) @@ -33,7 +33,7 @@ func CreateOrPatchPod(c kubernetes.Interface, meta metav1.ObjectMeta, transform return PatchPod(c, cur, transform) } -func PatchPod(c kubernetes.Interface, cur *apiv1.Pod, transform func(*apiv1.Pod) *apiv1.Pod) (*apiv1.Pod, error) { +func PatchPod(c kubernetes.Interface, cur *core.Pod, transform func(*core.Pod) *core.Pod) (*core.Pod, error) { curJson, err := json.Marshal(cur) if err != nil { return nil, err @@ -44,7 +44,7 @@ func PatchPod(c kubernetes.Interface, cur *apiv1.Pod, transform func(*apiv1.Pod) return nil, err } - patch, err := strategicpatch.CreateTwoWayMergePatch(curJson, modJson, apiv1.Pod{}) + patch, err := strategicpatch.CreateTwoWayMergePatch(curJson, modJson, core.Pod{}) if err != nil { return nil, err } @@ -55,7 +55,7 @@ func PatchPod(c kubernetes.Interface, cur *apiv1.Pod, transform func(*apiv1.Pod) return c.CoreV1().Pods(cur.Namespace).Patch(cur.Name, types.StrategicMergePatchType, patch) } -func TryPatchPod(c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*apiv1.Pod) *apiv1.Pod) (result *apiv1.Pod, err error) { +func TryPatchPod(c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*core.Pod) *core.Pod) (result *core.Pod, err error) { attempt := 0 err = wait.PollImmediate(kutil.RetryInterval, kutil.RetryTimeout, func() (bool, error) { attempt++ @@ -76,7 +76,7 @@ func TryPatchPod(c kubernetes.Interface, meta metav1.ObjectMeta, transform func( return } -func TryUpdatePod(c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*apiv1.Pod) *apiv1.Pod) (result *apiv1.Pod, err error) { +func TryUpdatePod(c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*core.Pod) *core.Pod) (result *core.Pod, err error) { attempt := 0 err = wait.PollImmediate(kutil.RetryInterval, kutil.RetryTimeout, func() (bool, error) { attempt++ @@ -100,16 +100,16 @@ func TryUpdatePod(c kubernetes.Interface, meta metav1.ObjectMeta, transform func // ref: https://github.com/coreos/prometheus-operator/blob/c79166fcff3dae7bb8bc1e6bddc81837c2d97c04/pkg/k8sutil/k8sutil.go#L64 // PodRunningAndReady returns whether a pod is running and each container has // passed it's ready state. -func PodRunningAndReady(pod apiv1.Pod) (bool, error) { +func PodRunningAndReady(pod core.Pod) (bool, error) { switch pod.Status.Phase { - case apiv1.PodFailed, apiv1.PodSucceeded: + case core.PodFailed, core.PodSucceeded: return false, errors.New("pod completed") - case apiv1.PodRunning: + case core.PodRunning: for _, cond := range pod.Status.Conditions { - if cond.Type != apiv1.PodReady { + if cond.Type != core.PodReady { continue } - return cond.Status == apiv1.ConditionTrue, nil + return cond.Status == core.ConditionTrue, nil } return false, errors.New("pod ready condition not found") } diff --git a/vendor/github.com/appscode/kutil/core/v1/rc.go b/vendor/github.com/appscode/kutil/core/v1/rc.go index 719fcbf4c..a46b9b728 100644 --- a/vendor/github.com/appscode/kutil/core/v1/rc.go +++ b/vendor/github.com/appscode/kutil/core/v1/rc.go @@ -7,7 +7,7 @@ import ( . "github.com/appscode/go/types" "github.com/appscode/kutil" "github.com/golang/glog" - apiv1 "k8s.io/api/core/v1" + core "k8s.io/api/core/v1" kerr "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" @@ -16,14 +16,14 @@ import ( "k8s.io/client-go/kubernetes" ) -func CreateOrPatchRC(c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*apiv1.ReplicationController) *apiv1.ReplicationController) (*apiv1.ReplicationController, error) { +func CreateOrPatchRC(c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*core.ReplicationController) *core.ReplicationController) (*core.ReplicationController, error) { cur, err := c.CoreV1().ReplicationControllers(meta.Namespace).Get(meta.Name, metav1.GetOptions{}) if kerr.IsNotFound(err) { glog.V(3).Infof("Creating ReplicationController %s/%s.", meta.Namespace, meta.Name) - return c.CoreV1().ReplicationControllers(meta.Namespace).Create(transform(&apiv1.ReplicationController{ + return c.CoreV1().ReplicationControllers(meta.Namespace).Create(transform(&core.ReplicationController{ TypeMeta: metav1.TypeMeta{ Kind: "ReplicationController", - APIVersion: apiv1.SchemeGroupVersion.String(), + APIVersion: core.SchemeGroupVersion.String(), }, ObjectMeta: meta, })) @@ -33,7 +33,7 @@ func CreateOrPatchRC(c kubernetes.Interface, meta metav1.ObjectMeta, transform f return PatchRC(c, cur, transform) } -func PatchRC(c kubernetes.Interface, cur *apiv1.ReplicationController, transform func(*apiv1.ReplicationController) *apiv1.ReplicationController) (*apiv1.ReplicationController, error) { +func PatchRC(c kubernetes.Interface, cur *core.ReplicationController, transform func(*core.ReplicationController) *core.ReplicationController) (*core.ReplicationController, error) { curJson, err := json.Marshal(cur) if err != nil { return nil, err @@ -44,7 +44,7 @@ func PatchRC(c kubernetes.Interface, cur *apiv1.ReplicationController, transform return nil, err } - patch, err := strategicpatch.CreateTwoWayMergePatch(curJson, modJson, apiv1.ReplicationController{}) + patch, err := strategicpatch.CreateTwoWayMergePatch(curJson, modJson, core.ReplicationController{}) if err != nil { return nil, err } @@ -55,7 +55,7 @@ func PatchRC(c kubernetes.Interface, cur *apiv1.ReplicationController, transform return c.CoreV1().ReplicationControllers(cur.Namespace).Patch(cur.Name, types.StrategicMergePatchType, patch) } -func TryPatchRC(c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*apiv1.ReplicationController) *apiv1.ReplicationController) (result *apiv1.ReplicationController, err error) { +func TryPatchRC(c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*core.ReplicationController) *core.ReplicationController) (result *core.ReplicationController, err error) { attempt := 0 err = wait.PollImmediate(kutil.RetryInterval, kutil.RetryTimeout, func() (bool, error) { attempt++ @@ -76,7 +76,7 @@ func TryPatchRC(c kubernetes.Interface, meta metav1.ObjectMeta, transform func(* return } -func TryUpdateRC(c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*apiv1.ReplicationController) *apiv1.ReplicationController) (result *apiv1.ReplicationController, err error) { +func TryUpdateRC(c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*core.ReplicationController) *core.ReplicationController) (result *core.ReplicationController, err error) { attempt := 0 err = wait.PollImmediate(kutil.RetryInterval, kutil.RetryTimeout, func() (bool, error) { attempt++ diff --git a/vendor/github.com/appscode/kutil/core/v1/secret.go b/vendor/github.com/appscode/kutil/core/v1/secret.go index c896a4b4b..0ba7089a4 100644 --- a/vendor/github.com/appscode/kutil/core/v1/secret.go +++ b/vendor/github.com/appscode/kutil/core/v1/secret.go @@ -6,7 +6,7 @@ import ( "github.com/appscode/kutil" "github.com/golang/glog" - apiv1 "k8s.io/api/core/v1" + core "k8s.io/api/core/v1" kerr "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" @@ -15,14 +15,14 @@ import ( "k8s.io/client-go/kubernetes" ) -func CreateOrPatchSecret(c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*apiv1.Secret) *apiv1.Secret) (*apiv1.Secret, error) { +func CreateOrPatchSecret(c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*core.Secret) *core.Secret) (*core.Secret, error) { cur, err := c.CoreV1().Secrets(meta.Namespace).Get(meta.Name, metav1.GetOptions{}) if kerr.IsNotFound(err) { glog.V(3).Infof("Creating Secret %s/%s.", meta.Namespace, meta.Name) - return c.CoreV1().Secrets(meta.Namespace).Create(transform(&apiv1.Secret{ + return c.CoreV1().Secrets(meta.Namespace).Create(transform(&core.Secret{ TypeMeta: metav1.TypeMeta{ Kind: "Secret", - APIVersion: apiv1.SchemeGroupVersion.String(), + APIVersion: core.SchemeGroupVersion.String(), }, ObjectMeta: meta, })) @@ -32,7 +32,7 @@ func CreateOrPatchSecret(c kubernetes.Interface, meta metav1.ObjectMeta, transfo return PatchSecret(c, cur, transform) } -func PatchSecret(c kubernetes.Interface, cur *apiv1.Secret, transform func(*apiv1.Secret) *apiv1.Secret) (*apiv1.Secret, error) { +func PatchSecret(c kubernetes.Interface, cur *core.Secret, transform func(*core.Secret) *core.Secret) (*core.Secret, error) { curJson, err := json.Marshal(cur) if err != nil { return nil, err @@ -43,7 +43,7 @@ func PatchSecret(c kubernetes.Interface, cur *apiv1.Secret, transform func(*apiv return nil, err } - patch, err := strategicpatch.CreateTwoWayMergePatch(curJson, modJson, apiv1.Secret{}) + patch, err := strategicpatch.CreateTwoWayMergePatch(curJson, modJson, core.Secret{}) if err != nil { return nil, err } @@ -54,7 +54,7 @@ func PatchSecret(c kubernetes.Interface, cur *apiv1.Secret, transform func(*apiv return c.CoreV1().Secrets(cur.Namespace).Patch(cur.Name, types.StrategicMergePatchType, patch) } -func TryPatchSecret(c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*apiv1.Secret) *apiv1.Secret) (result *apiv1.Secret, err error) { +func TryPatchSecret(c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*core.Secret) *core.Secret) (result *core.Secret, err error) { attempt := 0 err = wait.PollImmediate(kutil.RetryInterval, kutil.RetryTimeout, func() (bool, error) { attempt++ @@ -75,7 +75,7 @@ func TryPatchSecret(c kubernetes.Interface, meta metav1.ObjectMeta, transform fu return } -func TryUpdateSecret(c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*apiv1.Secret) *apiv1.Secret) (result *apiv1.Secret, err error) { +func TryUpdateSecret(c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*core.Secret) *core.Secret) (result *core.Secret, err error) { attempt := 0 err = wait.PollImmediate(kutil.RetryInterval, kutil.RetryTimeout, func() (bool, error) { attempt++ diff --git a/vendor/github.com/appscode/kutil/core/v1/service.go b/vendor/github.com/appscode/kutil/core/v1/service.go index 688188369..c42eb2ad0 100644 --- a/vendor/github.com/appscode/kutil/core/v1/service.go +++ b/vendor/github.com/appscode/kutil/core/v1/service.go @@ -6,7 +6,7 @@ import ( "github.com/appscode/kutil" "github.com/golang/glog" - apiv1 "k8s.io/api/core/v1" + core "k8s.io/api/core/v1" kerr "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" @@ -15,14 +15,14 @@ import ( "k8s.io/client-go/kubernetes" ) -func CreateOrPatchService(c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*apiv1.Service) *apiv1.Service) (*apiv1.Service, error) { +func CreateOrPatchService(c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*core.Service) *core.Service) (*core.Service, error) { cur, err := c.CoreV1().Services(meta.Namespace).Get(meta.Name, metav1.GetOptions{}) if kerr.IsNotFound(err) { glog.V(3).Infof("Creating Service %s/%s.", meta.Namespace, meta.Name) - return c.CoreV1().Services(meta.Namespace).Create(transform(&apiv1.Service{ + return c.CoreV1().Services(meta.Namespace).Create(transform(&core.Service{ TypeMeta: metav1.TypeMeta{ Kind: "Service", - APIVersion: apiv1.SchemeGroupVersion.String(), + APIVersion: core.SchemeGroupVersion.String(), }, ObjectMeta: meta, })) @@ -32,7 +32,7 @@ func CreateOrPatchService(c kubernetes.Interface, meta metav1.ObjectMeta, transf return PatchService(c, cur, transform) } -func PatchService(c kubernetes.Interface, cur *apiv1.Service, transform func(*apiv1.Service) *apiv1.Service) (*apiv1.Service, error) { +func PatchService(c kubernetes.Interface, cur *core.Service, transform func(*core.Service) *core.Service) (*core.Service, error) { curJson, err := json.Marshal(cur) if err != nil { return nil, err @@ -43,7 +43,7 @@ func PatchService(c kubernetes.Interface, cur *apiv1.Service, transform func(*ap return nil, err } - patch, err := strategicpatch.CreateTwoWayMergePatch(curJson, modJson, apiv1.Service{}) + patch, err := strategicpatch.CreateTwoWayMergePatch(curJson, modJson, core.Service{}) if err != nil { return nil, err } @@ -54,7 +54,7 @@ func PatchService(c kubernetes.Interface, cur *apiv1.Service, transform func(*ap return c.CoreV1().Services(cur.Namespace).Patch(cur.Name, types.StrategicMergePatchType, patch) } -func TryPatchService(c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*apiv1.Service) *apiv1.Service) (result *apiv1.Service, err error) { +func TryPatchService(c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*core.Service) *core.Service) (result *core.Service, err error) { attempt := 0 err = wait.PollImmediate(kutil.RetryInterval, kutil.RetryTimeout, func() (bool, error) { attempt++ @@ -75,7 +75,7 @@ func TryPatchService(c kubernetes.Interface, meta metav1.ObjectMeta, transform f return } -func TryUpdateService(c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*apiv1.Service) *apiv1.Service) (result *apiv1.Service, err error) { +func TryUpdateService(c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*core.Service) *core.Service) (result *core.Service, err error) { attempt := 0 err = wait.PollImmediate(kutil.RetryInterval, kutil.RetryTimeout, func() (bool, error) { attempt++ diff --git a/vendor/github.com/appscode/kutil/core/v1/serviceaccount.go b/vendor/github.com/appscode/kutil/core/v1/serviceaccount.go index 480b3078c..ade71b5a1 100644 --- a/vendor/github.com/appscode/kutil/core/v1/serviceaccount.go +++ b/vendor/github.com/appscode/kutil/core/v1/serviceaccount.go @@ -6,7 +6,7 @@ import ( "github.com/appscode/kutil" "github.com/golang/glog" - apiv1 "k8s.io/api/core/v1" + core "k8s.io/api/core/v1" kerr "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" @@ -15,14 +15,14 @@ import ( "k8s.io/client-go/kubernetes" ) -func CreateOrPatchServiceAccount(c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*apiv1.ServiceAccount) *apiv1.ServiceAccount) (*apiv1.ServiceAccount, error) { +func CreateOrPatchServiceAccount(c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*core.ServiceAccount) *core.ServiceAccount) (*core.ServiceAccount, error) { cur, err := c.CoreV1().ServiceAccounts(meta.Namespace).Get(meta.Name, metav1.GetOptions{}) if kerr.IsNotFound(err) { glog.V(3).Infof("Creating ServiceAccount %s/%s.", meta.Namespace, meta.Name) - return c.CoreV1().ServiceAccounts(meta.Namespace).Create(transform(&apiv1.ServiceAccount{ + return c.CoreV1().ServiceAccounts(meta.Namespace).Create(transform(&core.ServiceAccount{ TypeMeta: metav1.TypeMeta{ Kind: "ServiceAccount", - APIVersion: apiv1.SchemeGroupVersion.String(), + APIVersion: core.SchemeGroupVersion.String(), }, ObjectMeta: meta, })) @@ -32,7 +32,7 @@ func CreateOrPatchServiceAccount(c kubernetes.Interface, meta metav1.ObjectMeta, return PatchServiceAccount(c, cur, transform) } -func PatchServiceAccount(c kubernetes.Interface, cur *apiv1.ServiceAccount, transform func(*apiv1.ServiceAccount) *apiv1.ServiceAccount) (*apiv1.ServiceAccount, error) { +func PatchServiceAccount(c kubernetes.Interface, cur *core.ServiceAccount, transform func(*core.ServiceAccount) *core.ServiceAccount) (*core.ServiceAccount, error) { curJson, err := json.Marshal(cur) if err != nil { return nil, err @@ -43,7 +43,7 @@ func PatchServiceAccount(c kubernetes.Interface, cur *apiv1.ServiceAccount, tran return nil, err } - patch, err := strategicpatch.CreateTwoWayMergePatch(curJson, modJson, apiv1.ServiceAccount{}) + patch, err := strategicpatch.CreateTwoWayMergePatch(curJson, modJson, core.ServiceAccount{}) if err != nil { return nil, err } @@ -54,7 +54,7 @@ func PatchServiceAccount(c kubernetes.Interface, cur *apiv1.ServiceAccount, tran return c.CoreV1().ServiceAccounts(cur.Namespace).Patch(cur.Name, types.StrategicMergePatchType, patch) } -func TryPatchServiceAccount(c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*apiv1.ServiceAccount) *apiv1.ServiceAccount) (result *apiv1.ServiceAccount, err error) { +func TryPatchServiceAccount(c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*core.ServiceAccount) *core.ServiceAccount) (result *core.ServiceAccount, err error) { attempt := 0 err = wait.PollImmediate(kutil.RetryInterval, kutil.RetryTimeout, func() (bool, error) { attempt++ @@ -75,7 +75,7 @@ func TryPatchServiceAccount(c kubernetes.Interface, meta metav1.ObjectMeta, tran return } -func TryUpdateServiceAccount(c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*apiv1.ServiceAccount) *apiv1.ServiceAccount) (result *apiv1.ServiceAccount, err error) { +func TryUpdateServiceAccount(c kubernetes.Interface, meta metav1.ObjectMeta, transform func(*core.ServiceAccount) *core.ServiceAccount) (result *core.ServiceAccount, err error) { attempt := 0 err = wait.PollImmediate(kutil.RetryInterval, kutil.RetryTimeout, func() (bool, error) { attempt++ diff --git a/vendor/github.com/appscode/kutil/rbac/v1beta1/kubernetes.go b/vendor/github.com/appscode/kutil/rbac/v1beta1/kubernetes.go index 3bc3c264e..284743d4e 100644 --- a/vendor/github.com/appscode/kutil/rbac/v1beta1/kubernetes.go +++ b/vendor/github.com/appscode/kutil/rbac/v1beta1/kubernetes.go @@ -6,12 +6,12 @@ import ( "reflect" "github.com/appscode/kutil" - rbacv1beta1 "k8s.io/api/rbac/v1beta1" + rbac "k8s.io/api/rbac/v1beta1" "k8s.io/apimachinery/pkg/runtime/schema" ) func GetGroupVersionKind(v interface{}) schema.GroupVersionKind { - return rbacv1beta1.SchemeGroupVersion.WithKind(kutil.GetKind(v)) + return rbac.SchemeGroupVersion.WithKind(kutil.GetKind(v)) } func AssignTypeKind(v interface{}) error { @@ -20,20 +20,20 @@ func AssignTypeKind(v interface{}) error { } switch u := v.(type) { - case *rbacv1beta1.Role: - u.APIVersion = rbacv1beta1.SchemeGroupVersion.String() + case *rbac.Role: + u.APIVersion = rbac.SchemeGroupVersion.String() u.Kind = kutil.GetKind(v) return nil - case *rbacv1beta1.RoleBinding: - u.APIVersion = rbacv1beta1.SchemeGroupVersion.String() + case *rbac.RoleBinding: + u.APIVersion = rbac.SchemeGroupVersion.String() u.Kind = kutil.GetKind(v) return nil - case *rbacv1beta1.ClusterRole: - u.APIVersion = rbacv1beta1.SchemeGroupVersion.String() + case *rbac.ClusterRole: + u.APIVersion = rbac.SchemeGroupVersion.String() u.Kind = kutil.GetKind(v) return nil - case *rbacv1beta1.ClusterRoleBinding: - u.APIVersion = rbacv1beta1.SchemeGroupVersion.String() + case *rbac.ClusterRoleBinding: + u.APIVersion = rbac.SchemeGroupVersion.String() u.Kind = kutil.GetKind(v) return nil } diff --git a/vendor/github.com/appscode/kutil/util.go b/vendor/github.com/appscode/kutil/util.go index 35d13ecb5..9ab5428ba 100644 --- a/vendor/github.com/appscode/kutil/util.go +++ b/vendor/github.com/appscode/kutil/util.go @@ -2,16 +2,10 @@ package kutil import ( "fmt" - "io/ioutil" - "net/http" - "os" - "reflect" - "strings" - "time" - "github.com/hashicorp/go-version" "github.com/pkg/errors" - apiv1 "k8s.io/api/core/v1" + "io/ioutil" + core "k8s.io/api/core/v1" apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" kerr "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/meta" @@ -22,6 +16,11 @@ import ( "k8s.io/client-go/kubernetes" clientsetscheme "k8s.io/client-go/kubernetes/scheme" "k8s.io/client-go/rest" + "net/http" + "os" + "reflect" + "strings" + "time" ) const ( @@ -38,7 +37,7 @@ func Namespace() string { return ns } } - return apiv1.NamespaceDefault + return core.NamespaceDefault } func IsPreferredAPIResource(c kubernetes.Interface, groupVersion, kind string) bool { @@ -120,12 +119,12 @@ func GetKind(v interface{}) string { return val.Type().Name() } -func GetObjectReference(v interface{}, gv schema.GroupVersion) *apiv1.ObjectReference { +func GetObjectReference(v interface{}, gv schema.GroupVersion) *core.ObjectReference { m, err := meta.Accessor(v) if err != nil { - return &apiv1.ObjectReference{} + return &core.ObjectReference{} } - return &apiv1.ObjectReference{ + return &core.ObjectReference{ APIVersion: gv.String(), Kind: GetKind(v), Namespace: m.GetNamespace(), diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/clientset.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/clientset.go deleted file mode 100644 index bae98c78b..000000000 --- a/vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/clientset.go +++ /dev/null @@ -1,98 +0,0 @@ -/* -Copyright 2017 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package clientset - -import ( - glog "github.com/golang/glog" - apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1" - discovery "k8s.io/client-go/discovery" - rest "k8s.io/client-go/rest" - flowcontrol "k8s.io/client-go/util/flowcontrol" -) - -type Interface interface { - Discovery() discovery.DiscoveryInterface - ApiextensionsV1beta1() apiextensionsv1beta1.ApiextensionsV1beta1Interface - // Deprecated: please explicitly pick a version if possible. - Apiextensions() apiextensionsv1beta1.ApiextensionsV1beta1Interface -} - -// Clientset contains the clients for groups. Each group has exactly one -// version included in a Clientset. -type Clientset struct { - *discovery.DiscoveryClient - apiextensionsV1beta1 *apiextensionsv1beta1.ApiextensionsV1beta1Client -} - -// ApiextensionsV1beta1 retrieves the ApiextensionsV1beta1Client -func (c *Clientset) ApiextensionsV1beta1() apiextensionsv1beta1.ApiextensionsV1beta1Interface { - return c.apiextensionsV1beta1 -} - -// Deprecated: Apiextensions retrieves the default version of ApiextensionsClient. -// Please explicitly pick a version. -func (c *Clientset) Apiextensions() apiextensionsv1beta1.ApiextensionsV1beta1Interface { - return c.apiextensionsV1beta1 -} - -// Discovery retrieves the DiscoveryClient -func (c *Clientset) Discovery() discovery.DiscoveryInterface { - if c == nil { - return nil - } - return c.DiscoveryClient -} - -// NewForConfig creates a new Clientset for the given config. -func NewForConfig(c *rest.Config) (*Clientset, error) { - configShallowCopy := *c - if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { - configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) - } - var cs Clientset - var err error - cs.apiextensionsV1beta1, err = apiextensionsv1beta1.NewForConfig(&configShallowCopy) - if err != nil { - return nil, err - } - - cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) - if err != nil { - glog.Errorf("failed to create the DiscoveryClient: %v", err) - return nil, err - } - return &cs, nil -} - -// NewForConfigOrDie creates a new Clientset for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *Clientset { - var cs Clientset - cs.apiextensionsV1beta1 = apiextensionsv1beta1.NewForConfigOrDie(c) - - cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) - return &cs -} - -// New creates a new Clientset for the given RESTClient. -func New(c rest.Interface) *Clientset { - var cs Clientset - cs.apiextensionsV1beta1 = apiextensionsv1beta1.New(c) - - cs.DiscoveryClient = discovery.NewDiscoveryClient(c) - return &cs -} diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/doc.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/doc.go deleted file mode 100644 index 7d72e7fb2..000000000 --- a/vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/doc.go +++ /dev/null @@ -1,20 +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. -*/ - -// This package is generated by client-gen with custom arguments. - -// This package has the automatically generated clientset. -package clientset diff --git a/vendor/k8s.io/kubernetes/pkg/apis/extensions/types.go b/vendor/k8s.io/kubernetes/pkg/apis/extensions/types.go index 875db603e..028160be4 100644 --- a/vendor/k8s.io/kubernetes/pkg/apis/extensions/types.go +++ b/vendor/k8s.io/kubernetes/pkg/apis/extensions/types.go @@ -937,7 +937,7 @@ type PodSecurityPolicySpec struct { // +optional DefaultAllowPrivilegeEscalation *bool // AllowPrivilegeEscalation determines if a pod can request to allow - // privilege escalation. If unspecified, defaults to true. + // privilege escalation. // +optional AllowPrivilegeEscalation bool // AllowedHostPaths is a white list of allowed host paths. Empty indicates that all host paths may be used. diff --git a/vendor/k8s.io/kubernetes/pkg/apis/extensions/v1beta1/defaults.go b/vendor/k8s.io/kubernetes/pkg/apis/extensions/v1beta1/defaults.go index d817c2f0f..c653e812b 100644 --- a/vendor/k8s.io/kubernetes/pkg/apis/extensions/v1beta1/defaults.go +++ b/vendor/k8s.io/kubernetes/pkg/apis/extensions/v1beta1/defaults.go @@ -63,15 +63,6 @@ func SetDefaults_DaemonSet(obj *extensionsv1beta1.DaemonSet) { } } -func SetDefaults_PodSecurityPolicySpec(obj *extensionsv1beta1.PodSecurityPolicySpec) { - // This field was added after PodSecurityPolicy was released. - // Policies that do not include this field must remain as permissive as they were prior to the introduction of this field. - if obj.AllowPrivilegeEscalation == nil { - t := true - obj.AllowPrivilegeEscalation = &t - } -} - func SetDefaults_Deployment(obj *extensionsv1beta1.Deployment) { // Default labels and selector to labels from pod template spec. labels := obj.Spec.Template.Labels diff --git a/vendor/k8s.io/kubernetes/pkg/apis/extensions/v1beta1/zz_generated.conversion.go b/vendor/k8s.io/kubernetes/pkg/apis/extensions/v1beta1/zz_generated.conversion.go index 95b006f05..7e6636783 100644 --- a/vendor/k8s.io/kubernetes/pkg/apis/extensions/v1beta1/zz_generated.conversion.go +++ b/vendor/k8s.io/kubernetes/pkg/apis/extensions/v1beta1/zz_generated.conversion.go @@ -1075,9 +1075,7 @@ func autoConvert_v1beta1_PodSecurityPolicySpec_To_extensions_PodSecurityPolicySp } out.ReadOnlyRootFilesystem = in.ReadOnlyRootFilesystem out.DefaultAllowPrivilegeEscalation = (*bool)(unsafe.Pointer(in.DefaultAllowPrivilegeEscalation)) - if err := v1.Convert_Pointer_bool_To_bool(&in.AllowPrivilegeEscalation, &out.AllowPrivilegeEscalation, s); err != nil { - return err - } + out.AllowPrivilegeEscalation = in.AllowPrivilegeEscalation out.AllowedHostPaths = *(*[]extensions.AllowedHostPath)(unsafe.Pointer(&in.AllowedHostPaths)) return nil } @@ -1121,9 +1119,7 @@ func autoConvert_extensions_PodSecurityPolicySpec_To_v1beta1_PodSecurityPolicySp } out.ReadOnlyRootFilesystem = in.ReadOnlyRootFilesystem out.DefaultAllowPrivilegeEscalation = (*bool)(unsafe.Pointer(in.DefaultAllowPrivilegeEscalation)) - if err := v1.Convert_bool_To_Pointer_bool(&in.AllowPrivilegeEscalation, &out.AllowPrivilegeEscalation, s); err != nil { - return err - } + out.AllowPrivilegeEscalation = in.AllowPrivilegeEscalation out.AllowedHostPaths = *(*[]v1beta1.AllowedHostPath)(unsafe.Pointer(&in.AllowedHostPaths)) return nil } diff --git a/vendor/k8s.io/kubernetes/pkg/apis/extensions/v1beta1/zz_generated.defaults.go b/vendor/k8s.io/kubernetes/pkg/apis/extensions/v1beta1/zz_generated.defaults.go index 11bd8e640..ba0c3716a 100644 --- a/vendor/k8s.io/kubernetes/pkg/apis/extensions/v1beta1/zz_generated.defaults.go +++ b/vendor/k8s.io/kubernetes/pkg/apis/extensions/v1beta1/zz_generated.defaults.go @@ -36,8 +36,6 @@ func RegisterDefaults(scheme *runtime.Scheme) error { scheme.AddTypeDefaultingFunc(&v1beta1.DeploymentList{}, func(obj interface{}) { SetObjectDefaults_DeploymentList(obj.(*v1beta1.DeploymentList)) }) scheme.AddTypeDefaultingFunc(&v1beta1.NetworkPolicy{}, func(obj interface{}) { SetObjectDefaults_NetworkPolicy(obj.(*v1beta1.NetworkPolicy)) }) scheme.AddTypeDefaultingFunc(&v1beta1.NetworkPolicyList{}, func(obj interface{}) { SetObjectDefaults_NetworkPolicyList(obj.(*v1beta1.NetworkPolicyList)) }) - scheme.AddTypeDefaultingFunc(&v1beta1.PodSecurityPolicy{}, func(obj interface{}) { SetObjectDefaults_PodSecurityPolicy(obj.(*v1beta1.PodSecurityPolicy)) }) - scheme.AddTypeDefaultingFunc(&v1beta1.PodSecurityPolicyList{}, func(obj interface{}) { SetObjectDefaults_PodSecurityPolicyList(obj.(*v1beta1.PodSecurityPolicyList)) }) scheme.AddTypeDefaultingFunc(&v1beta1.ReplicaSet{}, func(obj interface{}) { SetObjectDefaults_ReplicaSet(obj.(*v1beta1.ReplicaSet)) }) scheme.AddTypeDefaultingFunc(&v1beta1.ReplicaSetList{}, func(obj interface{}) { SetObjectDefaults_ReplicaSetList(obj.(*v1beta1.ReplicaSetList)) }) return nil @@ -342,17 +340,6 @@ func SetObjectDefaults_NetworkPolicyList(in *v1beta1.NetworkPolicyList) { } } -func SetObjectDefaults_PodSecurityPolicy(in *v1beta1.PodSecurityPolicy) { - SetDefaults_PodSecurityPolicySpec(&in.Spec) -} - -func SetObjectDefaults_PodSecurityPolicyList(in *v1beta1.PodSecurityPolicyList) { - for i := range in.Items { - a := &in.Items[i] - SetObjectDefaults_PodSecurityPolicy(a) - } -} - func SetObjectDefaults_ReplicaSet(in *v1beta1.ReplicaSet) { SetDefaults_ReplicaSet(in) v1.SetDefaults_PodSpec(&in.Spec.Template.Spec) diff --git a/vendor/k8s.io/kubernetes/pkg/apis/rbac/helpers.go b/vendor/k8s.io/kubernetes/pkg/apis/rbac/helpers.go index efc4c61c5..549aedc98 100644 --- a/vendor/k8s.io/kubernetes/pkg/apis/rbac/helpers.go +++ b/vendor/k8s.io/kubernetes/pkg/apis/rbac/helpers.go @@ -348,7 +348,7 @@ func NewRoleBindingForClusterRole(roleName, namespace string) *RoleBindingBuilde // Groups adds the specified groups as the subjects of the RoleBinding. func (r *RoleBindingBuilder) Groups(groups ...string) *RoleBindingBuilder { for _, group := range groups { - r.RoleBinding.Subjects = append(r.RoleBinding.Subjects, Subject{Kind: GroupKind, APIGroup: GroupName, Name: group}) + r.RoleBinding.Subjects = append(r.RoleBinding.Subjects, Subject{Kind: GroupKind, Name: group}) } return r } @@ -356,7 +356,7 @@ func (r *RoleBindingBuilder) Groups(groups ...string) *RoleBindingBuilder { // Users adds the specified users as the subjects of the RoleBinding. func (r *RoleBindingBuilder) Users(users ...string) *RoleBindingBuilder { for _, user := range users { - r.RoleBinding.Subjects = append(r.RoleBinding.Subjects, Subject{Kind: UserKind, APIGroup: GroupName, Name: user}) + r.RoleBinding.Subjects = append(r.RoleBinding.Subjects, Subject{Kind: UserKind, Name: user}) } return r }