Skip to content

Commit

Permalink
Adding resource limits (#14)
Browse files Browse the repository at this point in the history
* Adding resource limits
  • Loading branch information
alfespa17 committed Apr 29, 2022
1 parent 8a2cb4c commit 5ec7231
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 3 deletions.
31 changes: 28 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@ api:
version: "2.1.4"
replicaCount: "1"
serviceType: "ClusterIP"
resources: #Optional
limits:
cpu: 500m
memory: 1024Mi
requests:
cpu: 200m
memory: 256Mi
properties:
databaseType: "SQL_AZURE" # Replace with "H2" (ONLY FOR TESTING), "SQL_AZURE", "POSTGRESQL" or "MYSQL"
databaseHostname: "mysuperdatabse.database.windows.net" # Replace with the real value
Expand All @@ -101,6 +108,13 @@ executor:
version: "1.5.4"
replicaCount: "1"
serviceType: "ClusterIP"
resources: #Optional
limits:
cpu: 1000m
memory: 1024Mi
requests:
cpu: 500m
memory: 256Mi
properties:
toolsRepository: "https://github.com/AzBuilder/terrakube-extensions" # Default extension repository
toolsBranch: "main" #Default branch for extensions
Expand All @@ -113,13 +127,27 @@ registry:
version: "2.1.4"
replicaCount: "1"
serviceType: "ClusterIP"
resources: #Optional
limits:
cpu: 500m
memory: 1024Mi
requests:
cpu: 200m
memory: 256Mi

## UI Properties
ui:
enabled: true
version: "0.5.0"
replicaCount: "1"
serviceType: "ClusterIP"
resources:
limits:
cpu: 500m
memory: 512Mi
requests:
cpu: 200m
memory: 256Mi

## Ingress properties
ingress:
Expand All @@ -132,7 +160,6 @@ ingress:
annotations: # This annotations can change based on requirements. The followin is an example using nginx ingress and lets encrypt
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/use-regex: "true"
nginx.ingress.kubernetes.io/enable-cors: "true"
cert-manager.io/cluster-issuer: letsencrypt
api:
enabled: true
Expand All @@ -142,7 +169,6 @@ ingress:
annotations: # This annotations can change based on requirements. The followin is an example using nginx ingress and lets encrypt
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/use-regex: "true"
nginx.ingress.kubernetes.io/enable-cors: "true"
nginx.ingress.kubernetes.io/rewrite-target: /$2
nginx.ingress.kubernetes.io/configuration-snippet: "proxy_set_header Authorization $http_authorization;"
cert-manager.io/cluster-issuer: letsencrypt
Expand All @@ -154,7 +180,6 @@ ingress:
annotations: # This annotations can change based on requirements. The followin is an example using nginx ingress and lets encrypt
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/use-regex: "true"
nginx.ingress.kubernetes.io/enable-cors: "true"
cert-manager.io/cluster-issuer: letsencrypt
```
Expand Down
3 changes: 3 additions & 0 deletions templates/deployment-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ spec:
containers:
- name: terrakube-api
image: azbuilder/api-server:{{ .Values.api.version }}
{{- if .Values.api.resources }}
resources: {{- toYaml .Values.api.resources | nindent 12 }}
{{- end }}
ports:
- containerPort: 8080
envFrom:
Expand Down
3 changes: 3 additions & 0 deletions templates/deployment-executor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ spec:
containers:
- name: terrakube-executor
image: azbuilder/executor:{{ .Values.executor.version }}
{{- if .Values.executor.resources }}
resources: {{- toYaml .Values.executor.resources | nindent 12 }}
{{- end }}
ports:
- containerPort: 8090
envFrom:
Expand Down
3 changes: 3 additions & 0 deletions templates/deployment-registry.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ spec:
containers:
- name: terrakube-registry
image: azbuilder/open-registry:{{ .Values.registry.version }}
{{- if .Values.registry.resources }}
resources: {{- toYaml .Values.registry.resources | nindent 12 }}
{{- end }}
ports:
- containerPort: 8075
envFrom:
Expand Down
3 changes: 3 additions & 0 deletions templates/deployment-ui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ spec:
containers:
- name: terrakube-ui
image: azbuilder/terrakube-ui:{{ .Values.ui.version }}
{{- if .Values.ui.resources }}
resources: {{- toYaml .Values.ui.resources | nindent 12 }}
{{- end }}
ports:
- containerPort: 8080
envFrom:
Expand Down
12 changes: 12 additions & 0 deletions values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@
"description": "Kubernetes service type",
"enum": ["ClusterIP", "NodePort", "LoadBalancer", "ExternalName"]
},
"resources": {
"type": "object"
},
"properties": {
"type": "object",
"required": ["databaseType", "databaseHostname", "databaseName", "databaseUser", "databasePassword"],
Expand Down Expand Up @@ -129,6 +132,9 @@
"description": "Kubernetes service type",
"enum": ["ClusterIP", "NodePort", "LoadBalancer", "ExternalName"]
},
"resources": {
"type": "object"
},
"properties": {
"type": "object",
"required": ["toolsRepository", "toolsBranch"],
Expand Down Expand Up @@ -172,6 +178,9 @@
"serviceType": {
"description": "Kubernetes service type",
"enum": ["ClusterIP", "NodePort", "LoadBalancer", "ExternalName"]
},
"resources": {
"type": "object"
}
}
},
Expand All @@ -194,6 +203,9 @@
"serviceType": {
"description": "Kubernetes service type",
"enum": ["ClusterIP", "NodePort", "LoadBalancer", "ExternalName"]
},
"resources": {
"type": "object"
}
}
},
Expand Down
4 changes: 4 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ api:
version: ""
replicaCount: ""
serviceType: ""
resources: {}
properties:
databaseType: ""
databaseHostname: ""
Expand All @@ -36,6 +37,7 @@ executor:
version: ""
replicaCount: ""
serviceType: ""
resources: {}
properties:
toolsRepository: "https://github.com/AzBuilder/terrakube-extensions"
toolsBranch: "main"
Expand All @@ -48,13 +50,15 @@ registry:
version: ""
replicaCount: ""
serviceType: ""
resources: {}

## UI Properties
ui:
enabled: true
version: ""
replicaCount: ""
serviceType: ""
resources: {}

## Ingress properties
ingress:
Expand Down

0 comments on commit 5ec7231

Please sign in to comment.