Пример #1
0
def _add_osd_rc_deployment(gendoc):
    context = gendoc.context
    extra_rc_args = [
        f'--release-namespace={context.is_namespace}',
    ]
    if not context.suffix:
        # The main x86_64 release controller also monitors origin
        extra_rc_args.append('--publish-namespace=origin')

    # Creating Cluster Groups for the AMD64 jobs...
    if context.arch == 'x86_64':
        extra_rc_args.append('--cluster-group=build02,build03,build04')
        extra_rc_args.append('--cluster-group=vsphere')

    gendoc.append({
        'apiVersion': 'apps/v1',
        'kind': 'Deployment',
        'metadata': {
            'annotations': {
                'image.openshift.io/triggers':
                '[{"from":{"kind":"ImageStreamTag","name":"release-controller:latest"},"fieldPath":"spec.template.spec.containers[?(@.name==\\"controller\\")].image"}]'
            },
            'name': f'release-controller-{context.is_namespace}',
            'namespace': context.config.rc_deployment_namespace,
        },
        'spec': {
            'replicas': 1,
            'selector': {
                'matchLabels': {
                    'app': context.rc_service_name
                }
            },
            'template': {
                'metadata': {
                    'labels': {
                        'app': context.rc_service_name
                    }
                },
                'spec': {
                    'containers': [
                        *_get_osd_rc_deployment_sidecars(context), {
                            "resources": {
                                "requests": {
                                    "memory": "2Gi"
                                },
                            },
                            'command': [
                                '/usr/bin/release-controller', *extra_rc_args,
                                '--prow-config=/etc/config/config.yaml',
                                '--supplemental-prow-config-dir=/etc/config',
                                '--job-config=/etc/job-config',
                                '--listen=' + ('127.0.0.1:8080' if
                                               context.private else ':8080'),
                                f'--prow-namespace={context.config.rc_deployment_namespace}',
                                '--non-prow-job-kubeconfig=/etc/kubeconfig/kubeconfig',
                                f'--job-namespace={context.jobs_namespace}',
                                '--tools-image-stream-tag=release-controller-bootstrap:tests',
                                f'--release-architecture={context.get_supported_architecture_name()}',
                                '-v=6',
                                '--github-token-path=/etc/github/oauth',
                                '--github-endpoint=http://ghproxy',
                                '--github-graphql-endpoint=http://ghproxy/graphql',
                                '--github-throttle=250',
                                '--bugzilla-endpoint=https://bugzilla.redhat.com',
                                '--bugzilla-api-key-path=/etc/bugzilla/api',
                                '--bugzilla-auth-method=bearer',
                                '--verify-bugzilla',
                                '--jira-endpoint=https://issues.redhat.com',
                                '--jira-bearer-token-file=/etc/jira/api',
                                '--verify-jira',
                                '--plugin-config=/etc/plugins/plugins.yaml',
                                '--supplemental-plugin-config-dir=/etc/plugins',
                                '--authentication-message=Pulling these images requires <a href="https://docs.ci.openshift.org/docs/how-tos/use-registries-in-build-farm/">authenticating to the app.ci cluster</a>.',
                                f'--art-suffix={context.art_suffix}'
                            ],
                            'image':
                            'release-controller:latest',
                            'name':
                            'controller',
                            'volumeMounts':
                            get_rc_volume_mounts(),
                            'livenessProbe': {
                                'httpGet': {
                                    'path': '/healthz',
                                    'port': 8081
                                },
                                'initialDelaySeconds': 3,
                                'periodSeconds': 3,
                            },
                            'readinessProbe': {
                                'httpGet': {
                                    'path': '/healthz/ready',
                                    'port': 8081
                                },
                                'initialDelaySeconds': 10,
                                'periodSeconds': 3,
                                'timeoutSeconds': 600,
                            },
                        }
                    ],
                    'serviceAccountName':
                    f'release-controller-{context.is_namespace}',
                    'volumes':
                    get_rc_volumes(context, context.is_namespace)
                }
            }
        }
    })

    gendoc.append({
        'apiVersion': 'apps/v1',
        'kind': 'Deployment',
        'metadata': {
            'annotations': {
                'image.openshift.io/triggers':
                '[{"from":{"kind":"ImageStreamTag","name":"release-controller-api:latest"},"fieldPath":"spec.template.spec.containers[?(@.name==\\"controller\\")].image"}]'
            },
            'name': f'release-controller-api-{context.is_namespace}',
            'namespace': context.config.rc_deployment_namespace,
        },
        'spec': {
            'replicas': 3,
            'selector': {
                'matchLabels': {
                    'app': context.rc_api_service_name
                }
            },
            'template': {
                'metadata': {
                    'labels': {
                        'app': context.rc_api_service_name
                    }
                },
                'spec': {
                    'containers': [
                        *_get_osd_rc_deployment_sidecars(context),
                        {
                            "resources": {
                                "requests": {
                                    "memory": "2Gi"
                                },
                            },
                            'command': [
                                '/usr/bin/release-controller-api',
                                # '--to=release',  # Removed according to release controller help
                                f'--release-namespace={context.is_namespace}',
                                f'--artifacts={context.fc_app_url}',
                                f'--prow-namespace={context.config.rc_deployment_namespace}',
                                '--non-prow-job-kubeconfig=/etc/kubeconfig/kubeconfig',
                                f'--job-namespace={context.jobs_namespace}',
                                '--tools-image-stream-tag=release-controller-bootstrap:tests',
                                f'--release-architecture={context.get_supported_architecture_name()}',
                                '-v=6',
                                '--authentication-message=Pulling these images requires <a href="https://docs.ci.openshift.org/docs/how-tos/use-registries-in-build-farm/">authenticating to the app.ci cluster</a>.',
                                f'--art-suffix={context.art_suffix}'
                            ],
                            'image':
                            'release-controller-api:latest',
                            'name':
                            'controller',
                            'volumeMounts':
                            get_kubeconfig_volume_mounts(),
                            'livenessProbe': {
                                'httpGet': {
                                    'path': '/healthz',
                                    'port': 8081
                                },
                                'initialDelaySeconds': 3,
                                'periodSeconds': 3,
                            },
                            'readinessProbe': {
                                'httpGet': {
                                    'path': '/healthz/ready',
                                    'port': 8081
                                },
                                'initialDelaySeconds': 10,
                                'periodSeconds': 3,
                                'timeoutSeconds': 600,
                            },
                        }
                    ],
                    'serviceAccountName':
                    f'release-controller-{context.is_namespace}',
                    'volumes':
                    get_kubeconfig_volumes(
                        context,
                        namespace=context.is_namespace,
                        secret_name=context.secret_name_tls_api)
                }
            }
        }
    })
