Beispiel #1
0
def promote_service(stack, name, version):
    fullName = "%s/%s" % (stack, name)
    command = "rio promote %s:%s" % (fullName, version)
    util.run(command)
    stackJson = util.runToJson("rio export -o json %s" % stack)
    got = stackJson['services'][name]['version']

    return got
Beispiel #2
0
def weight_service(stack, name, version, weight):
    fullName = "%s/%s" % (stack, name)
    command = "rio weight %s:%s=%s" % (fullName, version, weight)
    util.run(command)
    stackJson = util.runToJson("rio export -o json %s" % stack)
    got = stackJson['services'][name]['revisions']['v2']['weight']

    return got
Beispiel #3
0
def kuberoletest(stack, sname):

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

    cmd = (f'rio kubectl get -n rio-cloud -o=json role {realname}')
    obj = util.runToJson(cmd)
    replicas = obj['rules'][0]['verbs']

    return replicas
Beispiel #4
0
def kuberoletest(stack, sname):

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

    cmd = (f'rio kubectl get -n {namespace} -o=json role')
    obj = util.runToJson(cmd)
    replicas = obj['items'][0]['rules'][0]['verbs']

    return replicas
Beispiel #5
0
def stage_service(stack, name, version, second_config):
    fullName = "%s/%s" % (stack, name)
    path = "/usr/share/nginx/html/index.html"
    command = "rio stage --image=nginx --config %s:%s %s:%s" % (
        second_config, path, fullName, version)
    print(command)
    util.runwait(command, fullName)
    stackJson = util.runToJson("rio export -o json %s" % stack)
    got = stackJson['services'][name]['revisions']['v2']['scale']

    return got
Beispiel #6
0
def kubeclusterroletest(stack, sname):

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

    cmd = (f'rio kubectl get -o=json clusterrole')
    obj = util.runToJson(cmd)

    for item in obj['items']:
        if item['metadata']['name'] == (f'{sname}-{namespace}'):
            return item['rules'][0]['verbs']

    return None
Beispiel #7
0
def serviceJson(stack, service):
    fullName = "%s/%s" % (stack, service)
    obj = util.runToJson("rio export -o json -t service %s" % fullName)
    return obj
Beispiel #8
0
def stackJson(stack, service):
    # service is passed in so that there will be one in the stack export
    obj = util.runToJson("rio export -o json %s" % stack)
    return obj