Skip to content

Commit 99c450f

Browse files
committed
Apply cluster configuration file handling
Signed-off-by: Toni Finger <[email protected]>
1 parent 3e5357a commit 99c450f

File tree

4 files changed

+12
-14
lines changed

4 files changed

+12
-14
lines changed

Tests/config.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ subject_root = "{subject}"
6262

6363
[subjects._.kubernetes_setup]
6464
kube_plugin = "kind"
65+
kube_plugin_config = "../playbooks/kubernetes_cluster_configs/kind_cluster_config.yaml"
6566
clusterspec = "kaas/clusterspec.yaml"
6667
clusterspec_cluster = "current-k8s-release"
6768

Tests/kaas/plugin/interface.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from abc import ABC, abstractmethod
1+
from abc import abstractmethod
22
from typing import final
33
import os
44
import os.path
@@ -8,7 +8,7 @@
88
logger = logging.getLogger("interface")
99

1010

11-
class KubernetesClusterPlugin(ABC):
11+
class KubernetesClusterPlugin():
1212
"""
1313
An abstract base class for custom Kubernetes cluster provider plugins.
1414
It represents an interface class from which the api provider-specific
@@ -21,9 +21,9 @@ class KubernetesClusterPlugin(ABC):
2121
working_directory = None
2222

2323
@final
24-
def __init__(self, config=None):
24+
def __init__(self, config_file=None):
2525
logger.info(f"Init provider plug-in of type {self.__class__.__name__}")
26-
self.config = config
26+
self.config = config_file
2727
logger.debug(self.config)
2828
self.working_directory = os.getcwd()
2929
logger.debug(f"Working from {self.working_directory}")
@@ -56,12 +56,7 @@ def create(self, name="scs-cluster", version=None, kubeconfig_filepath=None):
5656
self.cluster_name = name
5757
self.cluster_version = version
5858

59-
self._create_cluster() # TODO: maybe we do not need to use try exept here?
60-
# try:
61-
# self._create_cluster()
62-
# except Exception as e:
63-
# logging.exception(e)
64-
# self._delete_cluster()
59+
self._create_cluster()
6560

6661
if kubeconfig_filepath:
6762
shutil.move(self.kubeconfig, kubeconfig_filepath)

Tests/kaas/plugin/run_plugin.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ def init_plugin(plugin_kind, config=None):
2222
return plugin_maker(config)
2323

2424

25-
def run_plugin_create(plugin_kind, clusterspec_cluster, clusterspec):
26-
plugin = init_plugin(plugin_kind)
25+
def run_plugin_create(plugin_kind, plugin_config, clusterspec_cluster, clusterspec):
26+
plugin = init_plugin(plugin_kind, plugin_config)
2727
plugin.create(clusterspec_cluster, clusterspec[clusterspec_cluster]['branch'], os.path.abspath(clusterspec[clusterspec_cluster]['kubeconfig']))
2828

2929

@@ -44,11 +44,12 @@ def cli():
4444

4545
@cli.command()
4646
@click.argument('plugin_kind', type=click.Choice(list(PLUGIN_LOOKUP), case_sensitive=False))
47+
@click.argument('plugin_config', type=click.Path(exists=True, dir_okay=False))
4748
@click.argument('clusterspec_path', type=click.Path(exists=True, dir_okay=False))
4849
@click.argument('clusterspec_cluster', type=str, default="default")
49-
def create(plugin_kind, clusterspec_path, clusterspec_cluster):
50+
def create(plugin_kind, plugin_config, clusterspec_path, clusterspec_cluster):
5051
clusterspec = load_spec(clusterspec_path)['clusters']
51-
run_plugin_create(plugin_kind, clusterspec_cluster, clusterspec)
52+
run_plugin_create(plugin_kind, plugin_config, clusterspec_cluster, clusterspec)
5253

5354

5455
@cli.command()

Tests/scs-test-runner.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ def build_provision_command(self, subject):
9393
sys.executable, self.run_plugin_py,
9494
'create',
9595
kubernetes_setup['kube_plugin'],
96+
self.abspath(kubernetes_setup['kube_plugin_config']),
9697
self.abspath(kubernetes_setup['clusterspec']),
9798
kubernetes_setup['clusterspec_cluster'],
9899
],

0 commit comments

Comments
 (0)