-
Notifications
You must be signed in to change notification settings - Fork 300
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: Direct paging improvements (#3064)
# What this PR does * Create Direct Paging integration (with default route) when team is created with bulk_update * Create notification policies when user is created with bulk_update * If user notification policies are empty change it to Email * Minor markup and wording improvements * Add grafana queue to helm chart * Remove disabled commands for redis helm chart * Improve Dockerfile caching ## Which issue(s) this PR fixes ## Checklist - [ ] Unit, integration, and e2e (if applicable) tests updated - [ ] Documentation added (or `pr:no public docs` PR label added if not required) - [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not required)
- Loading branch information
Showing
29 changed files
with
318 additions
and
186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Ignore everything | ||
* | ||
|
||
# Allow directories | ||
!/engine | ||
!/grafana-plugin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,82 +1,116 @@ | ||
running_under_parent_tiltfile = os.getenv('TILT_PARENT', 'false') == 'true' | ||
running_under_parent_tiltfile = os.getenv("TILT_PARENT", "false") == "true" | ||
# The user/pass that you will login to Grafana with | ||
grafana_admin_user_pass = os.getenv('GRAFANA_ADMIN_USER_PASS', 'oncall') | ||
grafana_admin_user_pass = os.getenv("GRAFANA_ADMIN_USER_PASS", "oncall") | ||
# HELM_PREFIX must be "oncall-dev" as it is hardcoded in dev/helm-local.yml | ||
HELM_PREFIX="oncall-dev" | ||
HELM_PREFIX = "oncall-dev" | ||
# Use docker registery generated by ctlptl (dev/kind-config.yaml) | ||
DOCKER_REGISTRY="localhost:63628/" | ||
DOCKER_REGISTRY = "localhost:63628/" | ||
|
||
if not running_under_parent_tiltfile: | ||
# Load the custom Grafana extensions | ||
v1alpha1.extension_repo(name='grafana-tilt-extensions', | ||
ref='main', | ||
url='https://github.com/grafana/tilt-extensions') | ||
v1alpha1.extension(name='grafana', repo_name='grafana-tilt-extensions', repo_path='grafana') | ||
v1alpha1.extension_repo( | ||
name="grafana-tilt-extensions", | ||
ref="main", | ||
url="https://github.com/grafana/tilt-extensions", | ||
) | ||
v1alpha1.extension( | ||
name="grafana", repo_name="grafana-tilt-extensions", repo_path="grafana" | ||
) | ||
|
||
load('ext://grafana', 'grafana') | ||
load('ext://configmap', 'configmap_create') | ||
load("ext://grafana", "grafana") | ||
load("ext://configmap", "configmap_create") | ||
load("ext://docker_build_sub", "docker_build_sub") | ||
|
||
# Tell ops-devenv/Tiltifle where our plugin.json file lives | ||
plugin_file = os.path.abspath('grafana-plugin/src/plugin.json') | ||
plugin_file = os.path.abspath("grafana-plugin/src/plugin.json") | ||
|
||
|
||
def plugin_json(): | ||
return plugin_file | ||
|
||
|
||
allow_k8s_contexts(["kind-kind"]) | ||
|
||
docker_build( | ||
"localhost:63628/oncall/engine:dev", | ||
"./engine", | ||
target = 'prod', | ||
live_update=[ | ||
sync('./engine/', '/etc/app'), | ||
run('cd /etc/app && pip install -r requirements.txt', | ||
trigger='./engine/requirements.txt'), | ||
] | ||
local_resource("download-cache", cmd="docker pull grafana/oncall:latest; docker tag grafana/oncall localhost:63628/grafana/oncall:latest") | ||
|
||
# Build the image including frontend folder for pytest | ||
docker_build_sub( | ||
"localhost:63628/oncall/engine:dev", | ||
context="./engine", | ||
cache_from="localhost:63628/grafana/oncall:latest", | ||
# only=["./engine", "./grafana-plugin"], | ||
ignore=["./grafana-plugin/test-results/", "./grafana-plugin/dist/", "./grafana-plugin/e2e-tests/"], | ||
child_context=".", | ||
target="dev", | ||
extra_cmds=["ADD ./grafana-plugin/src/plugin.json /etc/grafana-plugin/src/plugin.json"], | ||
live_update=[ | ||
sync("./engine/", "/etc/app"), | ||
run( | ||
"cd /etc/app && pip install -r requirements.txt", | ||
trigger="./engine/requirements.txt", | ||
), | ||
], | ||
) | ||
|
||
# Build the plugin in the background | ||
local_resource('build-ui', | ||
labels=['OnCallUI'], | ||
cmd='cd grafana-plugin && yarn install && yarn build:dev', | ||
serve_cmd='cd grafana-plugin && ONCALL_API_URL=http://oncall-dev-engine:8080 yarn watch', | ||
allow_parallel=True) | ||
local_resource( | ||
"build-ui", | ||
labels=["OnCallUI"], | ||
cmd="cd grafana-plugin && yarn install && yarn build:dev", | ||
serve_cmd="cd grafana-plugin && ONCALL_API_URL=http://oncall-dev-engine:8080 yarn watch", | ||
allow_parallel=True, | ||
) | ||
|
||
yaml = helm( | ||
'helm/oncall', | ||
name=HELM_PREFIX, | ||
values=['./dev/helm-local.yml']) | ||
yaml = helm("helm/oncall", name=HELM_PREFIX, values=["./dev/helm-local.yml"]) | ||
|
||
k8s_yaml(yaml) | ||
|
||
# Generate and load the grafana deploy yaml | ||
configmap_create('grafana-oncall-app-provisioning', | ||
namespace='default', | ||
from_file='dev/grafana/provisioning/plugins/grafana-oncall-app-provisioning.yaml') | ||
configmap_create( | ||
"grafana-oncall-app-provisioning", | ||
namespace="default", | ||
from_file="dev/grafana/provisioning/plugins/grafana-oncall-app-provisioning.yaml", | ||
) | ||
|
||
k8s_resource(objects=['grafana-oncall-app-provisioning:configmap'], | ||
new_name='grafana-oncall-app-provisioning-configmap', | ||
resource_deps = ['build-ui', 'engine'], | ||
labels=['Grafana']) | ||
k8s_resource( | ||
objects=["grafana-oncall-app-provisioning:configmap"], | ||
new_name="grafana-oncall-app-provisioning-configmap", | ||
resource_deps=["build-ui", "engine"], | ||
labels=["Grafana"], | ||
) | ||
|
||
# Use separate grafana helm chart | ||
if not running_under_parent_tiltfile: | ||
grafana(context='grafana-plugin', | ||
plugin_files = ['grafana-plugin/src/plugin.json'], | ||
namespace='default', | ||
deps = ['grafana-oncall-app-provisioning-configmap', 'build-ui', 'engine'], | ||
extra_env={ | ||
'GF_SECURITY_ADMIN_PASSWORD': 'oncall', | ||
'GF_SECURITY_ADMIN_USER': 'oncall', | ||
'GF_AUTH_ANONYMOUS_ENABLED': 'false', | ||
}, | ||
) | ||
|
||
k8s_resource(workload='celery', resource_deps=['mariadb', 'redis-master'], labels=['OnCallBackend']) | ||
k8s_resource(workload='engine', port_forwards=8080, resource_deps=['mariadb', 'redis-master'], labels=['OnCallBackend']) | ||
k8s_resource(workload='redis-master', labels=['OnCallDeps']) | ||
k8s_resource(workload='mariadb', labels=['OnCallDeps']) | ||
grafana( | ||
context="grafana-plugin", | ||
plugin_files=["grafana-plugin/src/plugin.json"], | ||
namespace="default", | ||
deps=["grafana-oncall-app-provisioning-configmap", "build-ui", "engine"], | ||
extra_env={ | ||
"GF_SECURITY_ADMIN_PASSWORD": "oncall", | ||
"GF_SECURITY_ADMIN_USER": "oncall", | ||
"GF_AUTH_ANONYMOUS_ENABLED": "false", | ||
}, | ||
) | ||
|
||
k8s_resource( | ||
workload="celery", | ||
resource_deps=["mariadb", "redis-master"], | ||
labels=["OnCallBackend"], | ||
) | ||
k8s_resource( | ||
workload="engine", | ||
port_forwards=8080, | ||
resource_deps=["mariadb", "redis-master"], | ||
labels=["OnCallBackend"], | ||
) | ||
k8s_resource(workload="redis-master", labels=["OnCallDeps"]) | ||
k8s_resource(workload="mariadb", labels=["OnCallDeps"]) | ||
|
||
|
||
# name all tilt resources after the k8s object namespace + name | ||
def resource_name(id): | ||
return id.name.replace(HELM_PREFIX + '-', '') | ||
return id.name.replace(HELM_PREFIX + "-", "") | ||
|
||
|
||
workload_to_resource_function(resource_name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.