コード例 #1
0
ファイル: test_entrypoint.py プロジェクト: zhangshengchun/rio
def kube_chk(stack, sname):
    fullName = (f"{stack}/{sname}")

    id = util.rioInspect(fullName, "id")
    namespace = id.split(":")[0]
    obj = util.kubectl(namespace, "deployment", sname)

    return obj['spec']['template']['spec']['containers'][0]['command']
コード例 #2
0
ファイル: test_dns-search.py プロジェクト: woerwin/rio
def kube_chk(stack, sname):
    fullName = (f"{stack}/{sname}")

    id = util.rioInspect(fullName, "id")
    namespace = id.split(":")[0]
    obj = util.kubectl(namespace, "deployment", sname)

    return obj['spec']['template']['spec']['dnsConfig']['searches']
コード例 #3
0
ファイル: test_volume.py プロジェクト: zhangshengchun/rio
def kubetest(vname):

    id = util.rioInspect(vname, "id")
    nspace = id.split(":")[0]

    obj = util.kubectl(nspace, "pvc", vname)
    volsize = obj['spec']['resources']['requests']['storage']

    return volsize
コード例 #4
0
def kube_chk(stack, sname):
    fullName = (f"{stack}/{sname}")

    id = util.rioInspect(fullName, "id")
    namespace = id.split(":")[0]
    obj = util.kubectl(namespace, "deployment", sname)

    container = obj['spec']['template']['spec']['containers'][0]
    return container['resources']['requests']['memory']
コード例 #5
0
ファイル: test_volume-emptydir.py プロジェクト: woerwin/rio
def kube_vol_name(stack, sname):
    fullName = (f"{stack}/{sname}")

    id = util.rioInspect(fullName, "id")
    namespace = id.split(":")[0]
    obj = util.kubectl(namespace, "deployment", sname)
    obj = obj['spec']['template']['spec']['containers'][0]

    return obj['volumeMounts'][0]['name']
コード例 #6
0
ファイル: test_scale.py プロジェクト: woerwin/rio
def kube_return_scale(stack, service):
    fullName = "%s/%s" % (stack, service)

    id = util.rioInspect(fullName, "id")
    namespace = id.split(":")[0]
    obj = util.kubectl(namespace, "deployment", service)
    replicas = obj['status']['replicas']

    return replicas
コード例 #7
0
ファイル: test_scale_run.py プロジェクト: zhangshengchun/rio
def kube_chk(stack, sname):
    fullName = (f"{stack}/{sname}")

    id = util.rioInspect(fullName, "id")
    namespace = id.split(":")[0]
    obj = util.kubectl(namespace, "deployment", sname)

    container = obj['spec']['replicas']
    return container
コード例 #8
0
ファイル: test_cap-add.py プロジェクト: woerwin/rio
def kube_capadd_chk(stack, service_name, *capabilities):
    fullName = "%s/%s" % (stack, service_name)

    id = util.rioInspect(fullName, "id")
    namespace = id.split(":")[0]
    obj = util.kubectl(namespace, "deployment", service_name)

    container = obj['spec']['template']['spec']['containers'][0]
    return container['securityContext']['capabilities']['add']
コード例 #9
0
def kubetest(stack, service):
    fullName = "%s/%s" % (stack, service)
    id = util.rioInspect(fullName, "id")
    namespace = id.split(":")[0]

    obj = util.kubectl(namespace, "deployment", service)
    results = obj['spec']['template']['spec']['hostNetwork']

    return results
コード例 #10
0
ファイル: test_privileged.py プロジェクト: zhangshengchun/rio
def kubetest(stack, service):
    fullName = "%s/%s" % (stack, service)
    id = util.rioInspect(fullName, "id")
    namespace = id.split(":")[0]

    obj = util.kubectl(namespace, "deployment", service)
    container = obj['spec']['template']['spec']['containers'][0]
    results = container['securityContext']['privileged']

    return results
コード例 #11
0
def kube_chk_maxUnavailable(stack, service):
    fullName = "%s/%s" % (stack, service)
    id = util.rioInspect(fullName, "id")
    namespace = id.split(":")[0]

    obj = util.kubectl(namespace, "deployment", service)
    cnt = obj['spec']['strategy']['rollingUpdate']
    results = cnt['maxUnavailable']

    return results
コード例 #12
0
ファイル: test_tty.py プロジェクト: zhangshengchun/rio
def kube_chk_tty(stack, service):
    fullName = "%s/%s" % (stack, service)
    id = util.rioInspect(fullName, "id")
    namespace = id.split(":")[0]

    obj = util.kubectl(namespace, "deployment", service)
    cnt = obj['spec']['template']['spec']['containers'][0]
    results = cnt['tty']

    return results
コード例 #13
0
def kube_chk(stack, sname, mdata):
    print(sname)
    fullName = (f"{stack}/{sname}")

    id = util.rioInspect(fullName, "id")
    namespace = id.split(":")[0]
    obj = util.kubectl(namespace, "deployment", sname)
    container = obj['spec']['template']['metadata']['annotations'][f"{mdata}"]

    return container
コード例 #14
0
def kube_chk_updateStrategy(stack, service):
    fullName = "%s/%s" % (stack, service)
    id = util.rioInspect(fullName, "id")
    namespace = id.split(":")[0]

    obj = util.kubectl(namespace, "deployment", service)
    cnt = obj['spec']['strategy']
    results = cnt['type']

    return results
コード例 #15
0
def kubesperiod(stack, service):
    fullName = "%s/%s" % (stack, service)
    id = util.rioInspect(fullName, "id")
    namespace = id.split(":")[0]

    obj = util.kubectl(namespace, "deployment", service)
    cnt = obj['spec']['template']['spec']['containers'][0]['readinessProbe']
    results = cnt['initialDelaySeconds']

    return results
