Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions deploy/helm/openshell/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,19 @@ Namespaced Issuer (selfSigned) for cert-manager CA bootstrap.
{{- define "openshell.issuerSelfSigned" -}}
{{- printf "%s-selfsigned" (include "openshell.fullname" .) | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
gRPC endpoint sandbox pods use to call back into the gateway. An explicit
.Values.server.grpcEndpoint is used verbatim. Otherwise it is derived from
the in-cluster Service DNS, release namespace, service port, and disableTls
flag — so the default value works for any release name or namespace without
override.
*/}}
{{- define "openshell.grpcEndpoint" -}}
{{- if .Values.server.grpcEndpoint -}}
{{- .Values.server.grpcEndpoint -}}
{{- else -}}
{{- $scheme := ternary "http" "https" (default false .Values.server.disableTls) -}}
{{- printf "%s://%s.%s.svc.cluster.local:%d" $scheme (include "openshell.fullname" .) .Release.Namespace (int .Values.service.port) -}}
{{- end -}}
{{- end }}
2 changes: 1 addition & 1 deletion deploy/helm/openshell/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ spec:
value: {{ .Values.supervisor.image.pullPolicy | quote }}
{{- end }}
- name: OPENSHELL_GRPC_ENDPOINT
value: {{ if .Values.server.disableTls }}{{ .Values.server.grpcEndpoint | replace "https://" "http://" | quote }}{{ else }}{{ .Values.server.grpcEndpoint | quote }}{{ end }}
value: {{ include "openshell.grpcEndpoint" . | quote }}
{{- if .Values.server.sshGatewayHost }}
- name: OPENSHELL_SSH_GATEWAY_HOST
value: {{ .Values.server.sshGatewayHost | quote }}
Expand Down
8 changes: 6 additions & 2 deletions deploy/helm/openshell/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,12 @@ server:
# (Always for :latest, IfNotPresent otherwise). Set to "Always" for dev
# clusters so new images are picked up without manual eviction.
sandboxImagePullPolicy: ""
# gRPC endpoint for sandboxes to callback to OpenShell (must be reachable from pods)
grpcEndpoint: "https://openshell.openshell.svc.cluster.local:8080"
# gRPC endpoint sandboxes call back into the gateway. Leave empty to derive
# it from the chart fullname, release namespace, service port, and
# disableTls flag (i.e. <scheme>://<fullname>.<namespace>.svc.cluster.local:<port>).
# Override only when sandboxes must reach the gateway via a different
# hostname (e.g. an external ingress or a host alias).
grpcEndpoint: ""
# Public host/port returned to CLI clients for SSH proxy CONNECT requests.
# For local clusters the default 127.0.0.1:8080 is correct; for remote
# clusters these should be set to the externally reachable host and port.
Expand Down
1 change: 0 additions & 1 deletion deploy/kube/manifests/openshell-helmchart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ spec:
dbUrl: __DB_URL__
sshGatewayHost: __SSH_GATEWAY_HOST__
sshGatewayPort: __SSH_GATEWAY_PORT__
grpcEndpoint: "https://openshell.openshell.svc.cluster.local:8080"
hostGatewayIP: __HOST_GATEWAY_IP__
disableGatewayAuth: __DISABLE_GATEWAY_AUTH__
disableTls: __DISABLE_TLS__
Expand Down
3 changes: 1 addition & 2 deletions examples/gateway-deploy-connect.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ kubectl create namespace openshell
helm upgrade --install openshell deploy/helm/openshell \
--namespace openshell \
--set server.disableTls=true \
--set service.type=ClusterIP \
--set server.grpcEndpoint=http://openshell.openshell.svc.cluster.local:8080
--set service.type=ClusterIP
```

For local evaluation, forward the service and register the forwarded endpoint:
Expand Down
12 changes: 12 additions & 0 deletions tasks/scripts/helm-k3s-local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)"
_branch="$(git -C "${ROOT}" rev-parse --abbrev-ref HEAD 2>/dev/null)" || _branch=""
_suffix="$(printf '%s' "${_branch##*/}" | tr '[:upper:]' '[:lower:]' | tr -cs 'a-z0-9' '-' | sed 's/-*$//')"
CLUSTER_NAME="${HELM_K3S_CLUSTER_NAME:-openshell-dev${_suffix:+-${_suffix}}}"
# k3d caps cluster names at 32 chars; validated in cmd_create so the operator
# gets an actionable hint instead of a deep-stack k3d validation error.
K3D_CLUSTER_NAME_MAX=32
# Host port forwarded to port 80 via the k3d load balancer.
# Used by Envoy Gateway's LoadBalancer service (values-gateway.yaml).
HOST_LB_PORT="${HELM_K3S_LB_HOST_PORT:-8080}"
Expand Down Expand Up @@ -154,6 +157,15 @@ cmd_create() {
require_docker
require_k3d

if (( ${#CLUSTER_NAME} > K3D_CLUSTER_NAME_MAX )); then
cat >&2 <<EOF
error: derived cluster name '${CLUSTER_NAME}' is ${#CLUSTER_NAME} chars; k3d caps at ${K3D_CLUSTER_NAME_MAX}.
Set HELM_K3S_CLUSTER_NAME to a shorter name, e.g.:
HELM_K3S_CLUSTER_NAME=openshell-dev-${_suffix:0:$(( K3D_CLUSTER_NAME_MAX - 14 ))} mise run helm:k3s:create
EOF
exit 1
fi

local lb_port_map="${HOST_LB_PORT}:80@loadbalancer"

if k3d_cluster_exists; then
Expand Down
Loading