Skip to content

Commit

Permalink
Tune buildah (#920)
Browse files Browse the repository at this point in the history
* Removed from limitrange default CPU. Added values for app builder for pipeline job and buildah.

* Fixed unit tests for limits cpu

* Added unit-tests for useBuildKit resources args
  • Loading branch information
satr authored Sep 5, 2023
1 parent 8717408 commit dc25475
Show file tree
Hide file tree
Showing 27 changed files with 233 additions and 106 deletions.
7 changes: 4 additions & 3 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,13 @@
"DNS_ZONE": "dev.radix.equinor.com",
"RADIXOPERATOR_CLUSTER_TYPE": "development",
"RADIXOPERATOR_DEFAULT_USER_GROUP": "64b28659-4fe4-4222-8497-85dd7e43e25b",
"RADIXOPERATOR_APP_BUILDER_RESOURCES_LIMITS_MEMORY": "2500M",
"RADIXOPERATOR_APP_BUILDER_RESOURCES_REQUESTS_MEMORY": "800M",
"RADIXOPERATOR_APP_BUILDER_RESOURCES_REQUESTS_CPU": "800m",
"RADIXOPERATOR_APP_LIMITS_DEFAULT_MEMORY": "500M",
"RADIXOPERATOR_APP_LIMITS_DEFAULT_CPU": "400m",
"RADIXOPERATOR_APP_LIMITS_DEFAULT_REQUEST_MEMORY": "50M",
"RADIXOPERATOR_APP_LIMITS_DEFAULT_REQUEST_CPU": "40m",
"RADIXOPERATOR_APP_LIMITS_DEFAULT_REQUEST_CPU": "100m",
"RADIXOPERATOR_APP_ENV_LIMITS_DEFAULT_MEMORY": "500M",
"RADIXOPERATOR_APP_ENV_LIMITS_DEFAULT_CPU": "400m",
"RADIXOPERATOR_APP_ENV_LIMITS_DEFAULT_REQUEST_MEMORY": "50M",
"RADIXOPERATOR_APP_ENV_LIMITS_DEFAULT_REQUEST_CPU": "40m",
"RADIXOPERATOR_APP_ROLLING_UPDATE_MAX_UNAVAILABLE": "25%",
Expand Down
4 changes: 2 additions & 2 deletions charts/radix-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
name: radix-operator
version: 1.21.7
appVersion: 1.41.7
version: 1.21.8
appVersion: 1.41.8
kubeVersion: ">=1.24.0"
description: Radix Operator
keywords:
Expand Down
11 changes: 7 additions & 4 deletions charts/radix-operator/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,24 @@ spec:
# For configuring limit ranges on app namespaces
- name: RADIXOPERATOR_APP_LIMITS_DEFAULT_MEMORY
value: {{ .Values.app.limitrange.default.memory | quote }}
- name: RADIXOPERATOR_APP_LIMITS_DEFAULT_CPU
value: {{ .Values.app.limitrange.default.cpu | quote }}
- name: RADIXOPERATOR_APP_LIMITS_DEFAULT_REQUEST_MEMORY
value: {{ .Values.app.limitrange.defaultRequest.memory | quote }}
- name: RADIXOPERATOR_APP_LIMITS_DEFAULT_REQUEST_CPU
value: {{ .Values.app.limitrange.defaultRequest.cpu | quote }}
# For configuring limit ranges on env namespaces
- name: RADIXOPERATOR_APP_ENV_LIMITS_DEFAULT_MEMORY
value: {{ .Values.app.env.limitrange.default.memory | quote }}
- name: RADIXOPERATOR_APP_ENV_LIMITS_DEFAULT_CPU
value: {{ .Values.app.env.limitrange.default.cpu | quote }}
- name: RADIXOPERATOR_APP_ENV_LIMITS_DEFAULT_REQUEST_MEMORY
value: {{ .Values.app.env.limitrange.defaultRequest.memory | quote }}
- name: RADIXOPERATOR_APP_ENV_LIMITS_DEFAULT_REQUEST_CPU
value: {{ .Values.app.env.limitrange.defaultRequest.cpu | quote }}
# For configuring limit ranges on app namespaces
- name: RADIXOPERATOR_APP_BUILDER_RESOURCES_LIMITS_MEMORY
value: {{ .Values.app.builder.resources.limits.memory | quote }}
- name: RADIXOPERATOR_APP_BUILDER_RESOURCES_REQUESTS_MEMORY
value: {{ .Values.app.builder.resources.requests.memory | quote }}
- name: RADIXOPERATOR_APP_BUILDER_RESOURCES_REQUESTS_CPU
value: {{ .Values.app.builder.resources.requests.cpu | quote }}
# For configuring readiness probe
- name: RADIXOPERATOR_APP_READINESS_PROBE_INITIAL_DELAY_SECONDS
value: {{ .Values.app.readinessProbe.initialDelaySeconds | quote }}
Expand Down
12 changes: 9 additions & 3 deletions charts/radix-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ app:
limitrange:
default:
memory: 450M
cpu: 2000m
defaultRequest:
memory: 450M
cpu: 100m
Expand All @@ -42,10 +41,17 @@ app:
limitrange:
default:
memory: 500M
cpu: 2000m
defaultRequest:
memory: 500M
cpu: 50m
cpu: 100m
builder:
# Limit range on builder job in app namespace
resources:
limits:
memory: 5000M
requests:
memory: 800M
cpu: 800m
# Readiness probe parameters
readinessProbe:
initialDelaySeconds: 5
Expand Down
7 changes: 7 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
Expand Down Expand Up @@ -84,6 +86,7 @@ github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeME
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs=
github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ=
github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
Expand Down Expand Up @@ -181,10 +184,12 @@ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
Expand All @@ -211,6 +216,8 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
github.com/onsi/ginkgo/v2 v2.6.0 h1:9t9b9vRUbFq3C4qKFCGkVuq/fIHji802N1nrtkh1mNc=
github.com/onsi/gomega v1.24.1 h1:KORJXNNTzJXzu4ScJWssJfJMnJ+2QJqhoQSRwNlze9E=
Expand Down
3 changes: 3 additions & 0 deletions pipeline-runner/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ func setPipelineArgsFromArguments(cmd *cobra.Command, pipelineArgs *model.Pipeli
cmd.Flags().StringVar(&pipelineArgs.RadixConfigFile, defaults.RadixConfigFileEnvironmentVariable, "", "Radix config file name. Example: /workspace/radixconfig.yaml")
cmd.Flags().StringVar(&pipelineArgs.ImageTag, defaults.RadixImageTagEnvironmentVariable, "latest", "Docker image tag")
cmd.Flags().StringVar(&pipelineArgs.LogLevel, defaults.LogLevel, "INFO", "Log level: ERROR, INFO (default), DEBUG")
cmd.Flags().StringVar(&pipelineArgs.Builder.ResourcesLimitsMemory, defaults.OperatorAppBuilderResourcesLimitsMemoryEnvironmentVariable, "800M", "Image builder resource limit memory")
cmd.Flags().StringVar(&pipelineArgs.Builder.ResourcesRequestsCPU, defaults.OperatorAppBuilderResourcesRequestsCPUEnvironmentVariable, "800m", "Image builder resource requests CPU")
cmd.Flags().StringVar(&pipelineArgs.Builder.ResourcesRequestsMemory, defaults.OperatorAppBuilderResourcesRequestsMemoryEnvironmentVariable, "5000M", "Image builder resource requests memory")
var useCache string
cmd.Flags().StringVar(&useCache, defaults.RadixUseCacheEnvironmentVariable, "0", "Use cache")
var pushImage string
Expand Down
8 changes: 8 additions & 0 deletions pipeline-runner/model/pipelineInfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ type PipelineInfo struct {
SourceDeploymentGitBranch string
}

// Builder Holds info about the builder arguments
type Builder struct {
ResourcesLimitsMemory string
ResourcesRequestsCPU string
ResourcesRequestsMemory string
}

// PipelineArguments Holds arguments for the pipeline
type PipelineArguments struct {
PipelineType string
Expand Down Expand Up @@ -102,6 +109,7 @@ type PipelineArguments struct {
ImageTagNames map[string]string
LogLevel string
AppName string
Builder Builder
}

// InitPipeline Initialize pipeline with step implementations
Expand Down
9 changes: 6 additions & 3 deletions pipeline-runner/steps/build_acr.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,10 +279,13 @@ func createACRBuildContainers(appName string, pipelineInfo *model.PipelineInfo,
componentImage.Context, componentImage.Dockerfile, componentImage.ImagePath,
clusterTypeImage, clusterNameImage)
container.Command = containerCommand
resource := map[corev1.ResourceName]resource.Quantity{
corev1.ResourceMemory: resource.MustParse("800M"),
container.Resources.Requests = map[corev1.ResourceName]resource.Quantity{
corev1.ResourceCPU: resource.MustParse(pipelineInfo.PipelineArguments.Builder.ResourcesRequestsCPU),
corev1.ResourceMemory: resource.MustParse(pipelineInfo.PipelineArguments.Builder.ResourcesRequestsMemory),
}
container.Resources.Limits = map[corev1.ResourceName]resource.Quantity{
corev1.ResourceMemory: resource.MustParse(pipelineInfo.PipelineArguments.Builder.ResourcesLimitsMemory),
}
container.Resources.Requests = resource
}
containers = append(containers, container)
}
Expand Down
6 changes: 2 additions & 4 deletions pkg/apis/application/application_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,8 @@ func TestOnSync_LimitsDefined_LimitsSet(t *testing.T) {
// Setup
tu, client, kubeUtil, radixClient := setupTest()
defer os.Clearenv()
os.Setenv(defaults.OperatorAppLimitDefaultCPUEnvironmentVariable, "0.5")
os.Setenv(defaults.OperatorAppLimitDefaultMemoryEnvironmentVariable, "300M")
os.Setenv(defaults.OperatorAppLimitDefaultReqestCPUEnvironmentVariable, "0.25")
os.Setenv(defaults.OperatorAppLimitDefaultRequestCPUEnvironmentVariable, "0.25")
os.Setenv(defaults.OperatorAppLimitDefaultRequestMemoryEnvironmentVariable, "256M")

// Test
Expand All @@ -244,9 +243,8 @@ func TestOnSync_NoLimitsDefined_NoLimitsSet(t *testing.T) {
// Setup
tu, client, kubeUtil, radixClient := setupTest()
defer os.Clearenv()
os.Setenv(defaults.OperatorAppLimitDefaultCPUEnvironmentVariable, "")
os.Setenv(defaults.OperatorAppLimitDefaultMemoryEnvironmentVariable, "")
os.Setenv(defaults.OperatorAppLimitDefaultReqestCPUEnvironmentVariable, "")
os.Setenv(defaults.OperatorAppLimitDefaultRequestCPUEnvironmentVariable, "")
os.Setenv(defaults.OperatorAppLimitDefaultRequestMemoryEnvironmentVariable, "")

// Test
Expand Down
11 changes: 2 additions & 9 deletions pkg/apis/application/limitrange.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,19 @@ const (
)

func (app *Application) createLimitRangeOnAppNamespace(namespace string) error {
defaultCPULimit := defaults.GetDefaultCPULimitForAppNamespace()
defaultMemoryLimit := defaults.GetDefaultMemoryLimitForAppNamespace()
defaultCPURequest := defaults.GetDefaultCPURequestForAppNamespace()
defaultMemoryRequest := defaults.GetDefaultMemoryRequestForAppNamespace()

// If not all limits are defined, then don't put any limits on namespace
if defaultCPULimit == nil ||
defaultMemoryLimit == nil ||
if defaultMemoryLimit == nil ||
defaultCPURequest == nil ||
defaultMemoryRequest == nil {
log.Warningf("Not all limits are defined for the Operator, so no limitrange will be put on namespace %s", namespace)
return nil
}

limitRange := app.kubeutil.BuildLimitRange(namespace,
limitRangeName, app.registration.Name,
*defaultCPULimit,
*defaultMemoryLimit,
*defaultCPURequest,
*defaultMemoryRequest)
limitRange := app.kubeutil.BuildLimitRange(namespace, limitRangeName, app.registration.Name, defaultMemoryLimit, defaultCPURequest, defaultMemoryRequest)

return app.kubeutil.ApplyLimitRange(namespace, limitRange)
}
1 change: 0 additions & 1 deletion pkg/apis/batch/syncer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ func (s *syncerTestSuite) SetupTest() {
s.promClient = prometheusfake.NewSimpleClientset()
s.kubeUtil, _ = kube.New(s.kubeClient, s.radixClient, secretproviderfake.NewSimpleClientset())
s.T().Setenv(defaults.OperatorEnvLimitDefaultMemoryEnvironmentVariable, "1500Mi")
s.T().Setenv(defaults.OperatorEnvLimitDefaultCPUEnvironmentVariable, "2000m")
s.T().Setenv(defaults.OperatorRollingUpdateMaxUnavailable, "25%")
s.T().Setenv(defaults.OperatorRollingUpdateMaxSurge, "25%")
}
Expand Down
39 changes: 23 additions & 16 deletions pkg/apis/defaults/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,17 @@ import (
const (
OperatorDefaultUserGroupEnvironmentVariable = "RADIXOPERATOR_DEFAULT_USER_GROUP"
OperatorEnvLimitDefaultMemoryEnvironmentVariable = "RADIXOPERATOR_APP_ENV_LIMITS_DEFAULT_MEMORY"
OperatorEnvLimitDefaultCPUEnvironmentVariable = "RADIXOPERATOR_APP_ENV_LIMITS_DEFAULT_CPU"
OperatorEnvLimitDefaultRequestMemoryEnvironmentVariable = "RADIXOPERATOR_APP_ENV_LIMITS_DEFAULT_REQUEST_MEMORY"
OperatorEnvLimitDefaultReqestCPUEnvironmentVariable = "RADIXOPERATOR_APP_ENV_LIMITS_DEFAULT_REQUEST_CPU"
OperatorEnvLimitDefaultRequestCPUEnvironmentVariable = "RADIXOPERATOR_APP_ENV_LIMITS_DEFAULT_REQUEST_CPU"

OperatorAppLimitDefaultMemoryEnvironmentVariable = "RADIXOPERATOR_APP_LIMITS_DEFAULT_MEMORY"
OperatorAppLimitDefaultCPUEnvironmentVariable = "RADIXOPERATOR_APP_LIMITS_DEFAULT_CPU"
OperatorAppLimitDefaultRequestMemoryEnvironmentVariable = "RADIXOPERATOR_APP_LIMITS_DEFAULT_REQUEST_MEMORY"
OperatorAppLimitDefaultReqestCPUEnvironmentVariable = "RADIXOPERATOR_APP_LIMITS_DEFAULT_REQUEST_CPU"
)
OperatorAppLimitDefaultRequestCPUEnvironmentVariable = "RADIXOPERATOR_APP_LIMITS_DEFAULT_REQUEST_CPU"

// GetDefaultCPULimitForAppNamespace Gets the default container CPU limit for app namespaces defined as an environment variable
func GetDefaultCPULimitForAppNamespace() *resource.Quantity {
return getQuantityFromEnvironmentVariable(OperatorAppLimitDefaultCPUEnvironmentVariable)
}
OperatorAppBuilderResourcesLimitsMemoryEnvironmentVariable = "RADIXOPERATOR_APP_BUILDER_RESOURCES_LIMITS_MEMORY"
OperatorAppBuilderResourcesRequestsMemoryEnvironmentVariable = "RADIXOPERATOR_APP_BUILDER_RESOURCES_REQUESTS_MEMORY"
OperatorAppBuilderResourcesRequestsCPUEnvironmentVariable = "RADIXOPERATOR_APP_BUILDER_RESOURCES_REQUESTS_CPU"
)

// GetDefaultMemoryLimitForAppNamespace Gets the default container memory limit for app namespaces defined as an environment variable
func GetDefaultMemoryLimitForAppNamespace() *resource.Quantity {
Expand All @@ -33,34 +30,44 @@ func GetDefaultMemoryLimitForAppNamespace() *resource.Quantity {

// GetDefaultCPURequestForAppNamespace Gets the default container CPU request for app namespaces defined as an environment variable
func GetDefaultCPURequestForAppNamespace() *resource.Quantity {
return getQuantityFromEnvironmentVariable(OperatorAppLimitDefaultReqestCPUEnvironmentVariable)
return getQuantityFromEnvironmentVariable(OperatorAppLimitDefaultRequestCPUEnvironmentVariable)
}

// GetDefaultMemoryRequestForAppNamespace Gets the default container memory request for app namespaces defined as an environment variable
func GetDefaultMemoryRequestForAppNamespace() *resource.Quantity {
return getQuantityFromEnvironmentVariable(OperatorAppLimitDefaultRequestMemoryEnvironmentVariable)
}

// GetDefaultCPULimit Gets the default container CPU limit defined as an environment variable
func GetDefaultCPULimit() *resource.Quantity {
return getQuantityFromEnvironmentVariable(OperatorEnvLimitDefaultCPUEnvironmentVariable)
}

// GetDefaultMemoryLimit Gets the default container memory limit defined as an environment variable
func GetDefaultMemoryLimit() *resource.Quantity {
return getQuantityFromEnvironmentVariable(OperatorEnvLimitDefaultMemoryEnvironmentVariable)
}

// GetDefaultCPURequest Gets the default container CPU request defined as an environment variable
func GetDefaultCPURequest() *resource.Quantity {
return getQuantityFromEnvironmentVariable(OperatorEnvLimitDefaultReqestCPUEnvironmentVariable)
return getQuantityFromEnvironmentVariable(OperatorEnvLimitDefaultRequestCPUEnvironmentVariable)
}

// GetDefaultMemoryRequest Gets the default container memory request defined as an environment variable
func GetDefaultMemoryRequest() *resource.Quantity {
return getQuantityFromEnvironmentVariable(OperatorEnvLimitDefaultRequestMemoryEnvironmentVariable)
}

// GetResourcesLimitsMemoryForAppBuilderNamespace Gets the default container memory limit for builder job in app namespaces defined as an environment variable
func GetResourcesLimitsMemoryForAppBuilderNamespace() *resource.Quantity {
return getQuantityFromEnvironmentVariable(OperatorAppBuilderResourcesLimitsMemoryEnvironmentVariable)
}

// GetResourcesRequestsCPUForAppBuilderNamespace Gets the default container CPU request for builder job in app namespaces defined as an environment variable
func GetResourcesRequestsCPUForAppBuilderNamespace() *resource.Quantity {
return getQuantityFromEnvironmentVariable(OperatorAppBuilderResourcesRequestsCPUEnvironmentVariable)
}

// GetResourcesRequestsMemoryForAppBuilderNamespace Gets the default container memory request for builder job in app namespaces defined as an environment variable
func GetResourcesRequestsMemoryForAppBuilderNamespace() *resource.Quantity {
return getQuantityFromEnvironmentVariable(OperatorAppBuilderResourcesRequestsMemoryEnvironmentVariable)
}

func getQuantityFromEnvironmentVariable(envName string) *resource.Quantity {
quantityAsString := os.Getenv(envName)
if quantityAsString == "" {
Expand Down
Loading

0 comments on commit dc25475

Please sign in to comment.