Skip to content

Commit

Permalink
Update charts to support multiple neon-core ingresses
Browse files Browse the repository at this point in the history
Update CLI entrypoint to make iris Gradio UI deployments optional
  • Loading branch information
NeonDaniel committed Dec 29, 2023
1 parent 3a52bd0 commit 8db4114
Show file tree
Hide file tree
Showing 11 changed files with 98 additions and 60 deletions.
30 changes: 21 additions & 9 deletions neon_diana_utils/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -645,13 +645,14 @@ def configure_neon_core(mq_user: str = None,
return

# Prompt for IRIS Web UI configuration
# TODO: Optional
confirmed = False
iris_domain = "iris.diana.k8s" # TODO: Read from backend config
while not confirmed:
iris_domain = click.prompt("Hostname for Iris Web UI", type=str,
default=iris_domain)
confirmed = click.confirm(f"Is {iris_domain} correct?")
iris_domain = None
if click.confirm("Configure IRIS Gradio Web UI?"):
confirmed = False
iris_domain = "iris.diana.k8s" # TODO: Read from backend config
while not confirmed:
iris_domain = click.prompt("Hostname for Iris Gradio Web UI",
type=str, default=iris_domain)
confirmed = click.confirm(f"Is {iris_domain} correct?")

if orchestrator == Orchestrator.KUBERNETES:
shutil.copytree(join(dirname(__file__), "templates", "neon"),
Expand All @@ -661,8 +662,19 @@ def configure_neon_core(mq_user: str = None,
values = join(output_path, "neon-core", "values.yaml")
with open(values, "r") as f:
config = yaml.safe_load(f)
config['iris']['subdomain'], config['iris']['domain'] =\
iris_domain.split('.', 1)
if iris_domain:
iris_subdomain, iris_domain = iris_domain.split('.', 1)
config['core']['domain'] = iris_domain
config['core']['ingress']['rules'].append(
{'host': iris_subdomain, 'serviceName': 'neon-core-iris',
'servicePort': 7860})
else:
click.echo("iris Gradio UI disabled")
config['core']['iris-gradio']['replicaCount'] = 0

if not config['core']['ingress']['rules']:
click.echo('No HTTP ingress configured')
config['core']['ingress']['enabled'] = False
with open(values, 'w') as f:
yaml.safe_dump(config, f)
elif orchestrator == Orchestrator.COMPOSE:
Expand Down
2 changes: 1 addition & 1 deletion neon_diana_utils/helm_charts/base/base-neon/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ name: base-neon
description: Library chart for basic Neon Core Services

type: library
version: 0.0.4
version: 0.0.5
appVersion: "1.0.1a16"
40 changes: 40 additions & 0 deletions neon_diana_utils/helm_charts/base/base-neon/templates/_ingress.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{{- define "base-neon.ingress" -}}
{{ if .Values.ingress.enabled }}
{{- $domain := .Values.domain -}}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: ingress-iris-http
annotations:
kubernetes.io/ingress.class: {{ .Values.ingress.ingressClassName }}
cert-manager.io/issuer: {{ .Values.ingress.certIssuer }}
spec:
tls:
- secretName: {{ .Values.ingress.tlsSecretName }}
hosts:
{{- range .Values.ingress.rules }}
- {{ printf "%s.%s " .host $.Values.domain }}
{{- end }}

rules:
{{- range .Values.ingress.rules }}
- host: {{ printf "%s.%s " .host $.Values.domain }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ .serviceName }}
port:
number: {{ .servicePort }}
{{- end }}

{{- end -}}
{{- end -}}
11 changes: 9 additions & 2 deletions neon_diana_utils/helm_charts/neon/core/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ name: neon-core
description: Deploy Neon Core Services

type: application
version: 0.0.6
version: 0.0.8
appVersion: "1.0.1a16"
dependencies:
- name: base-neon
version: 0.0.5
repository: file://../../base/base-neon
- name: neon-messagebus
alias: neon-messagebus
version: 0.0.6
Expand All @@ -29,4 +32,8 @@ dependencies:
- name: neon-gui
alias: neon-gui
version: 0.0.5
repository: file://../neon-gui
repository: file://../neon-gui
- name: neon-iris
alias: iris-gradio
version: 0.0.5
repository: file://../neon-iris
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{- include "base-neon.ingress" . }}
17 changes: 16 additions & 1 deletion neon_diana_utils/helm_charts/neon/core/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,19 @@ neon-enclosure:
tag: *tag
neon-gui:
image:
tag: *tag
tag: *tag
iris-gradio:
ingress:
enabled: False

domain: diana.local
ingress:
enabled: True
ingressClassName: nginx
tlsSecretName: tls-letsencrypt-iris
certIssuer: letsencrypt-private-key
rules:
- host: iris
serviceName: neon-core-iris
servicePort: 7860
# Define ingress rules for any available web UIs that may be enabled here
4 changes: 2 additions & 2 deletions neon_diana_utils/helm_charts/neon/neon-iris/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: neon-iris
description: Deploy Neon IRIS Web UI

type: application
version: 0.0.4
version: 0.0.5
appVersion: "1.0.1a16"

dependencies:
- name: base-neon
version: 0.0.4
version: 0.0.5
repository: file://../../base/base-neon
Original file line number Diff line number Diff line change
@@ -1,38 +1 @@
{{ if .Values.ingress.enabled }}
{{- $domain := .Values.domain -}}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: ingress-iris-http
annotations:
kubernetes.io/ingress.class: {{ .Values.ingress.ingressClassName }}
cert-manager.io/issuer: {{ .Values.ingress.certIssuer }}
spec:
tls:
- secretName: {{ .Values.ingress.tlsSecretName }}
hosts:
{{- range .Values.ingress.rules }}
- {{ printf "%s.%s " .host $.Values.domain }}
{{- end }}

rules:
{{- range .Values.ingress.rules }}
- host: {{ printf "%s.%s " .host $.Values.domain }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ .serviceName }}
port:
number: {{ .servicePort }}
{{- end }}

{{- end }}
{{- include "base-neon.ingress" . }}
1 change: 0 additions & 1 deletion neon_diana_utils/helm_charts/neon/neon-iris/values.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
serviceName: neon-core-iris
subdomain: iris
domain: diana.local
replicaCount: 1
configMap: neon-config
Expand Down
6 changes: 1 addition & 5 deletions neon_diana_utils/templates/neon/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,5 @@ appVersion: "1.0.1a5"
dependencies:
- name: neon-core
alias: core
version: 0.0.6
repository: https://neongeckocom.github.io/neon-diana-utils
- name: neon-iris
alias: iris
version: 0.0.4
version: 0.0.8
repository: https://neongeckocom.github.io/neon-diana-utils
7 changes: 6 additions & 1 deletion neon_diana_utils/templates/neon/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,9 @@ core:
image: {}
neon-gui:
image: {}
iris: {}
iris-gradio:
image: {}

domain: diana.local
ingress:
rules: []

0 comments on commit 8db4114

Please sign in to comment.