def label_matrix(): get = lambda *keys: [request.args.get(k) for k in keys] _type, ns, name = get('matcher_type', 'matcher_ns', 'matcher_name') collection = K8Kat.deps() if _type == 'deployment' else K8Kat.svcs() matcher = collection.ns(ns).find(name) result = ResUtils.label_matrix(matcher) return jsonify(result)
def stdSetUpClass(cls, step_class): cls.dep = K8Kat.deps().ns(TESTING_NS).find(TESTING_DEP_NM) cls.svc = K8Kat.svcs().ns(TESTING_NS).find(TESTING_SVC_NM) cls.step = step_class( from_port=cls.svc.from_port, dep_ns=TESTING_NS, svc_name=TESTING_SVC_NM, dep_name=TESTING_DEP_NM, )
def __init__(self, **args): super().__init__() self.from_port = args['from_port'] self.dep = K8Kat.deps().ns(args['dep_ns']).find(args['dep_name']) self.svc = K8Kat.svcs().ns(args['dep_ns']).find(args['svc_name']) self._stunt_pod = None
def find_and_assoc_svcs(self): from k8_kat.base.k8_kat import K8Kat candidate_svcs = K8Kat.svcs().ns(self.ns).go() checker = lambda svc: ResUtils.dep_matches_svc(self.raw, svc.raw) self.assoced_svcs = [s for s in candidate_svcs if checker(s)]