def _add_osd_rc_deployment(gendoc):
    context = gendoc.context
    extra_rc_args = [
        f'--release-namespace={context.is_namespace}',
    ]
    if not context.suffix:
        # The main x86_64 release controller also monitors origin
        extra_rc_args.append('--publish-namespace=origin')

    gendoc.append({
        'apiVersion': 'apps/v1',
        'kind': 'Deployment',
        'metadata': {
            'annotations': {
                'image.openshift.io/triggers':
                '[{"from":{"kind":"ImageStreamTag","name":"release-controller:latest"},"fieldPath":"spec.template.spec.containers[?(@.name==\\"controller\\")].image"}]'
            },
            'name': f'release-controller-{context.is_namespace}',
            'namespace': context.config.rc_deployment_namespace,
        },
        'spec': {
            'replicas': 1,
            'selector': {
                'matchLabels': {
                    'app': context.rc_service_name
                }
            },
            'template': {
                'metadata': {
                    'labels': {
                        'app': context.rc_service_name
                    }
                },
                'spec': {
                    'containers': [
                        *_get_osd_rc_deployment_sidecars(context),
                        {
                            "resources": {
                                "requests": {
                                    "memory": "2Gi"
                                },
                            },
                            'command': [
                                '/usr/bin/release-controller',
                                # '--to=release',  # Removed according to release controller help
                                *extra_rc_args,
                                '--prow-config=/etc/config/config.yaml',
                                '--job-config=/etc/job-config',
                                f'--artifacts={context.fc_app_url}',
                                '--listen=' + ('127.0.0.1:8080' if
                                               context.private else ':8080'),
                                f'--prow-namespace={context.config.rc_deployment_namespace}',
                                '--non-prow-job-kubeconfig=/etc/kubeconfig/kubeconfig',
                                f'--job-namespace={context.jobs_namespace}',
                                '--tools-image-stream-tag=release-controller-bootstrap:tests',
                                f'--release-architecture={context.get_supported_architecture_name()}',
                                '-v=6',
                                '--github-token-path=/etc/github/oauth',
                                '--github-endpoint=http://ghproxy',
                                '--github-graphql-endpoint=http://ghproxy/graphql',
                                '--github-throttle=250',
                                '--bugzilla-endpoint=https://bugzilla.redhat.com',
                                '--bugzilla-api-key-path=/etc/bugzilla/api',
                                '--plugin-config=/etc/plugins/plugins.yaml',
                                '--verify-bugzilla'
                            ],
                            'image':
                            'release-controller:latest',
                            'name':
                            'controller',
                            'volumeMounts':
                            get_rc_volume_mounts(context)
                        }
                    ],
                    'serviceAccountName':
                    f'release-controller-{context.is_namespace}',
                    'volumes':
                    get_rc_volumes(context, context.is_namespace)
                }
            }
        }
    })
