commit
c19cf8093d
12 changed files with 67 additions and 42 deletions
18
.github/workflows/helm_release.yml
vendored
Normal file
18
.github/workflows/helm_release.yml
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
name: helm-release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
call-update-helm-repo:
|
||||
uses: grafana/helm-charts/.github/workflows/update-helm-repo.yaml@main
|
||||
with:
|
||||
charts_dir: helm
|
||||
cr_configfile: helm/cr.yaml
|
||||
ct_configfile: helm/ct.yaml
|
||||
secrets:
|
||||
helm_repo_token: ${{ secrets.GH_BOT_ACCESS_TOKEN }}
|
||||
# See https://github.com/grafana/helm-charts/blob/main/INTERNAL.md about this key
|
||||
gpg_key_base64: ${{ secrets.HELM_SIGN_KEY_BASE64 }}
|
||||
|
|
@ -72,3 +72,7 @@ jobs:
|
|||
source_folder: "docs/sources"
|
||||
# Append ".x" to target to produce a v<major>.<minor>.x directory.
|
||||
target_folder: "content/docs/oncall/${{ steps.target.outputs.target }}.x"
|
||||
# Allow the workflow to succeed if there are no changes to commit.
|
||||
# This is only going to be true on tags as those events ignore the path
|
||||
# filter in the workflow `on.push` section.
|
||||
allow_no_changes: "true"
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ services:
|
|||
condition: service_started
|
||||
|
||||
celery:
|
||||
# TODO: change to the public image once it's public
|
||||
image: grafana/oncall
|
||||
restart: always
|
||||
command: sh -c "./celery_with_exporter.sh"
|
||||
|
|
@ -102,8 +101,8 @@ services:
|
|||
cpus: 0.5
|
||||
command: --default-authentication-plugin=mysql_native_password --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
|
||||
restart: always
|
||||
ports:
|
||||
- 3306:3306
|
||||
expose:
|
||||
- 3306
|
||||
volumes:
|
||||
- dbdata:/var/lib/mysql
|
||||
environment:
|
||||
|
|
@ -119,8 +118,8 @@ services:
|
|||
mem_limit: 100m
|
||||
cpus: 0.1
|
||||
restart: always
|
||||
ports:
|
||||
- 6379:6379
|
||||
expose:
|
||||
- 6379
|
||||
|
||||
rabbitmq:
|
||||
image: "rabbitmq:3.7.15-management"
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ class ActionCreateSerializer(serializers.ModelSerializer):
|
|||
id = serializers.CharField(read_only=True, source="public_primary_key")
|
||||
organization = serializers.HiddenField(default=CurrentOrganizationDefault())
|
||||
team_id = TeamPrimaryKeyRelatedField(required=False, allow_null=True, source="team")
|
||||
url = serializers.CharField(required=True, allow_null=False, allow_blank=False, source="webhook")
|
||||
|
||||
class Meta:
|
||||
model = CustomButton
|
||||
|
|
@ -22,7 +23,7 @@ class ActionCreateSerializer(serializers.ModelSerializer):
|
|||
"name",
|
||||
"organization",
|
||||
"team_id",
|
||||
"webhook",
|
||||
"url",
|
||||
"data",
|
||||
"user",
|
||||
"password",
|
||||
|
|
@ -31,7 +32,6 @@ class ActionCreateSerializer(serializers.ModelSerializer):
|
|||
]
|
||||
extra_kwargs = {
|
||||
"name": {"required": True, "allow_null": False, "allow_blank": False},
|
||||
"webhook": {"required": True, "allow_null": False, "allow_blank": False},
|
||||
"data": {"required": False, "allow_null": True, "allow_blank": False},
|
||||
"user": {"required": False, "allow_null": True, "allow_blank": False},
|
||||
"password": {"required": False, "allow_null": True, "allow_blank": False},
|
||||
|
|
@ -41,13 +41,13 @@ class ActionCreateSerializer(serializers.ModelSerializer):
|
|||
|
||||
validators = [UniqueTogetherValidator(queryset=CustomButton.objects.all(), fields=["name", "organization"])]
|
||||
|
||||
def validate_webhook(self, webhook):
|
||||
if webhook:
|
||||
def validate_url(self, url):
|
||||
if url:
|
||||
try:
|
||||
URLValidator()(webhook)
|
||||
URLValidator()(url)
|
||||
except ValidationError:
|
||||
raise serializers.ValidationError("Webhook is incorrect")
|
||||
return webhook
|
||||
raise serializers.ValidationError("URL is incorrect")
|
||||
return url
|
||||
return None
|
||||
|
||||
def validate_data(self, data):
|
||||
|
|
@ -74,12 +74,12 @@ class ActionCreateSerializer(serializers.ModelSerializer):
|
|||
|
||||
class ActionUpdateSerializer(ActionCreateSerializer):
|
||||
team_id = TeamPrimaryKeyRelatedField(source="team", read_only=True)
|
||||
url = serializers.CharField(required=False, allow_null=False, allow_blank=False, source="webhook")
|
||||
|
||||
class Meta(ActionCreateSerializer.Meta):
|
||||
|
||||
extra_kwargs = {
|
||||
"name": {"required": False, "allow_null": False, "allow_blank": False},
|
||||
"webhook": {"required": False, "allow_null": False, "allow_blank": False},
|
||||
"data": {"required": False, "allow_null": True, "allow_blank": False},
|
||||
"user": {"required": False, "allow_null": True, "allow_blank": False},
|
||||
"password": {"required": False, "allow_null": True, "allow_blank": False},
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ def test_get_custom_actions(
|
|||
"id": custom_action.public_primary_key,
|
||||
"name": custom_action.name,
|
||||
"team_id": None,
|
||||
"webhook": custom_action.webhook,
|
||||
"url": custom_action.webhook,
|
||||
"data": custom_action.data,
|
||||
"user": custom_action.user,
|
||||
"password": custom_action.password,
|
||||
|
|
@ -68,7 +68,7 @@ def test_get_custom_actions_filter_by_name(
|
|||
"id": custom_action.public_primary_key,
|
||||
"name": custom_action.name,
|
||||
"team_id": None,
|
||||
"webhook": custom_action.webhook,
|
||||
"url": custom_action.webhook,
|
||||
"data": custom_action.data,
|
||||
"user": custom_action.user,
|
||||
"password": custom_action.password,
|
||||
|
|
@ -122,7 +122,7 @@ def test_get_custom_action(
|
|||
"id": custom_action.public_primary_key,
|
||||
"name": custom_action.name,
|
||||
"team_id": None,
|
||||
"webhook": custom_action.webhook,
|
||||
"url": custom_action.webhook,
|
||||
"data": custom_action.data,
|
||||
"user": custom_action.user,
|
||||
"password": custom_action.password,
|
||||
|
|
@ -144,7 +144,7 @@ def test_create_custom_action(make_organization_and_user_with_token):
|
|||
|
||||
data = {
|
||||
"name": "Test outgoing webhook",
|
||||
"webhook": "https://example.com",
|
||||
"url": "https://example.com",
|
||||
}
|
||||
|
||||
response = client.post(url, data=data, format="json", HTTP_AUTHORIZATION=f"{token}")
|
||||
|
|
@ -155,7 +155,7 @@ def test_create_custom_action(make_organization_and_user_with_token):
|
|||
"id": custom_action.public_primary_key,
|
||||
"name": custom_action.name,
|
||||
"team_id": None,
|
||||
"webhook": custom_action.webhook,
|
||||
"url": custom_action.webhook,
|
||||
"data": custom_action.data,
|
||||
"user": custom_action.user,
|
||||
"password": custom_action.password,
|
||||
|
|
@ -179,13 +179,13 @@ def test_create_custom_action_invalid_data(
|
|||
|
||||
data = {
|
||||
"name": "Test outgoing webhook",
|
||||
"webhook": "invalid_url",
|
||||
"url": "invalid_url",
|
||||
}
|
||||
|
||||
response = client.post(url, data=data, format="json", HTTP_AUTHORIZATION=f"{token}")
|
||||
|
||||
assert response.status_code == status.HTTP_400_BAD_REQUEST
|
||||
assert response.data["webhook"][0] == "Webhook is incorrect"
|
||||
assert response.data["url"][0] == "URL is incorrect"
|
||||
|
||||
data = {
|
||||
"name": "Test outgoing webhook",
|
||||
|
|
@ -194,10 +194,10 @@ def test_create_custom_action_invalid_data(
|
|||
response = client.post(url, data=data, format="json", HTTP_AUTHORIZATION=f"{token}")
|
||||
|
||||
assert response.status_code == status.HTTP_400_BAD_REQUEST
|
||||
assert response.data["webhook"][0] == "This field is required."
|
||||
assert response.data["url"][0] == "This field is required."
|
||||
|
||||
data = {
|
||||
"webhook": "https://example.com",
|
||||
"url": "https://example.com",
|
||||
}
|
||||
|
||||
response = client.post(url, data=data, format="json", HTTP_AUTHORIZATION=f"{token}")
|
||||
|
|
@ -231,7 +231,7 @@ def test_update_custom_action(
|
|||
"id": custom_action.public_primary_key,
|
||||
"name": data["name"],
|
||||
"team_id": None,
|
||||
"webhook": custom_action.webhook,
|
||||
"url": custom_action.webhook,
|
||||
"data": custom_action.data,
|
||||
"user": custom_action.user,
|
||||
"password": custom_action.password,
|
||||
|
|
|
|||
5
helm/cr.yaml
Normal file
5
helm/cr.yaml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
git-repo: helm-charts
|
||||
key: Grafana Loki
|
||||
owner: grafana
|
||||
sign: true
|
||||
skip-existing: true
|
||||
12
helm/ct.yaml
Normal file
12
helm/ct.yaml
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
# See https://github.com/helm/chart-testing#configuration
|
||||
remote: origin
|
||||
target-branch: main
|
||||
chart-dirs:
|
||||
- helm
|
||||
chart-repos:
|
||||
- jetstack=https://charts.jetstack.io
|
||||
- bitnami=https://charts.bitnami.com/bitnami
|
||||
- grafana=https://grafana.github.io/helm-charts
|
||||
- ingress-nginx=https://kubernetes.github.io/ingress-nginx
|
||||
helm-extra-args: --timeout 600s
|
||||
validate-maintainers: false
|
||||
|
|
@ -8,7 +8,7 @@ type: application
|
|||
# This is the chart version. This version number should be incremented each time you make changes
|
||||
# to the chart and its templates, including the app version.
|
||||
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
||||
version: 0.1.0
|
||||
version: 1.0.0
|
||||
|
||||
# This is the version number of the application being deployed. This version number should be
|
||||
# incremented each time you make changes to the application. Versions are not expected to
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@
|
|||
value: "admin"
|
||||
- name: OSS
|
||||
value: "True"
|
||||
- name: UWSGI_LISTEN
|
||||
value: "1024"
|
||||
{{- end }}
|
||||
|
||||
{{- define "snippet.celery.env" -}}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,6 @@ metadata:
|
|||
name: {{ include "oncall.fullname" . }}-redis-external
|
||||
type: Opaque
|
||||
data:
|
||||
rabbitmq-password: {{ required "externalRedis.password is required if not redis.enabled" .Values.externalRedis.password | b64enc | quote }}
|
||||
redis-password: {{ required "externalRedis.password is required if not redis.enabled" .Values.externalRedis.password | b64enc | quote }}
|
||||
{{- end }}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,15 +0,0 @@
|
|||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: "{{ include "oncall.fullname" . }}-test-connection"
|
||||
labels:
|
||||
{{- include "oncall.labels" . | nindent 4 }}
|
||||
annotations:
|
||||
"helm.sh/hook": test
|
||||
spec:
|
||||
containers:
|
||||
- name: wget
|
||||
image: busybox
|
||||
command: ['wget']
|
||||
args: ['{{ include "oncall.fullname" . }}:{{ .Values.service.port }}']
|
||||
restartPolicy: Never
|
||||
|
|
@ -55,7 +55,7 @@ ingress:
|
|||
cert-manager.io/issuer: "letsencrypt-prod"
|
||||
|
||||
# Whether to install ingress controller
|
||||
nginx-ingress:
|
||||
ingress-nginx:
|
||||
enabled: true
|
||||
|
||||
# Install cert-manager as a part of the release
|
||||
|
|
@ -120,7 +120,7 @@ externalRabbitmq:
|
|||
redis:
|
||||
enabled: true
|
||||
|
||||
external_redis:
|
||||
externalRedis:
|
||||
host:
|
||||
password:
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue