Module: KubernetesMetadata::TestApiAdapter

Defined in:
lib/fluent/plugin/kubernetes_metadata_test_api_adapter.rb

Instance Method Summary collapse

Instance Method Details

#api_valid?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/fluent/plugin/kubernetes_metadata_test_api_adapter.rb', line 26

def api_valid?
  true
end

#get_namespace(namespace_name, unused, options) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/fluent/plugin/kubernetes_metadata_test_api_adapter.rb', line 29

def get_namespace(namespace_name, unused, options)
  return {
    metadata: {
      name: namespace_name,
      uid: namespace_name + 'uuid',
      labels: {
        foo_ns: 'bar_ns'
      }
    }
  }
end

#get_pod(pod_name, namespace_name, options) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/fluent/plugin/kubernetes_metadata_test_api_adapter.rb', line 41

def get_pod(pod_name, namespace_name, options)
  return {
    metadata: {
      name: pod_name,
      namespace: namespace_name,
      uid: namespace_name + namespace_name + "uuid",
      labels: {
        foo: 'bar'
      }
    },
    spec: {
      nodeName: 'aNodeName',
      containers: [{
        name: 'foo',
        image: 'bar'
      }, {
        name: 'bar',
        image: 'foo'
      }]
    },
    status: {
      podIP: '172.17.0.8'
    }
  }
end