Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add lua support #485

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion grafana/helm/grafana/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: grafana
description: A Helm chart for grafana on plural
type: application
version: 0.2.19
version: 0.2.20
appVersion: "9.2.5"
dependencies:
- name: grafana
Expand Down
119 changes: 119 additions & 0 deletions grafana/helm/grafana/values.yaml.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
output = {
global={
application={
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should definitely have helper functions for these

links={
{ description= "grafana web ui",
url=Var.Values.hostname
}
}
}
},
grafana={
admin={
password=dedupe(Var, "grafana.grafana.admin.password", randAlphaNum(14)),
user='admin'
},
ingress={
annotations={},
tls={
{
hosts={
Var.Values.hostname,
},
secretName='grafana-tls'
}
},
hosts={
Var.Values.hostname
}
},
["grafana.ini"]={
server={
root_url="https://" .. default("grafana.onplural.sh", Var.Values.hostname),
},
},
},
}

if Var.Provider == "kind" then
output.grafana.ingress.annotations = {
['external-dns.alpha.kubernetes.io/target']='127.0.0.1'
}
end

if Var.SMTP ~= nil then
output.secret={
smtp={
enabled=true,
user=Var.SMTP.User,
password=Var.SMTP.Password
}
}
output.grafana.smtp={
existingSecret='grafana-smtp-credentials',
userKey= "user",
passwordKey= "password",
}
grafana_ini = output.grafana["grafana.ini"]
grafana_ini.smtp={
enabled=true,
host= Var.SMTP.Server .. ":" .. Var.SMTP.Port,
from_address=Var.SMTP.Sender
}
end

if Var.OIDC ~= nil then
grafana_ini = output.grafana["grafana.ini"]
grafana_ini["auth.generic_oauth"]={
name='Plural',
enabled=true,
allow_sign_up=true,
client_id=Var.OIDC.ClientId,
client_secret=Var.OIDC.ClientSecret,
scopes='openid profile',
auth_url=Var.OIDC.Configuration.AuthorizationEndpoint,
token_url=Var.OIDC.Configuration.TokenEndpoint,
api_url=Var.OIDC.Configuration.UserinfoEndpoint,
role_attribute_path="null",
groups_attribute_path='groups'
}
end

if Var.Configuration then
if Var.Configuration.loki then
output.grafana.datasources={
["datasources.yaml"]={
apiVersion=1,
deleteDatasources={
{
name='Loki',
orgId=1
}
}
}
}
end
end

if Var.Values.usePostgres then
output.grafana.env={
['GF_DATABASE_TYPE']='postgres',
['GF_DATABASE_HOST']='plural-postgres-grafana',
['GF_DATABASE_NAME']='grafana',
['GF_DATABASE_USER']='grafana',
['GF_DATABASE_SSL_MODE']='require'
}

output.grafana.envValueFrom={
GF_DATABASE_PASSWORD={
secretKeyRef={
name='grafana.plural-postgres-grafana.credentials.postgresql.acid.zalan.do',
key='password'
}
}
}

output.postgres={
enabled=true
}
end
81 changes: 0 additions & 81 deletions grafana/helm/grafana/values.yaml.tpl

This file was deleted.