From 530bc0d9e0afdf7931170a0ad2b61166fa3f626e Mon Sep 17 00:00:00 2001 From: Vijay Samuel Date: Tue, 2 May 2017 08:44:31 -0700 Subject: [PATCH] Abstracting pod interface in kubernetes plugin to enable easier vendoring (#4152) --- CHANGELOG.asciidoc | 1 + NOTICE | 12 +- filebeat/beater/filebeat.go | 2 +- .../kubernetes/indexing.go | 0 .../kubernetes/indexing_test.go | 0 libbeat/processors/kubernetes/indexing.go | 32 ++- .../processors/kubernetes/indexing_test.go | 40 ++-- libbeat/processors/kubernetes/podwatcher.go | 46 +++-- libbeat/processors/kubernetes/types.go | 99 +++++++++ .../vendor}/github.com/ericchiang/k8s/LICENSE | 0 .../github.com/ericchiang/k8s/Makefile | 0 .../github.com/ericchiang/k8s/README.md | 0 .../k8s/api/resource/generated.pb.go | 0 .../k8s/api/unversioned/generated.pb.go | 0 .../ericchiang/k8s/api/unversioned/time.go | 0 .../ericchiang/k8s/api/v1/generated.pb.go | 0 .../k8s/apis/apps/v1alpha1/generated.pb.go | 0 .../k8s/apis/apps/v1beta1/generated.pb.go | 0 .../apis/authentication/v1/generated.pb.go | 0 .../authentication/v1beta1/generated.pb.go | 0 .../k8s/apis/authorization/v1/generated.pb.go | 0 .../authorization/v1beta1/generated.pb.go | 0 .../k8s/apis/autoscaling/v1/generated.pb.go | 0 .../apis/autoscaling/v2alpha1/generated.pb.go | 0 .../k8s/apis/batch/v1/generated.pb.go | 0 .../k8s/apis/batch/v2alpha1/generated.pb.go | 0 .../certificates/v1alpha1/generated.pb.go | 0 .../apis/certificates/v1beta1/generated.pb.go | 0 .../apis/extensions/v1beta1/generated.pb.go | 0 .../apis/imagepolicy/v1alpha1/generated.pb.go | 0 .../k8s/apis/meta/v1/generated.pb.go | 0 .../ericchiang/k8s/apis/meta/v1/time.go | 0 .../k8s/apis/policy/v1alpha1/generated.pb.go | 0 .../k8s/apis/policy/v1beta1/generated.pb.go | 0 .../k8s/apis/rbac/v1alpha1/generated.pb.go | 0 .../k8s/apis/rbac/v1beta1/generated.pb.go | 0 .../apis/settings/v1alpha1/generated.pb.go | 0 .../k8s/apis/storage/v1/generated.pb.go | 0 .../k8s/apis/storage/v1beta1/generated.pb.go | 0 .../github.com/ericchiang/k8s/client.go | 0 .../github.com/ericchiang/k8s/codec.go | 0 .../github.com/ericchiang/k8s/config.go | 0 .../github.com/ericchiang/k8s/discovery.go | 0 .../vendor}/github.com/ericchiang/k8s/gen.go | 0 .../vendor}/github.com/ericchiang/k8s/gen.sh | 0 .../github.com/ericchiang/k8s/labels.go | 0 .../ericchiang/k8s/runtime/generated.pb.go | 0 .../k8s/runtime/schema/generated.pb.go | 0 .../vendor}/github.com/ericchiang/k8s/tprs.go | 0 .../github.com/ericchiang/k8s/types.go | 0 .../k8s/util/intstr/generated.pb.go | 0 .../k8s/watch/versioned/generated.pb.go | 0 .../processors/kubernetes/vendor/vendor.json | 188 ++++++++++++++++++ metricbeat/beater/metricbeat.go | 2 +- .../kubernetes/indexing.go | 19 +- .../kubernetes/indexing_test.go | 30 ++- vendor/vendor.json | 181 ----------------- 57 files changed, 386 insertions(+), 266 deletions(-) rename filebeat/{processors => processor}/kubernetes/indexing.go (100%) rename filebeat/{processors => processor}/kubernetes/indexing_test.go (100%) create mode 100644 libbeat/processors/kubernetes/types.go rename {vendor => libbeat/processors/kubernetes/vendor}/github.com/ericchiang/k8s/LICENSE (100%) rename {vendor => libbeat/processors/kubernetes/vendor}/github.com/ericchiang/k8s/Makefile (100%) rename {vendor => libbeat/processors/kubernetes/vendor}/github.com/ericchiang/k8s/README.md (100%) rename {vendor => libbeat/processors/kubernetes/vendor}/github.com/ericchiang/k8s/api/resource/generated.pb.go (100%) rename {vendor => libbeat/processors/kubernetes/vendor}/github.com/ericchiang/k8s/api/unversioned/generated.pb.go (100%) rename {vendor => libbeat/processors/kubernetes/vendor}/github.com/ericchiang/k8s/api/unversioned/time.go (100%) rename {vendor => libbeat/processors/kubernetes/vendor}/github.com/ericchiang/k8s/api/v1/generated.pb.go (100%) rename {vendor => libbeat/processors/kubernetes/vendor}/github.com/ericchiang/k8s/apis/apps/v1alpha1/generated.pb.go (100%) rename {vendor => libbeat/processors/kubernetes/vendor}/github.com/ericchiang/k8s/apis/apps/v1beta1/generated.pb.go (100%) rename {vendor => libbeat/processors/kubernetes/vendor}/github.com/ericchiang/k8s/apis/authentication/v1/generated.pb.go (100%) rename {vendor => libbeat/processors/kubernetes/vendor}/github.com/ericchiang/k8s/apis/authentication/v1beta1/generated.pb.go (100%) rename {vendor => libbeat/processors/kubernetes/vendor}/github.com/ericchiang/k8s/apis/authorization/v1/generated.pb.go (100%) rename {vendor => libbeat/processors/kubernetes/vendor}/github.com/ericchiang/k8s/apis/authorization/v1beta1/generated.pb.go (100%) rename {vendor => libbeat/processors/kubernetes/vendor}/github.com/ericchiang/k8s/apis/autoscaling/v1/generated.pb.go (100%) rename {vendor => libbeat/processors/kubernetes/vendor}/github.com/ericchiang/k8s/apis/autoscaling/v2alpha1/generated.pb.go (100%) rename {vendor => libbeat/processors/kubernetes/vendor}/github.com/ericchiang/k8s/apis/batch/v1/generated.pb.go (100%) rename {vendor => libbeat/processors/kubernetes/vendor}/github.com/ericchiang/k8s/apis/batch/v2alpha1/generated.pb.go (100%) rename {vendor => libbeat/processors/kubernetes/vendor}/github.com/ericchiang/k8s/apis/certificates/v1alpha1/generated.pb.go (100%) rename {vendor => libbeat/processors/kubernetes/vendor}/github.com/ericchiang/k8s/apis/certificates/v1beta1/generated.pb.go (100%) rename {vendor => libbeat/processors/kubernetes/vendor}/github.com/ericchiang/k8s/apis/extensions/v1beta1/generated.pb.go (100%) rename {vendor => libbeat/processors/kubernetes/vendor}/github.com/ericchiang/k8s/apis/imagepolicy/v1alpha1/generated.pb.go (100%) rename {vendor => libbeat/processors/kubernetes/vendor}/github.com/ericchiang/k8s/apis/meta/v1/generated.pb.go (100%) rename {vendor => libbeat/processors/kubernetes/vendor}/github.com/ericchiang/k8s/apis/meta/v1/time.go (100%) rename {vendor => libbeat/processors/kubernetes/vendor}/github.com/ericchiang/k8s/apis/policy/v1alpha1/generated.pb.go (100%) rename {vendor => libbeat/processors/kubernetes/vendor}/github.com/ericchiang/k8s/apis/policy/v1beta1/generated.pb.go (100%) rename {vendor => libbeat/processors/kubernetes/vendor}/github.com/ericchiang/k8s/apis/rbac/v1alpha1/generated.pb.go (100%) rename {vendor => libbeat/processors/kubernetes/vendor}/github.com/ericchiang/k8s/apis/rbac/v1beta1/generated.pb.go (100%) rename {vendor => libbeat/processors/kubernetes/vendor}/github.com/ericchiang/k8s/apis/settings/v1alpha1/generated.pb.go (100%) rename {vendor => libbeat/processors/kubernetes/vendor}/github.com/ericchiang/k8s/apis/storage/v1/generated.pb.go (100%) rename {vendor => libbeat/processors/kubernetes/vendor}/github.com/ericchiang/k8s/apis/storage/v1beta1/generated.pb.go (100%) rename {vendor => libbeat/processors/kubernetes/vendor}/github.com/ericchiang/k8s/client.go (100%) rename {vendor => libbeat/processors/kubernetes/vendor}/github.com/ericchiang/k8s/codec.go (100%) rename {vendor => libbeat/processors/kubernetes/vendor}/github.com/ericchiang/k8s/config.go (100%) rename {vendor => libbeat/processors/kubernetes/vendor}/github.com/ericchiang/k8s/discovery.go (100%) rename {vendor => libbeat/processors/kubernetes/vendor}/github.com/ericchiang/k8s/gen.go (100%) rename {vendor => libbeat/processors/kubernetes/vendor}/github.com/ericchiang/k8s/gen.sh (100%) rename {vendor => libbeat/processors/kubernetes/vendor}/github.com/ericchiang/k8s/labels.go (100%) rename {vendor => libbeat/processors/kubernetes/vendor}/github.com/ericchiang/k8s/runtime/generated.pb.go (100%) rename {vendor => libbeat/processors/kubernetes/vendor}/github.com/ericchiang/k8s/runtime/schema/generated.pb.go (100%) rename {vendor => libbeat/processors/kubernetes/vendor}/github.com/ericchiang/k8s/tprs.go (100%) rename {vendor => libbeat/processors/kubernetes/vendor}/github.com/ericchiang/k8s/types.go (100%) rename {vendor => libbeat/processors/kubernetes/vendor}/github.com/ericchiang/k8s/util/intstr/generated.pb.go (100%) rename {vendor => libbeat/processors/kubernetes/vendor}/github.com/ericchiang/k8s/watch/versioned/generated.pb.go (100%) create mode 100644 libbeat/processors/kubernetes/vendor/vendor.json rename metricbeat/{processors => processor}/kubernetes/indexing.go (78%) rename metricbeat/{processors => processor}/kubernetes/indexing_test.go (73%) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index a8bf249f96d..561e47bbebb 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -113,6 +113,7 @@ https://github.com/elastic/beats/compare/v5.1.1...master[Check the HEAD diff] - Support new `index_patterns` field when loading templates for Elasticsearch >= 6.0 {pull}4056[4056] - Adding goimports support to make check and fmt {pull}4114[4114] - Make kubernetes indexers/matchers pluggable {pull}4151[4151] +- Abstracting pod interface in kubernetes plugin to enable easier vendoring {pull}4152[4152] *Filebeat* diff --git a/NOTICE b/NOTICE index 9a7ff68f38e..535d3491b5d 100644 --- a/NOTICE +++ b/NOTICE @@ -246,12 +246,6 @@ Copyright 2014-2015 The Prometheus Authors This product includes software developed at SoundCloud Ltd. (http://soundcloud.com/). --------------------------------------------------------------------- -github.com/ericchiang/k8s --------------------------------------------------------------------- -Apache License - - -------------------------------------------------------------------- github.com/garyburd/redigo -------------------------------------------------------------------- @@ -1175,6 +1169,12 @@ 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. +-------------------------------------------------------------------- +github.com/ericchiang/k8s +-------------------------------------------------------------------- +Apache License + + -------------------------------------------------------------------- github.com/Azure/go-ansiterm -------------------------------------------------------------------- diff --git a/filebeat/beater/filebeat.go b/filebeat/beater/filebeat.go index 9f82276f55c..bf515eb776f 100644 --- a/filebeat/beater/filebeat.go +++ b/filebeat/beater/filebeat.go @@ -20,7 +20,7 @@ import ( "github.com/elastic/beats/filebeat/spooler" // Add filebeat level processors - _ "github.com/elastic/beats/filebeat/processors/kubernetes" + _ "github.com/elastic/beats/filebeat/processor/kubernetes" ) var ( diff --git a/filebeat/processors/kubernetes/indexing.go b/filebeat/processor/kubernetes/indexing.go similarity index 100% rename from filebeat/processors/kubernetes/indexing.go rename to filebeat/processor/kubernetes/indexing.go diff --git a/filebeat/processors/kubernetes/indexing_test.go b/filebeat/processor/kubernetes/indexing_test.go similarity index 100% rename from filebeat/processors/kubernetes/indexing_test.go rename to filebeat/processor/kubernetes/indexing_test.go diff --git a/libbeat/processors/kubernetes/indexing.go b/libbeat/processors/kubernetes/indexing.go index c53408cfec6..453a62c75bc 100644 --- a/libbeat/processors/kubernetes/indexing.go +++ b/libbeat/processors/kubernetes/indexing.go @@ -6,8 +6,6 @@ import ( "sync" "github.com/elastic/beats/libbeat/common" - - corev1 "github.com/ericchiang/k8s/api/v1" ) //Names of indexers and matchers that have been defined. @@ -27,11 +25,11 @@ var Indexing = NewRegister() type Indexer interface { // GetMetadata generates event metadata for the given pod, then returns the // list of indexes to create, with the metadata to put on them - GetMetadata(pod *corev1.Pod) []MetadataIndex + GetMetadata(pod *Pod) []MetadataIndex // GetIndexes return the list of indexes the given pod belongs to. This function // must return the same indexes than GetMetadata - GetIndexes(pod *corev1.Pod) []string + GetIndexes(pod *Pod) []string } // MetadataIndex holds a pair of index -> metadata info @@ -51,7 +49,7 @@ type Matcher interface { //GenMeta takes in pods to generate metadata for them type GenMeta interface { //GenerateMetaData generates metadata by taking in a pod as an input - GenerateMetaData(pod *corev1.Pod) common.MapStr + GenerateMetaData(pod *Pod) common.MapStr } type Indexers struct { @@ -133,7 +131,7 @@ func (r *Register) GetMatcher(name string) MatcherConstructor { } // GetMetadata returns the composed metadata list from all registered indexers -func (i *Indexers) GetMetadata(pod *corev1.Pod) []MetadataIndex { +func (i *Indexers) GetMetadata(pod *Pod) []MetadataIndex { var metadata []MetadataIndex i.RLock() defer i.RUnlock() @@ -146,7 +144,7 @@ func (i *Indexers) GetMetadata(pod *corev1.Pod) []MetadataIndex { } // GetIndexes returns the composed index list from all registered indexers -func (i *Indexers) GetIndexes(pod *corev1.Pod) []string { +func (i *Indexers) GetIndexes(pod *Pod) []string { var indexes []string i.RLock() defer i.RUnlock() @@ -179,7 +177,7 @@ type GenDefaultMeta struct { } // GenerateMetaData generates default metadata for the given pod taking to account certain filters -func (g *GenDefaultMeta) GenerateMetaData(pod *corev1.Pod) common.MapStr { +func (g *GenDefaultMeta) GenerateMetaData(pod *Pod) common.MapStr { labelMap := common.MapStr{} annotationsMap := common.MapStr{} @@ -195,9 +193,9 @@ func (g *GenDefaultMeta) GenerateMetaData(pod *corev1.Pod) common.MapStr { meta := common.MapStr{ "pod": common.MapStr{ - "name": pod.Metadata.GetName(), + "name": pod.Metadata.Name, }, - "namespace": pod.Metadata.GetNamespace(), + "namespace": pod.Metadata.Namespace, } if len(labelMap) != 0 { @@ -236,18 +234,18 @@ func NewPodNameIndexer(_ common.Config, genMeta GenMeta) (Indexer, error) { return &PodNameIndexer{genMeta: genMeta}, nil } -func (p *PodNameIndexer) GetMetadata(pod *corev1.Pod) []MetadataIndex { +func (p *PodNameIndexer) GetMetadata(pod *Pod) []MetadataIndex { data := p.genMeta.GenerateMetaData(pod) return []MetadataIndex{ { - Index: pod.Metadata.GetName(), + Index: pod.Metadata.Name, Data: data, }, } } -func (p *PodNameIndexer) GetIndexes(pod *corev1.Pod) []string { - return []string{pod.Metadata.GetName()} +func (p *PodNameIndexer) GetIndexes(pod *Pod) []string { + return []string{pod.Metadata.Name} } // ContainerIndexer indexes pods based on all their containers IDs @@ -259,7 +257,7 @@ func NewContainerIndexer(_ common.Config, genMeta GenMeta) (Indexer, error) { return &ContainerIndexer{genMeta: genMeta}, nil } -func (c *ContainerIndexer) GetMetadata(pod *corev1.Pod) []MetadataIndex { +func (c *ContainerIndexer) GetMetadata(pod *Pod) []MetadataIndex { commonMeta := c.genMeta.GenerateMetaData(pod) containers := c.GetIndexes(pod) var metadata []MetadataIndex @@ -277,10 +275,10 @@ func (c *ContainerIndexer) GetMetadata(pod *corev1.Pod) []MetadataIndex { return metadata } -func (c *ContainerIndexer) GetIndexes(pod *corev1.Pod) []string { +func (c *ContainerIndexer) GetIndexes(pod *Pod) []string { var containers []string for _, status := range pod.Status.ContainerStatuses { - cID := status.GetContainerID() + cID := status.ContainerID if cID != "" { parts := strings.Split(cID, "//") if len(parts) == 2 { diff --git a/libbeat/processors/kubernetes/indexing_test.go b/libbeat/processors/kubernetes/indexing_test.go index e9a6f731f99..faf1331ea8a 100644 --- a/libbeat/processors/kubernetes/indexing_test.go +++ b/libbeat/processors/kubernetes/indexing_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/elastic/beats/libbeat/common" - corev1 "github.com/ericchiang/k8s/api/v1" - metav1 "github.com/ericchiang/k8s/apis/meta/v1" "github.com/stretchr/testify/assert" ) @@ -19,15 +17,15 @@ func TestPodIndexer(t *testing.T) { podName := "testpod" ns := "testns" - pod := corev1.Pod{ - Metadata: &metav1.ObjectMeta{ - Name: &podName, - Namespace: &ns, + pod := Pod{ + Metadata: ObjectMeta{ + Name: podName, + Namespace: ns, Labels: map[string]string{ "labelkey": "labelvalue", }, }, - Spec: &corev1.PodSpec{}, + Spec: PodSpec{}, } indexers := podIndexer.GetMetadata(&pod) @@ -61,16 +59,16 @@ func TestContainerIndexer(t *testing.T) { ns := "testns" container := "container" - pod := corev1.Pod{ - Metadata: &metav1.ObjectMeta{ - Name: &podName, - Namespace: &ns, + pod := Pod{ + Metadata: ObjectMeta{ + Name: podName, + Namespace: ns, Labels: map[string]string{ "labelkey": "labelvalue", }, }, - Status: &corev1.PodStatus{ - ContainerStatuses: make([]*corev1.ContainerStatus, 0), + Status: PodStatus{ + ContainerStatuses: make([]PodContainerStatus, 0), }, } @@ -90,10 +88,10 @@ func TestContainerIndexer(t *testing.T) { cid := "docker://abcde" - pod.Status.ContainerStatuses = []*corev1.ContainerStatus{ + pod.Status.ContainerStatuses = []PodContainerStatus{ { - Name: &container, - ContainerID: &cid, + Name: container, + ContainerID: cid, }, } expected["container"] = common.MapStr{ @@ -152,10 +150,10 @@ func TestFilteredGenMeta(t *testing.T) { podName := "testpod" ns := "testns" - pod := corev1.Pod{ - Metadata: &metav1.ObjectMeta{ - Name: &podName, - Namespace: &ns, + pod := Pod{ + Metadata: ObjectMeta{ + Name: podName, + Namespace: ns, Labels: map[string]string{ "foo": "bar", "x": "y", @@ -165,7 +163,7 @@ func TestFilteredGenMeta(t *testing.T) { "c": "d", }, }, - Spec: &corev1.PodSpec{}, + Spec: PodSpec{}, } indexers := podIndexer.GetMetadata(&pod) diff --git a/libbeat/processors/kubernetes/podwatcher.go b/libbeat/processors/kubernetes/podwatcher.go index 0064e7e3dac..f9869bfaff3 100644 --- a/libbeat/processors/kubernetes/podwatcher.go +++ b/libbeat/processors/kubernetes/podwatcher.go @@ -2,6 +2,7 @@ package kubernetes import ( "context" + "encoding/json" "sync" "time" @@ -28,7 +29,7 @@ type PodWatcher struct { type annotationCache struct { sync.Mutex annotations map[string]common.MapStr - pods map[string]*corev1.Pod // pod uid -> Pod + pods map[string]*Pod // pod uid -> Pod } type NodeOption struct{} @@ -48,7 +49,7 @@ func NewPodWatcher(kubeClient *k8s.Client, indexers *Indexers, syncPeriod time.D stop: cancel, annotationCache: annotationCache{ annotations: make(map[string]common.MapStr), - pods: make(map[string]*corev1.Pod), + pods: make(map[string]*Pod), }, } } @@ -124,44 +125,63 @@ func (p *PodWatcher) Run() bool { } } -func (p *PodWatcher) onPodAdd(pod *corev1.Pod) { +func (p *PodWatcher) onPodAdd(pod *Pod) { metadata := p.indexers.GetMetadata(pod) p.annotationCache.Lock() defer p.annotationCache.Unlock() - p.annotationCache.pods[pod.Metadata.GetUid()] = pod + p.annotationCache.pods[pod.Metadata.UID] = pod for _, m := range metadata { p.annotationCache.annotations[m.Index] = m.Data } } -func (p *PodWatcher) onPodUpdate(pod *corev1.Pod) { - oldPod := p.GetPod(pod.Metadata.GetUid()) - if oldPod.Metadata.GetResourceVersion() != pod.Metadata.GetResourceVersion() { +func (p *PodWatcher) onPodUpdate(pod *Pod) { + oldPod := p.GetPod(pod.Metadata.UID) + if oldPod.Metadata.ResourceVersion != pod.Metadata.ResourceVersion { //Process the new pod changes p.onPodDelete(oldPod) p.onPodAdd(pod) } } -func (p *PodWatcher) onPodDelete(pod *corev1.Pod) { +func (p *PodWatcher) onPodDelete(pod *Pod) { p.annotationCache.Lock() defer p.annotationCache.Unlock() - delete(p.annotationCache.pods, pod.Metadata.GetUid()) + delete(p.annotationCache.pods, pod.Metadata.UID) for _, index := range p.indexers.GetIndexes(pod) { delete(p.annotationCache.annotations, index) } } +func (p *PodWatcher) getPodMeta(pod *corev1.Pod) *Pod { + bytes, err := json.Marshal(pod) + if err != nil { + logp.Warn("Unable to marshal %v", pod.String()) + return nil + } + + po := &Pod{} + err = json.Unmarshal(bytes, po) + if err != nil { + logp.Warn("Unable to marshal %v", pod.String()) + return nil + } + + return po + +} + func (p *PodWatcher) worker() { - for pod := range p.podQueue { - if pod.Metadata.GetDeletionTimestamp() != nil { + for po := range p.podQueue { + pod := p.getPodMeta(po) + if pod.Metadata.DeletionTimestamp != "" { p.onPodDelete(pod) } else { - existing := p.GetPod(pod.Metadata.GetUid()) + existing := p.GetPod(pod.Metadata.UID) if existing != nil { p.onPodUpdate(pod) } else { @@ -181,7 +201,7 @@ func (p *PodWatcher) GetMetaData(arg string) common.MapStr { return nil } -func (p *PodWatcher) GetPod(uid string) *corev1.Pod { +func (p *PodWatcher) GetPod(uid string) *Pod { p.annotationCache.Lock() defer p.annotationCache.Unlock() return p.annotationCache.pods[uid] diff --git a/libbeat/processors/kubernetes/types.go b/libbeat/processors/kubernetes/types.go new file mode 100644 index 00000000000..d83194dc25a --- /dev/null +++ b/libbeat/processors/kubernetes/types.go @@ -0,0 +1,99 @@ +package kubernetes + +type ObjectMeta struct { + Annotations map[string]string `json:"annotations"` + CreationTimestamp string `json:"creationTimestamp"` + DeletionTimestamp string `json:"deletionTimestamp"` + GenerateName string `json:"generateName"` + Labels map[string]string `json:"labels"` + Name string `json:"name"` + Namespace string `json:"namespace"` + OwnerReferences []struct { + APIVersion string `json:"apiVersion"` + Controller bool `json:"controller"` + Kind string `json:"kind"` + Name string `json:"name"` + UID string `json:"uid"` + } `json:"ownerReferences"` + ResourceVersion string `json:"resourceVersion"` + SelfLink string `json:"selfLink"` + UID string `json:"uid"` +} + +type Container struct { + Image string `json:"image"` + ImagePullPolicy string `json:"imagePullPolicy"` + Name string `json:"name"` + Ports []ContainerPort `json:"ports"` + Resources struct{} `json:"resources"` + TerminationMessagePath string `json:"terminationMessagePath"` + VolumeMounts []struct { + MountPath string `json:"mountPath"` + Name string `json:"name"` + ReadOnly bool `json:"readOnly"` + } `json:"volumeMounts"` +} + +type ContainerPort struct { + Name string `json:"name"` + ContainerPort int64 `json:"containerPort"` + Protocol string `json:"protocol"` +} + +type PodSpec struct { + Containers []Container `json:"containers"` + DNSPolicy string `json:"dnsPolicy"` + NodeName string `json:"nodeName"` + RestartPolicy string `json:"restartPolicy"` + SecurityContext struct{} `json:"securityContext"` + ServiceAccount string `json:"serviceAccount"` + ServiceAccountName string `json:"serviceAccountName"` + TerminationGracePeriodSeconds int64 `json:"terminationGracePeriodSeconds"` +} + +type PodStatusCondition struct { + LastProbeTime interface{} `json:"lastProbeTime"` + LastTransitionTime string `json:"lastTransitionTime"` + Status string `json:"status"` + Type string `json:"type"` +} + +type PodContainerStatus struct { + ContainerID string `json:"containerID"` + Image string `json:"image"` + ImageID string `json:"imageID"` + LastState struct { + Terminated struct { + ContainerID string `json:"containerID"` + ExitCode int64 `json:"exitCode"` + FinishedAt string `json:"finishedAt"` + Reason string `json:"reason"` + StartedAt string `json:"startedAt"` + } `json:"terminated"` + } `json:"lastState"` + Name string `json:"name"` + Ready bool `json:"ready"` + RestartCount int64 `json:"restartCount"` + State struct { + Running struct { + StartedAt string `json:"startedAt"` + } `json:"running"` + } `json:"state"` +} + +type PodStatus struct { + Conditions []PodStatusCondition `json:"conditions"` + ContainerStatuses []PodContainerStatus `json:"containerStatuses"` + HostIP string `json:"hostIP"` + Phase string `json:"phase"` + PodIP string `json:"podIP"` + StartTime string `json:"startTime"` +} + +type Pod struct { + APIVersion string `json:"apiVersion"` + Kind string `json:"kind"` + Metadata ObjectMeta `json:"metadata"` + Spec PodSpec `json:"spec"` + Status PodStatus `json:"status"` +} diff --git a/vendor/github.com/ericchiang/k8s/LICENSE b/libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/LICENSE similarity index 100% rename from vendor/github.com/ericchiang/k8s/LICENSE rename to libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/LICENSE diff --git a/vendor/github.com/ericchiang/k8s/Makefile b/libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/Makefile similarity index 100% rename from vendor/github.com/ericchiang/k8s/Makefile rename to libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/Makefile diff --git a/vendor/github.com/ericchiang/k8s/README.md b/libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/README.md similarity index 100% rename from vendor/github.com/ericchiang/k8s/README.md rename to libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/README.md diff --git a/vendor/github.com/ericchiang/k8s/api/resource/generated.pb.go b/libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/api/resource/generated.pb.go similarity index 100% rename from vendor/github.com/ericchiang/k8s/api/resource/generated.pb.go rename to libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/api/resource/generated.pb.go diff --git a/vendor/github.com/ericchiang/k8s/api/unversioned/generated.pb.go b/libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/api/unversioned/generated.pb.go similarity index 100% rename from vendor/github.com/ericchiang/k8s/api/unversioned/generated.pb.go rename to libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/api/unversioned/generated.pb.go diff --git a/vendor/github.com/ericchiang/k8s/api/unversioned/time.go b/libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/api/unversioned/time.go similarity index 100% rename from vendor/github.com/ericchiang/k8s/api/unversioned/time.go rename to libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/api/unversioned/time.go diff --git a/vendor/github.com/ericchiang/k8s/api/v1/generated.pb.go b/libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/api/v1/generated.pb.go similarity index 100% rename from vendor/github.com/ericchiang/k8s/api/v1/generated.pb.go rename to libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/api/v1/generated.pb.go diff --git a/vendor/github.com/ericchiang/k8s/apis/apps/v1alpha1/generated.pb.go b/libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/apis/apps/v1alpha1/generated.pb.go similarity index 100% rename from vendor/github.com/ericchiang/k8s/apis/apps/v1alpha1/generated.pb.go rename to libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/apis/apps/v1alpha1/generated.pb.go diff --git a/vendor/github.com/ericchiang/k8s/apis/apps/v1beta1/generated.pb.go b/libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/apis/apps/v1beta1/generated.pb.go similarity index 100% rename from vendor/github.com/ericchiang/k8s/apis/apps/v1beta1/generated.pb.go rename to libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/apis/apps/v1beta1/generated.pb.go diff --git a/vendor/github.com/ericchiang/k8s/apis/authentication/v1/generated.pb.go b/libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/apis/authentication/v1/generated.pb.go similarity index 100% rename from vendor/github.com/ericchiang/k8s/apis/authentication/v1/generated.pb.go rename to libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/apis/authentication/v1/generated.pb.go diff --git a/vendor/github.com/ericchiang/k8s/apis/authentication/v1beta1/generated.pb.go b/libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/apis/authentication/v1beta1/generated.pb.go similarity index 100% rename from vendor/github.com/ericchiang/k8s/apis/authentication/v1beta1/generated.pb.go rename to libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/apis/authentication/v1beta1/generated.pb.go diff --git a/vendor/github.com/ericchiang/k8s/apis/authorization/v1/generated.pb.go b/libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/apis/authorization/v1/generated.pb.go similarity index 100% rename from vendor/github.com/ericchiang/k8s/apis/authorization/v1/generated.pb.go rename to libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/apis/authorization/v1/generated.pb.go diff --git a/vendor/github.com/ericchiang/k8s/apis/authorization/v1beta1/generated.pb.go b/libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/apis/authorization/v1beta1/generated.pb.go similarity index 100% rename from vendor/github.com/ericchiang/k8s/apis/authorization/v1beta1/generated.pb.go rename to libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/apis/authorization/v1beta1/generated.pb.go diff --git a/vendor/github.com/ericchiang/k8s/apis/autoscaling/v1/generated.pb.go b/libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/apis/autoscaling/v1/generated.pb.go similarity index 100% rename from vendor/github.com/ericchiang/k8s/apis/autoscaling/v1/generated.pb.go rename to libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/apis/autoscaling/v1/generated.pb.go diff --git a/vendor/github.com/ericchiang/k8s/apis/autoscaling/v2alpha1/generated.pb.go b/libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/apis/autoscaling/v2alpha1/generated.pb.go similarity index 100% rename from vendor/github.com/ericchiang/k8s/apis/autoscaling/v2alpha1/generated.pb.go rename to libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/apis/autoscaling/v2alpha1/generated.pb.go diff --git a/vendor/github.com/ericchiang/k8s/apis/batch/v1/generated.pb.go b/libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/apis/batch/v1/generated.pb.go similarity index 100% rename from vendor/github.com/ericchiang/k8s/apis/batch/v1/generated.pb.go rename to libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/apis/batch/v1/generated.pb.go diff --git a/vendor/github.com/ericchiang/k8s/apis/batch/v2alpha1/generated.pb.go b/libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/apis/batch/v2alpha1/generated.pb.go similarity index 100% rename from vendor/github.com/ericchiang/k8s/apis/batch/v2alpha1/generated.pb.go rename to libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/apis/batch/v2alpha1/generated.pb.go diff --git a/vendor/github.com/ericchiang/k8s/apis/certificates/v1alpha1/generated.pb.go b/libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/apis/certificates/v1alpha1/generated.pb.go similarity index 100% rename from vendor/github.com/ericchiang/k8s/apis/certificates/v1alpha1/generated.pb.go rename to libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/apis/certificates/v1alpha1/generated.pb.go diff --git a/vendor/github.com/ericchiang/k8s/apis/certificates/v1beta1/generated.pb.go b/libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/apis/certificates/v1beta1/generated.pb.go similarity index 100% rename from vendor/github.com/ericchiang/k8s/apis/certificates/v1beta1/generated.pb.go rename to libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/apis/certificates/v1beta1/generated.pb.go diff --git a/vendor/github.com/ericchiang/k8s/apis/extensions/v1beta1/generated.pb.go b/libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/apis/extensions/v1beta1/generated.pb.go similarity index 100% rename from vendor/github.com/ericchiang/k8s/apis/extensions/v1beta1/generated.pb.go rename to libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/apis/extensions/v1beta1/generated.pb.go diff --git a/vendor/github.com/ericchiang/k8s/apis/imagepolicy/v1alpha1/generated.pb.go b/libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/apis/imagepolicy/v1alpha1/generated.pb.go similarity index 100% rename from vendor/github.com/ericchiang/k8s/apis/imagepolicy/v1alpha1/generated.pb.go rename to libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/apis/imagepolicy/v1alpha1/generated.pb.go diff --git a/vendor/github.com/ericchiang/k8s/apis/meta/v1/generated.pb.go b/libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/apis/meta/v1/generated.pb.go similarity index 100% rename from vendor/github.com/ericchiang/k8s/apis/meta/v1/generated.pb.go rename to libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/apis/meta/v1/generated.pb.go diff --git a/vendor/github.com/ericchiang/k8s/apis/meta/v1/time.go b/libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/apis/meta/v1/time.go similarity index 100% rename from vendor/github.com/ericchiang/k8s/apis/meta/v1/time.go rename to libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/apis/meta/v1/time.go diff --git a/vendor/github.com/ericchiang/k8s/apis/policy/v1alpha1/generated.pb.go b/libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/apis/policy/v1alpha1/generated.pb.go similarity index 100% rename from vendor/github.com/ericchiang/k8s/apis/policy/v1alpha1/generated.pb.go rename to libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/apis/policy/v1alpha1/generated.pb.go diff --git a/vendor/github.com/ericchiang/k8s/apis/policy/v1beta1/generated.pb.go b/libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/apis/policy/v1beta1/generated.pb.go similarity index 100% rename from vendor/github.com/ericchiang/k8s/apis/policy/v1beta1/generated.pb.go rename to libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/apis/policy/v1beta1/generated.pb.go diff --git a/vendor/github.com/ericchiang/k8s/apis/rbac/v1alpha1/generated.pb.go b/libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/apis/rbac/v1alpha1/generated.pb.go similarity index 100% rename from vendor/github.com/ericchiang/k8s/apis/rbac/v1alpha1/generated.pb.go rename to libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/apis/rbac/v1alpha1/generated.pb.go diff --git a/vendor/github.com/ericchiang/k8s/apis/rbac/v1beta1/generated.pb.go b/libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/apis/rbac/v1beta1/generated.pb.go similarity index 100% rename from vendor/github.com/ericchiang/k8s/apis/rbac/v1beta1/generated.pb.go rename to libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/apis/rbac/v1beta1/generated.pb.go diff --git a/vendor/github.com/ericchiang/k8s/apis/settings/v1alpha1/generated.pb.go b/libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/apis/settings/v1alpha1/generated.pb.go similarity index 100% rename from vendor/github.com/ericchiang/k8s/apis/settings/v1alpha1/generated.pb.go rename to libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/apis/settings/v1alpha1/generated.pb.go diff --git a/vendor/github.com/ericchiang/k8s/apis/storage/v1/generated.pb.go b/libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/apis/storage/v1/generated.pb.go similarity index 100% rename from vendor/github.com/ericchiang/k8s/apis/storage/v1/generated.pb.go rename to libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/apis/storage/v1/generated.pb.go diff --git a/vendor/github.com/ericchiang/k8s/apis/storage/v1beta1/generated.pb.go b/libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/apis/storage/v1beta1/generated.pb.go similarity index 100% rename from vendor/github.com/ericchiang/k8s/apis/storage/v1beta1/generated.pb.go rename to libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/apis/storage/v1beta1/generated.pb.go diff --git a/vendor/github.com/ericchiang/k8s/client.go b/libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/client.go similarity index 100% rename from vendor/github.com/ericchiang/k8s/client.go rename to libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/client.go diff --git a/vendor/github.com/ericchiang/k8s/codec.go b/libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/codec.go similarity index 100% rename from vendor/github.com/ericchiang/k8s/codec.go rename to libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/codec.go diff --git a/vendor/github.com/ericchiang/k8s/config.go b/libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/config.go similarity index 100% rename from vendor/github.com/ericchiang/k8s/config.go rename to libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/config.go diff --git a/vendor/github.com/ericchiang/k8s/discovery.go b/libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/discovery.go similarity index 100% rename from vendor/github.com/ericchiang/k8s/discovery.go rename to libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/discovery.go diff --git a/vendor/github.com/ericchiang/k8s/gen.go b/libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/gen.go similarity index 100% rename from vendor/github.com/ericchiang/k8s/gen.go rename to libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/gen.go diff --git a/vendor/github.com/ericchiang/k8s/gen.sh b/libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/gen.sh similarity index 100% rename from vendor/github.com/ericchiang/k8s/gen.sh rename to libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/gen.sh diff --git a/vendor/github.com/ericchiang/k8s/labels.go b/libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/labels.go similarity index 100% rename from vendor/github.com/ericchiang/k8s/labels.go rename to libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/labels.go diff --git a/vendor/github.com/ericchiang/k8s/runtime/generated.pb.go b/libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/runtime/generated.pb.go similarity index 100% rename from vendor/github.com/ericchiang/k8s/runtime/generated.pb.go rename to libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/runtime/generated.pb.go diff --git a/vendor/github.com/ericchiang/k8s/runtime/schema/generated.pb.go b/libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/runtime/schema/generated.pb.go similarity index 100% rename from vendor/github.com/ericchiang/k8s/runtime/schema/generated.pb.go rename to libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/runtime/schema/generated.pb.go diff --git a/vendor/github.com/ericchiang/k8s/tprs.go b/libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/tprs.go similarity index 100% rename from vendor/github.com/ericchiang/k8s/tprs.go rename to libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/tprs.go diff --git a/vendor/github.com/ericchiang/k8s/types.go b/libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/types.go similarity index 100% rename from vendor/github.com/ericchiang/k8s/types.go rename to libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/types.go diff --git a/vendor/github.com/ericchiang/k8s/util/intstr/generated.pb.go b/libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/util/intstr/generated.pb.go similarity index 100% rename from vendor/github.com/ericchiang/k8s/util/intstr/generated.pb.go rename to libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/util/intstr/generated.pb.go diff --git a/vendor/github.com/ericchiang/k8s/watch/versioned/generated.pb.go b/libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/watch/versioned/generated.pb.go similarity index 100% rename from vendor/github.com/ericchiang/k8s/watch/versioned/generated.pb.go rename to libbeat/processors/kubernetes/vendor/github.com/ericchiang/k8s/watch/versioned/generated.pb.go diff --git a/libbeat/processors/kubernetes/vendor/vendor.json b/libbeat/processors/kubernetes/vendor/vendor.json new file mode 100644 index 00000000000..bc490fe13c9 --- /dev/null +++ b/libbeat/processors/kubernetes/vendor/vendor.json @@ -0,0 +1,188 @@ +{ + "comment": "", + "ignore": "test", + "package": [ + { + "checksumSHA1": "K0iEPnt2DZL5/YrrzAQoMnA+9Pc=", + "origin": "github.com/exekias/k8s", + "path": "github.com/ericchiang/k8s", + "revision": "28fccef3cb52078910f5f4c09f395c2f7e5fc1b0", + "revisionTime": "2017-04-08T16:30:40Z" + }, + { + "checksumSHA1": "uQuMoUlS7hAWsB+Mwr/1B7+35BU=", + "path": "github.com/ericchiang/k8s/api/resource", + "revision": "929412ddf58668dc5aa49e47fa822507f048d34b", + "revisionTime": "2017-04-20T15:30:38Z" + }, + { + "checksumSHA1": "XN1tbPrI03O0ishnZyfkWtTnrcQ=", + "path": "github.com/ericchiang/k8s/api/unversioned", + "revision": "929412ddf58668dc5aa49e47fa822507f048d34b", + "revisionTime": "2017-04-20T15:30:38Z" + }, + { + "checksumSHA1": "yfTg3/Qn7KiizNJ39JmPBFi9YDQ=", + "path": "github.com/ericchiang/k8s/api/v1", + "revision": "929412ddf58668dc5aa49e47fa822507f048d34b", + "revisionTime": "2017-04-20T15:30:38Z" + }, + { + "checksumSHA1": "uw/3eB6WiVCSrQZS9ZZs/1kyu1I=", + "path": "github.com/ericchiang/k8s/apis/apps/v1alpha1", + "revision": "929412ddf58668dc5aa49e47fa822507f048d34b", + "revisionTime": "2017-04-20T15:30:38Z" + }, + { + "checksumSHA1": "GPnvYx9Uxhpwmv01iygWR6+naTI=", + "path": "github.com/ericchiang/k8s/apis/apps/v1beta1", + "revision": "929412ddf58668dc5aa49e47fa822507f048d34b", + "revisionTime": "2017-04-20T15:30:38Z" + }, + { + "checksumSHA1": "Jjw5tBYv4k+Es+qPp03rnzyzRWA=", + "path": "github.com/ericchiang/k8s/apis/authentication/v1", + "revision": "929412ddf58668dc5aa49e47fa822507f048d34b", + "revisionTime": "2017-04-20T15:30:38Z" + }, + { + "checksumSHA1": "uR4S43Wc80fhS0vMDE3Z3hFg7J8=", + "path": "github.com/ericchiang/k8s/apis/authentication/v1beta1", + "revision": "929412ddf58668dc5aa49e47fa822507f048d34b", + "revisionTime": "2017-04-20T15:30:38Z" + }, + { + "checksumSHA1": "aM2KSDZbHn8jJomPPeG6LKpMwhs=", + "path": "github.com/ericchiang/k8s/apis/authorization/v1", + "revision": "929412ddf58668dc5aa49e47fa822507f048d34b", + "revisionTime": "2017-04-20T15:30:38Z" + }, + { + "checksumSHA1": "4yWZvduAw2JNdHd1cXjTJBUy0lw=", + "path": "github.com/ericchiang/k8s/apis/authorization/v1beta1", + "revision": "929412ddf58668dc5aa49e47fa822507f048d34b", + "revisionTime": "2017-04-20T15:30:38Z" + }, + { + "checksumSHA1": "1nMeCVQImIo1CpRRyOYMIqLoPBc=", + "path": "github.com/ericchiang/k8s/apis/autoscaling/v1", + "revision": "929412ddf58668dc5aa49e47fa822507f048d34b", + "revisionTime": "2017-04-20T15:30:38Z" + }, + { + "checksumSHA1": "kUXiQQA99K7zquvG9es3yauVjYw=", + "path": "github.com/ericchiang/k8s/apis/autoscaling/v2alpha1", + "revision": "929412ddf58668dc5aa49e47fa822507f048d34b", + "revisionTime": "2017-04-20T15:30:38Z" + }, + { + "checksumSHA1": "vMWsdmHlmaAQZIT0c26dwxe9pDw=", + "path": "github.com/ericchiang/k8s/apis/batch/v1", + "revision": "929412ddf58668dc5aa49e47fa822507f048d34b", + "revisionTime": "2017-04-20T15:30:38Z" + }, + { + "checksumSHA1": "bqaX0T9jycmp9ao1Ov41dfPn0Ng=", + "path": "github.com/ericchiang/k8s/apis/batch/v2alpha1", + "revision": "929412ddf58668dc5aa49e47fa822507f048d34b", + "revisionTime": "2017-04-20T15:30:38Z" + }, + { + "checksumSHA1": "9GRVPI+Tf4RrlX2aveUGEUHKIrM=", + "path": "github.com/ericchiang/k8s/apis/certificates/v1alpha1", + "revision": "929412ddf58668dc5aa49e47fa822507f048d34b", + "revisionTime": "2017-04-20T15:30:38Z" + }, + { + "checksumSHA1": "k1dF56GRoEg6rooFKO7UvEJvBcE=", + "path": "github.com/ericchiang/k8s/apis/certificates/v1beta1", + "revision": "929412ddf58668dc5aa49e47fa822507f048d34b", + "revisionTime": "2017-04-20T15:30:38Z" + }, + { + "checksumSHA1": "4pDHINIk6BdPBYWGF20IwHNCg2Q=", + "path": "github.com/ericchiang/k8s/apis/extensions/v1beta1", + "revision": "929412ddf58668dc5aa49e47fa822507f048d34b", + "revisionTime": "2017-04-20T15:30:38Z" + }, + { + "checksumSHA1": "NAL7OeKSEzTOoXHBFnC1B1VmBVs=", + "path": "github.com/ericchiang/k8s/apis/imagepolicy/v1alpha1", + "revision": "929412ddf58668dc5aa49e47fa822507f048d34b", + "revisionTime": "2017-04-20T15:30:38Z" + }, + { + "checksumSHA1": "Vg1/xjzLJHZlvuheWC4abghACwQ=", + "path": "github.com/ericchiang/k8s/apis/meta/v1", + "revision": "929412ddf58668dc5aa49e47fa822507f048d34b", + "revisionTime": "2017-04-20T15:30:38Z" + }, + { + "checksumSHA1": "wYSNb+W2L5gJlGO8n6mGOGft8R8=", + "path": "github.com/ericchiang/k8s/apis/policy/v1alpha1", + "revision": "929412ddf58668dc5aa49e47fa822507f048d34b", + "revisionTime": "2017-04-20T15:30:38Z" + }, + { + "checksumSHA1": "ioJ28pdUN6fDkOp8dT+Tg3HSqmk=", + "path": "github.com/ericchiang/k8s/apis/policy/v1beta1", + "revision": "929412ddf58668dc5aa49e47fa822507f048d34b", + "revisionTime": "2017-04-20T15:30:38Z" + }, + { + "checksumSHA1": "UErnBsjjtmg3oYjLYU1S80oi3sk=", + "path": "github.com/ericchiang/k8s/apis/rbac/v1alpha1", + "revision": "929412ddf58668dc5aa49e47fa822507f048d34b", + "revisionTime": "2017-04-20T15:30:38Z" + }, + { + "checksumSHA1": "Xl+Tm8ZOz0cMOrfLaQvu/lsWObU=", + "path": "github.com/ericchiang/k8s/apis/rbac/v1beta1", + "revision": "929412ddf58668dc5aa49e47fa822507f048d34b", + "revisionTime": "2017-04-20T15:30:38Z" + }, + { + "checksumSHA1": "YyZyaF0k2NAQAZvsCOVdhAkfVU0=", + "path": "github.com/ericchiang/k8s/apis/settings/v1alpha1", + "revision": "929412ddf58668dc5aa49e47fa822507f048d34b", + "revisionTime": "2017-04-20T15:30:38Z" + }, + { + "checksumSHA1": "vUc3mf0rE7CQ3B52wfrMDyspLgA=", + "path": "github.com/ericchiang/k8s/apis/storage/v1", + "revision": "929412ddf58668dc5aa49e47fa822507f048d34b", + "revisionTime": "2017-04-20T15:30:38Z" + }, + { + "checksumSHA1": "7/oj1z0vG1pvRza+UuKQ6txdleI=", + "path": "github.com/ericchiang/k8s/apis/storage/v1beta1", + "revision": "929412ddf58668dc5aa49e47fa822507f048d34b", + "revisionTime": "2017-04-20T15:30:38Z" + }, + { + "checksumSHA1": "mm5iTFmLQ6h98DKgiUuTCpHP9H4=", + "path": "github.com/ericchiang/k8s/runtime", + "revision": "929412ddf58668dc5aa49e47fa822507f048d34b", + "revisionTime": "2017-04-20T15:30:38Z" + }, + { + "checksumSHA1": "Kk1UDqUx2Pr1LyvIIgcJBApTlCk=", + "path": "github.com/ericchiang/k8s/runtime/schema", + "revision": "929412ddf58668dc5aa49e47fa822507f048d34b", + "revisionTime": "2017-04-20T15:30:38Z" + }, + { + "checksumSHA1": "LoxBND74egHIasOX6z98FeeW0zI=", + "path": "github.com/ericchiang/k8s/util/intstr", + "revision": "929412ddf58668dc5aa49e47fa822507f048d34b", + "revisionTime": "2017-04-20T15:30:38Z" + }, + { + "checksumSHA1": "fobEKiMk5D7IGvCSwh4HdG1o98c=", + "path": "github.com/ericchiang/k8s/watch/versioned", + "revision": "929412ddf58668dc5aa49e47fa822507f048d34b", + "revisionTime": "2017-04-20T15:30:38Z" + } + ], + "rootPath": "github.com/elastic/beats/libbeat/processors/kubernetes" +} diff --git a/metricbeat/beater/metricbeat.go b/metricbeat/beater/metricbeat.go index 0165755d26b..33356c4f86e 100644 --- a/metricbeat/beater/metricbeat.go +++ b/metricbeat/beater/metricbeat.go @@ -14,7 +14,7 @@ import ( "github.com/pkg/errors" // Add metricbeat specific processors - _ "github.com/elastic/beats/metricbeat/processors/kubernetes" + _ "github.com/elastic/beats/metricbeat/processor/kubernetes" ) // Metricbeat implements the Beater interface for metricbeat. diff --git a/metricbeat/processors/kubernetes/indexing.go b/metricbeat/processor/kubernetes/indexing.go similarity index 78% rename from metricbeat/processors/kubernetes/indexing.go rename to metricbeat/processor/kubernetes/indexing.go index 701a0148776..e20d62c8984 100644 --- a/metricbeat/processors/kubernetes/indexing.go +++ b/metricbeat/processor/kubernetes/indexing.go @@ -6,7 +6,6 @@ import ( "github.com/elastic/beats/libbeat/common" "github.com/elastic/beats/libbeat/processors/kubernetes" - corev1 "github.com/ericchiang/k8s/api/v1" ) const ( @@ -40,12 +39,12 @@ func newIpPortIndexer(_ common.Config, genMeta kubernetes.GenMeta) (kubernetes.I return &IpPortIndexer{genMeta: genMeta}, nil } -func (h *IpPortIndexer) GetMetadata(pod *corev1.Pod) []kubernetes.MetadataIndex { +func (h *IpPortIndexer) GetMetadata(pod *kubernetes.Pod) []kubernetes.MetadataIndex { commonMeta := h.genMeta.GenerateMetaData(pod) hostPorts := h.GetIndexes(pod) var metadata []kubernetes.MetadataIndex - if pod.Status.PodIP == nil { + if pod.Status.PodIP == "" { return metadata } for i := 0; i < len(hostPorts); i++ { @@ -55,10 +54,10 @@ func (h *IpPortIndexer) GetMetadata(pod *corev1.Pod) []kubernetes.MetadataIndex ports := container.Ports for _, port := range ports { - if port.ContainerPort == nil { + if port.ContainerPort == int64(0) { continue } - if strings.Index(hostPorts[i], fmt.Sprintf("%s:%d", *pod.Status.PodIP, *port.ContainerPort)) != -1 { + if strings.Index(hostPorts[i], fmt.Sprintf("%s:%d", pod.Status.PodIP, port.ContainerPort)) != -1 { containerMeta["container"] = common.MapStr{ "name": container.Name, } @@ -82,21 +81,21 @@ func (h *IpPortIndexer) GetMetadata(pod *corev1.Pod) []kubernetes.MetadataIndex return metadata } -func (h *IpPortIndexer) GetIndexes(pod *corev1.Pod) []string { +func (h *IpPortIndexer) GetIndexes(pod *kubernetes.Pod) []string { var hostPorts []string ip := pod.Status.PodIP - if ip == nil { + if ip == "" { return hostPorts } for _, container := range pod.Spec.Containers { ports := container.Ports for _, port := range ports { - if port.ContainerPort != nil { - hostPorts = append(hostPorts, fmt.Sprintf("%s:%d", *ip, *port.ContainerPort)) + if port.ContainerPort != int64(0) { + hostPorts = append(hostPorts, fmt.Sprintf("%s:%d", ip, port.ContainerPort)) } else { - hostPorts = append(hostPorts, *ip) + hostPorts = append(hostPorts, ip) } } diff --git a/metricbeat/processors/kubernetes/indexing_test.go b/metricbeat/processor/kubernetes/indexing_test.go similarity index 73% rename from metricbeat/processors/kubernetes/indexing_test.go rename to metricbeat/processor/kubernetes/indexing_test.go index dd985c55d92..294a8d24d6a 100644 --- a/metricbeat/processors/kubernetes/indexing_test.go +++ b/metricbeat/processor/kubernetes/indexing_test.go @@ -6,8 +6,6 @@ import ( "github.com/elastic/beats/libbeat/common" "github.com/elastic/beats/libbeat/processors/kubernetes" - corev1 "github.com/ericchiang/k8s/api/v1" - metav1 "github.com/ericchiang/k8s/apis/meta/v1" "github.com/stretchr/testify/assert" ) @@ -23,21 +21,21 @@ func TestIpPortIndexer(t *testing.T) { ns := "testns" container := "container" ip := "1.2.3.4" - port := int32(80) - pod := corev1.Pod{ - Metadata: &metav1.ObjectMeta{ - Name: &podName, - Namespace: &ns, + port := int64(80) + pod := kubernetes.Pod{ + Metadata: kubernetes.ObjectMeta{ + Name: podName, + Namespace: ns, Labels: map[string]string{ "labelkey": "labelvalue", }, }, - Spec: &corev1.PodSpec{ - Containers: make([]*corev1.Container, 0), + Spec: kubernetes.PodSpec{ + Containers: make([]kubernetes.Container, 0), }, - Status: &corev1.PodStatus{ - PodIP: &ip, + Status: kubernetes.PodStatus{ + PodIP: ip, }, } @@ -55,13 +53,13 @@ func TestIpPortIndexer(t *testing.T) { }, } - pod.Spec.Containers = []*corev1.Container{ + pod.Spec.Containers = []kubernetes.Container{ { - Name: &container, - Ports: []*corev1.ContainerPort{ + Name: container, + Ports: []kubernetes.ContainerPort{ { - Name: &container, - ContainerPort: &port, + Name: container, + ContainerPort: port, }, }, }, diff --git a/vendor/vendor.json b/vendor/vendor.json index b87a1369685..16f4c2880e7 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -159,187 +159,6 @@ "revision": "664e6bc79eb43c956507b6e20a867140516ad15a", "revisionTime": "2016-09-16T08:04:11Z" }, - { - "checksumSHA1": "K0iEPnt2DZL5/YrrzAQoMnA+9Pc=", - "origin": "github.com/exekias/k8s", - "path": "github.com/ericchiang/k8s", - "revision": "28fccef3cb52078910f5f4c09f395c2f7e5fc1b0", - "revisionTime": "2017-04-08T16:30:40Z" - }, - { - "checksumSHA1": "uQuMoUlS7hAWsB+Mwr/1B7+35BU=", - "path": "github.com/ericchiang/k8s/api/resource", - "revision": "c43ac68b93575a2f99c8003747ce0aabaf3e5660", - "revisionTime": "2017-04-05T19:18:49Z" - }, - { - "checksumSHA1": "XN1tbPrI03O0ishnZyfkWtTnrcQ=", - "path": "github.com/ericchiang/k8s/api/unversioned", - "revision": "c43ac68b93575a2f99c8003747ce0aabaf3e5660", - "revisionTime": "2017-04-05T19:18:49Z" - }, - { - "checksumSHA1": "yfTg3/Qn7KiizNJ39JmPBFi9YDQ=", - "path": "github.com/ericchiang/k8s/api/v1", - "revision": "c43ac68b93575a2f99c8003747ce0aabaf3e5660", - "revisionTime": "2017-04-05T19:18:49Z" - }, - { - "checksumSHA1": "uw/3eB6WiVCSrQZS9ZZs/1kyu1I=", - "path": "github.com/ericchiang/k8s/apis/apps/v1alpha1", - "revision": "c43ac68b93575a2f99c8003747ce0aabaf3e5660", - "revisionTime": "2017-04-05T19:18:49Z" - }, - { - "checksumSHA1": "GPnvYx9Uxhpwmv01iygWR6+naTI=", - "path": "github.com/ericchiang/k8s/apis/apps/v1beta1", - "revision": "c43ac68b93575a2f99c8003747ce0aabaf3e5660", - "revisionTime": "2017-04-05T19:18:49Z" - }, - { - "checksumSHA1": "Jjw5tBYv4k+Es+qPp03rnzyzRWA=", - "path": "github.com/ericchiang/k8s/apis/authentication/v1", - "revision": "c43ac68b93575a2f99c8003747ce0aabaf3e5660", - "revisionTime": "2017-04-05T19:18:49Z" - }, - { - "checksumSHA1": "uR4S43Wc80fhS0vMDE3Z3hFg7J8=", - "path": "github.com/ericchiang/k8s/apis/authentication/v1beta1", - "revision": "c43ac68b93575a2f99c8003747ce0aabaf3e5660", - "revisionTime": "2017-04-05T19:18:49Z" - }, - { - "checksumSHA1": "aM2KSDZbHn8jJomPPeG6LKpMwhs=", - "path": "github.com/ericchiang/k8s/apis/authorization/v1", - "revision": "c43ac68b93575a2f99c8003747ce0aabaf3e5660", - "revisionTime": "2017-04-05T19:18:49Z" - }, - { - "checksumSHA1": "4yWZvduAw2JNdHd1cXjTJBUy0lw=", - "path": "github.com/ericchiang/k8s/apis/authorization/v1beta1", - "revision": "c43ac68b93575a2f99c8003747ce0aabaf3e5660", - "revisionTime": "2017-04-05T19:18:49Z" - }, - { - "checksumSHA1": "1nMeCVQImIo1CpRRyOYMIqLoPBc=", - "path": "github.com/ericchiang/k8s/apis/autoscaling/v1", - "revision": "c43ac68b93575a2f99c8003747ce0aabaf3e5660", - "revisionTime": "2017-04-05T19:18:49Z" - }, - { - "checksumSHA1": "kUXiQQA99K7zquvG9es3yauVjYw=", - "path": "github.com/ericchiang/k8s/apis/autoscaling/v2alpha1", - "revision": "c43ac68b93575a2f99c8003747ce0aabaf3e5660", - "revisionTime": "2017-04-05T19:18:49Z" - }, - { - "checksumSHA1": "vMWsdmHlmaAQZIT0c26dwxe9pDw=", - "path": "github.com/ericchiang/k8s/apis/batch/v1", - "revision": "c43ac68b93575a2f99c8003747ce0aabaf3e5660", - "revisionTime": "2017-04-05T19:18:49Z" - }, - { - "checksumSHA1": "bqaX0T9jycmp9ao1Ov41dfPn0Ng=", - "path": "github.com/ericchiang/k8s/apis/batch/v2alpha1", - "revision": "c43ac68b93575a2f99c8003747ce0aabaf3e5660", - "revisionTime": "2017-04-05T19:18:49Z" - }, - { - "checksumSHA1": "9GRVPI+Tf4RrlX2aveUGEUHKIrM=", - "path": "github.com/ericchiang/k8s/apis/certificates/v1alpha1", - "revision": "c43ac68b93575a2f99c8003747ce0aabaf3e5660", - "revisionTime": "2017-04-05T19:18:49Z" - }, - { - "checksumSHA1": "k1dF56GRoEg6rooFKO7UvEJvBcE=", - "path": "github.com/ericchiang/k8s/apis/certificates/v1beta1", - "revision": "c43ac68b93575a2f99c8003747ce0aabaf3e5660", - "revisionTime": "2017-04-05T19:18:49Z" - }, - { - "checksumSHA1": "4pDHINIk6BdPBYWGF20IwHNCg2Q=", - "path": "github.com/ericchiang/k8s/apis/extensions/v1beta1", - "revision": "c43ac68b93575a2f99c8003747ce0aabaf3e5660", - "revisionTime": "2017-04-05T19:18:49Z" - }, - { - "checksumSHA1": "NAL7OeKSEzTOoXHBFnC1B1VmBVs=", - "path": "github.com/ericchiang/k8s/apis/imagepolicy/v1alpha1", - "revision": "c43ac68b93575a2f99c8003747ce0aabaf3e5660", - "revisionTime": "2017-04-05T19:18:49Z" - }, - { - "checksumSHA1": "Vg1/xjzLJHZlvuheWC4abghACwQ=", - "path": "github.com/ericchiang/k8s/apis/meta/v1", - "revision": "c43ac68b93575a2f99c8003747ce0aabaf3e5660", - "revisionTime": "2017-04-05T19:18:49Z" - }, - { - "checksumSHA1": "wYSNb+W2L5gJlGO8n6mGOGft8R8=", - "path": "github.com/ericchiang/k8s/apis/policy/v1alpha1", - "revision": "c43ac68b93575a2f99c8003747ce0aabaf3e5660", - "revisionTime": "2017-04-05T19:18:49Z" - }, - { - "checksumSHA1": "ioJ28pdUN6fDkOp8dT+Tg3HSqmk=", - "path": "github.com/ericchiang/k8s/apis/policy/v1beta1", - "revision": "c43ac68b93575a2f99c8003747ce0aabaf3e5660", - "revisionTime": "2017-04-05T19:18:49Z" - }, - { - "checksumSHA1": "UErnBsjjtmg3oYjLYU1S80oi3sk=", - "path": "github.com/ericchiang/k8s/apis/rbac/v1alpha1", - "revision": "c43ac68b93575a2f99c8003747ce0aabaf3e5660", - "revisionTime": "2017-04-05T19:18:49Z" - }, - { - "checksumSHA1": "Xl+Tm8ZOz0cMOrfLaQvu/lsWObU=", - "path": "github.com/ericchiang/k8s/apis/rbac/v1beta1", - "revision": "c43ac68b93575a2f99c8003747ce0aabaf3e5660", - "revisionTime": "2017-04-05T19:18:49Z" - }, - { - "checksumSHA1": "YyZyaF0k2NAQAZvsCOVdhAkfVU0=", - "path": "github.com/ericchiang/k8s/apis/settings/v1alpha1", - "revision": "c43ac68b93575a2f99c8003747ce0aabaf3e5660", - "revisionTime": "2017-04-05T19:18:49Z" - }, - { - "checksumSHA1": "vUc3mf0rE7CQ3B52wfrMDyspLgA=", - "path": "github.com/ericchiang/k8s/apis/storage/v1", - "revision": "c43ac68b93575a2f99c8003747ce0aabaf3e5660", - "revisionTime": "2017-04-05T19:18:49Z" - }, - { - "checksumSHA1": "7/oj1z0vG1pvRza+UuKQ6txdleI=", - "path": "github.com/ericchiang/k8s/apis/storage/v1beta1", - "revision": "c43ac68b93575a2f99c8003747ce0aabaf3e5660", - "revisionTime": "2017-04-05T19:18:49Z" - }, - { - "checksumSHA1": "mm5iTFmLQ6h98DKgiUuTCpHP9H4=", - "path": "github.com/ericchiang/k8s/runtime", - "revision": "c43ac68b93575a2f99c8003747ce0aabaf3e5660", - "revisionTime": "2017-04-05T19:18:49Z" - }, - { - "checksumSHA1": "Kk1UDqUx2Pr1LyvIIgcJBApTlCk=", - "path": "github.com/ericchiang/k8s/runtime/schema", - "revision": "c43ac68b93575a2f99c8003747ce0aabaf3e5660", - "revisionTime": "2017-04-05T19:18:49Z" - }, - { - "checksumSHA1": "LoxBND74egHIasOX6z98FeeW0zI=", - "path": "github.com/ericchiang/k8s/util/intstr", - "revision": "c43ac68b93575a2f99c8003747ce0aabaf3e5660", - "revisionTime": "2017-04-05T19:18:49Z" - }, - { - "checksumSHA1": "fobEKiMk5D7IGvCSwh4HdG1o98c=", - "path": "github.com/ericchiang/k8s/watch/versioned", - "revision": "c43ac68b93575a2f99c8003747ce0aabaf3e5660", - "revisionTime": "2017-04-05T19:18:49Z" - }, { "checksumSHA1": "2UmMbNHc8FBr98mJFN1k8ISOIHk=", "path": "github.com/garyburd/redigo/internal",