Exemple #1
0
def main():
    '''Deploy Prometheus operator and Instance '''
    if deploy_options.target != "oc-ingress":
        # Deploy Operator Group
        deployer('deploy/monitoring/prometheus/assisted-installer-operator-group.yaml',
                 'OperatorGroup')
        # Deploy Subscription
        deploy_prometheus_sub(OLM_NS, CAT_SRC)
        # Deploy Prom svc
        deployer('deploy/monitoring/prometheus/assisted-installer-k8s-prometheus-svc.yaml',
                 'Prometheus Service')
        # Deploy Prometheus Instance
        deployer('deploy/monitoring/prometheus/assisted-installer-k8s-prometheus-subscription-instance.yaml',
                 'Prometheus Instance on K8s')
        sleep(10)
        utils.check_k8s_rollout(
            k8s_object='statefulset',
            k8s_object_name='prometheus-assisted-installer-prometheus',
            target=deploy_options.target,
            namespace=deploy_options.namespace
        )
        # Deploy Prom svc Monitor
        deployer('deploy/monitoring/prometheus/assisted-installer-prometheus-svc-monitor.yaml',
                 'Prometheus Service Monitor')
    else:
        # Deploy Operator Group
        try:
            deployer('deploy/monitoring/prometheus/assisted-installer-operator-group.yaml',
                     'OperatorGroup')
        except:
            cmd = "{} -n {} get OperatorGroup --no-headers".format(CMD_BIN, deploy_options.namespace)
            if not utils.check_output(cmd):
                print("The creation of an OperatorGroup is Forbidden for you user please request a creation of one before execute this again, exiting...")
                sys.exit(1)
            else:
                print("Another OperatorGroup exists, continuing")
        # Deploy Subscription
        deploy_prometheus_sub(OLM_NS, CAT_SRC)
        # Deploy Oauth Pre-reqs for OCP integration
        deploy_oauth_reqs()
        # Deploy Prom svc;
        # We create the service first in order to self-generate the secret prometheus-k8s-tls
        deployer('deploy/monitoring/prometheus/assisted-installer-ocp-prometheus-svc.yaml',
                 'Prometheus Service on OCP')
        # Deploy Prometheus Instance
        deployer('deploy/monitoring/prometheus/assisted-installer-ocp-prometheus-subscription-instance.yaml',
                 'Prometheus Instance on OCP')
        sleep(10)
        utils.check_k8s_rollout(
            k8s_object='statefulset',
            k8s_object_name='prometheus-assisted-installer-prometheus',
            target=deploy_options.target,
            namespace=deploy_options.namespace
        )
        # Deploy Prom svc Monitor
        deployer('deploy/monitoring/prometheus/assisted-installer-prometheus-svc-monitor.yaml',
                 'Prometheus Service Monitor')
        # Deploy Prometheus Route
        deploy_prometheus_route()
Exemple #2
0
def main():
    '''Deploy Grafana for Assisted Installer'''
    if deploy_options.target != "oc-ingress":
        # Deploy grafana configuration
        grafana_conf_file = 'grafana-k8s.ini'
        deploy_grafana_config(grafana_conf_file)
        # Deploy grafana DS
        deploy_grafana_ds()
        # Deploy Dashboards
        deployer('deploy/monitoring/grafana/grafana-dashboards.yaml',
                 'Grafana Dashboards')
        # Deploy Assisted Installer Dashboard
        deployer(
            'deploy/monitoring/grafana/assisted-installer-grafana-dashboard.yaml',
            'Grafana Assisted Installer Dashboard')
        # Deploy Grafana
        deployer(
            'deploy/monitoring/grafana/assisted-installer-k8s-grafana.yaml',
            'Grafana Instance on K8s')
        sleep(10)
        utils.check_k8s_rollout(
            k8s_object='deployment',
            k8s_object_name='grafana',
            target=deploy_options.target,
            namespace=deploy_options.namespace,
        )
    else:
        # Deploy Oauth Pre-reqs for OCP integration
        deploy_oauth_reqs()
        # Deploy grafana configuration
        grafana_conf_file = 'grafana.ini'
        deploy_grafana_config(grafana_conf_file)
        # Deploy grafana DS
        deploy_grafana_ds()
        # Deploy Dashboards
        deployer('deploy/monitoring/grafana/grafana-dashboards.yaml',
                 'Grafana Dashboards')
        # Deploy Assisted Installer Dashboard
        deployer(
            'deploy/monitoring/grafana/assisted-installer-grafana-dashboard.yaml',
            'Grafana Assisted Installer Dashboard')
        # Deploy Grafana
        deployer(
            'deploy/monitoring/grafana/assisted-installer-ocp-grafana.yaml',
            'Grafana Instance on OCP')
        sleep(10)
        utils.check_k8s_rollout(
            k8s_object='deployment',
            k8s_object_name='grafana',
            target=deploy_options.target,
            namespace=deploy_options.namespace,
        )
        # Deploy grafana Route
        deploy_grafana_route()
Exemple #3
0
def main():
    if args.target != "oc-ingress":
        # Deploy Operator Group
        deployer(
            'deploy/monitoring/prometheus/assisted-installer-operator-group.yaml',
            'OperatorGroup')
        # Deploy Subscription
        deploy_prometheus_sub(olm_ns, cat_src)
        # Deploy Prom svc
        deployer(
            'deploy/monitoring/prometheus/assisted-installer-k8s-prometheus-svc.yaml',
            'Prometheus Service')
        # Deploy Prometheus Instance
        deployer(
            'deploy/monitoring/prometheus/assisted-installer-k8s-prometheus-subscription-instance.yaml',
            'Prometheus Instance on K8s')
        sleep(10)
        utils.check_k8s_rollout('statefulset',
                                'prometheus-assisted-installer-prometheus')
        # Deploy Prom svc Monitor
        deployer(
            'deploy/monitoring/prometheus/assisted-installer-prometheus-svc-monitor.yaml',
            'Prometheus Service Monitor')
    else:
        # Deploy Operator Group
        deployer(
            'deploy/monitoring/prometheus/assisted-installer-operator-group.yaml',
            'OperatorGroup')
        # Deploy Subscription
        deploy_prometheus_sub(olm_ns, cat_src)
        # Deploy Oauth Pre-reqs for OCP integration
        deploy_oauth_reqs()
        # Deploy Prom svc; We create the service first in order to self-generate the secret prometheus-k8s-tls
        deployer(
            'deploy/monitoring/prometheus/assisted-installer-ocp-prometheus-svc.yaml',
            'Prometheus Service on OCP')
        # Deploy Prometheus Instance
        deployer(
            'deploy/monitoring/prometheus/assisted-installer-ocp-prometheus-subscription-instance.yaml',
            'Prometheus Instance on OCP')
        sleep(10)
        utils.check_k8s_rollout('statefulset',
                                'prometheus-assisted-installer-prometheus')
        # Deploy Prom svc Monitor
        deployer(
            'deploy/monitoring/prometheus/assisted-installer-prometheus-svc-monitor.yaml',
            'Prometheus Service Monitor')
        # Deploy Prometheus Route
        deploy_prometheus_route()