apiVersion: config.kiosk.sh/v1alpha1
kind: Template
metadata:
  name: space-restrictions
# This section defines parameters that can be used for this template
# Can be used in resources.manifests and resources.helm.values
parameters:
  # Name of the parameter
  - name: DEFAULT_CPU_LIMIT
    # The default value of the parameter
    value: "1"
  - name: DEFAULT_CPU_REQUESTS
    value: "0.5"
    # If a parameter is required the template instance will need to set it
    # required: true
    # Make sure only values are entered for this parameter
    validation: "^[0-9]*\\.?[0-9]+$"
resources:
  manifests:
    - apiVersion: v1
      kind: LimitRange
      metadata:
        name: space-limit-range
        annotations: 
          # Parameters can also be used inside a string
          # with ${namespace.metadata.annotations.myAnnotation}
          example-parameter: "Hello from ${namespace} - ${WILL_NOT_BE_REPLACED}"
      spec:
        limits:
          - default:
              # Use the DEFAULT_CPU_LIMIT parameter here and
              # parse it as json, which renders the "1" as 1. 
              cpu: "${{DEFAULT_CPU_LIMIT}}"
            defaultRequest:
              cpu: "${{DEFAULT_CPU_REQUESTS}}"
            type: Container