Skip to content

Commit

Permalink
Add ingress config option to kontena-lens addon (#995)
Browse files Browse the repository at this point in the history
  • Loading branch information
nevalla authored and jakolehm committed Jan 29, 2019
1 parent 67e980e commit 8a26743
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions non-oss/pharos_pro/addons/kontena-lens/addon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@

config_schema {
optional(:name).filled(:str?)
optional(:ingress).schema do
optional(:host).filled(:str?)
optional(:tls).schema do
optional(:enabled).filled(:bool?)
optional(:email).filled(:str?)
end
end
optional(:host).filled(:str?)
optional(:tls).schema do
optional(:enabled).filled(:bool?)
Expand Down Expand Up @@ -45,14 +52,15 @@
install {
patch_old_resource

host = config.host || "lens.#{gateway_node_ip}.nip.io"
host = config.ingress&.host || config.host || "lens.#{gateway_node_ip}.nip.io"
tls_email = config.ingress&.tls&.email || config.tls&.email
name = config.name || 'pharos-cluster'
charts_enabled = config.charts&.enabled != false
helm_repositories = config.charts&.repositories || [stable_helm_repo]
tiller_version = '2.12.2'
apply_resources(
host: host,
email: config.tls&.email,
email: tls_email,
tls_enabled: tls_enabled?,
charts_enabled: charts_enabled,
user_management: user_management_enabled?,
Expand All @@ -71,6 +79,8 @@
create_admin_user(admin_password)
message << "\nYou can sign in with the following admin credentials (you won't see these again): " + pastel.cyan("admin / #{admin_password}")
end
message << "\nWarning: `config.host` option is deprecated in favor of `config.ingress.host` option and will be removed in future." if config.host
message << "\nWarning: `config.tls` option is deprecated in favor of `config.ingress.tls` option and will be removed in future." if config.tls
post_install_message(message)
}

Expand Down Expand Up @@ -154,7 +164,7 @@ def gateway_node_ip
end

def tls_enabled?
config.tls&.enabled != false
config.ingress&.tls&.enabled != false && config.tls&.enabled != false
end

def user_management_enabled?
Expand Down

0 comments on commit 8a26743

Please sign in to comment.