diff --git a/daemonset.go b/daemonset.go index aca47c3..e684f3e 100644 --- a/daemonset.go +++ b/daemonset.go @@ -17,6 +17,7 @@ package main import ( "context" // "fmt" + "sort" "strings" ) @@ -67,6 +68,12 @@ func getDaemonSetPods(ctx context.Context, d daemonSet) *[]pod { results[idx] = pr.p } + sort.Slice( + results, + func(i, j int) bool { + return *results[i].Metadata.Name < *results[j].Metadata.Name + }) + return &results } diff --git a/get_test.go b/get_test.go index 5262d1a..140975a 100644 --- a/get_test.go +++ b/get_test.go @@ -40,7 +40,9 @@ func init() { for _, fname := range []string{ "deployment.json", "replicaset.json", - "pod1.json"} { + "daemonset.json", + "pod1.json", + "pod2.json"} { addToCache(&cache, "testdata/"+fname) } } @@ -54,228 +56,312 @@ func addToCache(cacheref *map[string]interface{}, fname string) { kind := data["kind"].(string) ns := getNamespace(data) name := getName(data) - res := mapToResource(*getTestContext(), data) - (*cacheref)[rawCacheKey(kind, ns, name)] = data - (*cacheref)[cacheKey(kind, ns, name)] = res - (*cacheref)[kind] = []resource{res} + (*cacheref)[cacheKey(kind, ns, name)] = data + existing := (*cacheref)[kind] + if existing == nil { + (*cacheref)[kind] = []JsonObject{data} + } else { + (*cacheref)[kind] = append(existing.([]JsonObject), data) + } } func TestPods(t *testing.T) { simpletest( t, - `{allDeployments() { - metadata { - creationTimestamp - generation - labels { name value } - } - spec { - minReadySeconds - paused - progressDeadlineSeconds - replicas - revisionHistoryLimit - selector { - matchLabels { name value } - matchExpressions { - key - operator - values - } - } - strategy { - type - rollingUpdate { - maxSurgeInt - maxSurgeString - maxUnavailableInt - maxUnavailableString - } - } - template { - metadata { - creationTimestamp - labels { name value } - }, - spec { - dnsPolicy - restartPolicy - schedulerName - terminationGracePeriodSeconds - volumes { - name - persistentVolumeClaim { claimName readOnly } - } - } - } - } - replicaSets { - metadata { - name - } - pods { - metadata { - name - namespace - labels { - name - value - } - } - spec { - dnsPolicy - nodeName - restartPolicy - schedulerName - serviceAccountName - terminationGracePeriodSeconds - tolerations { - effect - key - operator - tolerationSeconds - } - volumes { - name - persistentVolumeClaim { claimName readOnly } - secret { defaultMode secretName } - } - } - } - } - }}`, - `{"allDeployments": [ + `{ + allDeployments() { + metadata { + creationTimestamp + generation + labels { name value } + } + spec { + minReadySeconds + paused + progressDeadlineSeconds + replicas + revisionHistoryLimit + selector { + matchLabels { name value } + matchExpressions { + key + operator + values + } + } + strategy { + type + rollingUpdate { + maxSurgeInt + maxSurgeString + maxUnavailableInt + maxUnavailableString + } + } + template { + metadata { + creationTimestamp + labels { name value } + }, + spec { + dnsPolicy + restartPolicy + schedulerName + terminationGracePeriodSeconds + volumes { + name + persistentVolumeClaim { claimName readOnly } + } + } + } + } + replicaSets { + metadata { + name + } + pods { + metadata { + name + namespace + labels { + name + value + } + } + spec { + dnsPolicy + nodeName + restartPolicy + schedulerName + serviceAccountName + terminationGracePeriodSeconds + tolerations { + effect + key + operator + tolerationSeconds + } + volumes { + name + persistentVolumeClaim { claimName readOnly } + secret { defaultMode secretName } + } + } + } + } + }}`, + `{ + "allDeployments": [ { - "metadata": { - "creationTimestamp": "2018-07-02T14:53:53Z", - "generation": 1, - "labels": [ - {"name": "app", "value": "clunky-sabertooth-joomla"}, - {"name": "chart", "value": "joomla-2.0.2"}, - {"name": "heritage", "value": "Tiller"}, - {"name": "release", "value": "clunky-sabertooth"} - ] - }, - "spec": { - "minReadySeconds": 0, - "paused": false, - "progressDeadlineSeconds": 600, - "replicas": 1, - "revisionHistoryLimit": 10, - "selector": { - "matchExpressions": [], - "matchLabels": [ - {"name": "app", "value": "clunky-sabertooth-joomla"} - ] - }, - "strategy": { - "rollingUpdate": { - "maxSurgeInt": 1, - "maxSurgeString": null, - "maxUnavailableInt": 1, - "maxUnavailableString": null - }, - "type": "RollingUpdate" - }, - "template": { - "metadata": { - "creationTimestamp": null, - "labels": [ - {"name": "app", "value": "clunky-sabertooth-joomla"} - ] - }, - "spec": { - "dnsPolicy": "ClusterFirst", - "restartPolicy": "Always", - "schedulerName": "default-scheduler", - "terminationGracePeriodSeconds": 30, - "volumes": [ - { - "name": "joomla-data", - "persistentVolumeClaim": { - "claimName": "clunky-sabertooth-joomla-joomla", - "readOnly": false - } - }, - { - "name": "apache-data", - "persistentVolumeClaim": { - "claimName": "clunky-sabertooth-joomla-apache", - "readOnly": false - } - } - ] - } - } - }, - "replicaSets": [ - { - "metadata": { - "name": "clunky-sabertooth-joomla-5d4ddc985d" - }, - "pods": [ - { - "metadata": { - "name": "clunky-sabertooth-joomla-5d4ddc985d-fpddz", - "namespace": "default", - "labels": [ - {"name": "app", "value": "clunky-sabertooth-joomla"}, - {"name": "pod-template-hash", "value": "1808875418"} - ] - }, - "spec": { - "dnsPolicy": "ClusterFirst", - "nodeName": "minikube", - "restartPolicy": "Always", - "schedulerName": "default-scheduler", - "serviceAccountName": "default", - "terminationGracePeriodSeconds": 30, - "tolerations": [ - { - "effect": "NoExecute", - "key": "node.kubernetes.io/not-ready", - "operator": "Exists", - "tolerationSeconds": 300 - }, - { - "effect": "NoExecute", - "key": "node.kubernetes.io/unreachable", - "operator": "Exists", - "tolerationSeconds": 300 - } - ], - "volumes": [ - { - "name": "joomla-data", - "persistentVolumeClaim": { - "claimName": "clunky-sabertooth-joomla-joomla", - "readOnly": false - }, - "secret": null - }, - { - "name": "apache-data", - "persistentVolumeClaim": { - "claimName": "clunky-sabertooth-joomla-apache", - "readOnly": false - }, - "secret": null - }, - { - "name": "default-token-l6lb2", - "persistentVolumeClaim": null, - "secret": { - "defaultMode": 420, - "secretName": "default-token-l6lb2" - } - } - ] - } - } + "metadata": { + "creationTimestamp": "2018-07-02T14:53:53Z", + "generation": 1, + "labels": [ + {"name": "app", "value": "clunky-sabertooth-joomla"}, + {"name": "chart", "value": "joomla-2.0.2"}, + {"name": "heritage", "value": "Tiller"}, + {"name": "release", "value": "clunky-sabertooth"} ] - } - ] - } - ] + }, + "spec": { + "minReadySeconds": 0, + "paused": false, + "progressDeadlineSeconds": 600, + "replicas": 1, + "revisionHistoryLimit": 10, + "selector": { + "matchExpressions": [], + "matchLabels": [ + {"name": "app", "value": "clunky-sabertooth-joomla"} + ] + }, + "strategy": { + "rollingUpdate": { + "maxSurgeInt": 1, + "maxSurgeString": null, + "maxUnavailableInt": 1, + "maxUnavailableString": null + }, + "type": "RollingUpdate" + }, + "template": { + "metadata": { + "creationTimestamp": null, + "labels": [ + {"name": "app", "value": "clunky-sabertooth-joomla"} + ] + }, + "spec": { + "dnsPolicy": "ClusterFirst", + "restartPolicy": "Always", + "schedulerName": "default-scheduler", + "terminationGracePeriodSeconds": 30, + "volumes": [ + { + "name": "joomla-data", + "persistentVolumeClaim": { + "claimName": "clunky-sabertooth-joomla-joomla", + "readOnly": false + } + }, + { + "name": "apache-data", + "persistentVolumeClaim": { + "claimName": "clunky-sabertooth-joomla-apache", + "readOnly": false + } + } + ] + } + } + }, + "replicaSets": [ + { + "metadata": { + "name": "clunky-sabertooth-joomla-5d4ddc985d" + }, + "pods": [ + { + "metadata": { + "name": "clunky-sabertooth-joomla-5d4ddc985d-fpddz", + "namespace": "default", + "labels": [ + {"name": "app", "value": "clunky-sabertooth-joomla"}, + {"name": "pod-template-hash", "value": "1808875418"} + ] + }, + "spec": { + "dnsPolicy": "ClusterFirst", + "nodeName": "minikube", + "restartPolicy": "Always", + "schedulerName": "default-scheduler", + "serviceAccountName": "default", + "terminationGracePeriodSeconds": 30, + "tolerations": [ + { + "effect": "NoExecute", + "key": "node.kubernetes.io/not-ready", + "operator": "Exists", + "tolerationSeconds": 300 + }, + { + "effect": "NoExecute", + "key": "node.kubernetes.io/unreachable", + "operator": "Exists", + "tolerationSeconds": 300 + } + ], + "volumes": [ + { + "name": "joomla-data", + "persistentVolumeClaim": { + "claimName": "clunky-sabertooth-joomla-joomla", + "readOnly": false + }, + "secret": null + }, + { + "name": "apache-data", + "persistentVolumeClaim": { + "claimName": "clunky-sabertooth-joomla-apache", + "readOnly": false + }, + "secret": null + }, + { + "name": "default-token-l6lb2", + "persistentVolumeClaim": null, + "secret": { + "defaultMode": 420, + "secretName": "default-token-l6lb2" + } + } + ] + } + } + ] + } + ] + } + ] }`) + simpletest( + t, + `{ + podByName(namespace: "default", + name: "clunky-sabertooth-joomla-5d4ddc985d-fpddz") { + owner { metadata { name } } + rootOwner { metadata { name } } + } + }`, + `{ + "podByName": { + "owner": { + "metadata": { "name": "clunky-sabertooth-joomla-5d4ddc985d" } + }, + "rootOwner": { + "metadata": { "name": "clunky-sabertooth-joomla" } + } + } + }`) + simpletest( + t, + `{ + allReplicaSets() { + owner { metadata { name } } + rootOwner { metadata { name } } + } + }`, + `{ + "allReplicaSets": [ + { + "owner": { + "metadata": { "name": "clunky-sabertooth-joomla" } + }, + "rootOwner": { + "metadata": { "name": "clunky-sabertooth-joomla" } + } + } + ] + }`) + simpletest( + t, + `{ + allDaemonSets() { + owner { metadata { name namespace } } + rootOwner { metadata { name namespace } } + pods { metadata { name labels { name value } } } + } + }`, + `{ + "allDaemonSets": [ + { + "owner": { + "metadata": { + "name": "calico-node", + "namespace": "kube-system" + } + }, + "rootOwner": { + "metadata": { + "name": "calico-node", + "namespace": "kube-system" + } + }, + "pods": [ + { + "metadata": { + "name": "calico-node-ddxfj", + "labels": [ + {"name": "controller-revision-hash", + "value": "3909226423"}, + {"name": "k8s-app", "value": "calico-node"}, + {"name": "pod-template-generation", "value": "1"} + ] + } + } + ] + } + ] + }`) } diff --git a/kubeaccess.go b/kubeaccess.go index 7118548..b3547e2 100644 --- a/kubeaccess.go +++ b/kubeaccess.go @@ -71,7 +71,7 @@ func lookUpMap( ctx context.Context, kind, namespace, name string) JsonObject { cache := getCache(ctx) - key := rawCacheKey(kind, namespace, name) + key := cacheKey(kind, namespace, name) cachedVal := (*cache)[key] var result JsonObject if cachedVal == nil { @@ -118,8 +118,13 @@ func getAllK8sObjsOfKind( kind string, test func(JsonObject) bool) []resource { cache := getCache(ctx) - results := (*cache)[kind] - if results == nil { + var cachedJsonObjs []JsonObject + var results []resource + + objs := (*cache)[kind] + if objs != nil { + cachedJsonObjs = objs.([]JsonObject) + } else { if isTest() { return make([]resource, 0) } @@ -139,35 +144,41 @@ func getAllK8sObjsOfKind( if err := cmd.Wait(); err != nil { log.Fatal(err) } - var resources []resource arr := (fromJson(bytes).(JsonObject))["items"].(JsonArray) - for _, res := range arr { - val := mapToResource(ctx, res.(JsonObject)) - (*cache)[cacheKey(kind, - *val.Metadata().Namespace(), *val.Metadata().Name())] = val - if test(res.(JsonObject)) { - resources = append(resources, val) - } - } - results = resources + for _, val := range arr { + cachedJsonObjs = append(cachedJsonObjs, val.(JsonObject)) + } } + for _, res := range cachedJsonObjs { + val := mapToResource(ctx, res) + if test(res) { + results = append(results, val) + } + } + if results == nil { results = make([]resource, 0) } - if (*cache)[kind] == nil { - (*cache)[kind] = results + if (*cache)[kind] == nil && len(cachedJsonObjs) > 0 { + (*cache)[kind] = cachedJsonObjs } - return results.([]resource) + return results } // Get all resource instances of a specific kind in a specific namespace + func getAllK8sObjsOfKindInNamespace( ctx context.Context, kind, ns string, test func(JsonObject) bool) []resource { cache := getCache(ctx) - results := (*cache)[kind] - if results == nil { + var cachedJsonObjs []JsonObject + var results []resource + + objs := (*cache)[kind] + if objs != nil { + cachedJsonObjs = objs.([]JsonObject) + } else { if isTest() { return make([]resource, 0) } @@ -187,23 +198,25 @@ func getAllK8sObjsOfKindInNamespace( if err := cmd.Wait(); err != nil { log.Fatal(err) } - var resources []resource arr := (fromJson(bytes).(JsonObject))["items"].(JsonArray) - for _, res := range arr { - val := mapToResource(ctx, res.(JsonObject)) - if test(res.(JsonObject)) { - resources = append(resources, val) - } + for _, val := range arr { + cachedJsonObjs = append(cachedJsonObjs, val.(JsonObject)) } - results = resources } + for _, res := range cachedJsonObjs { + val := mapToResource(ctx, res) + if test(res) { + results = append(results, val) + } + } + if results == nil { results = make([]resource, 0) } - if (*cache)[kind] == nil { - (*cache)[kind] = results + if (*cache)[kind] == nil && len(cachedJsonObjs) > 0 { + (*cache)[kind] = cachedJsonObjs } - return results.([]resource) + return results } func cacheKey(kind, namespace, name string) string { diff --git a/replicaset.go b/replicaset.go index a1c4c8a..f659848 100644 --- a/replicaset.go +++ b/replicaset.go @@ -17,6 +17,7 @@ package main import ( "context" // "fmt" + "sort" "strings" ) @@ -67,6 +68,12 @@ func getReplicaSetPods(ctx context.Context, r replicaSet) *[]pod { results[idx] = pr.p } + sort.Slice( + results, + func(i, j int) bool { + return *results[i].Metadata.Name < *results[j].Metadata.Name + }) + return &results } diff --git a/testdata/daemonset.json b/testdata/daemonset.json new file mode 100644 index 0000000..e2120bc --- /dev/null +++ b/testdata/daemonset.json @@ -0,0 +1,331 @@ +{ + "apiVersion": "extensions/v1beta1", + "kind": "DaemonSet", + "metadata": { + "creationTimestamp": "2018-07-26T00:58:25Z", + "generation": 1, + "labels": { + "k8s-app": "calico-node" + }, + "name": "calico-node", + "namespace": "kube-system", + "resourceVersion": "47029", + "selfLink": "/apis/extensions/v1beta1/namespaces/kube-system/daemonsets/calico-node", + "uid": "004e17fc-906f-11e8-bb3f-c29cc5a41b2a" + }, + "spec": { + "revisionHistoryLimit": 10, + "selector": { + "matchLabels": { + "k8s-app": "calico-node" + } + }, + "template": { + "metadata": { + "annotations": { + "scheduler.alpha.kubernetes.io/critical-pod": "" + }, + "creationTimestamp": null, + "labels": { + "k8s-app": "calico-node" + } + }, + "spec": { + "affinity": { + "nodeAffinity": { + "requiredDuringSchedulingIgnoredDuringExecution": { + "nodeSelectorTerms": [ + { + "matchExpressions": [ + { + "key": "ibmcloud.io/systemd-calico-node", + "operator": "DoesNotExist" + } + ] + } + ] + } + } + }, + "containers": [ + { + "env": [ + { + "name": "ETCD_ENDPOINTS", + "valueFrom": { + "configMapKeyRef": { + "key": "etcd_endpoints", + "name": "calico-config" + } + } + }, + { + "name": "CALICO_NETWORKING_BACKEND", + "valueFrom": { + "configMapKeyRef": { + "key": "calico_backend", + "name": "calico-config" + } + } + }, + { + "name": "CLUSTER_TYPE", + "value": "k8s,bgp" + }, + { + "name": "CALICO_DISABLE_FILE_LOGGING", + "value": "true" + }, + { + "name": "FELIX_DEFAULTENDPOINTTOHOSTACTION", + "value": "ACCEPT" + }, + { + "name": "FELIX_IPTABLESREFRESHINTERVAL", + "value": "60" + }, + { + "name": "FELIX_PROMETHEUSMETRICSENABLED", + "value": "true" + }, + { + "name": "FELIX_PROMETHEUSMETRICSPORT", + "value": "9091" + }, + { + "name": "IP", + "value": "autodetect" + }, + { + "name": "IP_AUTODETECTION_METHOD", + "value": "interface=(^bond0$|^eth0$|^ens6$)" + }, + { + "name": "CALICO_IPV4POOL_CIDR", + "value": "172.30.0.0/16" + }, + { + "name": "CALICO_IPV4POOL_IPIP", + "value": "cross-subnet" + }, + { + "name": "CALICO_K8S_NODE_REF", + "valueFrom": { + "fieldRef": { + "apiVersion": "v1", + "fieldPath": "spec.nodeName" + } + } + }, + { + "name": "FELIX_IPV6SUPPORT", + "value": "false" + }, + { + "name": "FELIX_LOGSEVERITYSCREEN", + "value": "info" + }, + { + "name": "FELIX_IPINIPMTU", + "value": "1480" + }, + { + "name": "ETCD_CA_CERT_FILE", + "valueFrom": { + "configMapKeyRef": { + "key": "etcd_ca", + "name": "calico-config" + } + } + }, + { + "name": "ETCD_KEY_FILE", + "valueFrom": { + "configMapKeyRef": { + "key": "etcd_key", + "name": "calico-config" + } + } + }, + { + "name": "ETCD_CERT_FILE", + "valueFrom": { + "configMapKeyRef": { + "key": "etcd_cert", + "name": "calico-config" + } + } + }, + { + "name": "FELIX_HEALTHENABLED", + "value": "true" + } + ], + "image": "registry.ng.bluemix.net/armada-master/node:v2.6.5", + "imagePullPolicy": "IfNotPresent", + "livenessProbe": { + "failureThreshold": 6, + "httpGet": { + "path": "/liveness", + "port": 9099, + "scheme": "HTTP" + }, + "initialDelaySeconds": 10, + "periodSeconds": 10, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "name": "calico-node", + "readinessProbe": { + "failureThreshold": 3, + "httpGet": { + "path": "/readiness", + "port": 9099, + "scheme": "HTTP" + }, + "periodSeconds": 10, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "resources": { + "requests": { + "cpu": "250m" + } + }, + "securityContext": { + "privileged": true + }, + "terminationMessagePath": "/dev/termination-log", + "terminationMessagePolicy": "File", + "volumeMounts": [ + { + "mountPath": "/lib/modules", + "name": "lib-modules", + "readOnly": true + }, + { + "mountPath": "/var/run/calico", + "name": "var-run-calico" + }, + { + "mountPath": "/calico-secrets", + "name": "etcd-certs" + } + ] + }, + { + "command": [ + "/install-cni.sh" + ], + "env": [ + { + "name": "ETCD_ENDPOINTS", + "valueFrom": { + "configMapKeyRef": { + "key": "etcd_endpoints", + "name": "calico-config" + } + } + }, + { + "name": "CNI_NETWORK_CONFIG", + "valueFrom": { + "configMapKeyRef": { + "key": "cni_network_config", + "name": "calico-config" + } + } + } + ], + "image": "registry.ng.bluemix.net/armada-master/cni:v1.11.2", + "imagePullPolicy": "IfNotPresent", + "name": "install-cni", + "resources": {}, + "terminationMessagePath": "/dev/termination-log", + "terminationMessagePolicy": "File", + "volumeMounts": [ + { + "mountPath": "/host/opt/cni/bin", + "name": "cni-bin-dir" + }, + { + "mountPath": "/host/etc/cni/net.d", + "name": "cni-net-dir" + }, + { + "mountPath": "/calico-secrets", + "name": "etcd-certs" + } + ] + } + ], + "dnsPolicy": "ClusterFirst", + "hostNetwork": true, + "restartPolicy": "Always", + "schedulerName": "default-scheduler", + "securityContext": {}, + "serviceAccount": "calico-node", + "serviceAccountName": "calico-node", + "terminationGracePeriodSeconds": 0, + "tolerations": [ + { + "operator": "Exists" + } + ], + "volumes": [ + { + "hostPath": { + "path": "/lib/modules", + "type": "" + }, + "name": "lib-modules" + }, + { + "hostPath": { + "path": "/var/run/calico", + "type": "" + }, + "name": "var-run-calico" + }, + { + "hostPath": { + "path": "/opt/cni/bin", + "type": "" + }, + "name": "cni-bin-dir" + }, + { + "hostPath": { + "path": "/etc/cni/net.d", + "type": "" + }, + "name": "cni-net-dir" + }, + { + "name": "etcd-certs", + "secret": { + "defaultMode": 420, + "secretName": "calico-etcd-secrets" + } + } + ] + } + }, + "templateGeneration": 1, + "updateStrategy": { + "rollingUpdate": { + "maxUnavailable": 5 + }, + "type": "RollingUpdate" + } + }, + "status": { + "currentNumberScheduled": 1, + "desiredNumberScheduled": 1, + "numberAvailable": 1, + "numberMisscheduled": 0, + "numberReady": 1, + "observedGeneration": 1, + "updatedNumberScheduled": 1 + } +} diff --git a/testdata/pod2.json b/testdata/pod2.json new file mode 100644 index 0000000..e239b03 --- /dev/null +++ b/testdata/pod2.json @@ -0,0 +1,412 @@ +{ + "apiVersion": "v1", + "kind": "Pod", + "metadata": { + "annotations": { + "kubernetes.io/psp": "ibm-privileged-psp", + "scheduler.alpha.kubernetes.io/critical-pod": "" + }, + "creationTimestamp": "2018-07-26T00:58:25Z", + "generateName": "calico-node-", + "labels": { + "controller-revision-hash": "3909226423", + "k8s-app": "calico-node", + "pod-template-generation": "1" + }, + "name": "calico-node-ddxfj", + "namespace": "kube-system", + "ownerReferences": [ + { + "apiVersion": "extensions/v1beta1", + "blockOwnerDeletion": true, + "controller": true, + "kind": "DaemonSet", + "name": "calico-node", + "uid": "004e17fc-906f-11e8-bb3f-c29cc5a41b2a" + } + ], + "resourceVersion": "47028", + "selfLink": "/api/v1/namespaces/kube-system/pods/calico-node-ddxfj", + "uid": "00531b05-906f-11e8-bb3f-c29cc5a41b2a" + }, + "spec": { + "affinity": { + "nodeAffinity": { + "requiredDuringSchedulingIgnoredDuringExecution": { + "nodeSelectorTerms": [ + { + "matchExpressions": [ + { + "key": "ibmcloud.io/systemd-calico-node", + "operator": "DoesNotExist" + } + ] + } + ] + } + } + }, + "containers": [ + { + "env": [ + { + "name": "ETCD_ENDPOINTS", + "valueFrom": { + "configMapKeyRef": { + "key": "etcd_endpoints", + "name": "calico-config" + } + } + }, + { + "name": "CALICO_NETWORKING_BACKEND", + "valueFrom": { + "configMapKeyRef": { + "key": "calico_backend", + "name": "calico-config" + } + } + }, + { + "name": "CLUSTER_TYPE", + "value": "k8s,bgp" + }, + { + "name": "CALICO_DISABLE_FILE_LOGGING", + "value": "true" + }, + { + "name": "FELIX_DEFAULTENDPOINTTOHOSTACTION", + "value": "ACCEPT" + }, + { + "name": "FELIX_IPTABLESREFRESHINTERVAL", + "value": "60" + }, + { + "name": "FELIX_PROMETHEUSMETRICSENABLED", + "value": "true" + }, + { + "name": "FELIX_PROMETHEUSMETRICSPORT", + "value": "9091" + }, + { + "name": "IP", + "value": "autodetect" + }, + { + "name": "IP_AUTODETECTION_METHOD", + "value": "interface=(^bond0$|^eth0$|^ens6$)" + }, + { + "name": "CALICO_IPV4POOL_CIDR", + "value": "172.30.0.0/16" + }, + { + "name": "CALICO_IPV4POOL_IPIP", + "value": "cross-subnet" + }, + { + "name": "CALICO_K8S_NODE_REF", + "valueFrom": { + "fieldRef": { + "apiVersion": "v1", + "fieldPath": "spec.nodeName" + } + } + }, + { + "name": "FELIX_IPV6SUPPORT", + "value": "false" + }, + { + "name": "FELIX_LOGSEVERITYSCREEN", + "value": "info" + }, + { + "name": "FELIX_IPINIPMTU", + "value": "1480" + }, + { + "name": "ETCD_CA_CERT_FILE", + "valueFrom": { + "configMapKeyRef": { + "key": "etcd_ca", + "name": "calico-config" + } + } + }, + { + "name": "ETCD_KEY_FILE", + "valueFrom": { + "configMapKeyRef": { + "key": "etcd_key", + "name": "calico-config" + } + } + }, + { + "name": "ETCD_CERT_FILE", + "valueFrom": { + "configMapKeyRef": { + "key": "etcd_cert", + "name": "calico-config" + } + } + }, + { + "name": "FELIX_HEALTHENABLED", + "value": "true" + } + ], + "image": "registry.ng.bluemix.net/armada-master/node:v2.6.5", + "imagePullPolicy": "IfNotPresent", + "livenessProbe": { + "failureThreshold": 6, + "httpGet": { + "path": "/liveness", + "port": 9099, + "scheme": "HTTP" + }, + "initialDelaySeconds": 10, + "periodSeconds": 10, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "name": "calico-node", + "readinessProbe": { + "failureThreshold": 3, + "httpGet": { + "path": "/readiness", + "port": 9099, + "scheme": "HTTP" + }, + "periodSeconds": 10, + "successThreshold": 1, + "timeoutSeconds": 1 + }, + "resources": { + "requests": { + "cpu": "250m" + } + }, + "securityContext": { + "privileged": true + }, + "terminationMessagePath": "/dev/termination-log", + "terminationMessagePolicy": "File", + "volumeMounts": [ + { + "mountPath": "/lib/modules", + "name": "lib-modules", + "readOnly": true + }, + { + "mountPath": "/var/run/calico", + "name": "var-run-calico" + }, + { + "mountPath": "/calico-secrets", + "name": "etcd-certs" + }, + { + "mountPath": "/var/run/secrets/kubernetes.io/serviceaccount", + "name": "calico-node-token-rczbq", + "readOnly": true + } + ] + }, + { + "command": [ + "/install-cni.sh" + ], + "env": [ + { + "name": "ETCD_ENDPOINTS", + "valueFrom": { + "configMapKeyRef": { + "key": "etcd_endpoints", + "name": "calico-config" + } + } + }, + { + "name": "CNI_NETWORK_CONFIG", + "valueFrom": { + "configMapKeyRef": { + "key": "cni_network_config", + "name": "calico-config" + } + } + } + ], + "image": "registry.ng.bluemix.net/armada-master/cni:v1.11.2", + "imagePullPolicy": "IfNotPresent", + "name": "install-cni", + "resources": {}, + "terminationMessagePath": "/dev/termination-log", + "terminationMessagePolicy": "File", + "volumeMounts": [ + { + "mountPath": "/host/opt/cni/bin", + "name": "cni-bin-dir" + }, + { + "mountPath": "/host/etc/cni/net.d", + "name": "cni-net-dir" + }, + { + "mountPath": "/calico-secrets", + "name": "etcd-certs" + }, + { + "mountPath": "/var/run/secrets/kubernetes.io/serviceaccount", + "name": "calico-node-token-rczbq", + "readOnly": true + } + ] + } + ], + "dnsPolicy": "ClusterFirst", + "hostNetwork": true, + "imagePullSecrets": [ + { + "name": "bluemix-default-secret" + } + ], + "nodeName": "10.76.193.41", + "restartPolicy": "Always", + "schedulerName": "default-scheduler", + "securityContext": {}, + "serviceAccount": "calico-node", + "serviceAccountName": "calico-node", + "terminationGracePeriodSeconds": 0, + "tolerations": [ + { + "operator": "Exists" + }, + { + "effect": "NoExecute", + "key": "node.kubernetes.io/not-ready", + "operator": "Exists" + }, + { + "effect": "NoExecute", + "key": "node.kubernetes.io/unreachable", + "operator": "Exists" + }, + { + "effect": "NoSchedule", + "key": "node.kubernetes.io/disk-pressure", + "operator": "Exists" + }, + { + "effect": "NoSchedule", + "key": "node.kubernetes.io/memory-pressure", + "operator": "Exists" + } + ], + "volumes": [ + { + "hostPath": { + "path": "/lib/modules", + "type": "" + }, + "name": "lib-modules" + }, + { + "hostPath": { + "path": "/var/run/calico", + "type": "" + }, + "name": "var-run-calico" + }, + { + "hostPath": { + "path": "/opt/cni/bin", + "type": "" + }, + "name": "cni-bin-dir" + }, + { + "hostPath": { + "path": "/etc/cni/net.d", + "type": "" + }, + "name": "cni-net-dir" + }, + { + "name": "etcd-certs", + "secret": { + "defaultMode": 420, + "secretName": "calico-etcd-secrets" + } + }, + { + "name": "calico-node-token-rczbq", + "secret": { + "defaultMode": 420, + "secretName": "calico-node-token-rczbq" + } + } + ] + }, + "status": { + "conditions": [ + { + "lastProbeTime": null, + "lastTransitionTime": "2018-07-26T00:58:25Z", + "status": "True", + "type": "Initialized" + }, + { + "lastProbeTime": null, + "lastTransitionTime": "2018-07-26T00:58:45Z", + "status": "True", + "type": "Ready" + }, + { + "lastProbeTime": null, + "lastTransitionTime": "2018-07-26T00:58:38Z", + "status": "True", + "type": "PodScheduled" + } + ], + "containerStatuses": [ + { + "containerID": "docker://a609bcf2011800564e451b40ab915c21a645774e996acd054aaba6e69299be14", + "image": "registry.ng.bluemix.net/armada-master/node:v2.6.5", + "imageID": "docker-pullable://registry.ng.bluemix.net/armada-master/node@sha256:d79a25b3ef899332f9de73536634c9a3ce3fa12b3e77e504cff1e2d2a8d536e6", + "lastState": {}, + "name": "calico-node", + "ready": true, + "restartCount": 0, + "state": { + "running": { + "startedAt": "2018-07-26T00:58:33Z" + } + } + }, + { + "containerID": "docker://679df731797b5f3538ac083829da595bd0ffe38217104e676058ccb35586de52", + "image": "registry.ng.bluemix.net/armada-master/cni:v1.11.2", + "imageID": "docker-pullable://registry.ng.bluemix.net/armada-master/cni@sha256:df0606795dc43a5f9f0823db26661a722107b93cfc88c1e20ba80bec45634023", + "lastState": {}, + "name": "install-cni", + "ready": true, + "restartCount": 0, + "state": { + "running": { + "startedAt": "2018-07-26T00:58:37Z" + } + } + } + ], + "hostIP": "10.76.193.41", + "phase": "Running", + "podIP": "10.76.193.41", + "qosClass": "Burstable", + "startTime": "2018-07-26T00:58:25Z" + } +}