Пример #3
0
def _add_origin_resources(gendoc):
    context = gendoc.context

    gendoc.append_all([{
        "apiVersion": "route.openshift.io/v1",
        "kind": "Route",
        "metadata": {
            "name": "release-controller",
            "namespace": "ci",
        },
        "spec": {
            "host": "origin-release.apps.ci.l2s4.p1.openshiftapps.com",
            "tls": {
                "insecureEdgeTerminationPolicy": "Redirect",
                "termination": "Edge"
            },
            "to": {
                "kind": "Service",
                "name": "release-controller",
            }
        }
    }, {
        "apiVersion": "v1",
        "kind": "Service",
        "metadata": {
            "name": "release-controller",
            "namespace": "ci",
        },
        "spec": {
            "ports": [{
                "port": 80,
                "targetPort": 8080
            }],
            "selector": {
                "app": "release-controller"
            }
        }
    }, {
        "apiVersion": "apps/v1",
        "kind": "Deployment",
        "metadata": {
            "annotations": {
                "image.openshift.io/triggers":
                "[{\"from\":{\"kind\":\"ImageStreamTag\",\"name\":\"release-controller:latest\"},\"fieldPath\":\"spec.template.spec.containers[?(@.name==\\\"controller\\\")].image\"}]",
            },
            "name": "release-controller",
            "namespace": "ci",
        },
        "spec": {
            "replicas": 1,
            "selector": {
                "matchLabels": {
                    "app": "release-controller"
                }
            },
            "template": {
                "metadata": {
                    "labels": {
                        "app": "release-controller"
                    }
                },
                "spec": {
                    "containers": [{
                        "command": [
                            "/usr/bin/release-controller",
                            "--release-namespace=origin",
                            "--prow-config=/etc/config/config.yaml",
                            "--supplemental-prow-config-dir=/etc/config",
                            "--job-config=/etc/job-config",
                            "--prow-namespace=ci",
                            "--non-prow-job-kubeconfig=/etc/kubeconfig/kubeconfig",
                            "--job-namespace=ci-release",
                            "--tools-image-stream-tag=4.6:tests",
                            "--release-architecture=amd64", "-v=4"
                        ],
                        "image":
                        "release-controller:latest",
                        "name":
                        "controller",
                        "volumeMounts":
                        get_rc_volume_mounts()
                    }],
                    "serviceAccountName":
                    "release-controller",
                    "volumes":
                    get_rc_volumes(context, None)
                }
            }
        }
    }])