Skip to content

Commit

Permalink
Merge pull request #11 from marcelovilla/add-gcp-support
Browse files Browse the repository at this point in the history
Add GCP support
  • Loading branch information
kenafoster authored May 17, 2024
2 parents 4ee142d + 691d42a commit aca7fd3
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/nebari_plugin_self_registration/__about__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.0.8"
__version__ = "0.0.9"
2 changes: 1 addition & 1 deletion src/nebari_plugin_self_registration/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class SelfRegistrationAffinitySelectorConfig(Base):
app: Optional[str] = ""
job: Optional[str] = ""


class SelfRegistrationAffinityConfig(Base):
enabled: Optional[bool] = True
selector: Union[SelfRegistrationAffinitySelectorConfig, str] = "general"
Expand Down Expand Up @@ -168,6 +167,7 @@ def input_vars(self, stage_outputs: Dict[str, Dict[str, Any]]):
else self.config.self_registration.affinity.selector
),
},
"cloud_provider": self.config.provider,
"theme": self.config.theme.jupyterhub.dict(),
}

Expand Down
1 change: 1 addition & 0 deletions src/nebari_plugin_self_registration/terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ module "self-registration" {
overrides = var.overrides
realm_id = var.realm_id
affinity = var.affinity
cloud_provider = var.cloud_provider
theme = var.theme
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ locals {
enabled = false
selector = null
}

affinity_selector_key = {
aws = "eks.amazonaws.com/nodegroup"
gcp = "cloud.google.com/gke-nodepool"
}
}

resource "kubernetes_namespace" "this" {
Expand Down Expand Up @@ -42,7 +47,7 @@ resource "helm_release" "self_registration" {
{
matchExpressions = [
{
key = "eks.amazonaws.com/nodegroup"
key = local.affinity_selector_key[var.cloud_provider]
operator = "In"
values = [local.affinity.selector.app]
}
Expand All @@ -60,7 +65,7 @@ resource "helm_release" "self_registration" {
{
matchExpressions = [
{
key = "eks.amazonaws.com/nodegroup"
key = local.affinity_selector_key[var.cloud_provider]
operator = "In"
values = [local.affinity.selector.job]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,13 @@ variable "affinity" {
}
}


variable "cloud_provider" {
type = string
}

variable "theme" {
description = "Theme configured in theme.jupyterhub"
type = map(any)
default = {}
}
}
9 changes: 9 additions & 0 deletions src/nebari_plugin_self_registration/terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,17 @@ variable "affinity" {
}
}


# GENERAL SETTINGS
# -----------------
variable "cloud_provider" {
description = "Cloud provider where Nebari is deployed to"
type = string
}

variable "theme" {
description = "Theme configured in theme.jupyterhub"
type = map(any)
default = {}

}

0 comments on commit aca7fd3

Please sign in to comment.