-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding create namespace fxnality to reckoner to replace it in helm3 (#…
…165) * adding create namespace fxnality to reckoner to replace it in helm3 * fixing lack of install of kuberentes module, adding a test for the new option * adding docs * testing things and stuff * phew, finally found that errror * removing debug line * making suggested chnanges
- Loading branch information
ejether
authored
Jan 3, 2020
1 parent
6f87be3
commit c214325
Showing
14 changed files
with
166 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,9 @@ | ||
source "$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"/setup_common.sh | ||
|
||
echo "Installing Helm" | ||
curl -sL https://get.helm.sh/helm-v3.0.1-linux-amd64.tar.gz | tar xzv linux-amd64/helm | ||
curl -sL https://get.helm.sh/helm-v3.0.2-linux-amd64.tar.gz | tar xzv linux-amd64/helm | ||
sudo mv linux-amd64/helm /usr/local/bin/helm | ||
rm -rf linux-amd64 | ||
helm version | ||
|
||
kubectl create namespace infra | ||
kubectl create namespace test | ||
kubectl create namespace testing | ||
kubectl create namespace polaris | ||
kubectl create namespace another-polaris | ||
kubectl create namespace a-different-one | ||
kubectl create namespace redis-test-namespace | ||
|
||
helm repo add stable https://kubernetes-charts.storage.googleapis.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
namespace: farglebargle #namespace to install the chart in, defaults to 'kube-system' | ||
repositories: | ||
test_repo: | ||
url: https://kubernetes-charts.storage.googleapis.com | ||
incubator: | ||
url: https://kubernetes-charts-incubator.storage.googleapis.com | ||
fairwinds-stable: | ||
url: https://charts.fairwinds.com/stable | ||
fairwinds-incubator: | ||
url: https://charts.fairwinds.com/incubator | ||
minimum_versions: #set minimum version requirements here | ||
helm: 0.0.0 | ||
reckoner: 0.0.0 | ||
charts: | ||
namespace-test: | ||
repository: stable | ||
chart: nginx-ingress | ||
namespace: farglebargle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
|
||
import logging | ||
import traceback | ||
|
||
from kubernetes import client, config | ||
|
||
|
||
def create_namespace(namespace): | ||
""" Create a namespace in the configured kubernetes cluster if it does not already exist | ||
Arguments: | ||
namespace: The namespace to create | ||
Returns True on success | ||
Raises error in case of failure | ||
""" | ||
try: | ||
config.load_kube_config() | ||
v1 = client.CoreV1Api() | ||
response = v1.create_namespace( | ||
client.V1Namespace( | ||
metadata=client.V1ObjectMeta(name=namespace) | ||
) | ||
) | ||
return True | ||
except Exception as e: | ||
logging.error("Unable to create namespace in cluster! {}".format(e)) | ||
logging.debug(traceback.format_exc()) | ||
raise e | ||
|
||
|
||
def list_namespace_names(): | ||
""" Lists namespaces in the configured kubernetes cluster. | ||
No arguments | ||
Returns list | ||
""" | ||
try: | ||
config.load_kube_config() | ||
v1 = client.CoreV1Api() | ||
namespaces = v1.list_namespace() | ||
return [namespace.metadata.name for namespace in namespaces.items] | ||
except Exception as e: | ||
logging.error("Unable to get namespaces in cluster! {}".format(e)) | ||
logging.debug(traceback.format_exc()) | ||
raise e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.