Skip to content
Snippets Groups Projects
Verified Commit f9fc37f3 authored by Mark's avatar Mark
Browse files

Add enable ingress to cli tool

parent 3c479942
No related branches found
No related tags found
No related merge requests found
......@@ -77,6 +77,10 @@ def main(): # pylint: disable=too-many-statements,too-many-branches,too-many-lo
type=str,
help='hostname of the machine. If not provided for a new machine, the '
'cluster name is used.')
create_parser.add_argument(
'--prometheus-enable-ingress',
action='store_true',
help=("Use this if you want to access OpenAppStack's prometheus api from outside"))
group = create_parser.add_mutually_exclusive_group(required=True)
......@@ -301,6 +305,8 @@ def create(clus, args): # pylint: disable=too-many-branches
clus.acme_staging = True
if args.local_flux:
clus.local_flux = True
if args.prometheus_enable_ingress:
clus.prometheus_enable_ingress = True
if args.create_droplet:
clus.create_droplet(ssh_key_id=args.ssh_key_id, hostname=args.create_hostname)
if args.verbose:
......
......@@ -47,6 +47,9 @@ class Cluster:
self.local_flux = False
# Set this to False if the data needs to be (re)loaded from file
self.data_loaded = False
# Set this to true if you want to access prometheus from outside you cluster
# The prometheus api is protected by basic authentication
self.prometheus_enable_ingress = False
# Load data from inventory.yml and settings.yml
if load_data:
self.load_data()
......@@ -152,6 +155,7 @@ class Cluster:
settings['acme_staging'] = self.acme_staging
settings['local_flux'] = self.local_flux
settings['cluster_dir'] = self.cluster_dir
settings['prometheus_enable_ingress'] = self.prometheus_enable_ingress
file_contents = yaml.safe_dump(settings, default_flow_style=False)
log.debug(file_contents)
......@@ -172,6 +176,7 @@ HOSTNAME={hostname}
FQDN={domain}
LOCAL_FLUX={local_flux}
KUBECONFIG={secret_dir}/kube_config_cluster.yml
PROMETHEUS_ENABLE_INGRESS={prometheus_enable_ingress}
"""
with open(self.dotenv_file, 'w') as stream:
......@@ -182,7 +187,8 @@ KUBECONFIG={secret_dir}/kube_config_cluster.yml
hostname=self.hostname,
domain=self.domain,
local_flux=self.local_flux,
secret_dir=self.secret_dir
secret_dir=self.secret_dir,
prometheus_enable_ingress=self.prometheus_enable_ingress
))
log.info("Created %s", self.dotenv_file)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment