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

introduce lua script #166

Open
wants to merge 1 commit into
base: master
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
135 changes: 135 additions & 0 deletions plural/helm/console/values.yaml.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
output = {
global={
application={
links={
{ description= "console web ui",
url=Var.Values.console_dns
}
}
}
},
enabled=true,
provider=Var.Provider,
license=Var.License,
ingress={
console_dns=Var.Values.console_dns,
},
serviceAccount= {
create=true,
annotations={
['eks.amazonaws.com/role-arn']="arn:aws:iam::" .. Var.Project .. ":role/" ..Var.Cluster .. "-console"
},
},
secrets={
jwt=dedupe(Var, "console.secrets.jwt", randAlphaNum(20)),
admin_name=default("someone", Var.Values.admin_name),
admin_email=dedupe(Var, "console.secrets.admin_email", default("[email protected]", Var.Config.Email)),
admin_password=dedupe(Var, "console.secrets.admin_password", randAlphaNum(20)),
cluster_name=Var.Cluster,
erlang=dedupe(Var, "console.secrets.erlang", randAlphaNum(14)),
id_rsa=ternary(Var.Values.private_key, dedupe(Var, "console.secrets.id_rsa", ""), hasKey (Var.Values, "private_key")),
id_rsa_pub=ternary(Var.Values.public_key, dedupe(Var, "console.secrets.id_rsa_pub", ""), hasKey(Var.Values, "public_key")),
ssh_passphrase=ternary(Var.Values.passphrase, dedupe(Var, "console.secrets.ssh_passphrase", ""), hasKey(Var.Values, "passphrase")),
git_access_token=ternary(Var.Values.access_token, dedupe(Var, "console.secrets.git_access_token", ""), hasKey(Var.Values, "access_token")),
git_user=default("console", Var.Values.git_user),
git_email=default("[email protected]", Var.Values.git_email),
git_url="",
repo_root="",
branch_name="",
config="",
key="",
},
extraEnv={}
}

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

if Var.Provider == "google" then
output.serviceAccount.create = false
end

if Var.Configuration then
if Var.Configuration.loki then
output.extraEnv={
{
name= "LOKI_HOST",
value= 'http://loki-loki-distributed-gateway.loki'
}
}
end
end

if Var.Provider == "azure" then
output.podLabels={
["aadpodidbinding"]="console"
}
output.consoleIdentityId=importValue("Terraform", "console_msi_id")
output.consoleIdentityClientId=importValue("Terraform", "console_msi_client_id")
table.insert(output.extraEnv,
{
name="ARM_USE_MSI",
value = 'true'

}
)
table.insert(output.extraEnv,
{
name="ARM_SUBSCRIPTION_ID",
value=Var.Context.SubscriptionId
}
)
table.insert(output.extraEnv,
{
name="ARM_TENANT_ID",
value= Var.Context.TenantId
}
)
end

if Var.OIDC ~= nil then
output.secrets.plural_client_id=Var.OIDC.ClientId
output.secrets.plural_client_secret=Var.OIDC.ClientSecret
end

if Var.Values.is_demo then
output.secrets.is_demo=Var.Values.is_demo
end

if Var.Values.console_dns then
local gitUrl=dig("console", "secrets", "git_url", "default", Var)
local identity=pathJoin(repoRoot(), ".plural-crypt", "identity")
if gitUrl == "default" or gitUrl == "" then
output.secrets.git_url=repoUrl()
else
output.secrets.git_url=gitUrl
end

output.secrets.repo_root=repoName()
output.secrets.branch_name=branchName()
output.secrets.config=readFile(pathJoin(homeDir(),".plural","config.yml"))

if fileExists(identity) then
output.secrets.identity=readFile(identity)
elseif dig("console", "secrets", "identity", "default", Var) ~= "default" then
output.secrets.identity= Var.console.secrets.identity
end
output.secrets.key=dedupe(Var, "console.secrets.key", readFile(pathJoin(homeDir(), ".plural", "key")))
end

if Var.Values.testBase then
if Var.Values.testBase.enabled then
output["test-base"]={
enabled=true,
secret={
CYPRESS_EMAIL=Var.Values.testBase.cypressEmail,
CYPRESS_PASSWORD=Var.Values.testBase.cypressPassword,
CYPRESS_BASE_URL= "https://" .. Var.Values.console_dns .. "/",
}
}
end
end
105 changes: 0 additions & 105 deletions plural/helm/console/values.yaml.tpl

This file was deleted.