Skip to content

Commit

Permalink
feat: add resources for team alertmanager and grafana
Browse files Browse the repository at this point in the history
  • Loading branch information
CasLubbers committed Nov 22, 2024
1 parent b58a961 commit 0873144
Show file tree
Hide file tree
Showing 6 changed files with 121 additions and 6 deletions.
8 changes: 8 additions & 0 deletions helmfile.d/helmfile-60.teams.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ releases:
pipeline: otomi-task-teams
values:
- ../values/tekton-dashboard/tekton-dashboard-teams.gotmpl
- resources:
{{- $teamApps.tekton.resources.dashboard | toYaml | nindent 10 }}
- name: prometheus-{{ $teamId }}
installed: {{ or ($team | get "managedMonitoring.grafana" false) ($team | get "managedMonitoring.alertmanager" false) }}
namespace: team-{{ $teamId }}
Expand All @@ -66,6 +68,8 @@ releases:
sidecar.istio.io/inject: "true"
labels:
prometheus: system
resources:
{{- $teamApps.alertmanager.resources | toYaml | nindent 14 }}
# to do: load slackTpl and opsgenieTpl only if alerts.receicers = true
config: {{- tpl (readFile "../helmfile.d/snippets/alertmanager-teams.gotmpl") (dict "instance" $team "root" $v "slackTpl" $slackTpl "opsgenieTpl" $opsgenieTpl) | nindent 12 }}
defaultRules:
Expand All @@ -78,6 +82,8 @@ releases:
prometheusSpec: {}
grafana:
enabled: {{ $team | get "managedMonitoring.grafana" false }}
resources:
{{- $teamApps.grafana.resources.grafana | toYaml | nindent 12 }}
namespaceOverride: null # team-{{ $teamId }}
nameOverride: {{ $teamId }}-po-grafana
fullnameOverride: {{ $teamId }}-po-grafana
Expand All @@ -100,6 +106,8 @@ releases:
enabled: true
label: release
labelValue: grafana-dashboards-{{ $teamId }}
resources:
{{- $teamApps.grafana.resources.sidecar | toYaml | nindent 14 }}
additionalDataSources:
- name: Prometheus-platform
editable: false
Expand Down
31 changes: 31 additions & 0 deletions helmfile.d/snippets/defaults.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,39 @@ environments:
{{- range $team := $teams }}
{{ $team }}:
apps:
alertmanager:
resources:
limits:
cpu: 200m
memory: 256Mi
requests:
cpu: 10m
memory: 64Mi
grafana:
resources:
grafana:
limits:
cpu: "1"
memory: 1Gi
requests:
cpu: 10m
memory: 128Mi
sidecar:
limits:
cpu: 500m
memory: 256Mi
requests:
cpu: 10m
memory: 128Mi
tekton:
resources:
dashboard:
limits:
cpu: 100m
memory: 128Mi
requests:
cpu: 10m
memory: 64Mi
buildpacksTask:
limits:
cpu: "2"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
"validate-templates:all": "set -e; i=28; while [ $i -le 31 ]; do NODE_ENV=test binzx/otomi validate-templates -k 1.$i; i=$(($i+1)); done",
"validate-values": "ENV_DIR=$PWD/tests/fixtures NODE_ENV=test binzx/otomi validate-values",
"bootstrap-dev": "rm -rf /tmp/otomi-bootstrap-dev; CI=1 VALUES_INPUT=$PWD/tests/bootstrap/input.yaml ENV_DIR=/tmp/otomi-bootstrap-dev binzx/otomi bootstrap",
"bootstrap-dev-with-repo": "CI=1 ENV_DIR=/tmp/otomi-bootstrap-dev binzx/otomi bootstrap"
"bootstrap-dev-with-repo": "CI=1 ENV_DIR=/tmp/otomi-bootstrap-dev VALUES_INPUT=$PWD/tests/bootstrap/input.yaml binzx/otomi bootstrap"
},
"standard-version": {
"skip": {
Expand Down
63 changes: 63 additions & 0 deletions tests/bootstrap/input.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,66 @@ teamConfig:
networkPolicy:
egressPublic: true
ingressPrivate: true
builds:
- name: nodejs-hello-world
tag: v0.0.1
trigger: false
mode:
docker:
repoUrl: https://github.com/redkubes/nodejs-helloworld
revision: HEAD
path: ./Docker
type: docker
- name: demo-java-maven
tag: v0.0.1
trigger: false
mode:
buildpacks:
repoUrl: https://github.com/buildpacks/samples
revision: HEAD
path: apps/java-maven
type: buildpacks
- name: demo-java-trigger
tag: v_0_0_1
trigger: true
mode:
docker:
repoUrl: https://github.com/buildpacks/samples
revision: HEAD
path: ./Docker
type: docker
services:
- headers:
response:
set: []
id: 78595314-cdaf-4b60-acc2-3b1a7f80fe2b
ingressClassName: platform
name: httpbin
ownHost: true
port: 80
type: public
- id: a106eb22-8c06-41b6-ab15-97aafb0888b5
ingressClassName: platform
name: nginx-deployment
ownHost: true
paths: []
port: 80
type: public
- id: 91f6af98-ad8e-4111-b916-cf1b5bdcafb0
ingressClassName: platform
ksvc:
predeployed: true
name: nginx-ksvc
ownHost: true
paths: []
port: 80
type: public
workloads:
- name: nodejs-helloworld
url: https://github.com/redkubes/nodejs-helloworld.git
path: ./
revision: HEAD
- name: httpbin
path: charts/httpbin
revision: HEAD
url: https://github.com/linode/apl-core.git
18 changes: 16 additions & 2 deletions values-schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1087,14 +1087,28 @@ definitions:
$ref: '#/definitions/alerts'
apps:
additionalProperties: true
alertmanager:
additionalProperties: false
properties:
resources:
$ref: '#/definitions/resources'
grafana:
additionalProperties: false
properties:
additionalProperties: false
properties:
grafana:
$ref: '#/definitions/resources'
sidecar:
$ref: '#/definitions/resources'
tekton:
additionalProperties: false
properties:
_rawValues:
$ref: '#/definitions/rawValues'
resources:
additionalProperties: false
properties:
dashboard:
$ref: '#/definitions/resources'
buildpacksTask:
$ref: '#/definitions/resources'
gitCloneTask:
Expand Down
5 changes: 2 additions & 3 deletions values/tekton-dashboard/tekton-dashboard-teams.gotmpl
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{{- $teamId := .Release.Labels.team }}
{{- $v := .Values }}
{{- $t := $v.apps.tekton }}

resources: {{- $t.resources.dashboard | toYaml | nindent 2 }}
{{- $custom := dig "resources" "dashboard" "enabled" false $v }}

teamId: {{ $teamId }}

Expand All @@ -17,4 +16,4 @@ args:
- --namespace=team-{{ $teamId }}
- --namespaces=team-{{ $teamId }}
- --stream-logs=true
- --external-logs=
- --external-logs=

0 comments on commit 0873144

Please sign in to comment.