Skip to content

Commit

Permalink
Adding Primaza-Identity-Namespace
Browse files Browse the repository at this point in the history
Signed-off-by: Feny Mehta <[email protected]>

Lint Python fix

Signed-off-by: Feny Mehta <[email protected]>

Test-1

Signed-off-by: Feny Mehta <[email protected]>

Test2

Signed-off-by: Feny Mehta <[email protected]>

Test3

Signed-off-by: Feny Mehta <[email protected]>

Lint Python test fix

Signed-off-by: Feny Mehta <[email protected]>

test-5

Signed-off-by: Feny Mehta <[email protected]>
  • Loading branch information
fbm3307 committed Aug 3, 2023
1 parent 317ab12 commit 43ab270
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
11 changes: 11 additions & 0 deletions scripts/src/primazactl/cmd/join/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from primazactl.primazamain.constants import DEFAULT_TENANT
from primazactl.version import __primaza_version__
from primazactl.utils import settings
from primazactl.primazaworker.constants import WORKER_NAMESPACE


def add_group(parser: argparse.ArgumentParser, parents=[]):
Expand Down Expand Up @@ -78,6 +79,15 @@ def add_args_join(parser: argparse.ArgumentParser):
type=str,
default=None)

parser.add_argument(
"-j", "--primaza-identity-namespace",
dest="primaza_identity_namespace",
required=False,
help=f"name to be used for the WorkerNamespace that will be created,\
default: {WORKER_NAMESPACE}.",
type=kubernetes_name,
default=WORKER_NAMESPACE)

# main
parser.add_argument(
"-d", "--cluster-environment",
Expand Down Expand Up @@ -147,6 +157,7 @@ def join_cluster(args):
cluster_environment=args.cluster_environment,
tenant=args.tenant,
internal_url=args.internal_url,
pidentity_namespace=args.primaza_identity_namespace,
).install_worker()

if settings.output_active():
Expand Down
11 changes: 6 additions & 5 deletions scripts/src/primazactl/primazaworker/workercluster.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from .constants import WORKER_NAMESPACE
from primazactl.primazamain.maincluster import MainCluster
from primazactl.primaza.primazacluster import PrimazaCluster
from primazactl.kubectl.constants import WORKER_CONFIG
Expand All @@ -17,6 +16,7 @@ class WorkerCluster(PrimazaCluster):
cluster_environment: str = None
primaza_main: MainCluster = None
manifest: Manifest = None
pidentity_namespace: str = None

def __init__(
self,
Expand All @@ -29,23 +29,24 @@ def __init__(
cluster_environment: str,
tenant: str,
internal_url: str | None = None,
pidentity_namespace: str | None = None,
):

sa_name, _ = names.get_identity_names(tenant, cluster_environment)
super().__init__(WORKER_NAMESPACE,
context,
super().__init__(context,
sa_name,
cluster_environment,
kubeconfig_file,
config_file,
cluster_environment,
tenant,
internal_url)
internal_url,
pidentity_namespace)

self.primaza_main = primaza_main
self.environment = environment
self.version = version
self.manifest = Manifest(WORKER_NAMESPACE, config_file,
self.manifest = Manifest(pidentity_namespace, config_file,
version, WORKER_CONFIG)

kcw = KubeConfigWrapper(context, self.kube_config_file)
Expand Down

0 comments on commit 43ab270

Please sign in to comment.