Merge pull request #1771 from coreos-inc/kubernetes-save-error
Make sure the Quay Enterprise Kubernetes namespace exists
This commit is contained in:
commit
480d890442
1 changed files with 11 additions and 2 deletions
|
@ -58,11 +58,20 @@ class KubernetesConfigProvider(FileConfigProvider):
|
|||
|
||||
def _assert_success(self, response):
|
||||
if response.status_code != 200:
|
||||
logger.error('K8s API call failed with response: %s => %s', response.status_code,
|
||||
logger.error('Kubernetes API call failed with response: %s => %s', response.status_code,
|
||||
response.text)
|
||||
raise CannotWriteConfigException('K8s API call failed. Please report this to support')
|
||||
raise CannotWriteConfigException('Kubernetes API call failed: %s' % response.text)
|
||||
|
||||
def _update_secret_file(self, filename, value):
|
||||
# Check first that the namespace for Quay Enterprise exists. If it does not, report that
|
||||
# as an error, as it seems to be a common issue.
|
||||
namespace_url = 'namespaces/%s' % (QE_NAMESPACE)
|
||||
response = self._execute_k8s_api('GET', namespace_url)
|
||||
if response.status_code != 200:
|
||||
msg = 'A Kubernetes namespace with name `%s` must be created to save config' % QE_NAMESPACE
|
||||
raise CannotWriteConfigException(msg)
|
||||
|
||||
# Save the secret to the namespace.
|
||||
secret_data = {}
|
||||
secret_data[filename] = base64.b64encode(value)
|
||||
|
||||
|
|
Reference in a new issue