Skip to content

Latest commit

 

History

History
54 lines (49 loc) · 1.45 KB

builds-setting-build-resources.adoc

File metadata and controls

54 lines (49 loc) · 1.45 KB

Setting build resources

By default, builds are completed by pods using unbound resources, such as memory and CPU. These resources can be limited.

Procedure
  • Limit resources by specifying resource limits in a project’s default container limits.

  • Or limit resource use by specifying resource limits as part of the build configuration. In the following example, each of the resources, cpu, and memory parameters are optional:

    apiVersion: "v1"
    kind: "BuildConfig"
    metadata:
      name: "sample-build"
    spec:
      resources:
        limits:
          cpu: "100m" (1)
          memory: "256Mi" (2)
    1. cpu is in CPU units: 100m represents 0.1 CPU units (100 * 1e-3).

    2. memory is in bytes: 256Mi represents 268435456 bytes (256 * 2 ^ 20).

      However, if a quota has been defined for your project, one of the following two items is required:

      • A resources section set with an explicit requests:

        resources:
          requests: (1)
            cpu: "100m"
            memory: "256Mi"
    3. The requests object contains the list of resources that correspond to the list of resources in the quota.

      • A limit range defined in your project, where the defaults from the LimitRange object apply to pods created during the build process.

        Otherwise, build pod creation will fail, citing a failure to satisfy quota.