Skip to content

Commit

Permalink
Merge pull request #5 from MetroStar/update-logo
Browse files Browse the repository at this point in the history
Update with new logo and styling for CDAO
  • Loading branch information
kenafoster authored Jan 19, 2024
2 parents 83b21a0 + e8d62f9 commit e064005
Show file tree
Hide file tree
Showing 11 changed files with 119 additions and 17 deletions.
Binary file modified docker/app/static/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 7 additions & 7 deletions docker/app/static/styles.css
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
header {
height: 56px;
height: 41px;
background-color: #000;
color: #fff;
font-size: 36px;
}
header > img {
height: 40px;
margin: 8px 24px;
height: 28px;
margin: 6px 24px;
}
.container {
max-width: 100% !important;
Expand All @@ -27,8 +27,8 @@ header > img {
align-items: flex-start;
gap: 8px;
align-self: stretch;
border: 1px solid #eab54e;
background: #eab54e;
border: 1px solid #e1e3e4;
background: #e1e3e4;
}
.card-header > h1 {
color: #000;
Expand Down Expand Up @@ -89,7 +89,7 @@ input:not(.btn) {
}
input:focus,
.btn.btn-primary:focus {
outline: 0.2rem solid #ba18da;
outline: 0.2rem solid #2e5084;
}
.btn {
width: 100%;
Expand All @@ -102,7 +102,7 @@ input:focus,
cursor: pointer;
}
.btn-primary {
background-color: #ba18da !important;
background-color: #2e5084 !important;
color: #fff;
}
.btn-primary:focus {
Expand Down
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.3"
__version__ = "0.0.4"
24 changes: 20 additions & 4 deletions src/nebari_plugin_self_registration/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
import sys
import time

from nebari.schema import Base, ProviderEnum
from nebari.schema import Base
from _nebari.stages.base import NebariTerraformStage
from nebari.hookspecs import NebariStage, hookimpl
from pathlib import Path
from typing import Any, Dict, List, Optional
from typing import Any, Dict, List, Optional, Union
from _nebari.stages.tf_objects import (
NebariKubernetesProvider,
NebariTerraformState,
Expand All @@ -17,14 +17,24 @@

CLIENT_NAME = "self-registration"

class SelfRegistrationAffinitySelectorConfig(Base):
default: str
app: Optional[str] = ""
job: Optional[str] = ""

class SelfRegistrationConfig(Base):
enabled: Optional[bool] = True
selector: Union[SelfRegistrationAffinitySelectorConfig, str] = "general"

class SelfRegistrationConfig(Base):
name: Optional[str] = "self-registration"
namespace: Optional[str] = None
values: Optional[Dict[str, Any]] = {}
account_expiration_days: Optional[int] = 7
approved_domains: Optional[List[str]] = []
coupons: Optional[List[str]] = []
registration_group: Optional[str] = ""
registration_group: Optional[str] = ""
affinity: SelfRegistrationConfig = SelfRegistrationConfig()


class InputSchema(Base):
Expand Down Expand Up @@ -150,7 +160,13 @@ def input_vars(self, stage_outputs: Dict[str, Dict[str, Any]]):
"create_namespace": create_ns,
"namespace": chart_ns,
"ingress_host": domain,
"overrides": self.config.self_registration.values
"overrides": self.config.self_registration.values,
"affinity": {
"enabled": self.config.self_registration.affinity.enabled,
"selector": self.config.self_registration.affinity.selector.__dict__
if isinstance(self.config.self_registration.affinity.selector, SelfRegistrationAffinitySelectorConfig)
else self.config.self_registration.affinity.selector,
},

}

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 @@ -26,4 +26,5 @@ module "self-registration" {
keycloak_config = module.keycloak.config
overrides = var.overrides
realm_id = var.realm_id
affinity = var.affinity
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.0.12
version: 0.0.13

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.0.3"
appVersion: "0.0.4"
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ spec:
nodeSelector:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.affinity }}
{{- with .Values.job.affinity }}
affinity:
{{- toYaml . | nindent 12 }}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ image:
repository: ghcr.io/metrostar/nebari-self-registration
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: "20240111-2128"
tag: "20240119-1720"

imagePullSecrets: []
nameOverride: ""
Expand Down Expand Up @@ -98,6 +98,8 @@ job:
podSecurityContext: {}
securityContext: {}
resources: {}
affinity: {}


app_configuration:
account_expiration_days: 7
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
locals {
affinity = var.affinity != null && lookup(var.affinity, "enabled", false) ? {
enabled = true
selector = try(
{ for k in ["default", "app", "job"] : k => length(var.affinity.selector[k]) > 0 ? var.affinity.selector[k] : var.affinity.selector.default },
{
app = var.affinity.selector
job = var.affinity.selector
},
)
} : {
enabled = false
selector = null
}
}

resource "kubernetes_namespace" "this" {
Expand All @@ -22,6 +35,42 @@ resource "helm_release" "self_registration" {
enabled = "true"
host = var.ingress_host
}
affinity = local.affinity.enabled ? {
nodeAffinity = {
requiredDuringSchedulingIgnoredDuringExecution = {
nodeSelectorTerms = [
{
matchExpressions = [
{
key = "eks.amazonaws.com/nodegroup"
operator = "In"
values = [local.affinity.selector.app]
}
]
}
]
}
}
} : {}
job = {
affinity = local.affinity.enabled ? {
nodeAffinity = {
requiredDuringSchedulingIgnoredDuringExecution = {
nodeSelectorTerms = [
{
matchExpressions = [
{
key = "eks.amazonaws.com/nodegroup"
operator = "In"
values = [local.affinity.selector.job]
}
]
}
]
}
}
} : {}
}
serviceAccount = {
name = var.self_registration_sa_name
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,21 @@ variable "self_registration_sa_name" {
variable "overrides" {
type = map(any)
default = {}
}
}

variable "affinity" {
type = object({
enabled = optional(bool, true)
selector = optional(any, "general")
})

default = {
enabled = false
selector = "general"
}

validation {
condition = can(tostring(var.affinity.selector)) || (can(var.affinity.selector.default) && length(try(var.affinity.selector.default, "")) > 0)
error_message = "\"affinity.selector\" argument must be a string or object { default, app, job }"
}
}
17 changes: 17 additions & 0 deletions src/nebari_plugin_self_registration/terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,21 @@ variable "registration_group" {
description = "Name of Keycloak group to add registering users"
type = string
default = ""
}

variable "affinity" {
type = object({
enabled = optional(bool, true)
selector = optional(any, "general")
})

default = {
enabled = false
selector = "general"
}

validation {
condition = can(tostring(var.affinity.selector)) || (can(var.affinity.selector.default) && length(try(var.affinity.selector.default, "")) > 0)
error_message = "\"affinity.selector\" argument must be a string or object { default, app, job }"
}
}

0 comments on commit e064005

Please sign in to comment.