コード例 #16
0
ファイル: test_health-cmd.py プロジェクト: zhangshengchun/rio
def kubecmd(stack, service):
    fullName = "%s/%s" % (stack, service)
    id = util.rioInspect(fullName, "id")
    namespace = id.split(":")[0]

    obj = util.kubectl(namespace, "deployment", service)
    cnt = obj['spec']['template']['spec']['containers'][0]['livenessProbe']
    results = cnt['exec']['command']

    return results
コード例 #17
0
def kubeurl(stack, service):
    fullName = "%s/%s" % (stack, service)
    id = util.rioInspect(fullName, "id")
    namespace = id.split(":")[0]

    obj = util.kubectl(namespace, "deployment", service)
    cnt = obj['spec']['template']['spec']['containers'][0]['readinessProbe']
    results = cnt['httpGet']['httpHeaders'][0]['value']

    return results
コード例 #18
0
def kuberetries(stack, service):
    fullName = "%s/%s" % (stack, service)
    id = util.rioInspect(fullName, "id")
    namespace = id.split(":")[0]

    obj = util.kubectl(namespace, "deployment", service)
    cnt = obj['spec']['template']['spec']['containers'][0]['readinessProbe']
    results = cnt['successThreshold']

    return results
コード例 #19
0
def kubetest(stack, sname):

    fullName = (f"{stack}/{sname}")
    id = util.rioInspect(fullName, "id")
    namespace = id.split(":")[0]

    obj = util.kubectl(namespace, "deployment", sname)
    replicas = obj['metadata']['name']

    return replicas
コード例 #20
0
def kubetest(stack, vname):
    fullVolName = (f"{stack}/{vname}")

    id = util.rioInspect(fullVolName, "id")
    namespace = id.split(":")[0]
    print(namespace)

    obj = util.kubectl(namespace, "pvc", vname)
    volsize = obj['spec']['resources']['requests']['storage']

    return volsize
コード例 #21
0
ファイル: test_publish.py プロジェクト: zhangshengchun/rio
def kube_return_target(stack, sname):

    fullName = (f"{stack}/{sname}")
    id = util.rioInspect(fullName, "id")
    namespace = id.split(":")[0]

    obj = util.kubectl(namespace, "deployment", sname)
    container = obj['spec']['template']['spec']['containers'][0]
    results = container['ports'][0]['containerPort']

    return results
コード例 #22
0
def kube_chk(stack, sname):
    fullName = (f"{stack}/{sname}")

    id = util.rioInspect(fullName, "id")
    namespace = id.split(":")[0]
    obj = util.kubectl(namespace, "deployment", sname)

    out = []
    for item in obj['spec']['template']['spec']['dnsConfig']['options']:
        out.append(item['name'])

    return out
コード例 #23
0
ファイル: test_label-file.py プロジェクト: woerwin/rio
def kube_chk(stack, sname, *lbl):
    fullName = (f"{stack}/{sname}")

    id = util.rioInspect(fullName, "id")
    namespace = id.split(":")[0]
    obj = util.kubectl(namespace, "deployment", sname)

    results = ""
    for c in lbl:
        results += obj['spec']['template']['metadata']['labels'][f"{lbl}"]

    return results
コード例 #24
0
def kubetest(stack, service):

    fullName = "%s/%s" % (stack, service)
    id = util.rioInspect(fullName, "id")
    namespace = id.split(":")[0]

    contents = util.kubectl(namespace, 'virtualservice', service)
    print(contents)

    domainName = contents['spec']['hosts'][2]
    print(domainName)

    return domainName
コード例 #25
0
ファイル: test_secret.py プロジェクト: zhangshengchun/rio
def kube_chk_mountPath(stack, service):
    fullName = "%s/%s" % (stack, service)
    id = util.rioInspect(fullName, "id")
    namespace = id.split(":")[0]

    obj = util.kubectl(namespace, "deployment", service)
    cnt = obj['spec']['template']['spec']['containers'][0]

    out = []
    for item in cnt['volumeMounts']:
        out.append(item['mountPath'])

    out.sort()

    return out
コード例 #26
0
def kube_chk(stack, service_name):
    fullName = "%s/%s" % (stack, service_name)

    id = util.rioInspect(fullName, "id")
    namespace = id.split(":")[0]
    obj = util.kubectl(namespace, "deployment", service_name)

    out = []
    for item in obj['spec']['template']['spec']['volumes']:
        if 'configMap' in item:
            out.append(item['configMap']['name'])

    out.sort()
    print(out)

    return out
コード例 #27
0
ファイル: test_env-value.py プロジェクト: zhangshengchun/rio
def kube_chk(stack, sname):
    print(sname)
    fullName = (f"{stack}/{sname}")

    id = util.rioInspect(fullName, "id")
    namespace = id.split(":")[0]
    obj = util.kubectl(namespace, "deployment", sname)
    container = obj['spec']['template']['spec']['containers'][0]

    out = []
    for item in container['env']:
        out.append(item['name'])
        out.append(item['value'])

    print(out)

    return out
コード例 #28
0
ファイル: test_add-host.py プロジェクト: woerwin/rio
def kube_chk_addhost(stack, sname):
    fullName = (f"{stack}/{sname}")
    id = util.rioInspect(fullName, "id")
    namespace = id.split(":")[0]

    obj = util.kubectl(namespace, "deployment", sname)
    cnt = obj['spec']['template']['spec']

    out = []
    for item in cnt['hostAliases']:
        out.append(item['hostnames'])
        out.append(item['ip'])

#    hostname = [0]
#    ip = cnt['ip']
#    results = (f"{ip}:{hostname}")

    return out