Exemplo n.º 1
0
def dd_environment():
    with kind_run(conditions=[setup_linkerd_cluster]) as kubeconfig:
        compose_file = os.path.join(HERE, "compose", "docker-compose.yaml")
        with docker_run(
                compose_file=compose_file,
                conditions=[
                    CheckDockerLogs(compose_file,
                                    'LINKERD DEPLOY COMPLETE',
                                    wait=5,
                                    attempts=120)
                ],
        ):
            with ExitStack() as stack:
                ip, port = stack.enter_context(
                    port_forward(kubeconfig, 'linkerd', 4191, 'deployment',
                                 'linkerd-controller'))

            instance = {
                'prometheus_url':
                'http://{ip}:{port}/metrics'.format(ip=ip, port=port),
                'metrics': [LINKERD_FIXTURE_METRICS],
                'type_overrides':
                LINKERD_FIXTURE_TYPES,
            }
            yield instance
Exemplo n.º 2
0
def dd_environment():
    with kind_run(conditions=[setup_cert_manager]) as kubeconfig:
        with ExitStack() as stack:
            ip_ports_metrics = [
                stack.enter_context(
                    port_forward(kubeconfig, 'gatekeeper-system',
                                 'gatekeeper-controller-manager',
                                 METRICS_PORT))
            ]
            ip_ports_health = [
                stack.enter_context(
                    port_forward(kubeconfig, 'gatekeeper-system',
                                 'gatekeeper-controller-manager', HEALTH_PORT))
            ]

        instances = {
            'instances': [
                {
                    'prometheus_url':
                    'http://{}:{}/metrics'.format(*ip_ports_metrics[0]),
                    'gatekeeper_health_endpoint':
                    'http://{}:{}/'.format(*ip_ports_health[0]),
                },
            ]
        }

        yield instances
Exemplo n.º 3
0
def dd_environment():
    with kind_run(conditions=[setup_cert_manager]) as kubeconfig:
        with ExitStack() as stack:
            ip_ports = [stack.enter_context(port_forward(kubeconfig, 'cert-manager', 'cert-manager', PORT))]
        instances = {
            'instances': [
                {'prometheus_url': 'http://{}:{}/metrics'.format(*ip_ports[0])},
            ]
        }

        yield instances
Exemplo n.º 4
0
def dd_environment():
    with kind_run(conditions=[setup_cilium]) as kubeconfig:
        with ExitStack() as stack:
            ip_ports = [
                stack.enter_context(port_forward(kubeconfig, 'cilium', 'cilium-operator', port)) for port in PORTS
            ]
        instances = {
            'instances': [
                {'agent_endpoint': 'http://{}:{}/metrics'.format(*ip_ports[0])},
                {'operator_endpoint': 'http://{}:{}/metrics'.format(*ip_ports[1])},
            ]
        }

        yield instances
Exemplo n.º 5
0
def dd_environment():

    with kind_run(conditions=[setup_calico],
                  kind_config=path.join(HERE,
                                        'kind-calico.yaml')) as kubeconfig:
        with ExitStack() as stack:
            calico_host, calico_port = stack.enter_context(
                port_forward(kubeconfig, 'kube-system', 9091, 'service',
                             'felix-metrics-svc'))
            instance = {
                "openmetrics_endpoint":
                'http://{}:{}/metrics'.format(calico_host, calico_port),
                "namespace":
                NAMESPACE,
                "extra_metrics":
                EXTRA_METRICS,
            }
            yield instance
Exemplo n.º 6
0
def dd_environment(dd_save_state):
    with kind_run(conditions=[setup_istio]) as kubeconfig:
        with ExitStack() as stack:
            if VERSION == '1.13.3':
                istiod_host, istiod_port = stack.enter_context(
                    port_forward(kubeconfig, 'istio-system', 15014,
                                 'deployment', 'istiod'))

                istiod_endpoint = 'http://{}:{}/metrics'.format(
                    istiod_host, istiod_port)
                instance = {
                    'istiod_endpoint': istiod_endpoint,
                    'use_openmetrics': 'false'
                }

                # save this instance to use for openmetrics_v2 instance, since the endpoint is different each run
                dd_save_state("istio_instance", instance)

                yield instance
Exemplo n.º 7
0
def dd_environment():
    use_openmetrics = CILIUM_LEGACY == 'false'
    kind_config = os.path.join(HERE, 'kind', 'kind-config.yaml')
    with TempDir('helm_dir') as helm_dir:
        with kind_run(
                conditions=[setup_cilium],
                kind_config=kind_config,
                env_vars={
                    "HELM_CACHE_HOME": path_join(helm_dir, 'Caches'),
                    "HELM_CONFIG_HOME": path_join(helm_dir, 'Preferences'),
                },
        ) as kubeconfig:
            with ExitStack() as stack:
                ip_ports = [
                    stack.enter_context(
                        port_forward(kubeconfig, 'cilium', port, 'deployment',
                                     'cilium-operator')) for port in PORTS
                ]

                instances = get_instances(ip_ports[0][0], ip_ports[0][1],
                                          ip_ports[1][0], ip_ports[1][1],
                                          use_openmetrics)

            yield instances