1 package v1 2 3 import ( 4 corev1 "k8s.io/api/core/v1" 5 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 6 ) 7 8 // +genclient 9 // +genclient:nonNamespaced 10 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 11 12 // Build configures the behavior of OpenShift builds for the entire cluster. 13 // This includes default settings that can be overridden in BuildConfig objects, and overrides which are applied to all builds. 14 // 15 // The canonical name is "cluster" 16 // 17 // Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer). 18 // +openshift:compatibility-gen:level=1 19 type Build struct { 20 metav1.TypeMeta `json:",inline"` 21 22 // metadata is the standard object's metadata. 23 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata 24 metav1.ObjectMeta `json:"metadata,omitempty"` 25 26 // Spec holds user-settable values for the build controller configuration 27 // +kubebuilder:validation:Required 28 // +required 29 Spec BuildSpec `json:"spec"` 30 } 31 32 type BuildSpec struct { 33 // AdditionalTrustedCA is a reference to a ConfigMap containing additional CAs that 34 // should be trusted for image pushes and pulls during builds. 35 // The namespace for this config map is openshift-config. 36 // 37 // DEPRECATED: Additional CAs for image pull and push should be set on 38 // image.config.openshift.io/cluster instead. 39 // 40 // +optional 41 AdditionalTrustedCA ConfigMapNameReference `json:"additionalTrustedCA"` 42 // BuildDefaults controls the default information for Builds 43 // +optional 44 BuildDefaults BuildDefaults `json:"buildDefaults"` 45 // BuildOverrides controls override settings for builds 46 // +optional 47 BuildOverrides BuildOverrides `json:"buildOverrides"` 48 } 49 50 type BuildDefaults struct { 51 // DefaultProxy contains the default proxy settings for all build operations, including image pull/push 52 // and source download. 53 // 54 // Values can be overrode by setting the `HTTP_PROXY`, `HTTPS_PROXY`, and `NO_PROXY` environment variables 55 // in the build config's strategy. 56 // +optional 57 DefaultProxy *ProxySpec `json:"defaultProxy,omitempty"` 58 59 // GitProxy contains the proxy settings for git operations only. If set, this will override 60 // any Proxy settings for all git commands, such as git clone. 61 // 62 // Values that are not set here will be inherited from DefaultProxy. 63 // +optional 64 GitProxy *ProxySpec `json:"gitProxy,omitempty"` 65 66 // Env is a set of default environment variables that will be applied to the 67 // build if the specified variables do not exist on the build 68 // +optional 69 Env []corev1.EnvVar `json:"env,omitempty"` 70 71 // ImageLabels is a list of docker labels that are applied to the resulting image. 72 // User can override a default label by providing a label with the same name in their 73 // Build/BuildConfig. 74 // +optional 75 ImageLabels []ImageLabel `json:"imageLabels,omitempty"` 76 77 // Resources defines resource requirements to execute the build. 78 // +optional 79 Resources corev1.ResourceRequirements `json:"resources"` 80 } 81 82 type ImageLabel struct { 83 // Name defines the name of the label. It must have non-zero length. 84 Name string `json:"name"` 85 86 // Value defines the literal value of the label. 87 // +optional 88 Value string `json:"value,omitempty"` 89 } 90 91 type BuildOverrides struct { 92 // ImageLabels is a list of docker labels that are applied to the resulting image. 93 // If user provided a label in their Build/BuildConfig with the same name as one in this 94 // list, the user's label will be overwritten. 95 // +optional 96 ImageLabels []ImageLabel `json:"imageLabels,omitempty"` 97 98 // NodeSelector is a selector which must be true for the build pod to fit on a node 99 // +optional 100 NodeSelector map[string]string `json:"nodeSelector,omitempty"` 101 102 // Tolerations is a list of Tolerations that will override any existing 103 // tolerations set on a build pod. 104 // +optional 105 Tolerations []corev1.Toleration `json:"tolerations,omitempty"` 106 107 // ForcePull overrides, if set, the equivalent value in the builds, 108 // i.e. false disables force pull for all builds, 109 // true enables force pull for all builds, 110 // independently of what each build specifies itself 111 // +optional 112 ForcePull *bool `json:"forcePull,omitempty"` 113 } 114 115 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 116 117 // Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer). 118 // +openshift:compatibility-gen:level=1 119 type BuildList struct { 120 metav1.TypeMeta `json:",inline"` 121 122 // metadata is the standard list's metadata. 123 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata 124 metav1.ListMeta `json:"metadata"` 125 126 Items []Build `json:"items"` 127 } 128