이 콘텐츠는 선택한 언어로 제공되지 않습니다.

Chapter 20. Configuring Global Build Defaults and Overrides


20.1. Overview

Developers can define settings in specific build configurations within their projects, such as configuring a proxy for Git cloning. Rather than requiring developers to define certain settings in each of their build configurations, cluster administrators can use admission control plug-ins to configure global build defaults and overrides that automatically use these settings in any build.

The settings from these plug-ins are not set in the build configurations or builds themselves, but rather are only used during the build process. This allows administrators to change the global configuration at any time, and any builds that are re-run from existing build configurations or builds will get the new settings.

The BuildDefaults admission control plug-in allows administrators to set global defaults for settings such as the Git HTTP and HTTPS proxy, as well as default environment variables. These defaults do not overwrite values that have been configured for a specific build. However, if those values are not present on the build definition, they are set to the default value.

The BuildOverrides admission control plug-in allows administrators to override a setting in a build, regardless of the value stored in the build. It currently supports overriding the forcePull flag on a build strategy to enforce always refreshing the local image during a build by pulling the image from the registry. This ensures that a user can only build with an image that they are allowed to pull.

20.2. Setting Global Build Defaults

You can set global build defaults two ways:

20.2.1. Configuring Global Build Defaults with Ansible

During advanced installations, the BuildDefaults plug-in can be configured using the following parameters, which are configurable in the inventory file:

  • openshift_builddefaults_http_proxy
  • openshift_builddefaults_https_proxy
  • openshift_builddefaults_no_proxy
  • openshift_builddefaults_git_http_proxy
  • openshift_builddefaults_git_https_proxy

Example 20.1. Example Build Defaults Configuration with Ansible

# These options configure the BuildDefaults admission controller which injects
# environment variables into Builds. These values will default to the global proxy
# config values. You only need to set these if they differ from the global settings
# above. See BuildDefaults
# documentation at https://docs.okd.io/latest/admin_guide/build_defaults_overrides.html
#openshift_builddefaults_http_proxy=http://USER:PASSWORD@HOST:PORT
openshift_builddefaults_https_proxy=https://USER:PASSWORD@HOST:PORT
openshift_builddefaults_no_proxy=build_defaults
openshift_builddefaults_git_http_proxy=http://USER:PASSWORD@HOST:PORT
openshift_builddefaults_git_https_proxy=https://USER:PASSWORD@HOST:PORT
# Or you may optionally define your own serialized as json
#openshift_builddefaults_json='{"BuildDefaults":{"configuration":{"apiVersion":"v1","env":[{"name":"HTTP_PROXY","value":"http://proxy.example.com.redhat.com:3128"},{"name":"NO_PROXY","value":"ose3-master.example.com"}],"gitHTTPProxy":"http://proxy.example.com:3128","kind":"BuildDefaultsConfig"}}}'
Note

There are additional proxy settings that can be configured for builds using Ansible parameters. For example: - The openshift_builddefaults_git_http_proxy and openshift_builddefaults_git_https_proxy parameters allow you to use a proxy for git cloning - The openshift_builddefaults_http_proxy and openshift_builddefaults_https_proxy parameters can make environment variables available to the Docker build strategy and Custom build strategy processes.

20.2.2. Manually Setting Global Build Defaults

To configure the BuildDefaults plug-in, add a configuration for it in the /etc/origin/master/master-config.yaml file on masters:

kubernetesMasterConfig:
  admissionConfig:
    pluginConfig:
      BuildDefaults:
        configuration:
          apiVersion: v1
          kind: BuildDefaultsConfig
          gitHTTPProxy: http://my.proxy:8080 1
          gitHTTPSProxy: https://my.proxy:8443 2
          env:
          - name: HTTP_PROXY 3
            value: http://my.proxy:8080
          - name: HTTPS_PROXY 4
            value: https://my.proxy:8443
          - name: CUSTOM_VAR 5
            value: custom_value
1
Sets the HTTP proxy to use when cloning source code from a Git repository.
2
Sets the HTTPS proxy to use when cloning source code from a Git repository.
3
Default environment variable that sets the HTTP proxy to use during the build. This may be used for downloading dependencies during the assemble and build phases.
4
Default environment variable that sets the HTTPS proxy to use during the build. This may be used for downloading dependencies during the assemble and build phases.
5
(Optional) Additional default environment variable that will be added to every build.

Restart the master service for the changes to take effect:

# systemctl restart atomic-openshift-master

20.3. Setting Global Build Overrides

To configure the BuildOverrides plug-in, add a configuration for it in the /etc/origin/master/master-config.yaml file on masters:

kubernetesMasterConfig:
  admissionConfig:
    pluginConfig:
      BuildOverrides:
        configuration:
          apiVersion: v1
          kind: BuildOverridesConfig
          forcePull: true 1
1
Force all builds to pull their builder image and any source images before starting the build.

Restart the master service for the changes to take effect:

# systemctl restart atomic-openshift-master
Red Hat logoGithubRedditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

© 2024 Red Hat, Inc.