Skip to content
Merged
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
22 changes: 22 additions & 0 deletions src/ops/cli/helmfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@

import logging
import os
import six
import sys

from kubernetes import config
from ops.cli.parser import SubParserConfig
from ops.hierarchical.composition_config_generator import CompositionConfigGenerator

Expand Down Expand Up @@ -87,6 +90,25 @@ def setup_kube_config(self, data):
file_location = self.generate_eks_kube_config(
cluster_name, aws_profile, region)
os.environ['KUBECONFIG'] = file_location
else:
logger.info('cluster.fqdn key missing in cluster definition'
'\n unable to generate EKS kubeconfig\n '
'looking for system kubernetes context')

try:
contexts, active_context = config.list_kube_config_contexts()
except Exception as ex:
logger.error('could not find system kubeconfig context')
logger.error(ex)
sys.exit()

logger.info('current default context is:\n %s '
'\n do you want to proceed with this context?',
active_context)
answer = six.moves.input("Only 'yes' will be accepted to approve.\n Enter a value:")
if answer != "yes":
sys.exit()


def generate_eks_kube_config(self, cluster_name, aws_profile, region):
file_location = self.get_tmp_file()
Expand Down