Skip to content

Commit

Permalink
Merge pull request #269 from andyxning/bump_kubernetes_to_1.8
Browse files Browse the repository at this point in the history
bump kubernetes to 1.8
  • Loading branch information
andyxning authored Oct 11, 2017
2 parents a3eb237 + 19797a2 commit c40353a
Show file tree
Hide file tree
Showing 909 changed files with 84,087 additions and 263,018 deletions.
647 changes: 301 additions & 346 deletions Godeps/Godeps.json

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions collectors/cronjob.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"

v2batch "k8s.io/client-go/pkg/apis/batch/v2alpha1"
v2batch "k8s.io/api/batch/v2alpha1"
"k8s.io/apimachinery/pkg/fields"
"k8s.io/client-go/tools/cache"
)

Expand Down Expand Up @@ -78,7 +79,7 @@ func (l CronJobLister) List() ([]v2batch.CronJob, error) {
func RegisterCronJobCollector(registry prometheus.Registerer, kubeClient kubernetes.Interface, namespace string) {
client := kubeClient.BatchV2alpha1().RESTClient()
glog.Infof("collect cronjob with %s", client.APIVersion())
cjlw := cache.NewListWatchFromClient(client, "cronjobs", namespace, nil)
cjlw := cache.NewListWatchFromClient(client, "cronjobs", namespace, fields.Everything())
cjinf := cache.NewSharedInformer(cjlw, &v2batch.CronJob{}, resyncPeriod)

cronJobLister := CronJobLister(func() (cronjobs []v2batch.CronJob, err error) {
Expand Down
4 changes: 2 additions & 2 deletions collectors/cronjob_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import (
"testing"
"time"

v2batch "k8s.io/api/batch/v2alpha1"
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/pkg/api/v1"
v2batch "k8s.io/client-go/pkg/apis/batch/v2alpha1"
)

var (
Expand Down
5 changes: 3 additions & 2 deletions collectors/daemonset.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ import (
"github.com/golang/glog"
"github.com/prometheus/client_golang/prometheus"
"golang.org/x/net/context"
"k8s.io/api/extensions/v1beta1"
"k8s.io/apimachinery/pkg/fields"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/pkg/apis/extensions/v1beta1"
"k8s.io/client-go/tools/cache"
)

Expand Down Expand Up @@ -67,7 +68,7 @@ func (l DaemonSetLister) List() ([]v1beta1.DaemonSet, error) {
func RegisterDaemonSetCollector(registry prometheus.Registerer, kubeClient kubernetes.Interface, namespace string) {
client := kubeClient.ExtensionsV1beta1().RESTClient()
glog.Infof("collect daemonset with %s", client.APIVersion())
dslw := cache.NewListWatchFromClient(client, "daemonsets", namespace, nil)
dslw := cache.NewListWatchFromClient(client, "daemonsets", namespace, fields.Everything())
dsinf := cache.NewSharedInformer(dslw, &v1beta1.DaemonSet{}, resyncPeriod)

dsLister := DaemonSetLister(func() (daemonsets []v1beta1.DaemonSet, err error) {
Expand Down
2 changes: 1 addition & 1 deletion collectors/daemonset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (
"testing"
"time"

"k8s.io/api/extensions/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/pkg/apis/extensions/v1beta1"
)

type mockDaemonSetStore struct {
Expand Down
5 changes: 3 additions & 2 deletions collectors/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ import (
"github.com/golang/glog"
"github.com/prometheus/client_golang/prometheus"
"golang.org/x/net/context"
"k8s.io/api/extensions/v1beta1"
"k8s.io/apimachinery/pkg/fields"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/pkg/apis/extensions/v1beta1"
"k8s.io/client-go/tools/cache"
)

Expand Down Expand Up @@ -104,7 +105,7 @@ func (l DeploymentLister) List() ([]v1beta1.Deployment, error) {
func RegisterDeploymentCollector(registry prometheus.Registerer, kubeClient kubernetes.Interface, namespace string) {
client := kubeClient.ExtensionsV1beta1().RESTClient()
glog.Infof("collect deployment with %s", client.APIVersion())
dlw := cache.NewListWatchFromClient(client, "deployments", namespace, nil)
dlw := cache.NewListWatchFromClient(client, "deployments", namespace, fields.Everything())
dinf := cache.NewSharedInformer(dlw, &v1beta1.Deployment{}, resyncPeriod)

dplLister := DeploymentLister(func() (deployments []v1beta1.Deployment, err error) {
Expand Down
2 changes: 1 addition & 1 deletion collectors/deployment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ import (
dto "github.com/prometheus/client_model/go"
"github.com/prometheus/common/expfmt"

"k8s.io/api/extensions/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/client-go/pkg/apis/extensions/v1beta1"
)

var (
Expand Down
5 changes: 3 additions & 2 deletions collectors/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ import (
"github.com/golang/glog"
"github.com/prometheus/client_golang/prometheus"
"golang.org/x/net/context"
v1batch "k8s.io/api/batch/v1"
"k8s.io/apimachinery/pkg/fields"
"k8s.io/client-go/kubernetes"
v1batch "k8s.io/client-go/pkg/apis/batch/v1"
"k8s.io/client-go/tools/cache"
)

Expand Down Expand Up @@ -97,7 +98,7 @@ func (l JobLister) List() ([]v1batch.Job, error) {
func RegisterJobCollector(registry prometheus.Registerer, kubeClient kubernetes.Interface, namespace string) {
client := kubeClient.BatchV1().RESTClient()
glog.Infof("collect job with %s", client.APIVersion())
jlw := cache.NewListWatchFromClient(client, "jobs", namespace, nil)
jlw := cache.NewListWatchFromClient(client, "jobs", namespace, fields.Everything())
jinf := cache.NewSharedInformer(jlw, &v1batch.Job{}, resyncPeriod)

jobLister := JobLister(func() (jobs []v1batch.Job, err error) {
Expand Down
4 changes: 2 additions & 2 deletions collectors/job_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import (
"testing"
"time"

v1batch "k8s.io/api/batch/v1"
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/pkg/api/v1"
v1batch "k8s.io/client-go/pkg/apis/batch/v1"
)

var (
Expand Down
5 changes: 3 additions & 2 deletions collectors/limitrange.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ import (
"github.com/golang/glog"
"github.com/prometheus/client_golang/prometheus"
"golang.org/x/net/context"
"k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/fields"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/pkg/api/v1"
"k8s.io/client-go/tools/cache"
)

Expand Down Expand Up @@ -54,7 +55,7 @@ func (l LimitRangeLister) List() (v1.LimitRangeList, error) {
func RegisterLimitRangeCollector(registry prometheus.Registerer, kubeClient kubernetes.Interface, namespace string) {
client := kubeClient.CoreV1().RESTClient()
glog.Infof("collect limitrange with %s", client.APIVersion())
rqlw := cache.NewListWatchFromClient(client, "limitranges", namespace, nil)
rqlw := cache.NewListWatchFromClient(client, "limitranges", namespace, fields.Everything())
rqinf := cache.NewSharedInformer(rqlw, &v1.LimitRange{}, resyncPeriod)

limitRangeLister := LimitRangeLister(func() (ranges v1.LimitRangeList, err error) {
Expand Down
2 changes: 1 addition & 1 deletion collectors/limitrange_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import (
"testing"
"time"

"k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/pkg/api/v1"
)

type mockLimitRangeStore struct {
Expand Down
7 changes: 4 additions & 3 deletions collectors/namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ import (
"github.com/golang/glog"
"github.com/prometheus/client_golang/prometheus"
"golang.org/x/net/context"
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/fields"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/pkg/api"
"k8s.io/client-go/pkg/api/v1"
"k8s.io/client-go/tools/cache"
)

Expand Down Expand Up @@ -65,7 +66,7 @@ func (l NamespaceLister) List() ([]v1.Namespace, error) {
func RegisterNamespaceCollector(registry prometheus.Registerer, kubeClient kubernetes.Interface, namespace string) {
client := kubeClient.CoreV1().RESTClient()
glog.Infof("collect namespace with %s", client.APIVersion())
nslw := cache.NewListWatchFromClient(client, "namespaces", api.NamespaceAll, nil)
nslw := cache.NewListWatchFromClient(client, "namespaces", metav1.NamespaceAll, fields.Everything())
nsinf := cache.NewSharedInformer(nslw, &v1.Namespace{}, resyncPeriod)

namespaceLister := NamespaceLister(func() (namespaces []v1.Namespace, err error) {
Expand Down
2 changes: 1 addition & 1 deletion collectors/namespace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (
"testing"
"time"

"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/pkg/api/v1"
)

type mockNamespaceStore struct {
Expand Down
7 changes: 4 additions & 3 deletions collectors/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ import (
"github.com/golang/glog"
"github.com/prometheus/client_golang/prometheus"
"golang.org/x/net/context"
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/fields"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/pkg/api"
"k8s.io/client-go/pkg/api/v1"
"k8s.io/client-go/tools/cache"
)

Expand Down Expand Up @@ -127,7 +128,7 @@ func (l NodeLister) List() (v1.NodeList, error) {
func RegisterNodeCollector(registry prometheus.Registerer, kubeClient kubernetes.Interface, namespace string) {
client := kubeClient.CoreV1().RESTClient()
glog.Infof("collect node with %s", client.APIVersion())
nlw := cache.NewListWatchFromClient(client, "nodes", api.NamespaceAll, nil)
nlw := cache.NewListWatchFromClient(client, "nodes", metav1.NamespaceAll, fields.Everything())
ninf := cache.NewSharedInformer(nlw, &v1.Node{}, resyncPeriod)

nodeLister := NodeLister(func() (machines v1.NodeList, err error) {
Expand Down
2 changes: 1 addition & 1 deletion collectors/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import (
"testing"
"time"

"k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/pkg/api/v1"
)

type mockNodeStore struct {
Expand Down
5 changes: 3 additions & 2 deletions collectors/persistentvolumeclaim.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ import (
"github.com/golang/glog"
"github.com/prometheus/client_golang/prometheus"
"golang.org/x/net/context"
"k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/fields"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/pkg/api/v1"
"k8s.io/client-go/tools/cache"
)

Expand Down Expand Up @@ -63,7 +64,7 @@ func (l PersistentVolumeClaimLister) List() (v1.PersistentVolumeClaimList, error
func RegisterPersistentVolumeClaimCollector(registry prometheus.Registerer, kubeClient kubernetes.Interface, namespace string) {
client := kubeClient.CoreV1().RESTClient()
glog.Infof("collect persistentvolumeclaim with %s", client.APIVersion())
pvclw := cache.NewListWatchFromClient(client, "persistentvolumeclaims", namespace, nil)
pvclw := cache.NewListWatchFromClient(client, "persistentvolumeclaims", namespace, fields.Everything())
pvcinf := cache.NewSharedInformer(pvclw, &v1.PersistentVolumeClaim{}, resyncPeriod)

persistentVolumeClaimLister := PersistentVolumeClaimLister(func() (pvcs v1.PersistentVolumeClaimList, err error) {
Expand Down
2 changes: 1 addition & 1 deletion collectors/persistentvolumeclaim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ package collectors
import (
"testing"

"k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/pkg/api/v1"
)

type mockPersistentVolumeClaimStore struct {
Expand Down
12 changes: 6 additions & 6 deletions collectors/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ import (
"github.com/golang/glog"
"github.com/prometheus/client_golang/prometheus"
"golang.org/x/net/context"
"k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/fields"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/pkg/api"
"k8s.io/client-go/pkg/api/v1"
"k8s.io/client-go/tools/cache"
)

Expand Down Expand Up @@ -173,7 +173,7 @@ func (l PodLister) List() ([]v1.Pod, error) {
func RegisterPodCollector(registry prometheus.Registerer, kubeClient kubernetes.Interface, namespace string) {
client := kubeClient.CoreV1().RESTClient()
glog.Infof("collect pod with %s", client.APIVersion())
plw := cache.NewListWatchFromClient(client, "pods", namespace, nil)
plw := cache.NewListWatchFromClient(client, "pods", namespace, fields.Everything())
pinf := cache.NewSharedInformer(plw, &v1.Pod{}, resyncPeriod)

podLister := PodLister(func() (pods []v1.Pod, err error) {
Expand Down Expand Up @@ -221,10 +221,10 @@ func (pc *podCollector) Describe(ch chan<- *prometheus.Desc) {
ch <- descPodContainerResourceLimitsNvidiaGPUDevices
}

func extractCreatedBy(annotation map[string]string) *api.ObjectReference {
value, ok := annotation[api.CreatedByAnnotation]
func extractCreatedBy(annotation map[string]string) *v1.ObjectReference {
value, ok := annotation[v1.CreatedByAnnotation]
if ok {
var r api.SerializedReference
var r v1.SerializedReference
err := json.Unmarshal([]byte(value), &r)
if err == nil {
return &r.Reference
Expand Down
2 changes: 1 addition & 1 deletion collectors/pod_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import (
"testing"
"time"

"k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/pkg/api/v1"
)

type mockPodStore struct {
Expand Down
5 changes: 3 additions & 2 deletions collectors/replicaset.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ import (
"github.com/golang/glog"
"github.com/prometheus/client_golang/prometheus"
"golang.org/x/net/context"
"k8s.io/api/extensions/v1beta1"
"k8s.io/apimachinery/pkg/fields"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/pkg/apis/extensions/v1beta1"
"k8s.io/client-go/tools/cache"
)

Expand Down Expand Up @@ -72,7 +73,7 @@ func (l ReplicaSetLister) List() ([]v1beta1.ReplicaSet, error) {
func RegisterReplicaSetCollector(registry prometheus.Registerer, kubeClient kubernetes.Interface, namespace string) {
client := kubeClient.ExtensionsV1beta1().RESTClient()
glog.Infof("collect replicaset with %s", client.APIVersion())
rslw := cache.NewListWatchFromClient(client, "replicasets", namespace, nil)
rslw := cache.NewListWatchFromClient(client, "replicasets", namespace, fields.Everything())
rsinf := cache.NewSharedInformer(rslw, &v1beta1.ReplicaSet{}, resyncPeriod)

replicaSetLister := ReplicaSetLister(func() (replicasets []v1beta1.ReplicaSet, err error) {
Expand Down
2 changes: 1 addition & 1 deletion collectors/replicaset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (
"testing"
"time"

"k8s.io/api/extensions/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/pkg/apis/extensions/v1beta1"
)

var (
Expand Down
5 changes: 3 additions & 2 deletions collectors/replicationcontroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ import (

"github.com/golang/glog"
"github.com/prometheus/client_golang/prometheus"
"k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/fields"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/pkg/api/v1"
"k8s.io/client-go/tools/cache"
)

Expand Down Expand Up @@ -78,7 +79,7 @@ func (l ReplicationControllerLister) List() ([]v1.ReplicationController, error)
func RegisterReplicationControllerCollector(registry prometheus.Registerer, kubeClient kubernetes.Interface, namespace string) {
client := kubeClient.CoreV1().RESTClient()
glog.Infof("collect replicationcontroller with %s", client.APIVersion())
rclw := cache.NewListWatchFromClient(client, "replicationcontrollers", namespace, nil)
rclw := cache.NewListWatchFromClient(client, "replicationcontrollers", namespace, fields.Everything())
rcinf := cache.NewSharedInformer(rclw, &v1.ReplicationController{}, resyncPeriod)

replicationControllerLister := ReplicationControllerLister(func() (rcs []v1.ReplicationController, err error) {
Expand Down
2 changes: 1 addition & 1 deletion collectors/replicationcontroller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (
"testing"
"time"

"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/pkg/api/v1"
)

var (
Expand Down
5 changes: 3 additions & 2 deletions collectors/resourcequota.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ import (
"github.com/golang/glog"
"github.com/prometheus/client_golang/prometheus"
"golang.org/x/net/context"
"k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/fields"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/pkg/api/v1"
"k8s.io/client-go/tools/cache"
)

Expand Down Expand Up @@ -52,7 +53,7 @@ func (l ResourceQuotaLister) List() (v1.ResourceQuotaList, error) {
func RegisterResourceQuotaCollector(registry prometheus.Registerer, kubeClient kubernetes.Interface, namespace string) {
client := kubeClient.CoreV1().RESTClient()
glog.Infof("collect resourcequota with %s", client.APIVersion())
rqlw := cache.NewListWatchFromClient(client, "resourcequotas", namespace, nil)
rqlw := cache.NewListWatchFromClient(client, "resourcequotas", namespace, fields.Everything())
rqinf := cache.NewSharedInformer(rqlw, &v1.ResourceQuota{}, resyncPeriod)

resourceQuotaLister := ResourceQuotaLister(func() (quotas v1.ResourceQuotaList, err error) {
Expand Down
2 changes: 1 addition & 1 deletion collectors/resourcequota_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import (
"testing"
"time"

"k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/pkg/api/v1"
)

type mockResourceQuotaStore struct {
Expand Down
Loading

0 comments on commit c40353a

Please sign in to comment.