-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
* added exception when cluster.fqdn missing * [RELEASE] - Release version 1.11.8 * added option to continue with current context * added exception error msg * Revert "[RELEASE] - Release version 1.11.8" This reverts commit 29a5c57.
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
||
|
@@ -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' | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
jewee
Author
Contributor
|
||
'\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() | ||
|
@jewee I missed this PR. I don't think we should ever fallback to current ctx. Prompting the user is overly complex imo.
Lets just fail if ctx cannot be created out of config.
The other qn I have is: how the cluster.fqn can be missing? Is this actually a config the user can override? It shouldnt and we need to generate this fqn out of others fields automatically