diff --git a/.github/workflows/frontends.yml b/.github/workflows/frontends.yml index d9d181b33fdf..1f2b85402919 100644 --- a/.github/workflows/frontends.yml +++ b/.github/workflows/frontends.yml @@ -96,8 +96,6 @@ jobs: - 'frontend/providers/template/**' applaunchpad: - 'frontend/providers/applaunchpad/**' - terminal: - - 'frontend/providers/terminal/**' dbprovider: - 'frontend/providers/dbprovider/**' costcenter: @@ -114,7 +112,6 @@ jobs: LICENSE_CHANGED: ${{ steps.filter.outputs.license }} TEMPLATE_CHANGED: ${{ steps.filter.outputs.template }} APPLAUNCHPAD_CHANGED: ${{ steps.filter.outputs.applaunchpad }} - TERMINAL_CHANGED: ${{ steps.filter.outputs.terminal }} DBPROVIDER_CHANGED: ${{ steps.filter.outputs.dbprovider }} COSTCENTER_CHANGED: ${{ steps.filter.outputs.costcenter }} DESKTOP_CHANGED: ${{ steps.filter.outputs.desktop }} @@ -130,7 +127,6 @@ jobs: "providers/license" "providers/template" "providers/applaunchpad" - "providers/terminal" "providers/dbprovider" "providers/costcenter" "desktop" @@ -140,7 +136,6 @@ jobs: [[ "$LICENSE_CHANGED" == "true" ]] && modules+=("providers/license") [[ "$TEMPLATE_CHANGED" == "true" ]] && modules+=("providers/template") [[ "$APPLAUNCHPAD_CHANGED" == "true" ]] && modules+=("providers/applaunchpad") - [[ "$TERMINAL_CHANGED" == "true" ]] && modules+=("providers/terminal") [[ "$DBPROVIDER_CHANGED" == "true" ]] && modules+=("providers/dbprovider") [[ "$COSTCENTER_CHANGED" == "true" ]] && modules+=("providers/costcenter") [[ "$DESKTOP_CHANGED" == "true" ]] && modules+=("desktop") diff --git a/controllers/app/deploy/appexample/cr.yaml b/controllers/app/deploy/appexample/cr.yaml index 5efeed920468..ae9ed9029fe6 100644 --- a/controllers/app/deploy/appexample/cr.yaml +++ b/controllers/app/deploy/appexample/cr.yaml @@ -76,24 +76,6 @@ spec: --- apiVersion: app.sealos.io/v1 kind: App -metadata: - name: terminal - namespace: app-system -spec: - data: - desc: sealos Terminal - url: "" - icon: /images/terminal.svg - menuData: - name: Terminal - type: iframe - displayType: normal - i18n: - zh-Hans: - name: 终端 ---- -apiVersion: app.sealos.io/v1 -kind: App metadata: name: deploy-manager spec: @@ -104,4 +86,4 @@ spec: url: "https://deploy.cloud.sealos.io" desc: Deploy Manager menuData: - displayType: normal \ No newline at end of file + displayType: normal diff --git a/controllers/go.work b/controllers/go.work index b32d855104a5..692ee9de999d 100644 --- a/controllers/go.work +++ b/controllers/go.work @@ -12,7 +12,6 @@ use ( ./node ./pkg ./resources - ./terminal ) replace ( diff --git a/controllers/go.work.sum b/controllers/go.work.sum index 032300b0dcde..d35f399c2fb1 100644 --- a/controllers/go.work.sum +++ b/controllers/go.work.sum @@ -3287,7 +3287,6 @@ github.com/pkg/sftp v1.13.1 h1:I2qBYMChEhIjOgazfJmV3/mZM256btk6wkCDRmW7JYs= github.com/pkg/sftp v1.13.5/go.mod h1:wHDZ0IZX6JcBYRK1TH9bcVq8G7TLpVHYIGJRFnmPfxg= github.com/posener/complete v1.1.1 h1:ccV59UEOTzVDnDUEFdT95ZzHVZ+5+158q8+SJb2QV5w= github.com/posener/complete v1.2.3 h1:NP0eAhjcjImqslEwo/1hq7gpajME0fTLTezBKDqfXqo= -github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/poy/onpar v0.0.0-20200406201722-06f95a1c68e8/go.mod h1:nSbFQvMj97ZyhFRSJYtut+msi4sOY6zJDGCdSc+/rZU= github.com/poy/onpar v1.1.2/go.mod h1:6X8FLNoxyr9kkmnlqpK6LSoiOtrO6MICtWwEuWkLjzg= github.com/pquerna/cachecontrol v0.0.0-20171018203845-0dec1b30a021/go.mod h1:prYjPmNq4d1NPVmpShWobRqXY3q7Vp+80DqgxxUrUIA= @@ -3523,10 +3522,7 @@ github.com/titanous/rocacheck v0.0.0-20171023193734-afe73141d399/go.mod h1:LdwHT github.com/tj/go-spin v1.1.0/go.mod h1:Mg1mzmePZm4dva8Qz60H2lHwmJ2loum4VIrLgVnKwh4= github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= -github.com/tklauser/go-sysconf v0.3.16 h1:frioLaCQSsF5Cy1jgRBrzr6t502KIIwQ0MArYICU0nA= -github.com/tklauser/go-sysconf v0.3.16/go.mod h1:/qNL9xxDhc7tx3HSRsLWNnuzbVfh3e7gh/BmM179nYI= github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= -github.com/tklauser/numcpus v0.11.0/go.mod h1:z+LwcLq54uWZTX0u/bGobaV34u6V7KNlTZejzM6/3MQ= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802 h1:uruHq4dN7GR16kFc5fp3d1RIYzJW5onx8Ybykw2YQFA= @@ -3606,7 +3602,6 @@ github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1 github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13 h1:fVcFKWvrslecOb/tg+Cc05dkeYx540o0FuFt3nUVDoE= github.com/yuin/gopher-lua v0.0.0-20171031051903-609c9cd26973 h1:iCnkJ/qjKZGdZnlcj1N55AxPDan814kpc3s1cDpQKd8= -github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= github.com/yvasiyarov/go-metrics v0.0.0-20140926110328-57bccd1ccd43/go.mod h1:aX5oPXxHm3bOH+xeAttToC8pqch2ScQN/JoXYupl6xs= github.com/yvasiyarov/go-metrics v0.0.0-20150112132944-c25f46c4b940 h1:p7OofyZ509h8DmPLh8Hn+EIIZm/xYhdZHJ9GnXHdr6U= github.com/yvasiyarov/go-metrics v0.0.0-20150112132944-c25f46c4b940/go.mod h1:aX5oPXxHm3bOH+xeAttToC8pqch2ScQN/JoXYupl6xs= @@ -4048,8 +4043,6 @@ golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= golang.org/x/net v0.44.0/go.mod h1:ECOoLqd5U3Lhyeyo/QDCEVQ4sNgYsqvCZ722XogGieY= golang.org/x/net v0.45.0 h1:RLBg5JKixCy82FtLJpeNlVM0nrSqpCRYzVU1n8kj0tM= golang.org/x/net v0.45.0/go.mod h1:ECOoLqd5U3Lhyeyo/QDCEVQ4sNgYsqvCZ722XogGieY= -golang.org/x/net v0.49.0 h1:eeHFmOGUTtaaPSGNmjBKpbng9MulQsJURQUAfUwY++o= -golang.org/x/net v0.49.0/go.mod h1:/ysNB2EvaqvesRkuLAyjI1ycPZlQHM3q01F02UY/MV8= golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210402161424-2e8d93401602/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= @@ -4088,8 +4081,6 @@ golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug= golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= -golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4= -golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190514135907-3a4b5fb9f71f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -4180,6 +4171,7 @@ golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ= golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc= golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/sys v0.40.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/sys v0.41.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= @@ -4637,7 +4629,6 @@ google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqw google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= -google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc= gopkg.in/check.v1 v1.0.0-20141024133853-64131543e789/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/controllers/terminal/.dockerignore b/controllers/terminal/.dockerignore deleted file mode 100644 index 8e6fac709b69..000000000000 --- a/controllers/terminal/.dockerignore +++ /dev/null @@ -1,3 +0,0 @@ -# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file -# Ignore build and test binaries. -testbin/ diff --git a/controllers/terminal/.gitignore b/controllers/terminal/.gitignore deleted file mode 100644 index c0a7a54cac5a..000000000000 --- a/controllers/terminal/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ - -# Binaries for programs and plugins -*.exe -*.exe~ -*.dll -*.so -*.dylib -bin -testbin/* - -# Test binary, build with `go test -c` -*.test - -# Output of the go coverage tool, specifically when used with LiteIDE -*.out - -# Kubernetes Generated files - skip generated files, except for vendored files - -!vendor/**/zz_generated.* - -# editor and IDE paraphernalia -.idea -*.swp -*.swo -*~ diff --git a/controllers/terminal/Dockerfile b/controllers/terminal/Dockerfile deleted file mode 100644 index 48fdeecd067d..000000000000 --- a/controllers/terminal/Dockerfile +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright © 2023 sealos. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -FROM gcr.io/distroless/static:nonroot -ARG TARGETARCH - -WORKDIR / -USER 65532:65532 - -COPY bin/controller-terminal-$TARGETARCH /manager -ENTRYPOINT ["/manager"] diff --git a/controllers/terminal/Makefile b/controllers/terminal/Makefile deleted file mode 100644 index 1fe5b0a7c456..000000000000 --- a/controllers/terminal/Makefile +++ /dev/null @@ -1,142 +0,0 @@ - -# Image URL to use all building/pushing image targets -IMG ?= ghcr.io/labring/sealos-terminal-controller:latest -TARGETARCH ?= amd64 - -# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary. -ENVTEST_K8S_VERSION = 1.24.1 - -# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set) -ifeq (,$(shell go env GOBIN)) -GOBIN=$(shell go env GOPATH)/bin -else -GOBIN=$(shell go env GOBIN) -endif - -# Setting SHELL to bash allows bash commands to be executed by recipes. -# This is a requirement for 'setup-envtest.sh' in the test target. -# Options are set to exit when a recipe line exits non-zero or a piped command fails. -SHELL = /usr/bin/env bash -o pipefail -.SHELLFLAGS = -ec - -.PHONY: all -all: build - -##@ General - -# The help target prints out all targets with their descriptions organized -# beneath their categories. The categories are represented by '##@' and the -# target descriptions by '##'. The awk commands is responsible for reading the -# entire set of makefiles included in this invocation, looking for lines of the -# file as xyz: ## something, and then pretty-format the target and help. Then, -# if there's a line with ##@ something, that gets pretty-printed as a category. -# More info on the usage of ANSI control characters for terminal formatting: -# https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters -# More info on the awk command: -# http://linuxcommand.org/lc3_adv_awk.php - -.PHONY: help -help: ## Display this help. - @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) - -##@ Development - -.PHONY: manifests -manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects. - $(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases - -.PHONY: generate -generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations. - $(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..." - -.PHONY: fmt -fmt: ## Run go fmt against code. - go fmt ./... - -.PHONY: vet -vet: ## Run go vet against code. - go vet ./... - -.PHONY: test -test: manifests generate fmt vet envtest ## Run tests. - KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test ./... -coverprofile cover.out - -##@ Build - -.PHONY: build -build: ## Build manager binary. - CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} go build -ldflags "-s -w" -trimpath -o bin/manager main.go - -.PHONY: run -run: manifests generate fmt vet ## Run a controller from your host. - go run ./main.go - -.PHONY: docker-build -docker-build: test ## Build docker image with the manager. - mv bin/manager bin/controller-terminal-${TARGETARCH} - chmod +x bin/controller-terminal-${TARGETARCH} - docker build -t ${IMG} . --build-arg TARGETARCH=${TARGETARCH} - -.PHONY: docker-push -docker-push: ## Push docker image with the manager. - docker push ${IMG} - -##@ Deployment - -ifndef ignore-not-found - ignore-not-found = false -endif - -.PHONY: install -install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config. - $(KUSTOMIZE) build config/crd | kubectl apply -f - - -.PHONY: uninstall -uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion. - $(KUSTOMIZE) build config/crd | kubectl delete --ignore-not-found=$(ignore-not-found) -f - - -.PHONY: pre-deploy -pre-deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config. - cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG} - $(KUSTOMIZE) build config/default > deploy/manifests/deploy.yaml - -.PHONY: deploy -deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config. - cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG} - $(KUSTOMIZE) build config/default | kubectl apply -f - - -.PHONY: undeploy -undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion. - $(KUSTOMIZE) build config/default | kubectl delete --ignore-not-found=$(ignore-not-found) -f - - -##@ Build Dependencies - -## Location to install dependencies to -LOCALBIN ?= $(shell pwd)/bin -$(LOCALBIN): - mkdir -p $(LOCALBIN) - -## Tool Binaries -KUSTOMIZE ?= $(LOCALBIN)/kustomize -CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen -ENVTEST ?= $(LOCALBIN)/setup-envtest - -## Tool Versions -KUSTOMIZE_VERSION ?= v5.3.0 -CONTROLLER_TOOLS_VERSION ?= v0.14.0 - -KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" -.PHONY: kustomize -kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary. -$(KUSTOMIZE): $(LOCALBIN) - curl -s $(KUSTOMIZE_INSTALL_SCRIPT) | bash -s -- $(subst v,,$(KUSTOMIZE_VERSION)) $(LOCALBIN) - -.PHONY: controller-gen -controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary. -$(CONTROLLER_GEN): $(LOCALBIN) - GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION) - -.PHONY: envtest -envtest: $(ENVTEST) ## Download envtest-setup locally if necessary. -$(ENVTEST): $(LOCALBIN) - GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest diff --git a/controllers/terminal/PROJECT b/controllers/terminal/PROJECT deleted file mode 100644 index e7f6464dd1f0..000000000000 --- a/controllers/terminal/PROJECT +++ /dev/null @@ -1,16 +0,0 @@ -domain: sealos.io -layout: -- go.kubebuilder.io/v3 -projectName: terminal -repo: github.com/labring/sealos -resources: -- api: - crdVersion: v1 - namespaced: true - controller: true - domain: sealos.io - group: terminal - kind: Terminal - path: github.com/labring/sealos/controllers/terminal/api/v1 - version: v1 -version: "3" diff --git a/controllers/terminal/README.md b/controllers/terminal/README.md deleted file mode 100644 index 5c2b751bb648..000000000000 --- a/controllers/terminal/README.md +++ /dev/null @@ -1,50 +0,0 @@ -# Terminal CRD -```yaml -apiVersion: terminal.sealos.io/v1 -kind: Terminal -metadata: - name: terminal-sample - annotations: - lastUpdateTime: "2022-08-09T15:22:49+08:00" -spec: - user: ccl - token: abcdefg - apiServer: https://192.168.49.2:8443 - keepalived: 5h - ttyImage: ghcr.io/cuisongliu/go-docker-dev:1.18.4 - replicas: 1 - ingressType: nginx -``` - -TerminalSpec -- user(string) -- token(string) -- keepalived(string) -- apiServer(string) - - APIServer address of the cluster. Default to "https://kubernetes.default.svc.cluster.local:443" - -- ttyImage(string) - - TTY Image Name. - -- replicas(int32) - - Number of desired pods in Deployment. - -- ingressType(string) - - Ingress Type, `nginx`. Default to `nginx`. - -## Usage -1. run `kubectl apply terminal.yaml` -2. run `kubectl get terminal terminal-name -o template --template={{.status.domain}}` to get terminal address. -3. visit terminal address. - -## Keep terminal alived - -Client should regularly update the `lastUpdateTime` in annotations to keep the terminal alived. The Cluster will delete the terminal if client does not update the annotations after the time that specified in `keepalived` filed in TerminalSpec. -The `lastUpdateTime` follows the [RFC3339 format](https://www.rfc-editor.org/rfc/rfc3339). - -## Log -The log module that terminal controller uses is `"sigs.k8s.io/controller-runtime/pkg/log"`, which is the default log module of kubebuilder. diff --git a/controllers/terminal/README_zh.md b/controllers/terminal/README_zh.md deleted file mode 100644 index 740feddfee53..000000000000 --- a/controllers/terminal/README_zh.md +++ /dev/null @@ -1,6 +0,0 @@ -## sealos cloud terminal 使用文档 - -### 产品介绍 - -sealos cloud terminal 是一个基于 kubernetes 的终端管理工具,可以在 kubernetes 集群中部署一个终端管理服务, -用户可以通过浏览器访问该服务,然后在浏览器中打开一个终端,通过终端可以访问 kubernetes 的 API server。 \ No newline at end of file diff --git a/controllers/terminal/api/v1/groupversion_info.go b/controllers/terminal/api/v1/groupversion_info.go deleted file mode 100644 index 71fce587731e..000000000000 --- a/controllers/terminal/api/v1/groupversion_info.go +++ /dev/null @@ -1,36 +0,0 @@ -/* -Copyright 2022 labring. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Package v1 contains API Schema definitions for the terminal v1 API group -// +kubebuilder:object:generate=true -// +groupName=terminal.sealos.io -package v1 - -import ( - "k8s.io/apimachinery/pkg/runtime/schema" - "sigs.k8s.io/controller-runtime/pkg/scheme" -) - -var ( - // GroupVersion is group version used to register these objects - GroupVersion = schema.GroupVersion{Group: "terminal.sealos.io", Version: "v1"} - - // SchemeBuilder is used to add go types to the GroupVersionKind scheme - SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} - - // AddToScheme adds the types in this group-version to the given scheme. - AddToScheme = SchemeBuilder.AddToScheme -) diff --git a/controllers/terminal/api/v1/terminal_types.go b/controllers/terminal/api/v1/terminal_types.go deleted file mode 100644 index 97b6dca1006a..000000000000 --- a/controllers/terminal/api/v1/terminal_types.go +++ /dev/null @@ -1,91 +0,0 @@ -/* -Copyright 2022 labring. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! -// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. - -// +kubebuilder:validation:Enum=nginx -type IngressType string - -const ( - Nginx IngressType = "nginx" -) - -// TerminalSpec defines the desired state of Terminal -type TerminalSpec struct { - // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster - // Important: Run "make" to regenerate code after modifying this file - - //+kubebuilder:validation:Required - User string `json:"user"` - //+kubebuilder:validation:Required - Token string `json:"token"` - //+kubebuilder:validation:Required - TTYImage string `json:"ttyImage"` - //+kubebuilder:validation:Required - Replicas *int32 `json:"replicas"` - //+kubebuilder:validation:Required - Keepalived string `json:"keepalived"` - //+kubebuilder:validation:Optional - APIServer string `json:"apiServer"` - //+kubebuilder:validation:Optional - //+kubebuilder:default=nginx - IngressType IngressType `json:"ingressType"` -} - -// TerminalStatus defines the observed state of Terminal -type TerminalStatus struct { - AvailableReplicas int32 `json:"availableReplicas"` - ServiceName string `json:"serviceName"` - SecretHeader string `json:"secretHeader"` - Domain string `json:"domain"` -} - -//+kubebuilder:object:root=true -//+kubebuilder:subresource:status -//+kubebuilder:printcolumn:name="User",type=string,JSONPath=".spec.user" -//+kubebuilder:printcolumn:name="Keepalived",type=string,JSONPath=".spec.keepalived" -//+kubebuilder:printcolumn:name="Domain",type=string,JSONPath=".status.domain" -//+kubebuilder:printcolumn:name="LastUpdateTime",priority=1,type=string,JSONPath=".metadata.annotations.lastUpdateTime" -//+kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" - -// Terminal is the Schema for the terminals API -type Terminal struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec TerminalSpec `json:"spec,omitempty"` - Status TerminalStatus `json:"status,omitempty"` -} - -//+kubebuilder:object:root=true - -// TerminalList contains a list of Terminal -type TerminalList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []Terminal `json:"items"` -} - -func init() { - SchemeBuilder.Register(&Terminal{}, &TerminalList{}) -} diff --git a/controllers/terminal/api/v1/zz_generated.deepcopy.go b/controllers/terminal/api/v1/zz_generated.deepcopy.go deleted file mode 100644 index af015bb15add..000000000000 --- a/controllers/terminal/api/v1/zz_generated.deepcopy.go +++ /dev/null @@ -1,120 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright 2022 labring. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by controller-gen. DO NOT EDIT. - -package v1 - -import ( - runtime "k8s.io/apimachinery/pkg/runtime" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Terminal) DeepCopyInto(out *Terminal) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - out.Status = in.Status -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Terminal. -func (in *Terminal) DeepCopy() *Terminal { - if in == nil { - return nil - } - out := new(Terminal) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Terminal) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *TerminalList) DeepCopyInto(out *TerminalList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Terminal, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TerminalList. -func (in *TerminalList) DeepCopy() *TerminalList { - if in == nil { - return nil - } - out := new(TerminalList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *TerminalList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *TerminalSpec) DeepCopyInto(out *TerminalSpec) { - *out = *in - if in.Replicas != nil { - in, out := &in.Replicas, &out.Replicas - *out = new(int32) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TerminalSpec. -func (in *TerminalSpec) DeepCopy() *TerminalSpec { - if in == nil { - return nil - } - out := new(TerminalSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *TerminalStatus) DeepCopyInto(out *TerminalStatus) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TerminalStatus. -func (in *TerminalStatus) DeepCopy() *TerminalStatus { - if in == nil { - return nil - } - out := new(TerminalStatus) - in.DeepCopyInto(out) - return out -} diff --git a/controllers/terminal/config/crd/bases/terminal.sealos.io_terminals.yaml b/controllers/terminal/config/crd/bases/terminal.sealos.io_terminals.yaml deleted file mode 100644 index 4ef9bcee5962..000000000000 --- a/controllers/terminal/config/crd/bases/terminal.sealos.io_terminals.yaml +++ /dev/null @@ -1,120 +0,0 @@ -# Copyright © 2024 sealos. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.14.0 - name: terminals.terminal.sealos.io -spec: - group: terminal.sealos.io - names: - kind: Terminal - listKind: TerminalList - plural: terminals - singular: terminal - scope: Namespaced - versions: - - additionalPrinterColumns: - - jsonPath: .spec.user - name: User - type: string - - jsonPath: .spec.keepalived - name: Keepalived - type: string - - jsonPath: .status.domain - name: Domain - type: string - - jsonPath: .metadata.annotations.lastUpdateTime - name: LastUpdateTime - priority: 1 - type: string - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - name: v1 - schema: - openAPIV3Schema: - description: Terminal is the Schema for the terminals API - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: TerminalSpec defines the desired state of Terminal - properties: - apiServer: - type: string - ingressType: - default: nginx - enum: - - nginx - type: string - keepalived: - type: string - replicas: - format: int32 - type: integer - token: - type: string - ttyImage: - type: string - user: - type: string - required: - - keepalived - - replicas - - token - - ttyImage - - user - type: object - status: - description: TerminalStatus defines the observed state of Terminal - properties: - availableReplicas: - format: int32 - type: integer - domain: - type: string - secretHeader: - type: string - serviceName: - type: string - required: - - availableReplicas - - domain - - secretHeader - - serviceName - type: object - type: object - served: true - storage: true - subresources: - status: {} diff --git a/controllers/terminal/config/crd/kustomization.yaml b/controllers/terminal/config/crd/kustomization.yaml deleted file mode 100644 index 97220760ad65..000000000000 --- a/controllers/terminal/config/crd/kustomization.yaml +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright © 2023 sealos. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# This kustomization.yaml is not intended to be run by itself, -# since it depends on service name and namespace that are out of this kustomize package. -# It should be run by config/default -resources: -- bases/terminal.sealos.io_terminals.yaml -#+kubebuilder:scaffold:crdkustomizeresource - -patchesStrategicMerge: -# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix. -# patches here are for enabling the conversion webhook for each CRD -#- patches/webhook_in_terminals.yaml -#+kubebuilder:scaffold:crdkustomizewebhookpatch - -# [CERTMANAGER] To enable cert-manager, uncomment all the sections with [CERTMANAGER] prefix. -# patches here are for enabling the CA injection for each CRD -#- patches/cainjection_in_terminals.yaml -#+kubebuilder:scaffold:crdkustomizecainjectionpatch - -# the following config is for teaching kustomize how to do kustomization for CRDs. -configurations: -- kustomizeconfig.yaml diff --git a/controllers/terminal/config/crd/kustomizeconfig.yaml b/controllers/terminal/config/crd/kustomizeconfig.yaml deleted file mode 100644 index 9c99fc52fb20..000000000000 --- a/controllers/terminal/config/crd/kustomizeconfig.yaml +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright © 2023 sealos. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# This file is for teaching kustomize how to substitute name and namespace reference in CRD -nameReference: -- kind: Service - version: v1 - fieldSpecs: - - kind: CustomResourceDefinition - version: v1 - group: apiextensions.k8s.io - path: spec/conversion/webhook/clientConfig/service/name - -namespace: -- kind: CustomResourceDefinition - version: v1 - group: apiextensions.k8s.io - path: spec/conversion/webhook/clientConfig/service/namespace - create: false - -varReference: -- path: metadata/annotations diff --git a/controllers/terminal/config/crd/patches/cainjection_in_terminals.yaml b/controllers/terminal/config/crd/patches/cainjection_in_terminals.yaml deleted file mode 100644 index 3bc1a5c4b21e..000000000000 --- a/controllers/terminal/config/crd/patches/cainjection_in_terminals.yaml +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright © 2023 sealos. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# The following patch adds a directive for certmanager to inject CA into the CRD -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) - name: terminals.terminal.sealos.io diff --git a/controllers/terminal/config/crd/patches/webhook_in_terminals.yaml b/controllers/terminal/config/crd/patches/webhook_in_terminals.yaml deleted file mode 100644 index f17fce5e5cbf..000000000000 --- a/controllers/terminal/config/crd/patches/webhook_in_terminals.yaml +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright © 2023 sealos. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# The following patch enables a conversion webhook for the CRD -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: terminals.terminal.sealos.io -spec: - conversion: - strategy: Webhook - webhook: - clientConfig: - service: - namespace: system - name: webhook-service - path: /convert - conversionReviewVersions: - - v1 diff --git a/controllers/terminal/config/default/kustomization.yaml b/controllers/terminal/config/default/kustomization.yaml deleted file mode 100644 index 44ca9b40f6d2..000000000000 --- a/controllers/terminal/config/default/kustomization.yaml +++ /dev/null @@ -1,88 +0,0 @@ -# Copyright © 2023 sealos. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Adds namespace to all resources. -namespace: terminal-system - -# Value of this field is prepended to the -# names of all resources, e.g. a deployment named -# "wordpress" becomes "alices-wordpress". -# Note that it should also match with the prefix (text before '-') of the namespace -# field above. -namePrefix: terminal- - -# Labels to add to all resources and selectors. -#commonLabels: -# someName: someValue - -bases: -- ../crd -- ../rbac -- ../manager -# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in -# crd/kustomization.yaml -#- ../webhook -# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'. 'WEBHOOK' components are required. -#- ../certmanager -# [PROMETHEUS] To enable prometheus monitor, uncomment all sections with 'PROMETHEUS'. -#- ../prometheus - -patchesStrategicMerge: -# Protect the /metrics endpoint by putting it behind auth. -# If you want your controller-manager to expose the /metrics -# endpoint w/o any authn/z, please comment the following line. -- manager_auth_proxy_patch.yaml - -# Mount the controller config file for loading manager configurations -# through a ComponentConfig type -#- manager_config_patch.yaml - -# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in -# crd/kustomization.yaml -#- manager_webhook_patch.yaml - -# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'. -# Uncomment 'CERTMANAGER' sections in crd/kustomization.yaml to enable the CA injection in the admission webhooks. -# 'CERTMANAGER' needs to be enabled to use ca injection -#- webhookcainjection_patch.yaml - -# the following config is for teaching kustomize how to do var substitution -vars: -# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER' prefix. -#- name: CERTIFICATE_NAMESPACE # namespace of the certificate CR -# objref: -# kind: Certificate -# group: cert-manager.io -# version: v1 -# name: serving-cert # this name should match the one in certificate.yaml -# fieldref: -# fieldpath: metadata.namespace -#- name: CERTIFICATE_NAME -# objref: -# kind: Certificate -# group: cert-manager.io -# version: v1 -# name: serving-cert # this name should match the one in certificate.yaml -#- name: SERVICE_NAMESPACE # namespace of the service -# objref: -# kind: Service -# version: v1 -# name: webhook-service -# fieldref: -# fieldpath: metadata.namespace -#- name: SERVICE_NAME -# objref: -# kind: Service -# version: v1 -# name: webhook-service diff --git a/controllers/terminal/config/default/manager_auth_proxy_patch.yaml b/controllers/terminal/config/default/manager_auth_proxy_patch.yaml deleted file mode 100644 index 62103d5d0160..000000000000 --- a/controllers/terminal/config/default/manager_auth_proxy_patch.yaml +++ /dev/null @@ -1,54 +0,0 @@ -# Copyright © 2023 sealos. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# This patch inject a sidecar container which is a HTTP proxy for the -# controller manager, it performs RBAC authorization against the Kubernetes API using SubjectAccessReviews. -apiVersion: apps/v1 -kind: Deployment -metadata: - name: controller-manager - namespace: system -spec: - template: - spec: - containers: - - name: kube-rbac-proxy - securityContext: - runAsNonRoot: true - allowPrivilegeEscalation: false - capabilities: - drop: - - "ALL" - image: gcr.io/kubebuilder/kube-rbac-proxy:v0.12.0 - args: - - "--secure-listen-address=0.0.0.0:8443" - - "--upstream=http://127.0.0.1:8080/" - - "--logtostderr=true" - - "--v=0" - ports: - - containerPort: 8443 - protocol: TCP - name: https - resources: - limits: - cpu: 500m - memory: 128Mi - requests: - cpu: 5m - memory: 64Mi - - name: manager - args: - - "--health-probe-bind-address=:8081" - - "--metrics-bind-address=127.0.0.1:8080" - - "--leader-elect" diff --git a/controllers/terminal/config/default/manager_config_patch.yaml b/controllers/terminal/config/default/manager_config_patch.yaml deleted file mode 100644 index ca4883fc5ce5..000000000000 --- a/controllers/terminal/config/default/manager_config_patch.yaml +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright © 2023 sealos. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -apiVersion: apps/v1 -kind: Deployment -metadata: - name: controller-manager - namespace: system -spec: - template: - spec: - containers: - - name: manager - args: - - "--config=controller_manager_config.yaml" - volumeMounts: - - name: manager-config - mountPath: /controller_manager_config.yaml - subPath: controller_manager_config.yaml - volumes: - - name: manager-config - configMap: - name: manager-config diff --git a/controllers/terminal/config/manager/controller_manager_config.yaml b/controllers/terminal/config/manager/controller_manager_config.yaml deleted file mode 100644 index 6bfcb2cfd061..000000000000 --- a/controllers/terminal/config/manager/controller_manager_config.yaml +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright © 2023 sealos. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -apiVersion: controller-runtime.sigs.k8s.io/v1alpha1 -kind: ControllerManagerConfig -health: - healthProbeBindAddress: :8081 -metrics: - bindAddress: 127.0.0.1:8080 -webhook: - port: 9443 -leaderElection: - leaderElect: true - resourceName: 50686b4e.sealos.io -# leaderElectionReleaseOnCancel defines if the leader should step down volume -# when the Manager ends. This requires the binary to immediately end when the -# Manager is stopped, otherwise, this setting is unsafe. Setting this significantly -# speeds up voluntary leader transitions as the new leader don't have to wait -# LeaseDuration time first. -# In the default scaffold provided, the program ends immediately after -# the manager stops, so would be fine to enable this option. However, -# if you are doing or is intended to do any operation such as perform cleanups -# after the manager stops then its usage might be unsafe. -# leaderElectionReleaseOnCancel: true diff --git a/controllers/terminal/config/manager/kustomization.yaml b/controllers/terminal/config/manager/kustomization.yaml deleted file mode 100644 index 7d4d59453006..000000000000 --- a/controllers/terminal/config/manager/kustomization.yaml +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright © 2023 sealos. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -resources: -- manager.yaml - -generatorOptions: - disableNameSuffixHash: true - -configMapGenerator: -- files: - - controller_manager_config.yaml - name: manager-config -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -images: -- name: controller - newName: ghcr.io/labring/sealos-terminal-controller - newTag: latest diff --git a/controllers/terminal/config/manager/manager.yaml b/controllers/terminal/config/manager/manager.yaml deleted file mode 100644 index 042d7f1e56ca..000000000000 --- a/controllers/terminal/config/manager/manager.yaml +++ /dev/null @@ -1,95 +0,0 @@ -# Copyright © 2023 sealos. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -apiVersion: v1 -kind: Namespace -metadata: - labels: - control-plane: controller-manager - name: system ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: controller-manager - namespace: system - labels: - control-plane: controller-manager -spec: - selector: - matchLabels: - control-plane: controller-manager - replicas: 1 - template: - metadata: - annotations: - kubectl.kubernetes.io/default-container: manager - labels: - control-plane: controller-manager - spec: - securityContext: - runAsNonRoot: true - # TODO(user): For common cases that do not require escalating privileges - # it is recommended to ensure that all your Pods/Containers are restrictive. - # More info: https://kubernetes.io/docs/concepts/security/pod-security-standards/#restricted - # Please uncomment the following code if your project does NOT have to work on old Kubernetes - # versions < 1.19 or on vendors versions which do NOT support this field by default (i.e. Openshift < 4.11 ). - # seccompProfile: - # type: RuntimeDefault - containers: - - command: - - /manager - args: - - --leader-elect - - --config-file-path=/config.yaml - image: controller:latest - name: manager - imagePullPolicy: Always - securityContext: - runAsNonRoot: true - allowPrivilegeEscalation: false - capabilities: - drop: - - "ALL" - livenessProbe: - httpGet: - path: /healthz - port: 8081 - initialDelaySeconds: 15 - periodSeconds: 20 - readinessProbe: - httpGet: - path: /readyz - port: 8081 - initialDelaySeconds: 5 - periodSeconds: 10 - # TODO(user): Configure the resources accordingly based on the project requirements. - # More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ - resources: - limits: - cpu: 500m - memory: 128Mi - requests: - cpu: 10m - memory: 64Mi - volumeMounts: - - name: terminal-controller-volume - mountPath: /config.yaml - subPath: config.yaml - serviceAccountName: controller-manager - terminationGracePeriodSeconds: 10 - volumes: - - name: terminal-controller-volume - configMap: - name: terminal-controller-config \ No newline at end of file diff --git a/controllers/terminal/config/prometheus/kustomization.yaml b/controllers/terminal/config/prometheus/kustomization.yaml deleted file mode 100644 index a32baf71b1b4..000000000000 --- a/controllers/terminal/config/prometheus/kustomization.yaml +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright © 2023 sealos. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -resources: -- monitor.yaml diff --git a/controllers/terminal/config/prometheus/monitor.yaml b/controllers/terminal/config/prometheus/monitor.yaml deleted file mode 100644 index 32401c3d7fdc..000000000000 --- a/controllers/terminal/config/prometheus/monitor.yaml +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright © 2023 sealos. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - - -# Prometheus Monitor Service (Metrics) -apiVersion: monitoring.coreos.com/v1 -kind: ServiceMonitor -metadata: - labels: - control-plane: controller-manager - name: controller-manager-metrics-monitor - namespace: system -spec: - endpoints: - - path: /metrics - port: https - scheme: https - bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token - tlsConfig: - insecureSkipVerify: true - selector: - matchLabels: - control-plane: controller-manager diff --git a/controllers/terminal/config/rbac/auth_proxy_client_clusterrole.yaml b/controllers/terminal/config/rbac/auth_proxy_client_clusterrole.yaml deleted file mode 100644 index 0e421adaba5d..000000000000 --- a/controllers/terminal/config/rbac/auth_proxy_client_clusterrole.yaml +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright © 2023 sealos. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: metrics-reader -rules: -- nonResourceURLs: - - "/metrics" - verbs: - - get diff --git a/controllers/terminal/config/rbac/auth_proxy_role.yaml b/controllers/terminal/config/rbac/auth_proxy_role.yaml deleted file mode 100644 index 7539c6cd1e86..000000000000 --- a/controllers/terminal/config/rbac/auth_proxy_role.yaml +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright © 2023 sealos. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: proxy-role -rules: -- apiGroups: - - authentication.k8s.io - resources: - - tokenreviews - verbs: - - create -- apiGroups: - - authorization.k8s.io - resources: - - subjectaccessreviews - verbs: - - create diff --git a/controllers/terminal/config/rbac/auth_proxy_role_binding.yaml b/controllers/terminal/config/rbac/auth_proxy_role_binding.yaml deleted file mode 100644 index 84c16ebd8d6a..000000000000 --- a/controllers/terminal/config/rbac/auth_proxy_role_binding.yaml +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright © 2023 sealos. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: proxy-rolebinding -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: proxy-role -subjects: -- kind: ServiceAccount - name: controller-manager - namespace: system diff --git a/controllers/terminal/config/rbac/auth_proxy_service.yaml b/controllers/terminal/config/rbac/auth_proxy_service.yaml deleted file mode 100644 index 70e47bf67833..000000000000 --- a/controllers/terminal/config/rbac/auth_proxy_service.yaml +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright © 2023 sealos. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -apiVersion: v1 -kind: Service -metadata: - labels: - control-plane: controller-manager - name: controller-manager-metrics-service - namespace: system -spec: - ports: - - name: https - port: 8443 - protocol: TCP - targetPort: https - selector: - control-plane: controller-manager diff --git a/controllers/terminal/config/rbac/kustomization.yaml b/controllers/terminal/config/rbac/kustomization.yaml deleted file mode 100644 index 9ea536e0fd4f..000000000000 --- a/controllers/terminal/config/rbac/kustomization.yaml +++ /dev/null @@ -1,32 +0,0 @@ -# Copyright © 2023 sealos. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -resources: -# All RBAC will be applied under this service account in -# the deployment namespace. You may comment out this resource -# if your manager will use a service account that exists at -# runtime. Be sure to update RoleBinding and ClusterRoleBinding -# subjects if changing service account names. -- service_account.yaml -- role.yaml -- role_binding.yaml -- leader_election_role.yaml -- leader_election_role_binding.yaml -# Comment the following 4 lines if you want to disable -# the auth proxy (https://github.com/brancz/kube-rbac-proxy) -# which protects your /metrics endpoint. -- auth_proxy_service.yaml -- auth_proxy_role.yaml -- auth_proxy_role_binding.yaml -- auth_proxy_client_clusterrole.yaml diff --git a/controllers/terminal/config/rbac/leader_election_role.yaml b/controllers/terminal/config/rbac/leader_election_role.yaml deleted file mode 100644 index 7ccba03c9765..000000000000 --- a/controllers/terminal/config/rbac/leader_election_role.yaml +++ /dev/null @@ -1,51 +0,0 @@ -# Copyright © 2023 sealos. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# permissions to do leader election. -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - name: leader-election-role -rules: -- apiGroups: - - "" - resources: - - configmaps - verbs: - - get - - list - - watch - - create - - update - - patch - - delete -- apiGroups: - - coordination.k8s.io - resources: - - leases - verbs: - - get - - list - - watch - - create - - update - - patch - - delete -- apiGroups: - - "" - resources: - - events - verbs: - - create - - patch diff --git a/controllers/terminal/config/rbac/leader_election_role_binding.yaml b/controllers/terminal/config/rbac/leader_election_role_binding.yaml deleted file mode 100644 index 493b75ed3993..000000000000 --- a/controllers/terminal/config/rbac/leader_election_role_binding.yaml +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright © 2023 sealos. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: leader-election-rolebinding -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: leader-election-role -subjects: -- kind: ServiceAccount - name: controller-manager - namespace: system diff --git a/controllers/terminal/config/rbac/role.yaml b/controllers/terminal/config/rbac/role.yaml deleted file mode 100644 index 27fae9e1a7e3..000000000000 --- a/controllers/terminal/config/rbac/role.yaml +++ /dev/null @@ -1,94 +0,0 @@ -# Copyright © 2024 sealos. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: manager-role -rules: -- apiGroups: - - "" - resources: - - events - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - apps - resources: - - deployments - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - "" - resources: - - services - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - networking.k8s.io - resources: - - ingresses - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - terminal.sealos.io - resources: - - terminals - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - terminal.sealos.io - resources: - - terminals/finalizers - verbs: - - update -- apiGroups: - - terminal.sealos.io - resources: - - terminals/status - verbs: - - get - - patch - - update diff --git a/controllers/terminal/config/rbac/role_binding.yaml b/controllers/terminal/config/rbac/role_binding.yaml deleted file mode 100644 index 749383ffe1ec..000000000000 --- a/controllers/terminal/config/rbac/role_binding.yaml +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright © 2023 sealos. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: manager-rolebinding -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: manager-role -subjects: -- kind: ServiceAccount - name: controller-manager - namespace: system diff --git a/controllers/terminal/config/rbac/service_account.yaml b/controllers/terminal/config/rbac/service_account.yaml deleted file mode 100644 index b8ca78e010b4..000000000000 --- a/controllers/terminal/config/rbac/service_account.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright © 2023 sealos. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -apiVersion: v1 -kind: ServiceAccount -metadata: - name: controller-manager - namespace: system diff --git a/controllers/terminal/config/rbac/terminal_editor_role.yaml b/controllers/terminal/config/rbac/terminal_editor_role.yaml deleted file mode 100644 index 12d95c0b5342..000000000000 --- a/controllers/terminal/config/rbac/terminal_editor_role.yaml +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright © 2023 sealos. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# permissions for end users to edit terminals. -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: terminal-editor-role -rules: -- apiGroups: - - terminal.sealos.io - resources: - - terminals - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - terminal.sealos.io - resources: - - terminals/status - verbs: - - get diff --git a/controllers/terminal/config/rbac/terminal_viewer_role.yaml b/controllers/terminal/config/rbac/terminal_viewer_role.yaml deleted file mode 100644 index 75b6600924f0..000000000000 --- a/controllers/terminal/config/rbac/terminal_viewer_role.yaml +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright © 2023 sealos. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# permissions for end users to view terminals. -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: terminal-viewer-role -rules: -- apiGroups: - - terminal.sealos.io - resources: - - terminals - verbs: - - get - - list - - watch -- apiGroups: - - terminal.sealos.io - resources: - - terminals/status - verbs: - - get diff --git a/controllers/terminal/config/samples/terminal_v1_terminal.yaml b/controllers/terminal/config/samples/terminal_v1_terminal.yaml deleted file mode 100644 index 878bb20c375e..000000000000 --- a/controllers/terminal/config/samples/terminal_v1_terminal.yaml +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright © 2023 sealos. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -apiVersion: terminal.sealos.io/v1 -kind: Terminal -metadata: - name: terminal-sample - annotations: - lastUpdateTime: "2022-08-15T14:22:49+08:00" -spec: - user: ccl - token: abc - apiServer: https://192.168.49.2:8443 - ttyImage: ghcr.io/cuisongliu/go-docker-dev:1.18.4 - replicas: 1 - keepalived: 11h - ingressType: nginx diff --git a/controllers/terminal/controllers/config.go b/controllers/terminal/controllers/config.go deleted file mode 100644 index 9b9e9a7572c4..000000000000 --- a/controllers/terminal/controllers/config.go +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright © 2024 sealos. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package controllers - -import ( - "github.com/labring/sealos/controllers/pkg/config" -) - -type Config struct { - config.Global `yaml:"global"` - TerminalConfig TerminalConfig `yaml:"terminalController"` -} - -type TerminalConfig struct { - IngressTLSSecretName string `yaml:"ingressTLSSecretName"` -} diff --git a/controllers/terminal/controllers/ingress.go b/controllers/terminal/controllers/ingress.go deleted file mode 100644 index 6f6374272779..000000000000 --- a/controllers/terminal/controllers/ingress.go +++ /dev/null @@ -1,100 +0,0 @@ -/* -Copyright 2022 labring. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package controllers - -import ( - "fmt" - - terminalv1 "github.com/labring/sealos/controllers/terminal/api/v1" - networkingv1 "k8s.io/api/networking/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -const ( - // TODO : higress currently do not support - //nolint:unused - safeConfigurationSnippet = ` -set $flag 0; -if ($http_upgrade = 'websocket') {set $flag "${flag}1";} -if ($http_sec_fetch_site !~ 'same-.*') {set $flag "${flag}2";} -if ($flag = '02'){ return 403; }` -) - -func (r *TerminalReconciler) createNginxIngress( - terminal *terminalv1.Terminal, - host string, -) *networkingv1.Ingress { - cors := fmt.Sprintf( - "%s%s,%s*.%s", - r.getProtocol(), - r.CtrConfig.CloudDomain+r.getPort(), - r.getProtocol(), - r.CtrConfig.CloudDomain+r.getPort(), - ) - - objectMeta := metav1.ObjectMeta{ - Name: terminal.Name, - Namespace: terminal.Namespace, - Annotations: map[string]string{ - "kubernetes.io/ingress.class": "nginx", - "nginx.ingress.kubernetes.io/proxy-send-timeout": "86400", - "nginx.ingress.kubernetes.io/proxy-read-timeout": "86400", - "nginx.ingress.kubernetes.io/proxy-body-size": "32m", - "nginx.ingress.kubernetes.io/proxy-buffer-size": "64k", - "nginx.ingress.kubernetes.io/enable-cors": "true", - "nginx.ingress.kubernetes.io/cors-allow-origin": cors, - "nginx.ingress.kubernetes.io/cors-allow-methods": "PUT, GET, POST, PATCH, OPTIONS", - "nginx.ingress.kubernetes.io/cors-allow-credentials": "false", - }, - } - - pathType := networkingv1.PathTypePrefix - paths := []networkingv1.HTTPIngressPath{{ - PathType: &pathType, - Path: "/", - Backend: networkingv1.IngressBackend{ - Service: &networkingv1.IngressServiceBackend{ - Name: terminal.Status.ServiceName, - Port: networkingv1.ServiceBackendPort{ - Number: 8080, - }, - }, - }, - }} - rule := networkingv1.IngressRule{ - Host: host, - IngressRuleValue: networkingv1.IngressRuleValue{ - HTTP: &networkingv1.HTTPIngressRuleValue{ - Paths: paths, - }, - }, - } - - ingress := &networkingv1.Ingress{ - ObjectMeta: objectMeta, - Spec: networkingv1.IngressSpec{ - Rules: []networkingv1.IngressRule{rule}, - }, - } - if !r.CtrConfig.DisableHTTPS { - ingress.Spec.TLS = []networkingv1.IngressTLS{{ - Hosts: []string{host}, - SecretName: r.CtrConfig.TerminalConfig.IngressTLSSecretName, - }} - } - return ingress -} diff --git a/controllers/terminal/controllers/suite_test.go b/controllers/terminal/controllers/suite_test.go deleted file mode 100644 index fca2d47d821c..000000000000 --- a/controllers/terminal/controllers/suite_test.go +++ /dev/null @@ -1,82 +0,0 @@ -/* -Copyright 2022 labring. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package controllers - -import ( - "path/filepath" - "testing" - - terminalv1 "github.com/labring/sealos/controllers/terminal/api/v1" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "k8s.io/client-go/kubernetes/scheme" - "k8s.io/client-go/rest" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/envtest" - logf "sigs.k8s.io/controller-runtime/pkg/log" - "sigs.k8s.io/controller-runtime/pkg/log/zap" -) - -// These tests use Ginkgo (BDD-style Go testing framework). Refer to -// http://onsi.github.io/ginkgo/ to learn more about Ginkgo. - -var ( - cfg *rest.Config - k8sClient client.Client - testEnv *envtest.Environment -) - -func TestAPIs(t *testing.T) { - RegisterFailHandler(Fail) - - RunSpecsWithDefaultAndCustomReporters(t, - "Controller Suite", - []Reporter{}) -} - -var _ = BeforeSuite(func() { - logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true))) - - By("bootstrapping test environment") - truePtr := true - testEnv = &envtest.Environment{ - UseExistingCluster: &truePtr, - CRDDirectoryPaths: []string{filepath.Join("..", "config", "crd", "bases")}, - ErrorIfCRDPathMissing: true, - } - - var err error - // cfg is defined in this file globally. - cfg, err = testEnv.Start() - Expect(err).NotTo(HaveOccurred()) - Expect(cfg).NotTo(BeNil()) - - err = terminalv1.AddToScheme(scheme.Scheme) - Expect(err).NotTo(HaveOccurred()) - - //+kubebuilder:scaffold:scheme - - k8sClient, err = client.New(cfg, client.Options{Scheme: scheme.Scheme}) - Expect(err).NotTo(HaveOccurred()) - Expect(k8sClient).NotTo(BeNil()) -}, 60) - -var _ = AfterSuite(func() { - By("tearing down the test environment") - err := testEnv.Stop() - Expect(err).NotTo(HaveOccurred()) -}) diff --git a/controllers/terminal/controllers/terminal_controller.go b/controllers/terminal/controllers/terminal_controller.go deleted file mode 100644 index 1d937e77c948..000000000000 --- a/controllers/terminal/controllers/terminal_controller.go +++ /dev/null @@ -1,462 +0,0 @@ -/* -Copyright 2022 labring. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package controllers - -import ( - "context" - "time" - - "github.com/labring/sealos/controllers/pkg/utils/label" - terminalv1 "github.com/labring/sealos/controllers/terminal/api/v1" - nanoid "github.com/matoous/go-nanoid/v2" - appsv1 "k8s.io/api/apps/v1" - corev1 "k8s.io/api/core/v1" - networkingv1 "k8s.io/api/networking/v1" - "k8s.io/apimachinery/pkg/api/resource" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/util/intstr" - "k8s.io/apimachinery/pkg/util/rand" - "k8s.io/client-go/rest" - "k8s.io/client-go/tools/record" - ctrl "sigs.k8s.io/controller-runtime" - "sigs.k8s.io/controller-runtime/pkg/builder" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" - "sigs.k8s.io/controller-runtime/pkg/log" - "sigs.k8s.io/controller-runtime/pkg/predicate" -) - -const TerminalPartOf = "terminal" - -const ( - HTTPSProtocol = "https://" - HTTPProtocol = "http://" - FinalizerName = "terminal.sealos.io/finalizer" - HostnameLength = 8 - KeepaliveAnnotation = "lastUpdateTime" - LetterBytes = "abcdefghijklmnopqrstuvwxyz0123456789" -) - -const ( - DefaultDomain = "cloud.sealos.io" - DefaultPort = "" - DefaultSecretName = "wildcard-cert" - DefaultSecretNamespace = "sealos-system" -) - -// request and limit for terminal pod -const ( - CPURequest = "0.01" - MemoryRequest = "16Mi" - CPULimit = "0.3" - MemoryLimit = "256Mi" -) - -// const ( -// SecretHeaderPrefix = "X-SEALOS-" -// ) - -// TerminalReconciler reconciles a Terminal object -type TerminalReconciler struct { - client.Client - Scheme *runtime.Scheme - recorder record.EventRecorder - Config *rest.Config - CtrConfig *Config -} - -//+kubebuilder:rbac:groups=terminal.sealos.io,resources=terminals,verbs=get;list;watch;create;update;patch;delete -//+kubebuilder:rbac:groups=terminal.sealos.io,resources=terminals/status,verbs=get;update;patch -//+kubebuilder:rbac:groups=terminal.sealos.io,resources=terminals/finalizers,verbs=update -//+kubebuilder:rbac:groups=apps,resources=deployments,verbs=get;list;watch;create;update;patch;delete -//+kubebuilder:rbac:groups=core,resources=services,verbs=get;list;watch;create;update;patch;delete -//+kubebuilder:rbac:groups="",resources=events,verbs=get;list;watch;create;update;patch;delete -//+kubebuilder:rbac:groups=networking.k8s.io,resources=ingresses,verbs=get;list;watch;create;update;patch;delete - -func (r *TerminalReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { - logger := log.FromContext(ctx, "terminal", req.NamespacedName) - terminal := &terminalv1.Terminal{} - if err := r.Get(ctx, req.NamespacedName, terminal); err != nil { - return ctrl.Result{}, client.IgnoreNotFound(err) - } - - if terminal.DeletionTimestamp.IsZero() { - if controllerutil.AddFinalizer(terminal, FinalizerName) { - if err := r.Update(ctx, terminal); err != nil { - return ctrl.Result{}, err - } - } - } else { - if controllerutil.RemoveFinalizer(terminal, FinalizerName) { - if err := r.Update(ctx, terminal); err != nil { - return ctrl.Result{}, err - } - } - return ctrl.Result{}, nil - } - - if err := r.fillDefaultValue(ctx, terminal); err != nil { - return ctrl.Result{}, err - } - - if isExpired(terminal) { - if err := r.Delete(ctx, terminal); err != nil { - return ctrl.Result{}, err - } - logger.Info("delete expired terminal success") - return ctrl.Result{}, nil - } - - if terminal.Status.ServiceName == "" { - terminal.Status.ServiceName = terminal.Name + "-svc" + rand.String(5) - if err := r.Status().Update(ctx, terminal); err != nil { - return ctrl.Result{}, err - } - } - - if terminal.Status.SecretHeader == "" { - terminal.Status.SecretHeader = r.generateSecretHeader() - if err := r.Status().Update(ctx, terminal); err != nil { - return ctrl.Result{}, err - } - } - - recLabels := label.RecommendedLabels(&label.Recommended{ - Name: terminal.Name, - ManagedBy: label.DefaultManagedBy, - PartOf: TerminalPartOf, - }) - - // Note: Fixme: For `Forward Compatibility` usage only, old resource controller need this label. - recLabels["TerminalID"] = terminal.Name - - var hostname string - if err := r.syncDeployment(ctx, terminal, &hostname, recLabels); err != nil { - logger.Error(err, "create deployment failed") - r.recorder.Eventf(terminal, corev1.EventTypeWarning, "Create deployment failed", "%v", err) - return ctrl.Result{}, err - } - - if err := r.syncService(ctx, terminal, recLabels); err != nil { - logger.Error(err, "create service failed") - r.recorder.Eventf(terminal, corev1.EventTypeWarning, "Create service failed", "%v", err) - return ctrl.Result{}, err - } - - if err := r.syncIngress(ctx, terminal, hostname, recLabels); err != nil { - logger.Error(err, "create ingress failed") - r.recorder.Eventf(terminal, corev1.EventTypeWarning, "Create ingress failed", "%v", err) - return ctrl.Result{}, err - } - - r.recorder.Eventf( - terminal, - corev1.EventTypeNormal, - "Created", - "create terminal success: %v", - terminal.Name, - ) - duration, _ := time.ParseDuration(terminal.Spec.Keepalived) - return ctrl.Result{RequeueAfter: duration}, nil -} - -func (r *TerminalReconciler) syncIngress( - ctx context.Context, - terminal *terminalv1.Terminal, - hostname string, - recLabels map[string]string, -) error { - var err error - host := hostname + "." + r.CtrConfig.CloudDomain - //nolint:gocritic - switch terminal.Spec.IngressType { - case terminalv1.Nginx: - err = r.syncNginxIngress(ctx, terminal, host, recLabels) - } - return err -} - -func (r *TerminalReconciler) syncNginxIngress( - ctx context.Context, - terminal *terminalv1.Terminal, - host string, - recLabels map[string]string, -) error { - ingress := &networkingv1.Ingress{ - ObjectMeta: metav1.ObjectMeta{ - Name: terminal.Name, - Namespace: terminal.Namespace, - Labels: recLabels, - }, - } - if _, err := controllerutil.CreateOrUpdate(ctx, r.Client, ingress, func() error { - expectIngress := r.createNginxIngress(terminal, host) - ingress.Annotations = expectIngress.Annotations - ingress.Spec.Rules = expectIngress.Spec.Rules - ingress.Spec.TLS = expectIngress.Spec.TLS - return controllerutil.SetControllerReference(terminal, ingress, r.Scheme) - }); err != nil { - return err - } - - domain := r.getProtocol() + host + r.getPort() - if terminal.Status.Domain != domain { - terminal.Status.Domain = domain - return r.Status().Update(ctx, terminal) - } - - return nil -} - -func (r *TerminalReconciler) syncService( - ctx context.Context, - terminal *terminalv1.Terminal, - recLabels map[string]string, -) error { - expectServiceSpec := corev1.ServiceSpec{ - Selector: recLabels, - Type: corev1.ServiceTypeClusterIP, - Ports: []corev1.ServicePort{ - { - Name: "tty", - Port: 8080, - TargetPort: intstr.FromInt(8080), - Protocol: corev1.ProtocolTCP, - }, - }, - } - - service := &corev1.Service{ - ObjectMeta: metav1.ObjectMeta{ - Name: terminal.Status.ServiceName, - Namespace: terminal.Namespace, - Labels: recLabels, - }, - } - - if _, err := controllerutil.CreateOrUpdate(ctx, r.Client, service, func() error { - // only update some specific fields - service.Spec.Selector = expectServiceSpec.Selector - service.Spec.Type = expectServiceSpec.Type - if len(service.Spec.Ports) == 0 { - service.Spec.Ports = expectServiceSpec.Ports - } else { - service.Spec.Ports[0].Name = expectServiceSpec.Ports[0].Name - service.Spec.Ports[0].Port = expectServiceSpec.Ports[0].Port - service.Spec.Ports[0].TargetPort = expectServiceSpec.Ports[0].TargetPort - service.Spec.Ports[0].Protocol = expectServiceSpec.Ports[0].Protocol - } - return controllerutil.SetControllerReference(terminal, service, r.Scheme) - }); err != nil { - return err - } - return nil -} - -func (r *TerminalReconciler) syncDeployment( - ctx context.Context, - terminal *terminalv1.Terminal, - hostname *string, - recLabels map[string]string, -) error { - var ( - objectMeta metav1.ObjectMeta - selector *metav1.LabelSelector - templateObjMeta metav1.ObjectMeta - ports []corev1.ContainerPort - envs []corev1.EnvVar - containers []corev1.Container - ) - - objectMeta = metav1.ObjectMeta{ - Name: terminal.Name, - Namespace: terminal.Namespace, - Labels: recLabels, - } - selector = &metav1.LabelSelector{ - MatchLabels: recLabels, - } - templateObjMeta = metav1.ObjectMeta{ - Labels: recLabels, - } - ports = []corev1.ContainerPort{ - { - Name: "http", - Protocol: corev1.ProtocolTCP, - ContainerPort: 8080, - }, - } - envs = []corev1.EnvVar{ - {Name: "APISERVER", Value: terminal.Spec.APIServer}, - {Name: "USER_TOKEN", Value: terminal.Spec.Token}, - {Name: "NAMESPACE", Value: terminal.Namespace}, - {Name: "USER_NAME", Value: terminal.Spec.User}, - // Add secret header - {Name: "CREDENTIAL", Value: terminal.Status.SecretHeader}, - } - - containers = []corev1.Container{ - { - Name: "tty", - Image: terminal.Spec.TTYImage, - Ports: ports, - Env: envs, - Resources: corev1.ResourceRequirements{ - Requests: corev1.ResourceList{ - "cpu": resource.MustParse(CPURequest), - "memory": resource.MustParse(MemoryRequest), - }, - Limits: corev1.ResourceList{ - "cpu": resource.MustParse(CPULimit), - "memory": resource.MustParse(MemoryLimit), - }, - }, - }, - } - - expectDeploymentSpec := appsv1.DeploymentSpec{ - Replicas: terminal.Spec.Replicas, - Selector: selector, - Template: corev1.PodTemplateSpec{ - ObjectMeta: templateObjMeta, - Spec: corev1.PodSpec{ - Containers: containers, - }, - }, - } - - deployment := &appsv1.Deployment{ - ObjectMeta: objectMeta, - } - - if _, err := controllerutil.CreateOrUpdate(ctx, r.Client, deployment, func() error { - // only update some specific fields - deployment.Spec.Replicas = expectDeploymentSpec.Replicas - deployment.Spec.Selector = expectDeploymentSpec.Selector - deployment.Spec.Template.Labels = expectDeploymentSpec.Template.Labels - if len(deployment.Spec.Template.Spec.Containers) == 0 { - deployment.Spec.Template.Spec.Containers = containers - } else { - deployment.Spec.Template.Spec.Containers[0].Name = containers[0].Name - deployment.Spec.Template.Spec.Containers[0].Image = containers[0].Image - deployment.Spec.Template.Spec.Containers[0].Ports = containers[0].Ports - deployment.Spec.Template.Spec.Containers[0].Env = containers[0].Env - deployment.Spec.Template.Spec.Containers[0].Resources = containers[0].Resources - } - - if deployment.Spec.Template.Spec.Hostname == "" { - letterID, err := nanoid.Generate(LetterBytes, HostnameLength) - if err != nil { - return err - } - // to keep pace with ingress host, hostname must start with a lower case letter - *hostname = "t" + letterID - deployment.Spec.Template.Spec.Hostname = *hostname - } else { - *hostname = deployment.Spec.Template.Spec.Hostname - } - - return controllerutil.SetControllerReference(terminal, deployment, r.Scheme) - }); err != nil { - return err - } - - if terminal.Status.AvailableReplicas != deployment.Status.AvailableReplicas { - terminal.Status.AvailableReplicas = deployment.Status.AvailableReplicas - return r.Status().Update(ctx, terminal) - } - - return nil -} - -func (r *TerminalReconciler) fillDefaultValue( - ctx context.Context, - terminal *terminalv1.Terminal, -) error { - hasUpdate := false - if terminal.Spec.APIServer == "" { - terminal.Spec.APIServer = r.Config.Host - hasUpdate = true - } - - if _, ok := terminal.Annotations[KeepaliveAnnotation]; !ok { - terminal.Annotations[KeepaliveAnnotation] = time.Now().Format(time.RFC3339) - hasUpdate = true - } - - if hasUpdate { - return r.Update(ctx, terminal) - } - - return nil -} - -// isExpired return true if the terminal has expired -func isExpired(terminal *terminalv1.Terminal) bool { - anno := terminal.Annotations - lastUpdateTime, err := time.Parse(time.RFC3339, anno[KeepaliveAnnotation]) - if err != nil { - // treat parse errors as not expired - return false - } - - duration, _ := time.ParseDuration(terminal.Spec.Keepalived) - return lastUpdateTime.Add(duration).Before(time.Now()) -} - -func (r *TerminalReconciler) getPort() string { - port := r.CtrConfig.CloudPort - if r.CtrConfig.DisableHTTPS { - port = r.CtrConfig.HTTPPort - } - - if port == "" { - return "" - } - if r.CtrConfig.DisableHTTPS && port == "80" { - return "" - } - if !r.CtrConfig.DisableHTTPS && (port == "80" || port == "443") { - return "" - } - return ":" + port -} - -func (r *TerminalReconciler) getProtocol() string { - if r.CtrConfig.DisableHTTPS { - return HTTPProtocol - } - return HTTPSProtocol -} - -func (r *TerminalReconciler) generateSecretHeader() string { - return rand.String(5) + ":" + rand.String(5) - // return SecretHeaderPrefix + strings.ToUpper(rand.String(5)) -} - -// SetupWithManager sets up the controller with the Manager. -func (r *TerminalReconciler) SetupWithManager(mgr ctrl.Manager) error { - r.recorder = mgr.GetEventRecorderFor("sealos-terminal-controller") - r.Config = mgr.GetConfig() - return ctrl.NewControllerManagedBy(mgr). - For(&terminalv1.Terminal{}, builder.WithPredicates(predicate.GenerationChangedPredicate{})). - Owns(&appsv1.Deployment{}, builder.WithPredicates(predicate.ResourceVersionChangedPredicate{})). - Owns(&corev1.Service{}, builder.WithPredicates(predicate.GenerationChangedPredicate{})). - Owns(&networkingv1.Ingress{}, builder.WithPredicates(predicate.GenerationChangedPredicate{})). - Complete(r) -} diff --git a/controllers/terminal/deploy/Kubefile b/controllers/terminal/deploy/Kubefile deleted file mode 100644 index cac4e9d7f876..000000000000 --- a/controllers/terminal/deploy/Kubefile +++ /dev/null @@ -1,9 +0,0 @@ -FROM scratch - -USER 65532:65532 - -COPY registry registry -COPY charts charts -COPY terminal-controller-entrypoint.sh terminal-controller-entrypoint.sh - -CMD ["bash terminal-controller-entrypoint.sh"] diff --git a/controllers/terminal/deploy/README.md b/controllers/terminal/deploy/README.md deleted file mode 100644 index 08f72f32cbf2..000000000000 --- a/controllers/terminal/deploy/README.md +++ /dev/null @@ -1,38 +0,0 @@ -### How to build image - -```shell -sealos build -t docker.io/labring/sealos-terminal-controller:latest -f Kubefile . -``` - -### How to run - -```shell -sealos run docker.io/labring/sealos-terminal-controller:latest -``` - -### Configuration - -The terminal controller supports the following environment variables: - -- `RELEASE_NAME`: Helm release name (default: `terminal`) -- `RELEASE_NAMESPACE`: Deployment namespace (default: `terminal-system`) -- `CHART_PATH`: Path to helm chart (default: `./charts/terminal-controller`) -- `HELM_OPTS`: Additional helm options -- `SEALOS_CLOUD_DOMAIN`: Cloud domain (auto-detected from sealos-config) -- `SEALOS_CLOUD_PORT`: Cloud port (auto-detected from sealos-config) -- `TERMINAL_BACKUP_ENABLED`: Enable resource backup (default: `true`) -- `TERMINAL_BACKUP_DIR`: Backup directory (default: `/tmp/sealos-backup/terminal-controller`) - -### Deployment Structure - -This deployment uses Helm charts for better manageability: - -- **Chart**: `charts/terminal-controller/` -- **Entrypoint**: `terminal-controller-entrypoint.sh` -- **CRD**: Terminals.terminal.sealos.io - -The controller will automatically: -- Create namespace if it doesn't exist (via `--create-namespace`) -- Adopt existing resources for smooth migration -- Backup resources before upgrades -- Configure from sealos-system configmap diff --git a/controllers/terminal/deploy/charts/terminal-controller/.helmignore b/controllers/terminal/deploy/charts/terminal-controller/.helmignore deleted file mode 100644 index 0e8a0eb36f4c..000000000000 --- a/controllers/terminal/deploy/charts/terminal-controller/.helmignore +++ /dev/null @@ -1,23 +0,0 @@ -# Patterns to ignore when building packages. -# This supports shell glob matching, relative path matching, and -# negation (prefixed with !). Only one pattern per line. -.DS_Store -# Common VCS dirs -.git/ -.gitignore -.bzr/ -.bzrignore -.hg/ -.hgignore -.svn/ -# Common backup files -*.swp -*.bak -*.tmp -*.orig -*~ -# Various IDEs -.project -.idea/ -*.tmproj -.vscode/ diff --git a/controllers/terminal/deploy/charts/terminal-controller/Chart.yaml b/controllers/terminal/deploy/charts/terminal-controller/Chart.yaml deleted file mode 100644 index 8229d9f41751..000000000000 --- a/controllers/terminal/deploy/charts/terminal-controller/Chart.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: v2 -name: terminal -description: Helm chart for the sealos terminal controller -type: application -version: 0.1.0 -appVersion: "0.1.0" diff --git a/controllers/terminal/deploy/charts/terminal-controller/crds/terminals.terminal.sealos.io.yaml b/controllers/terminal/deploy/charts/terminal-controller/crds/terminals.terminal.sealos.io.yaml deleted file mode 100644 index 7afca3e544de..000000000000 --- a/controllers/terminal/deploy/charts/terminal-controller/crds/terminals.terminal.sealos.io.yaml +++ /dev/null @@ -1,97 +0,0 @@ -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.9.0 - creationTimestamp: null - name: terminals.terminal.sealos.io -spec: - group: terminal.sealos.io - names: - kind: Terminal - listKind: TerminalList - plural: terminals - singular: terminal - scope: Namespaced - versions: - - additionalPrinterColumns: - - jsonPath: .spec.user - name: User - type: string - - jsonPath: .spec.keepalived - name: Keepalived - type: string - - jsonPath: .status.domain - name: Domain - type: string - - jsonPath: .metadata.annotations.lastUpdateTime - name: LastUpdateTime - priority: 1 - type: string - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - name: v1 - schema: - openAPIV3Schema: - description: Terminal is the Schema for the terminals API - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - description: TerminalSpec defines the desired state of Terminal - properties: - apiServer: - type: string - ingressType: - default: nginx - enum: - - nginx - type: string - keepalived: - type: string - replicas: - format: int32 - type: integer - token: - type: string - ttyImage: - type: string - user: - type: string - required: - - keepalived - - replicas - - token - - ttyImage - - user - type: object - status: - description: TerminalStatus defines the observed state of Terminal - properties: - availableReplicas: - format: int32 - type: integer - domain: - type: string - secretHeader: - type: string - serviceName: - type: string - required: - - availableReplicas - - domain - - secretHeader - - serviceName - type: object - type: object - served: true - storage: true - subresources: - status: {} diff --git a/controllers/terminal/deploy/charts/terminal-controller/templates/NOTES.txt b/controllers/terminal/deploy/charts/terminal-controller/templates/NOTES.txt deleted file mode 100644 index 6f54f1872cd2..000000000000 --- a/controllers/terminal/deploy/charts/terminal-controller/templates/NOTES.txt +++ /dev/null @@ -1,8 +0,0 @@ -Thank you for installing {{ .Chart.Name }}. - -Your release is named {{ .Release.Name }}. - -To learn more about the release, try: - - $ helm status {{ .Release.Name }} - $ helm get all {{ .Release.Name }} diff --git a/controllers/terminal/deploy/charts/terminal-controller/templates/_helpers.tpl b/controllers/terminal/deploy/charts/terminal-controller/templates/_helpers.tpl deleted file mode 100644 index f69e0399321e..000000000000 --- a/controllers/terminal/deploy/charts/terminal-controller/templates/_helpers.tpl +++ /dev/null @@ -1,60 +0,0 @@ -{{/* -Expand the name of the chart. -*/}} -{{- define "terminal.name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Create a default fully qualified app name. -*/}} -{{- define "terminal.fullname" -}} -{{- if .Values.fullnameOverride }} -{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} -{{- else }} -{{- $name := default .Chart.Name .Values.nameOverride }} -{{- if contains $name .Release.Name }} -{{- .Release.Name | trunc 63 | trimSuffix "-" }} -{{- else }} -{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} -{{- end }} -{{- end }} -{{- end }} - -{{/* -Create chart name and version as used by the chart label. -*/}} -{{- define "terminal.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Common labels -*/}} -{{- define "terminal.labels" -}} -helm.sh/chart: {{ include "terminal.chart" . }} -{{ include "terminal.selectorLabels" . }} -{{- if .Chart.AppVersion }} -app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} -{{- end }} -app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- end }} - -{{/* -Selector labels -*/}} -{{- define "terminal.selectorLabels" -}} -app.kubernetes.io/name: {{ include "terminal.name" . }} -app.kubernetes.io/instance: {{ .Release.Name }} -{{- end }} - -{{/* -Create the name of the service account to use -*/}} -{{- define "terminal.serviceAccountName" -}} -{{- if .Values.serviceAccount.create }} -{{- default (include "terminal.fullname" .) .Values.serviceAccount.name }} -{{- else }} -{{- default "default" .Values.serviceAccount.name }} -{{- end }} -{{- end }} diff --git a/controllers/terminal/deploy/charts/terminal-controller/templates/configmap.yaml b/controllers/terminal/deploy/charts/terminal-controller/templates/configmap.yaml deleted file mode 100644 index 0e7b81372110..000000000000 --- a/controllers/terminal/deploy/charts/terminal-controller/templates/configmap.yaml +++ /dev/null @@ -1,31 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ include "terminal.fullname" . }}-manager-config - namespace: {{ .Release.Namespace }} - labels: - control-plane: controller-manager - {{- include "terminal.labels" . | nindent 4 }} -data: - controller_manager_config.yaml: | - apiVersion: controller-runtime.sigs.k8s.io/v1alpha1 - kind: ControllerManagerConfig - health: - healthProbeBindAddress: :8081 - metrics: - bindAddress: 127.0.0.1:8080 - leaderElection: - leaderElect: true - resourceName: 50686b4e.sealos.io - config.yaml: | - global: - cloudDomain: {{ .Values.config.cloudDomain | quote }} - {{- if .Values.config.cloudPort }} - cloudPort: {{ .Values.config.cloudPort | quote }} - {{- end }} - {{- if .Values.config.httpPort }} - httpPort: {{ .Values.config.httpPort | quote }} - {{- end }} - disableHttps: {{ .Values.config.disableHttps }} - terminalController: - ingressTLSSecretName: {{ .Values.config.ingressTLSSecretName | quote }} diff --git a/controllers/terminal/deploy/charts/terminal-controller/templates/deployment.yaml b/controllers/terminal/deploy/charts/terminal-controller/templates/deployment.yaml deleted file mode 100644 index 3e9a10b0287b..000000000000 --- a/controllers/terminal/deploy/charts/terminal-controller/templates/deployment.yaml +++ /dev/null @@ -1,98 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "terminal.fullname" . }}-controller-manager - labels: - control-plane: controller-manager - {{- include "terminal.labels" . | nindent 4 }} -spec: - replicas: {{ .Values.replicaCount }} - selector: - matchLabels: - control-plane: controller-manager - template: - metadata: - annotations: - kubectl.kubernetes.io/default-container: manager - checksum/terminal-manager-config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} - {{- with .Values.podAnnotations }} - {{- toYaml . | nindent 8 }} - {{- end }} - labels: - control-plane: controller-manager - {{- include "terminal.labels" . | nindent 8 }} - {{- with .Values.podLabels }} - {{- toYaml . | nindent 8 }} - {{- end }} - spec: - {{- with .Values.imagePullSecrets }} - imagePullSecrets: - {{- toYaml . | nindent 8 }} - {{- end }} - serviceAccountName: {{ include "terminal.serviceAccountName" . }} - securityContext: - {{- toYaml .Values.podSecurityContext | nindent 8 }} - containers: - - name: manager - command: - - /manager - args: - - --health-probe-bind-address=:8081 - - --metrics-bind-address=127.0.0.1:8080 - - --leader-elect - - --config-file-path=/config.yaml - env: - - name: TERMINAL_SYSTEM_NAMESPACE - valueFrom: - fieldRef: - apiVersion: v1 - fieldPath: metadata.namespace - image: "{{ .Values.image }}" - imagePullPolicy: {{ .Values.imagePullPolicy }} - livenessProbe: - {{- toYaml .Values.livenessProbe | nindent 12 }} - readinessProbe: - {{- toYaml .Values.readinessProbe | nindent 12 }} - resources: - {{- toYaml .Values.resources | nindent 12 }} - securityContext: - {{- toYaml .Values.securityContext | nindent 12 }} - volumeMounts: - {{- with .Values.volumeMounts }} - {{- toYaml . | nindent 12 }} - {{- end }} - - name: terminal-manager-config - mountPath: /config.yaml - subPath: config.yaml - terminationGracePeriodSeconds: 10 - affinity: - {{- if .Values.affinity }} - {{- toYaml .Values.affinity | nindent 8 }} - {{- else }} - podAntiAffinity: - preferredDuringSchedulingIgnoredDuringExecution: - - weight: 100 - podAffinityTerm: - labelSelector: - matchExpressions: - - key: control-plane - operator: In - values: - - controller-manager - topologyKey: kubernetes.io/hostname - {{- end }} - {{- with .Values.nodeSelector }} - nodeSelector: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.tolerations }} - tolerations: - {{- toYaml . | nindent 8 }} - {{- end }} - volumes: - {{- with .Values.volumes }} - {{- toYaml . | nindent 8 }} - {{- end }} - - name: terminal-manager-config - configMap: - name: {{ include "terminal.fullname" . }}-manager-config diff --git a/controllers/terminal/deploy/charts/terminal-controller/templates/rbac.yaml b/controllers/terminal/deploy/charts/terminal-controller/templates/rbac.yaml deleted file mode 100644 index ac2acf8ae676..000000000000 --- a/controllers/terminal/deploy/charts/terminal-controller/templates/rbac.yaml +++ /dev/null @@ -1,174 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - name: {{ include "terminal.fullname" . }}-leader-election-role - namespace: {{ .Release.Namespace }} - labels: - control-plane: controller-manager - {{- include "terminal.labels" . | nindent 4 }} -rules: - - apiGroups: - - "" - resources: - - configmaps - verbs: - - get - - list - - watch - - create - - update - - patch - - delete - - apiGroups: - - coordination.k8s.io - resources: - - leases - verbs: - - get - - list - - watch - - create - - update - - patch - - delete - - apiGroups: - - "" - resources: - - events - verbs: - - create - - patch ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: {{ include "terminal.fullname" . }}-manager-role -rules: - - apiGroups: - - "" - resources: - - events - verbs: - - create - - delete - - get - - list - - patch - - update - - watch - - apiGroups: - - apps - resources: - - deployments - verbs: - - create - - delete - - get - - list - - patch - - update - - watch - - apiGroups: - - "" - resources: - - services - verbs: - - create - - delete - - get - - list - - patch - - update - - watch - - apiGroups: - - networking.k8s.io - resources: - - ingresses - verbs: - - create - - delete - - get - - list - - patch - - update - - watch - - apiGroups: - - rbac.authorization.k8s.io - resources: - - rolebindings - verbs: - - create - - delete - - get - - list - - patch - - update - - watch - - apiGroups: - - rbac.authorization.k8s.io - resources: - - roles - verbs: - - create - - delete - - get - - list - - patch - - update - - watch - - apiGroups: - - terminal.sealos.io - resources: - - terminals - verbs: - - create - - delete - - get - - list - - patch - - update - - watch - - apiGroups: - - terminal.sealos.io - resources: - - terminals/finalizers - verbs: - - update - - apiGroups: - - terminal.sealos.io - resources: - - terminals/status - verbs: - - get - - patch - - update ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: {{ include "terminal.fullname" . }}-leader-election-rolebinding - namespace: {{ .Release.Namespace }} - labels: - control-plane: controller-manager - {{- include "terminal.labels" . | nindent 4 }} -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: {{ include "terminal.fullname" . }}-leader-election-role -subjects: - - kind: ServiceAccount - name: {{ include "terminal.serviceAccountName" . }} - namespace: {{ .Release.Namespace }} ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: {{ include "terminal.fullname" . }}-manager-rolebinding -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: {{ include "terminal.fullname" . }}-manager-role -subjects: - - kind: ServiceAccount - name: {{ include "terminal.serviceAccountName" . }} - namespace: {{ .Release.Namespace }} diff --git a/controllers/terminal/deploy/charts/terminal-controller/templates/service.yaml b/controllers/terminal/deploy/charts/terminal-controller/templates/service.yaml deleted file mode 100644 index 8686ddcee419..000000000000 --- a/controllers/terminal/deploy/charts/terminal-controller/templates/service.yaml +++ /dev/null @@ -1,16 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - labels: - control-plane: controller-manager - {{- include "terminal.labels" . | nindent 4 }} - name: {{ include "terminal.fullname" . }}-controller-manager-metrics-service - namespace: {{ .Release.Namespace }} -spec: - ports: - - name: https - port: 8443 - protocol: TCP - targetPort: https - selector: - control-plane: controller-manager diff --git a/controllers/terminal/deploy/charts/terminal-controller/templates/serviceaccount.yaml b/controllers/terminal/deploy/charts/terminal-controller/templates/serviceaccount.yaml deleted file mode 100644 index 2314ee0a8e4d..000000000000 --- a/controllers/terminal/deploy/charts/terminal-controller/templates/serviceaccount.yaml +++ /dev/null @@ -1,12 +0,0 @@ -apiVersion: v1 -kind: ServiceAccount -metadata: - name: {{ include "terminal.serviceAccountName" . }} - namespace: {{ .Release.Namespace }} - labels: - control-plane: controller-manager - {{- include "terminal.labels" . | nindent 4 }} - {{- with .Values.serviceAccount.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} diff --git a/controllers/terminal/deploy/charts/terminal-controller/values.yaml b/controllers/terminal/deploy/charts/terminal-controller/values.yaml deleted file mode 100644 index 9be7f004752a..000000000000 --- a/controllers/terminal/deploy/charts/terminal-controller/values.yaml +++ /dev/null @@ -1,69 +0,0 @@ -# Default values for terminal controller helm chart. - -replicaCount: 1 - -image: ghcr.io/labring/sealos-terminal-controller:latest -imagePullPolicy: Always - -imagePullSecrets: [] -nameOverride: "" -fullnameOverride: "terminal" - -serviceAccount: - create: true - automount: true - annotations: {} - name: "terminal-controller-manager" - -podAnnotations: {} -podLabels: {} - -podSecurityContext: - runAsNonRoot: true - -securityContext: - allowPrivilegeEscalation: false - runAsNonRoot: true - -service: - metrics: - port: 8443 - -resources: - limits: - cpu: 500m - memory: 128Mi - requests: - cpu: 10m - memory: 64Mi - -config: - cloudDomain: "cloud.sealos.io" - cloudPort: "" - httpPort: "" - disableHttps: false - ingressTLSSecretName: "wildcard-cert-sealos" - -livenessProbe: - httpGet: - path: /healthz - port: 8081 - initialDelaySeconds: 15 - periodSeconds: 20 - -readinessProbe: - httpGet: - path: /readyz - port: 8081 - initialDelaySeconds: 5 - periodSeconds: 10 - -volumes: [] -volumeMounts: [] - -nodeSelector: {} - -tolerations: [] - -# If no affinity is provided a default podAntiAffinity is used to spread controllers. -affinity: {} diff --git a/controllers/terminal/deploy/terminal-controller-entrypoint.sh b/controllers/terminal/deploy/terminal-controller-entrypoint.sh deleted file mode 100755 index 74ebd6e181bf..000000000000 --- a/controllers/terminal/deploy/terminal-controller-entrypoint.sh +++ /dev/null @@ -1,130 +0,0 @@ -#!/bin/bash -set -ex - -HELM_OPTS=${HELM_OPTS:-""} -RELEASE_NAME=${RELEASE_NAME:-"terminal"} -RELEASE_NAMESPACE=${RELEASE_NAMESPACE:-"terminal-system"} -CHART_PATH=${CHART_PATH:-"./charts/terminal-controller"} - -TERMINAL_BACKUP_ENABLED=${TERMINAL_BACKUP_ENABLED:-"true"} -TERMINAL_BACKUP_DIR=${TERMINAL_BACKUP_DIR:-"/tmp/sealos-backup/terminal-controller"} - -adopt_namespaced_resource() { - local kind="$1" - local name="$2" - if kubectl -n "${RELEASE_NAMESPACE}" get "${kind}" "${name}" >/dev/null 2>&1; then - kubectl -n "${RELEASE_NAMESPACE}" label "${kind}" "${name}" app.kubernetes.io/managed-by=Helm --overwrite >/dev/null 2>&1 || true - kubectl -n "${RELEASE_NAMESPACE}" annotate "${kind}" "${name}" meta.helm.sh/release-name="${RELEASE_NAME}" meta.helm.sh/release-namespace="${RELEASE_NAMESPACE}" --overwrite >/dev/null 2>&1 || true - fi -} - -adopt_cluster_resource() { - local kind="$1" - local name="$2" - if kubectl get "${kind}" "${name}" >/dev/null 2>&1; then - kubectl label "${kind}" "${name}" app.kubernetes.io/managed-by=Helm --overwrite >/dev/null 2>&1 || true - kubectl annotate "${kind}" "${name}" meta.helm.sh/release-name="${RELEASE_NAME}" meta.helm.sh/release-namespace="${RELEASE_NAMESPACE}" --overwrite >/dev/null 2>&1 || true - fi -} - -get_cm_value() { - local namespace="$1" - local name="$2" - local key="$3" - kubectl get configmap "${name}" -n "${namespace}" -o "jsonpath={.data.${key}}" 2>/dev/null || true -} - -add_set_string() { - local key="$1" - local value="$2" - HELM_SET_ARGS+=(--set-string "${key}=${value}") -} - -backup_ns_resource() { - local kind="$1" - local name="$2" - if kubectl -n "${RELEASE_NAMESPACE}" get "${kind}" "${name}" >/dev/null 2>&1; then - kubectl -n "${RELEASE_NAMESPACE}" get "${kind}" "${name}" -o yaml >> "${TERMINAL_BACKUP_FILE}" - printf "\n---\n" >> "${TERMINAL_BACKUP_FILE}" - fi -} - -backup_cluster_resource() { - local kind="$1" - local name="$2" - if kubectl get "${kind}" "${name}" >/dev/null 2>&1; then - kubectl get "${kind}" "${name}" -o yaml >> "${TERMINAL_BACKUP_FILE}" - printf "\n---\n" >> "${TERMINAL_BACKUP_FILE}" - fi -} - -backup_terminal_resources() { - if [ "${TERMINAL_BACKUP_ENABLED}" != "true" ]; then - return - fi - local ts - ts=$(date +%Y%m%d%H%M%S) - mkdir -p "${TERMINAL_BACKUP_DIR}" - TERMINAL_BACKUP_FILE="${TERMINAL_BACKUP_DIR}/update-${ts}.yaml" - : > "${TERMINAL_BACKUP_FILE}" - - backup_cluster_resource customresourcedefinition terminals.terminal.sealos.io - backup_cluster_resource clusterrole terminal-manager-role - backup_cluster_resource clusterrolebinding terminal-manager-rolebinding - - if kubectl get namespace "${RELEASE_NAMESPACE}" >/dev/null 2>&1; then - kubectl get namespace "${RELEASE_NAMESPACE}" -o yaml >> "${TERMINAL_BACKUP_FILE}" - printf "\n---\n" >> "${TERMINAL_BACKUP_FILE}" - fi - backup_ns_resource configmap terminal-manager-config - backup_ns_resource service terminal-controller-manager-metrics-service - backup_ns_resource deployment terminal-controller-manager - backup_ns_resource serviceaccount terminal-controller-manager - backup_ns_resource role terminal-leader-election-role - backup_ns_resource rolebinding terminal-leader-election-rolebinding -} - -backup_terminal_resources - -HELM_SET_ARGS=() - -# Auto configure from sealos-config -SEALOS_CLOUD_DOMAIN=${SEALOS_CLOUD_DOMAIN:-"$(get_cm_value sealos-system sealos-config cloudDomain)"} -SEALOS_CLOUD_PORT=${SEALOS_CLOUD_PORT:-"$(get_cm_value sealos-system sealos-config cloudPort)"} -SEALOS_HTTP_PORT=${SEALOS_HTTP_PORT:-"$(get_cm_value sealos-system sealos-config httpPort)"} -SEALOS_DISABLE_HTTPS=${SEALOS_DISABLE_HTTPS:-"$(get_cm_value sealos-system sealos-config disableHttps)"} - -if [ -n "${SEALOS_CLOUD_DOMAIN}" ]; then - add_set_string config.cloudDomain "${SEALOS_CLOUD_DOMAIN}" -fi - -if [ -n "${SEALOS_CLOUD_PORT}" ]; then - add_set_string config.cloudPort "${SEALOS_CLOUD_PORT}" -fi - -if [ -n "${SEALOS_HTTP_PORT}" ]; then - add_set_string config.httpPort "${SEALOS_HTTP_PORT}" -fi - -if [ -n "${SEALOS_DISABLE_HTTPS}" ]; then - add_set_string config.disableHttps "${SEALOS_DISABLE_HTTPS}" -fi - -if ! helm status "${RELEASE_NAME}" -n "${RELEASE_NAMESPACE}" >/dev/null 2>&1; then - if kubectl get namespace "${RELEASE_NAMESPACE}" >/dev/null 2>&1; then - kubectl label namespace "${RELEASE_NAMESPACE}" app.kubernetes.io/managed-by=Helm --overwrite >/dev/null 2>&1 || true - kubectl annotate namespace "${RELEASE_NAMESPACE}" meta.helm.sh/release-name="${RELEASE_NAME}" meta.helm.sh/release-namespace="${RELEASE_NAMESPACE}" --overwrite >/dev/null 2>&1 || true - fi - - adopt_namespaced_resource configmap terminal-manager-config - adopt_namespaced_resource service terminal-controller-manager-metrics-service - adopt_namespaced_resource deployment terminal-controller-manager - adopt_namespaced_resource serviceaccount terminal-controller-manager - adopt_namespaced_resource role terminal-leader-election-role - adopt_namespaced_resource rolebinding terminal-leader-election-rolebinding - - adopt_cluster_resource clusterrole terminal-manager-role - adopt_cluster_resource clusterrolebinding terminal-manager-rolebinding -fi - -helm upgrade -i "${RELEASE_NAME}" -n "${RELEASE_NAMESPACE}" --create-namespace "${CHART_PATH}" "${HELM_SET_ARGS[@]}" ${HELM_OPTS} diff --git a/controllers/terminal/go.mod b/controllers/terminal/go.mod deleted file mode 100644 index 94111f087dcf..000000000000 --- a/controllers/terminal/go.mod +++ /dev/null @@ -1,82 +0,0 @@ -module github.com/labring/sealos/controllers/terminal - -go 1.24.0 - -replace ( - k8s.io/api => k8s.io/api v0.32.3 - k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.32.1 - k8s.io/apimachinery => k8s.io/apimachinery v0.32.1 - k8s.io/client-go => k8s.io/client-go v0.32.1 - sigs.k8s.io/controller-runtime => sigs.k8s.io/controller-runtime v0.20.4 -) - -require ( - github.com/labring/sealos/controllers/pkg v0.0.0-00010101000000-000000000000 - github.com/matoous/go-nanoid/v2 v2.1.0 - github.com/onsi/ginkgo v1.16.5 - github.com/onsi/gomega v1.36.1 - k8s.io/api v0.32.1 - k8s.io/apimachinery v0.32.3 - k8s.io/client-go v12.0.0+incompatible - sigs.k8s.io/controller-runtime v0.17.2 -) - -require ( - github.com/beorn7/perks v1.0.1 // indirect - github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/emicklei/go-restful/v3 v3.11.0 // indirect - github.com/evanphx/json-patch/v5 v5.9.11 // indirect - github.com/fsnotify/fsnotify v1.7.0 // indirect - github.com/fxamacker/cbor/v2 v2.7.0 // indirect - github.com/go-logr/logr v1.4.2 // indirect - github.com/go-logr/zapr v1.3.0 // indirect - github.com/go-openapi/jsonpointer v0.21.0 // indirect - github.com/go-openapi/jsonreference v0.20.2 // indirect - github.com/go-openapi/swag v0.23.0 // indirect - github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/protobuf v1.5.4 // indirect - github.com/google/btree v1.1.3 // indirect - github.com/google/gnostic-models v0.6.8 // indirect - github.com/google/go-cmp v0.6.0 // indirect - github.com/google/gofuzz v1.2.0 // indirect - github.com/google/uuid v1.6.0 // indirect - github.com/josharian/intern v1.0.0 // indirect - github.com/json-iterator/go v1.1.12 // indirect - github.com/mailru/easyjson v0.7.7 // indirect - github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect - github.com/modern-go/reflect2 v1.0.2 // indirect - github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect - github.com/nxadm/tail v1.4.8 // indirect - github.com/pkg/errors v0.9.1 // indirect - github.com/prometheus/client_golang v1.19.1 // indirect - github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.55.0 // indirect - github.com/prometheus/procfs v0.15.1 // indirect - github.com/spf13/pflag v1.0.5 // indirect - github.com/x448/float16 v0.8.4 // indirect - go.uber.org/multierr v1.11.0 // indirect - go.uber.org/zap v1.27.0 // indirect - golang.org/x/net v0.30.0 // indirect - golang.org/x/oauth2 v0.23.0 // indirect - golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.26.0 // indirect - golang.org/x/term v0.25.0 // indirect - golang.org/x/text v0.19.0 // indirect - golang.org/x/time v0.7.0 // indirect - gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect - google.golang.org/protobuf v1.35.1 // indirect - gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect - gopkg.in/inf.v0 v0.9.1 // indirect - gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/apiextensions-apiserver v0.32.1 // indirect - k8s.io/klog/v2 v2.130.1 // indirect - k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f // indirect - k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 // indirect - sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 // indirect - sigs.k8s.io/structured-merge-diff/v4 v4.4.2 // indirect - sigs.k8s.io/yaml v1.4.0 // indirect -) - -replace github.com/labring/sealos/controllers/pkg => ../pkg diff --git a/controllers/terminal/go.sum b/controllers/terminal/go.sum deleted file mode 100644 index fd79f2532f3b..000000000000 --- a/controllers/terminal/go.sum +++ /dev/null @@ -1,239 +0,0 @@ -github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= -github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= -github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g= -github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= -github.com/evanphx/json-patch v0.5.2 h1:xVCHIVMUu1wtM/VkR9jVZ45N3FhZfYMMYGorLCR8P3k= -github.com/evanphx/json-patch v0.5.2/go.mod h1:ZWS5hhDbVDyob71nXKNL0+PWn6ToqBHMikGIFbs31qQ= -github.com/evanphx/json-patch/v5 v5.9.11 h1:/8HVnzMq13/3x9TPvjG08wUGqBTmZBsCWzjTM0wiaDU= -github.com/evanphx/json-patch/v5 v5.9.11/go.mod h1:3j+LviiESTElxA4p3EMKAB9HXj3/XEtnUf6OZxqIQTM= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= -github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= -github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E= -github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ= -github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= -github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= -github.com/go-logr/zapr v1.3.0 h1:XGdV8XW8zdwFiwOA2Dryh1gj2KRQyOOoNmBy4EplIcQ= -github.com/go-logr/zapr v1.3.0/go.mod h1:YKepepNBd1u/oyhd/yQmtjVXmm9uML4IXUgMOwR8/Gg= -github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= -github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ= -github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY= -github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE= -github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k= -github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= -github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE= -github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ= -github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 h1:p104kn46Q8WdvHunIJ9dAyjPVtrBPhSr3KT2yUst43I= -github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= -github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= -github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= -github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= -github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= -github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= -github.com/google/btree v1.1.3 h1:CVpQJjYgC4VbzxeGVHfvZrv1ctoYCAI8vbl07Fcxlyg= -github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= -github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I= -github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= -github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db h1:097atOisP2aRj7vFgYQBbFN4U4JNXUNYpxael3UzMyo= -github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= -github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= -github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= -github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= -github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= -github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= -github.com/matoous/go-nanoid/v2 v2.1.0 h1:P64+dmq21hhWdtvZfEAofnvJULaRR1Yib0+PnU669bE= -github.com/matoous/go-nanoid/v2 v2.1.0/go.mod h1:KlbGNQ+FhrUNIHUxZdL63t7tl4LaPkZNpUULS8H4uVM= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= -github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= -github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= -github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= -github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= -github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= -github.com/onsi/ginkgo/v2 v2.22.0 h1:Yed107/8DjTr0lKCNt7Dn8yQ6ybuDRQoMGrNFKzMfHg= -github.com/onsi/ginkgo/v2 v2.22.0/go.mod h1:7Du3c42kxCUegi0IImZ1wUQzMBVecgIHjR1C+NkhLQo= -github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.36.1 h1:bJDPBO7ibjxcbHMgSCoo4Yj18UWbKDlLwX1x9sybDcw= -github.com/onsi/gomega v1.36.1/go.mod h1:PvZbdDc8J6XJEpDK4HCuRBm8a6Fzp9/DmhC9C7yFlog= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= -github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= -github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= -github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= -github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= -github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= -github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= -github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= -github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= -github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= -github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= -github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= -github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= -go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= -go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= -go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= -go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= -go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= -golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= -golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs= -golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= -golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= -golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24= -golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= -golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= -golang.org/x/time v0.7.0 h1:ntUhktv3OPE6TgYxXWv9vKvUSJyIFJlyohwbkEwPrKQ= -golang.org/x/time v0.7.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= -golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -gomodules.xyz/jsonpatch/v2 v2.4.0 h1:Ci3iUJyx9UeRx7CeFN8ARgGbkESwJK+KB9lLcWxY/Zw= -gomodules.xyz/jsonpatch/v2 v2.4.0/go.mod h1:AH3dM2RI6uoBZxn3LVrfvJ3E0/9dG4cSrbuBJT4moAY= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= -google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/evanphx/json-patch.v4 v4.12.0 h1:n6jtcsulIzXPJaxegRbvFNNrZDjbij7ny3gmSPG+6V4= -gopkg.in/evanphx/json-patch.v4 v4.12.0/go.mod h1:p8EYWUEYMpynmqDbY58zCKCFZw8pRWMG4EsWvDvM72M= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= -gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -k8s.io/api v0.32.3 h1:Hw7KqxRusq+6QSplE3NYG4MBxZw1BZnq4aP4cJVINls= -k8s.io/api v0.32.3/go.mod h1:2wEDTXADtm/HA7CCMD8D8bK4yuBUptzaRhYcYEEYA3k= -k8s.io/apiextensions-apiserver v0.32.1 h1:hjkALhRUeCariC8DiVmb5jj0VjIc1N0DREP32+6UXZw= -k8s.io/apiextensions-apiserver v0.32.1/go.mod h1:sxWIGuGiYov7Io1fAS2X06NjMIk5CbRHc2StSmbaQto= -k8s.io/apimachinery v0.32.1 h1:683ENpaCBjma4CYqsmZyhEzrGz6cjn1MY/X2jB2hkZs= -k8s.io/apimachinery v0.32.1/go.mod h1:GpHVgxoKlTxClKcteaeuF1Ul/lDVb74KpZcxcmLDElE= -k8s.io/client-go v0.32.1 h1:otM0AxdhdBIaQh7l1Q0jQpmo7WOFIk5FFa4bg6YMdUU= -k8s.io/client-go v0.32.1/go.mod h1:aTTKZY7MdxUaJ/KiUs8D+GssR9zJZi77ZqtzcGXIiDg= -k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= -k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= -k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f h1:GA7//TjRY9yWGy1poLzYYJJ4JRdzg3+O6e8I+e+8T5Y= -k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f/go.mod h1:R/HEjbvWI0qdfb8viZUeVZm0X6IZnxAydC7YU42CMw4= -k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 h1:M3sRQVHv7vB20Xc2ybTt7ODCeFj6JSWYFzOFnYeS6Ro= -k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -sigs.k8s.io/controller-runtime v0.20.4 h1:X3c+Odnxz+iPTRobG4tp092+CvBU9UK0t/bRf+n0DGU= -sigs.k8s.io/controller-runtime v0.20.4/go.mod h1:xg2XB0K5ShQzAgsoujxuKN4LNXR2LfwwHsPj7Iaw+XY= -sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 h1:/Rv+M11QRah1itp8VhT6HoVx1Ray9eB4DBr+K+/sCJ8= -sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3/go.mod h1:18nIHnGi6636UCz6m8i4DhaJ65T6EruyzmoQqI2BVDo= -sigs.k8s.io/structured-merge-diff/v4 v4.4.2 h1:MdmvkGuXi/8io6ixD5wud3vOLwc1rj0aNqRlpuvjmwA= -sigs.k8s.io/structured-merge-diff/v4 v4.4.2/go.mod h1:N8f93tFZh9U6vpxwRArLiikrE5/2tiu1w1AGfACIGE4= -sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= -sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= diff --git a/controllers/terminal/hack/boilerplate.go.txt b/controllers/terminal/hack/boilerplate.go.txt deleted file mode 100644 index fb1b985cb87d..000000000000 --- a/controllers/terminal/hack/boilerplate.go.txt +++ /dev/null @@ -1,15 +0,0 @@ -/* -Copyright 2022 labring. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ \ No newline at end of file diff --git a/controllers/terminal/main.go b/controllers/terminal/main.go deleted file mode 100644 index 5b56d39a0347..000000000000 --- a/controllers/terminal/main.go +++ /dev/null @@ -1,160 +0,0 @@ -/* -Copyright 2022 labring. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package main - -import ( - "flag" - "os" - - configpkg "github.com/labring/sealos/controllers/pkg/config" - "github.com/labring/sealos/controllers/pkg/utils/label" - terminalv1 "github.com/labring/sealos/controllers/terminal/api/v1" - "github.com/labring/sealos/controllers/terminal/controllers" - appsv1 "k8s.io/api/apps/v1" - corev1 "k8s.io/api/core/v1" - networkingv1 "k8s.io/api/networking/v1" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/apimachinery/pkg/runtime" - utilruntime "k8s.io/apimachinery/pkg/util/runtime" - clientgoscheme "k8s.io/client-go/kubernetes/scheme" - _ "k8s.io/client-go/plugin/pkg/client/auth" - "k8s.io/client-go/rest" - ctrl "sigs.k8s.io/controller-runtime" - "sigs.k8s.io/controller-runtime/pkg/cache" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/healthz" - "sigs.k8s.io/controller-runtime/pkg/log/zap" - metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server" -) - -var ( - scheme = runtime.NewScheme() - setupLog = ctrl.Log.WithName("setup") -) - -func init() { - utilruntime.Must(clientgoscheme.AddToScheme(scheme)) - utilruntime.Must(terminalv1.AddToScheme(scheme)) - //+kubebuilder:scaffold:scheme -} - -func main() { - var metricsAddr string - var enableLeaderElection bool - var probeAddr string - var configFilePath string - flag.StringVar( - &metricsAddr, - "metrics-bind-address", - ":8080", - "The address the metric endpoint binds to.", - ) - flag.StringVar( - &probeAddr, - "health-probe-bind-address", - ":8081", - "The address the probe endpoint binds to.", - ) - flag.BoolVar(&enableLeaderElection, "leader-elect", false, - "Enable leader election for controller manager. "+ - "Enabling this will ensure there is only one active controller manager.") - flag.StringVar( - &configFilePath, - "config-file-path", - "/config.yaml", - "The path of the config file", - ) - opts := zap.Options{ - Development: true, - } - opts.BindFlags(flag.CommandLine) - flag.Parse() - - ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts))) - - cacheObjLabelSelector := labels.SelectorFromSet(labels.Set{ - label.AppManagedBy: label.DefaultManagedBy, - label.AppPartOf: controllers.TerminalPartOf, - }) - - mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{ - Scheme: scheme, - Metrics: metricsserver.Options{ - BindAddress: metricsAddr, - }, - HealthProbeBindAddress: probeAddr, - LeaderElection: enableLeaderElection, - LeaderElectionID: "50686b4e.sealos.io", - // LeaderElectionReleaseOnCancel defines if the leader should step down voluntarily - // when the Manager ends. This requires the binary to immediately end when the - // Manager is stopped, otherwise, this setting is unsafe. Setting this significantly - // speeds up voluntary leader transitions as the new leader don't have to wait - // LeaseDuration time first. - // - // In the default scaffold provided, the program ends immediately after - // the manager stops, so would be fine to enable this option. However, - // if you are doing or is intended to do any operation such as perform cleanups - // after the manager stops then its usage might be unsafe. - // LeaderElectionReleaseOnCancel: true, - - // add custom cache for memory footprint optimization - NewCache: func(config *rest.Config, opts cache.Options) (cache.Cache, error) { - opts.ByObject = map[client.Object]cache.ByObject{ - &appsv1.Deployment{}: {Label: cacheObjLabelSelector}, - &corev1.Service{}: {Label: cacheObjLabelSelector}, - &networkingv1.Ingress{}: {Label: cacheObjLabelSelector}, - } - return cache.New(config, opts) - }, - }) - if err != nil { - setupLog.Error(err, "unable to start manager") - os.Exit(1) - } - - // Load the configuration file - config := &controllers.Config{} - if err := configpkg.LoadConfig(configFilePath, config); err != nil { - setupLog.Error(err, "unable to load configuration file") - os.Exit(1) - } - - if err = (&controllers.TerminalReconciler{ - Client: mgr.GetClient(), - Scheme: mgr.GetScheme(), - CtrConfig: config, - }).SetupWithManager(mgr); err != nil { - setupLog.Error(err, "unable to create controller", "controller", "Terminal") - os.Exit(1) - } - //+kubebuilder:scaffold:builder - - if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil { - setupLog.Error(err, "unable to set up health check") - os.Exit(1) - } - if err := mgr.AddReadyzCheck("readyz", healthz.Ping); err != nil { - setupLog.Error(err, "unable to set up ready check") - os.Exit(1) - } - - setupLog.Info("starting manager") - if err := mgr.Start(ctrl.SetupSignalHandler()); err != nil { - setupLog.Error(err, "fail to run manager") - os.Exit(1) - } -} diff --git a/controllers/terminal/scripts/Dockerfile-terminal-all b/controllers/terminal/scripts/Dockerfile-terminal-all deleted file mode 100644 index aa783f667318..000000000000 --- a/controllers/terminal/scripts/Dockerfile-terminal-all +++ /dev/null @@ -1,71 +0,0 @@ -FROM centos:7.6.1810 -# install tty -RUN yum install -y wget && yum install -y bind-utils && \ - wget https://github.com/tsl0922/ttyd/releases/download/1.4.2/ttyd_linux.x86_64 && \ - chmod +x ttyd_linux.x86_64 && \ - mv ttyd_linux.x86_64 /usr/bin/ttyd - -# install golang -RUN cd /root && wget https://dl.google.com/go/go1.12.linux-amd64.tar.gz && \ - tar zxvf go1.12.linux-amd64.tar.gz && \ - rm -rf go1.12.linux-amd64.tar.gz && mkdir /root/work -ENV GOROOT=/root/go GOPATH=/root/work PATH=$PATH:/root/go/bin:/root/work/bin - -# ENV APISERVER="https://127.0.0.1:6443" -# ENV USER_TOKEN="xxx" -# ENV NAMESPACE="default" -# ENV USER_NAME="fanux" -# ENV TERMINAL_ID="UUID" - -# install kubectl -RUN wget https://dl.k8s.io/v1.13.3/kubernetes-client-linux-amd64.tar.gz && \ - tar zxvf kubernetes-client-linux-amd64.tar.gz && \ - cp kubernetes/client/bin/kubectl /usr/bin && \ - rm -rf kubernetes-client-linux-amd64.tar.gz kubernetes - -# install zsh -RUN yum install -y git && \ - yum -y install zsh && sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)" - -# RUN cd /bin && wget https://github.com/neovim/neovim/releases/download/nightly/nvim-linux64.tar.gz && \ -# tar zxvf nvim-linux64.tar.gz && cp /bin/nvim-linux64/bin/nvim /bin/nvim-linux64/bin/vim && ls /bin/nvim-linux64/bin/vim -# ENV PATH=$PATH:/bin/nvim-linux64/bin - -RUN yum install -y ncurses-devel ruby ruby-devel lua lua-devel luajit \ - luajit-devel ctags git python python-devel \ - python3 python3-devel tcl-devel \ - perl perl-devel perl-ExtUtils-ParseXS \ - perl-ExtUtils-XSpp perl-ExtUtils-CBuilder \ - perl-ExtUtils-Embed \ - gcc-c++ cmake make && \ - wget https://github.com/vim/vim/archive/v8.1.0994.tar.gz && \ - tar zxvf v8.1.0994.tar.gz && cd vim-8.1.0994/src && \ - ./configure --with-features=huge \ - --enable-multibyte \ - --enable-pythoninterp=yes \ - --with-python-config-dir=/lib64/python2.7/config \ - --enable-python3interp=yes \ - --with-python3-config-dir=/lib64/python3.5/config \ - --enable-gui=gtk2 \ - --enable-cscope \ - --prefix=/usr/local \ - && make VIMRUNTIMEDIR=/usr/local/share/vim/vim81 && make install -RUN update-alternatives --install /usr/bin/editor editor /usr/local/bin/vim 1 && \ - update-alternatives --set editor /usr/local/bin/vim -ENV PATH=$PATH:/usr/local/bin - -# install vim and vim plugins -COPY .vimrc /root/.vimrc -RUN git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim && go get github.com/golang/lint || true - -# RUN vim +PluginInstall +qall -e || true && \ -# && git clone https://github.com/Valloric/YouCompleteMe ~/.vim/bundle/YouCompleteMe \ -# && cd ~/.vim/bundle/YouCompleteMe && \ -# ./install.py --clangd-completer --go-completer --ts-completer - -# vim +PluginInstall +qall && vim +GoInstallBinaries && -# or using ttyd -p 8080 bash -# or using ttyd -p 8080 zsh -COPY start-terminal.sh . -CMD ["sh","./start-terminal.sh"] - diff --git a/controllers/terminal/scripts/start-terminal.sh b/controllers/terminal/scripts/start-terminal.sh deleted file mode 100644 index 2bdd64f5a265..000000000000 --- a/controllers/terminal/scripts/start-terminal.sh +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright © 2023 sealos. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -env - -kubectl config set-credentials ${USER_NAME} --token=${USER_TOKEN} -kubectl config set-cluster kubernetes --server=${APISERVER} --insecure-skip-tls-verify=true -kubectl config set-context kubernetes \ ---cluster=kubernetes \ ---user=${USER_NAME} \ ---namespace=${NAMESPACE} -kubectl config use-context kubernetes - -cat ~/.kube/config - -# ttyd -p 8080 bash -ttyd -p 8080 zsh \ No newline at end of file diff --git a/frontend/Makefile b/frontend/Makefile index 1c373dabd079..c5b48eea08d1 100644 --- a/frontend/Makefile +++ b/frontend/Makefile @@ -15,7 +15,6 @@ endif # build image buildTargets := \ desktop \ - providers/terminal \ providers/costcenter \ providers/dbprovider \ providers/applaunchpad \ diff --git a/frontend/README.md b/frontend/README.md index b679aacad9e7..373305cc4fcf 100644 --- a/frontend/README.md +++ b/frontend/README.md @@ -39,7 +39,6 @@ pnpm dev-desktop pnpm dev-app # applaunchpad pnpm dev-db # dbprovider pnpm dev-cost # costcenter -pnpm dev-terminal # terminal pnpm dev-template # template # or run dev script in app's package directory diff --git a/frontend/desktop/public/images/terminal.svg b/frontend/desktop/public/images/terminal.svg deleted file mode 100644 index 7f0e5223315e..000000000000 --- a/frontend/desktop/public/images/terminal.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/frontend/package.json b/frontend/package.json index 2bed9a3b6c1a..842c4e598aaa 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -8,7 +8,6 @@ "dev-app": "pnpm -r --filter ./providers/applaunchpad run dev", "dev-db": "pnpm -r --filter ./providers/dbprovider run dev", "dev-cost": "pnpm -r --filter ./providers/costcenter run dev", - "dev-terminal": "pnpm -r --filter ./providers/terminal run dev", "dev-template": "pnpm -r --filter ./providers/template run dev", "dev-license": "pnpm -r --filter ./providers/license run dev", "gen:theme-typings": "pnpm chakra-cli tokens packages/ui/src/theme/theme.ts --out node_modules/.pnpm/node_modules/@chakra-ui/styled-system/dist/theming.types.d.ts", diff --git a/frontend/pnpm-lock.yaml b/frontend/pnpm-lock.yaml index e2cde3333e95..bb285efc7a1e 100644 --- a/frontend/pnpm-lock.yaml +++ b/frontend/pnpm-lock.yaml @@ -1670,115 +1670,6 @@ importers: specifier: ^1.6.0 version: 1.6.1(@types/node@18.13.0)(sass@1.69.5) - providers/terminal: - dependencies: - '@chakra-ui/anatomy': - specifier: ^2.2.1 - version: 2.2.2 - '@chakra-ui/icons': - specifier: ^2.1.1 - version: 2.1.1(@chakra-ui/system@2.6.2)(react@18.2.0) - '@chakra-ui/next-js': - specifier: ^2.1.5 - version: 2.2.0(@chakra-ui/react@2.8.2)(@emotion/react@11.11.1)(next@13.5.9)(react@18.2.0) - '@chakra-ui/react': - specifier: ^2.8.1 - version: 2.8.2(@emotion/react@11.11.1)(@emotion/styled@11.11.0)(@types/react@18.2.37)(framer-motion@10.16.5)(react-dom@18.2.0)(react@18.2.0) - '@chakra-ui/system': - specifier: ^2.6.1 - version: 2.6.2(@emotion/react@11.11.1)(@emotion/styled@11.11.0)(react@18.2.0) - '@emotion/react': - specifier: ^11.11.1 - version: 11.11.1(@types/react@18.2.37)(react@18.2.0) - '@emotion/styled': - specifier: ^11.11.0 - version: 11.11.0(@emotion/react@11.11.1)(@types/react@18.2.37)(react@18.2.0) - '@kubernetes/client-node': - specifier: 0.18.0 - version: 0.18.0 - '@sealos/shared': - specifier: workspace:^ - version: link:../../packages/shared - '@tanstack/react-query': - specifier: ^4.35.3 - version: 4.36.1(react-dom@18.2.0)(react@18.2.0) - axios: - specifier: 1.2.1 - version: 1.2.1 - clsx: - specifier: ^1.2.1 - version: 1.2.1 - eslint: - specifier: 8.36.0 - version: 8.36.0 - eslint-config-next: - specifier: 13.5.9 - version: 13.5.9(eslint@8.36.0)(typescript@5.2.2) - framer-motion: - specifier: ^10.16.4 - version: 10.16.5(react-dom@18.2.0)(react@18.2.0) - i18next: - specifier: ^23.11.5 - version: 23.12.1 - immer: - specifier: ^9.0.21 - version: 9.0.21 - js-yaml: - specifier: ^4.1.0 - version: 4.1.0 - lodash: - specifier: ^4.17.21 - version: 4.17.21 - lucide-react: - specifier: ^0.544.0 - version: 0.544.0(react@18.2.0) - nanoid: - specifier: ^4.0.2 - version: 4.0.2 - next: - specifier: 13.5.9 - version: 13.5.9(react-dom@18.2.0)(react@18.2.0)(sass@1.69.5) - next-i18next: - specifier: ^15.3.0 - version: 15.3.0(i18next@23.12.1)(next@13.5.9)(react-i18next@14.1.2)(react@18.2.0) - react: - specifier: 18.2.0 - version: 18.2.0 - react-dom: - specifier: 18.2.0 - version: 18.2.0(react@18.2.0) - react-i18next: - specifier: ^14.1.2 - version: 14.1.2(i18next@23.12.1)(react-dom@18.2.0)(react@18.2.0) - sealos-desktop-sdk: - specifier: workspace:* - version: link:../../packages/client-sdk - typescript: - specifier: ^5.2.2 - version: 5.2.2 - zustand: - specifier: ^4.4.1 - version: 4.4.7(@types/react@18.2.37)(immer@9.0.21)(react@18.2.0) - devDependencies: - '@types/js-yaml': - specifier: ^4.0.6 - version: 4.0.9 - '@types/lodash': - specifier: ^4.14.199 - version: 4.14.202 - '@types/node': - specifier: 18.15.5 - version: 18.15.5 - '@types/react': - specifier: 18.2.37 - version: 18.2.37 - '@types/react-dom': - specifier: 18.0.10 - version: 18.0.10 - sass: - specifier: ^1.68.0 - version: 1.69.5 - packages: /@aashutoshrathi/word-wrap@1.2.6: diff --git a/frontend/providers/terminal/.env.template b/frontend/providers/terminal/.env.template deleted file mode 100644 index ab07b515a075..000000000000 --- a/frontend/providers/terminal/.env.template +++ /dev/null @@ -1,4 +0,0 @@ -NEXT_PUBLIC_MOCK_KUBECONFIG="" -SITE="cloud.sealos.io" -TTYD_IMAGE="docker.io/labring4docker/terminal:1.23.2-1" -KEEPALIVED="30m" \ No newline at end of file diff --git a/frontend/providers/terminal/.eslintrc.json b/frontend/providers/terminal/.eslintrc.json deleted file mode 100644 index bffb357a7122..000000000000 --- a/frontend/providers/terminal/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "next/core-web-vitals" -} diff --git a/frontend/providers/terminal/.gitignore b/frontend/providers/terminal/.gitignore deleted file mode 100644 index c87c9b392c02..000000000000 --- a/frontend/providers/terminal/.gitignore +++ /dev/null @@ -1,36 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules -/.pnp -.pnp.js - -# testing -/coverage - -# next.js -/.next/ -/out/ - -# production -/build - -# misc -.DS_Store -*.pem - -# debug -npm-debug.log* -yarn-debug.log* -yarn-error.log* -.pnpm-debug.log* - -# local env files -.env*.local - -# vercel -.vercel - -# typescript -*.tsbuildinfo -next-env.d.ts diff --git a/frontend/providers/terminal/Dockerfile b/frontend/providers/terminal/Dockerfile deleted file mode 100644 index 32e15899dccd..000000000000 --- a/frontend/providers/terminal/Dockerfile +++ /dev/null @@ -1,72 +0,0 @@ -# Copyright © 2022 sealos. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Install dependencies only when needed -FROM node:current-alpine AS deps -# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed. -RUN apk add --no-cache libc6-compat && npm install -g pnpm -WORKDIR /app - -# Install dependencies based on the preferred package manager -COPY package.json pnpm-lock.yaml* ./ -RUN \ - [ -f pnpm-lock.yaml ] && pnpm install || \ - (echo "Lockfile not found." && exit 1) - -# Rebuild the source code only when needed -FROM node:current-alpine AS builder -WORKDIR /app -COPY --from=deps /app/node_modules ./node_modules -COPY . . - -# Next.js collects completely anonymous telemetry data about general usage. -# Learn more here: https://nextjs.org/telemetry -# Uncomment the following line in case you want to disable telemetry during the build. -ENV NEXT_TELEMETRY_DISABLED 1 - -RUN npm install -g pnpm && pnpm run build - -# Production image, copy all the files and run next -FROM node:current-alpine AS runner -WORKDIR /app - -ENV NODE_ENV production -# Uncomment the following line in case you want to disable telemetry during runtime. -ENV NEXT_TELEMETRY_DISABLED 1 - -RUN addgroup --system --gid 1001 nodejs -RUN adduser --system --uid 1001 nextjs - -RUN sed -i 's/https/http/' /etc/apk/repositories -RUN apk add curl \ - && apk add ca-certificates \ - && update-ca-certificates - -# You only need to copy next.config.js if you are NOT using the default configuration -# COPY --from=builder /app/next.config.js ./ -COPY --from=builder /app/public ./public -COPY --from=builder /app/package.json ./package.json - -# Automatically leverage output traces to reduce image size -# https://nextjs.org/docs/advanced-features/output-file-tracing -COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ -COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static - -USER nextjs - -EXPOSE 3000 - -ENV PORT 3000 - -CMD ["node", "server.js"] diff --git a/frontend/providers/terminal/Makefile b/frontend/providers/terminal/Makefile deleted file mode 100644 index a551e301b2a0..000000000000 --- a/frontend/providers/terminal/Makefile +++ /dev/null @@ -1,46 +0,0 @@ - -SERVICE_NAME=sealos-terminal -# Image URL to use all building/pushing image targets -IMG ?= $(SERVICE_NAME):latest -.PHONY: all -all: docker-build-and-push - -##@ General - -# The help target prints out all targets with their descriptions organized -# beneath their categories. The categories are represented by '##@' and the -# target descriptions by '##'. The awk commands is responsible for reading the -# entire set of makefiles included in this invocation, looking for lines of the -# file as xyz: ## something, and then pretty-format the target and help. Then, -# if there's a line with ##@ something, that gets pretty-printed as a category. -# More info on the usage of ANSI control characters for terminal formatting: -# https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters -# More info on the awk command: -# http://linuxcommand.org/lc3_adv_awk.php - -.PHONY: help -help: ## Display this help. - @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) - -##@ Build - -.PHONY: build -build: ## Build desktop-frontend binary. - pnpm run build - -.PHONY: run -run: ## Run a dev service from host. - pnpm run start - -.PHONY: docker-build -docker-build: ## Build docker image with the desktop-frontend. - sudo docker build -t $(IMG) . - -##@ Deployment - -.PHONY: docker-push-image -docker-push-image: ## Push docker image to Docker Hub. - docker push $(IMG) - -.PHONY: docker-build-and-push -docker-build-and-push: docker-build docker-push-image ## Build and push docker image with the desktop-frontend. \ No newline at end of file diff --git a/frontend/providers/terminal/README.md b/frontend/providers/terminal/README.md deleted file mode 100644 index 044c62ddbbf8..000000000000 --- a/frontend/providers/terminal/README.md +++ /dev/null @@ -1,5 +0,0 @@ -## sealos terminal - -## env - -Support the definition of SITE environment variables, the page is not authorized to jump to the SITE URL diff --git a/frontend/providers/terminal/deploy/Kubefile b/frontend/providers/terminal/deploy/Kubefile deleted file mode 100644 index 1dbc4bae22cb..000000000000 --- a/frontend/providers/terminal/deploy/Kubefile +++ /dev/null @@ -1,9 +0,0 @@ -FROM scratch - -USER 65532:65532 - -COPY registry registry -COPY charts charts -COPY terminal-frontend-entrypoint.sh terminal-frontend-entrypoint.sh - -CMD ["bash terminal-frontend-entrypoint.sh"] diff --git a/frontend/providers/terminal/deploy/charts/terminal-frontend/Chart.yaml b/frontend/providers/terminal/deploy/charts/terminal-frontend/Chart.yaml deleted file mode 100644 index 670819e0099c..000000000000 --- a/frontend/providers/terminal/deploy/charts/terminal-frontend/Chart.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: v2 -name: terminal-frontend -description: Sealos Terminal Frontend Helm Chart -type: application -version: 1.0.0 -appVersion: "latest" diff --git a/frontend/providers/terminal/deploy/charts/terminal-frontend/templates/_helpers.tpl b/frontend/providers/terminal/deploy/charts/terminal-frontend/templates/_helpers.tpl deleted file mode 100644 index 15167e6872ec..000000000000 --- a/frontend/providers/terminal/deploy/charts/terminal-frontend/templates/_helpers.tpl +++ /dev/null @@ -1,108 +0,0 @@ -{{/* -Expand the name of the chart. -*/}} -{{- define "terminal-frontend.name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Create a default fully qualified app name. -*/}} -{{- define "terminal-frontend.fullname" -}} -{{- if .Values.fullnameOverride }} -{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} -{{- else }} -{{- $name := default .Chart.Name .Values.nameOverride }} -{{- if contains $name .Release.Name }} -{{- .Release.Name | trunc 63 | trimSuffix "-" }} -{{- else }} -{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} -{{- end }} -{{- end }} -{{- end }} - -{{/* -Create chart name and version as used by the chart label. -*/}} -{{- define "terminal-frontend.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Common labels. -*/}} -{{- define "terminal-frontend.labels" -}} -helm.sh/chart: {{ include "terminal-frontend.chart" . }} -{{ include "terminal-frontend.selectorLabels" . }} -{{ include "terminal-frontend.recommendedLabels" . }} -{{- if .Chart.AppVersion }} -app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} -{{- end }} -app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- end }} - -{{/* -Selector labels keep compatibility with the previous manifest selector. -*/}} -{{- define "terminal-frontend.selectorLabels" -}} -app: {{ include "terminal-frontend.fullname" . }} -{{- end }} - -{{/* -Recommended Kubernetes labels. -*/}} -{{- define "terminal-frontend.recommendedLabels" -}} -app.kubernetes.io/name: {{ include "terminal-frontend.name" . }} -app.kubernetes.io/instance: {{ .Release.Name }} -{{- end }} - -{{/* -HTTP scheme for desktop-facing URLs. -*/}} -{{- define "terminal-frontend.scheme" -}} -{{- if eq (toString .Values.terminalConfig.disableHttps) "true" -}}http{{- else -}}https{{- end -}} -{{- end }} - -{{/* -Port without a leading colon, omitting default ports for the selected scheme. -*/}} -{{- define "terminal-frontend.port" -}} -{{- $scheme := include "terminal-frontend.scheme" . -}} -{{- $port := toString .Values.terminalConfig.cloudPort -}} -{{- if eq $scheme "http" -}} -{{- $port = toString .Values.terminalConfig.httpPort -}} -{{- end -}} -{{- if or (and (eq $scheme "https") (eq $port "443")) (and (eq $scheme "http") (eq $port "80")) -}} -{{- "" -}} -{{- else -}} -{{- $port -}} -{{- end -}} -{{- end }} - -{{/* -Optional ":port" suffix for desktop-facing URLs. -*/}} -{{- define "terminal-frontend.portSuffix" -}} -{{- $port := include "terminal-frontend.port" . -}} -{{- if $port -}}:{{ $port }}{{- end -}} -{{- end }} - -{{- define "terminal-frontend.cloudOrigin" -}} -{{- include "terminal-frontend.scheme" . -}}://{{ .Values.terminalConfig.cloudDomain }}{{ include "terminal-frontend.portSuffix" . }} -{{- end }} - -{{- define "terminal-frontend.wildcardCloudOrigin" -}} -{{- include "terminal-frontend.scheme" . -}}://*.{{ .Values.terminalConfig.cloudDomain }}{{ include "terminal-frontend.portSuffix" . }} -{{- end }} - -{{- define "terminal-frontend.terminalUrl" -}} -{{- include "terminal-frontend.scheme" . -}}://terminal.{{ .Values.terminalConfig.cloudDomain }}{{ include "terminal-frontend.portSuffix" . }} -{{- end }} - -{{- define "terminal-frontend.host" -}} -{{- default (printf "terminal.%s" .Values.terminalConfig.cloudDomain) .Values.ingress.host -}} -{{- end }} - -{{- define "terminal-frontend.ingressName" -}} -{{- default "sealos-terminal" .Values.ingress.name -}} -{{- end }} diff --git a/frontend/providers/terminal/deploy/charts/terminal-frontend/templates/app.yaml b/frontend/providers/terminal/deploy/charts/terminal-frontend/templates/app.yaml deleted file mode 100644 index 4bdfa4b68856..000000000000 --- a/frontend/providers/terminal/deploy/charts/terminal-frontend/templates/app.yaml +++ /dev/null @@ -1,19 +0,0 @@ -apiVersion: app.sealos.io/v1 -kind: App -metadata: - name: terminal - namespace: app-system -spec: - data: - desc: sealos CLoud Terminal - url: {{ include "terminal-frontend.terminalUrl" . | quote }} - icon: {{ printf "%s/logo.svg" (include "terminal-frontend.terminalUrl" .) | quote }} - i18n: - zh: - name: 终端 - zh-Hans: - name: 终端 - menuData: - name: Terminal - type: iframe - displayType: normal diff --git a/frontend/providers/terminal/deploy/charts/terminal-frontend/templates/configmap.yaml b/frontend/providers/terminal/deploy/charts/terminal-frontend/templates/configmap.yaml deleted file mode 100644 index e4d5c79608e1..000000000000 --- a/frontend/providers/terminal/deploy/charts/terminal-frontend/templates/configmap.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ include "terminal-frontend.fullname" . }}-config - namespace: {{ .Release.Namespace }} - labels: - {{- include "terminal-frontend.labels" . | nindent 4 }} -data: - .env: |- - TTYD_IMAGE={{ .Values.terminalConfig.ttydImage }} - SITE={{ include "terminal-frontend.cloudOrigin" . }} - KEEPALIVED={{ .Values.terminalConfig.keepalived }} - config.yaml: |- - addr: :3000 diff --git a/frontend/providers/terminal/deploy/charts/terminal-frontend/templates/deployment.yaml b/frontend/providers/terminal/deploy/charts/terminal-frontend/templates/deployment.yaml deleted file mode 100644 index 6614e9e70eed..000000000000 --- a/frontend/providers/terminal/deploy/charts/terminal-frontend/templates/deployment.yaml +++ /dev/null @@ -1,66 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "terminal-frontend.fullname" . }} - namespace: {{ .Release.Namespace }} - labels: - {{- include "terminal-frontend.labels" . | nindent 4 }} -spec: - replicas: {{ .Values.replicaCount }} - selector: - matchLabels: - {{- include "terminal-frontend.selectorLabels" . | nindent 6 }} - strategy: - type: RollingUpdate - rollingUpdate: - maxUnavailable: 25% - maxSurge: 25% - template: - metadata: - labels: - {{- include "terminal-frontend.labels" . | nindent 8 }} - annotations: - checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} - {{- with .Values.podAnnotations }} - {{- toYaml . | nindent 8 }} - {{- end }} - spec: - {{- with .Values.imagePullSecrets }} - imagePullSecrets: - {{- toYaml . | nindent 8 }} - {{- end }} - securityContext: - {{- toYaml .Values.podSecurityContext | nindent 8 }} - containers: - - name: {{ .Chart.Name }} - resources: - {{- toYaml .Values.resources | nindent 12 }} - securityContext: - {{- toYaml .Values.securityContext | nindent 12 }} - image: {{ .Values.image | quote }} - imagePullPolicy: {{ .Values.imagePullPolicy }} - env: - - name: NODE_TLS_REJECT_UNAUTHORIZED - value: {{ .Values.terminalConfig.tlsRejectUnauthorized | quote }} - startupProbe: - {{- toYaml .Values.startupProbe | nindent 12 }} - readinessProbe: - {{- toYaml .Values.readinessProbe | nindent 12 }} - livenessProbe: - {{- toYaml .Values.livenessProbe | nindent 12 }} - volumeMounts: - - name: terminal-frontend-volume - mountPath: /app/providers/terminal/.env - subPath: .env - - name: terminal-frontend-volume - mountPath: /config.yaml - subPath: config.yaml - {{- with .Values.affinity }} - affinity: - {{- toYaml . | nindent 8 }} - {{- end }} - volumes: - - name: terminal-frontend-volume - configMap: - defaultMode: 420 - name: {{ include "terminal-frontend.fullname" . }}-config diff --git a/frontend/providers/terminal/deploy/charts/terminal-frontend/templates/ingress.yaml b/frontend/providers/terminal/deploy/charts/terminal-frontend/templates/ingress.yaml deleted file mode 100644 index 3909caa4aa90..000000000000 --- a/frontend/providers/terminal/deploy/charts/terminal-frontend/templates/ingress.yaml +++ /dev/null @@ -1,43 +0,0 @@ -apiVersion: networking.k8s.io/v1 -kind: Ingress -metadata: - name: {{ include "terminal-frontend.ingressName" . }} - namespace: {{ .Release.Namespace }} - annotations: - kubernetes.io/ingress.class: {{ .Values.ingress.className | quote }} - nginx.ingress.kubernetes.io/enable-cors: "true" - nginx.ingress.kubernetes.io/cors-allow-methods: "PUT, GET, POST, DELETE, PATCH, OPTIONS" - nginx.ingress.kubernetes.io/cors-allow-origin: "{{ include "terminal-frontend.cloudOrigin" . }}, {{ include "terminal-frontend.wildcardCloudOrigin" . }}" - nginx.ingress.kubernetes.io/cors-allow-credentials: "true" - nginx.ingress.kubernetes.io/cors-max-age: "600" - nginx.ingress.kubernetes.io/backend-protocol: "HTTP" - nginx.ingress.kubernetes.io/configuration-snippet: | - more_clear_headers "X-Frame-Options:"; - more_set_headers "Content-Security-Policy: default-src * blob: data: *.{{ .Values.terminalConfig.cloudDomain }}{{ include "terminal-frontend.portSuffix" . }} {{ .Values.terminalConfig.cloudDomain }}{{ include "terminal-frontend.portSuffix" . }}; img-src * data: blob: resource: *.{{ .Values.terminalConfig.cloudDomain }}{{ include "terminal-frontend.portSuffix" . }} {{ .Values.terminalConfig.cloudDomain }}{{ include "terminal-frontend.portSuffix" . }}; connect-src * ws: wss: blob: resource:; style-src 'self' 'unsafe-inline' blob: *.{{ .Values.terminalConfig.cloudDomain }}{{ include "terminal-frontend.portSuffix" . }} {{ .Values.terminalConfig.cloudDomain }}{{ include "terminal-frontend.portSuffix" . }} resource:; script-src 'self' 'unsafe-inline' 'unsafe-eval' blob: *.{{ .Values.terminalConfig.cloudDomain }}{{ include "terminal-frontend.portSuffix" . }} {{ .Values.terminalConfig.cloudDomain }}{{ include "terminal-frontend.portSuffix" . }} resource: *.baidu.com *.bdstatic.com; frame-src 'self' *.{{ .Values.terminalConfig.cloudDomain }}{{ include "terminal-frontend.portSuffix" . }} {{ .Values.terminalConfig.cloudDomain }}{{ include "terminal-frontend.portSuffix" . }} mailto: tel: weixin: mtt: *.baidu.com; frame-ancestors 'self' {{ include "terminal-frontend.cloudOrigin" . }} {{ include "terminal-frontend.wildcardCloudOrigin" . }}"; - more_set_headers "X-Xss-Protection: 1; mode=block"; - higress.io/response-header-control-remove: X-Frame-Options - higress.io/response-header-control-update: | - Content-Security-Policy "default-src * blob: data: *.{{ .Values.terminalConfig.cloudDomain }}{{ include "terminal-frontend.portSuffix" . }} {{ .Values.terminalConfig.cloudDomain }}{{ include "terminal-frontend.portSuffix" . }}; img-src * data: blob: resource: *.{{ .Values.terminalConfig.cloudDomain }}{{ include "terminal-frontend.portSuffix" . }} {{ .Values.terminalConfig.cloudDomain }}{{ include "terminal-frontend.portSuffix" . }}; connect-src * ws: wss: blob: resource:; style-src 'self' 'unsafe-inline' blob: *.{{ .Values.terminalConfig.cloudDomain }}{{ include "terminal-frontend.portSuffix" . }} {{ .Values.terminalConfig.cloudDomain }}{{ include "terminal-frontend.portSuffix" . }} resource:; script-src 'self' 'unsafe-inline' 'unsafe-eval' blob: *.{{ .Values.terminalConfig.cloudDomain }}{{ include "terminal-frontend.portSuffix" . }} {{ .Values.terminalConfig.cloudDomain }}{{ include "terminal-frontend.portSuffix" . }} resource: *.baidu.com *.bdstatic.com; frame-src 'self' *.{{ .Values.terminalConfig.cloudDomain }}{{ include "terminal-frontend.portSuffix" . }} {{ .Values.terminalConfig.cloudDomain }}{{ include "terminal-frontend.portSuffix" . }} mailto: tel: weixin: mtt: *.baidu.com; frame-ancestors 'self' {{ include "terminal-frontend.cloudOrigin" . }} {{ include "terminal-frontend.wildcardCloudOrigin" . }}" - X-Xss-Protection "1; mode=block" - {{- with .Values.ingress.annotations }} - {{- toYaml . | nindent 4 }} - {{- end }} -spec: - ingressClassName: {{ .Values.ingress.className | quote }} - rules: - - host: {{ include "terminal-frontend.host" . | quote }} - http: - paths: - - pathType: Prefix - path: / - backend: - service: - name: {{ include "terminal-frontend.fullname" . }} - port: - number: {{ .Values.service.port }} - {{- if not (eq (toString .Values.terminalConfig.disableHttps) "true") }} - tls: - - hosts: - - {{ include "terminal-frontend.host" . | quote }} - secretName: {{ .Values.terminalConfig.certSecretName | quote }} - {{- end }} diff --git a/frontend/providers/terminal/deploy/charts/terminal-frontend/templates/service.yaml b/frontend/providers/terminal/deploy/charts/terminal-frontend/templates/service.yaml deleted file mode 100644 index 09a2546706a3..000000000000 --- a/frontend/providers/terminal/deploy/charts/terminal-frontend/templates/service.yaml +++ /dev/null @@ -1,16 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - labels: - {{- include "terminal-frontend.labels" . | nindent 4 }} - name: {{ include "terminal-frontend.fullname" . }} - namespace: {{ .Release.Namespace }} -spec: - type: {{ .Values.service.type }} - ports: - - name: http - port: {{ .Values.service.port }} - protocol: TCP - targetPort: {{ .Values.service.port }} - selector: - {{- include "terminal-frontend.selectorLabels" . | nindent 4 }} diff --git a/frontend/providers/terminal/deploy/charts/terminal-frontend/templates/tests/test-connection.yaml b/frontend/providers/terminal/deploy/charts/terminal-frontend/templates/tests/test-connection.yaml deleted file mode 100644 index c1b480e98c11..000000000000 --- a/frontend/providers/terminal/deploy/charts/terminal-frontend/templates/tests/test-connection.yaml +++ /dev/null @@ -1,17 +0,0 @@ -apiVersion: v1 -kind: Pod -metadata: - name: {{ include "terminal-frontend.fullname" . }}-test-connection - namespace: {{ .Release.Namespace }} - annotations: - "helm.sh/hook": test - "helm.sh/hook-delete-policy": before-hook-creation -spec: - restartPolicy: Never - containers: - - name: wget - image: {{ .Values.tests.image | quote }} - imagePullPolicy: IfNotPresent - command: ["/bin/sh", "-ec"] - args: - - wget -q -T 10 -O /dev/null "http://{{ include "terminal-frontend.fullname" . }}:{{ .Values.service.port }}{{ .Values.tests.path }}" diff --git a/frontend/providers/terminal/deploy/charts/terminal-frontend/terminal-frontend-values.yaml b/frontend/providers/terminal/deploy/charts/terminal-frontend/terminal-frontend-values.yaml deleted file mode 100644 index 6623a880044e..000000000000 --- a/frontend/providers/terminal/deploy/charts/terminal-frontend/terminal-frontend-values.yaml +++ /dev/null @@ -1,51 +0,0 @@ -# Custom values for terminal frontend helm chart. -# This file contains user-customizable configurations. - -replicaCount: 1 - -startupProbe: - httpGet: - path: /healthz - port: 3000 - periodSeconds: 2 - timeoutSeconds: 3 - failureThreshold: 30 -readinessProbe: - httpGet: - path: /healthz - port: 3000 - periodSeconds: 10 - timeoutSeconds: 3 - failureThreshold: 6 -livenessProbe: - httpGet: - path: /healthz - port: 3000 - periodSeconds: 20 - timeoutSeconds: 3 - failureThreshold: 3 - -resources: - limits: - cpu: 2000m - memory: 2048Mi - requests: - cpu: 10m - memory: 128Mi - -terminalConfig: - ttydImage: "docker.io/labring4docker/terminal:1.25.1-5" - keepalived: "30m" - -affinity: - podAntiAffinity: - preferredDuringSchedulingIgnoredDuringExecution: - - weight: 100 - podAffinityTerm: - labelSelector: - matchExpressions: - - key: "app" - operator: In - values: - - terminal-frontend - topologyKey: "kubernetes.io/hostname" diff --git a/frontend/providers/terminal/deploy/charts/terminal-frontend/values.yaml b/frontend/providers/terminal/deploy/charts/terminal-frontend/values.yaml deleted file mode 100644 index 36c41c28c435..000000000000 --- a/frontend/providers/terminal/deploy/charts/terminal-frontend/values.yaml +++ /dev/null @@ -1,93 +0,0 @@ -# Default values for terminal frontend helm chart. - -image: ghcr.io/labring/sealos-terminal-frontend:latest -imagePullPolicy: Always - -imagePullSecrets: [] -fullnameOverride: "terminal-frontend" - -replicaCount: 1 - -podAnnotations: {} -podLabels: {} - -podSecurityContext: - runAsNonRoot: true - runAsUser: 1001 - -securityContext: - runAsNonRoot: true - runAsUser: 1001 - allowPrivilegeEscalation: false - capabilities: - drop: - - "ALL" - -service: - type: ClusterIP - port: 3000 - -tests: - image: busybox:1.36.1 - path: /healthz - -startupProbe: - httpGet: - path: /healthz - port: 3000 - periodSeconds: 2 - timeoutSeconds: 3 - failureThreshold: 30 -readinessProbe: - httpGet: - path: /healthz - port: 3000 - periodSeconds: 10 - timeoutSeconds: 3 - failureThreshold: 6 -livenessProbe: - httpGet: - path: /healthz - port: 3000 - periodSeconds: 20 - timeoutSeconds: 3 - failureThreshold: 3 - -resources: - limits: - cpu: 2000m - memory: 2048Mi - requests: - cpu: 10m - memory: 128Mi - -ingress: - className: nginx - name: sealos-terminal - host: "" - annotations: {} - -# Terminal frontend configuration. -# cloudDomain, cloudPort, httpPort, disableHttps and certSecretName are auto-configured by entrypoint.sh from sealos-config. -terminalConfig: - cloudDomain: "127.0.0.1.nip.io" - cloudPort: "" - httpPort: "" - disableHttps: false - certSecretName: "wildcard-cert" - tlsRejectUnauthorized: "1" - ttydImage: "docker.io/labring4docker/terminal:1.25.1-5" - keepalived: "30m" - -affinity: - podAntiAffinity: - preferredDuringSchedulingIgnoredDuringExecution: - - weight: 100 - podAffinityTerm: - labelSelector: - matchExpressions: - - key: "app" - operator: In - values: - - terminal-frontend - topologyKey: "kubernetes.io/hostname" diff --git a/frontend/providers/terminal/deploy/images/shim/imagelist b/frontend/providers/terminal/deploy/images/shim/imagelist deleted file mode 100644 index e5eaed763ae3..000000000000 --- a/frontend/providers/terminal/deploy/images/shim/imagelist +++ /dev/null @@ -1 +0,0 @@ -docker.io/labring4docker/terminal:1.25.1-5 \ No newline at end of file diff --git a/frontend/providers/terminal/deploy/terminal-frontend-entrypoint.sh b/frontend/providers/terminal/deploy/terminal-frontend-entrypoint.sh deleted file mode 100755 index b080f0738482..000000000000 --- a/frontend/providers/terminal/deploy/terminal-frontend-entrypoint.sh +++ /dev/null @@ -1,159 +0,0 @@ -#!/bin/bash -set -euo pipefail - -RELEASE_NAME=${RELEASE_NAME:-"terminal-frontend"} -RELEASE_NAMESPACE=${RELEASE_NAMESPACE:-"terminal-frontend"} -CHART_PATH=${CHART_PATH:-"./charts/terminal-frontend"} -TOOLS_FILE=${TOOLS_FILE:-"/root/.sealos/cloud/scripts/tools.sh"} -AUTO_CONFIG_HELM_OPTS=() -ENFORCED_CONFIG_HELM_OPTS=() -HELM_EXTRA_ARGS=() -if [ -n "${HELM_OPTIONS:-}" ]; then - read -r -a PARSED_HELM_OPTIONS <<< "${HELM_OPTIONS}" - HELM_EXTRA_ARGS+=("${PARSED_HELM_OPTIONS[@]}") -fi -if [ -n "${HELM_OPTS:-}" ]; then - read -r -a PARSED_HELM_OPTS <<< "${HELM_OPTS}" - HELM_EXTRA_ARGS+=("${PARSED_HELM_OPTS[@]}") -fi - -get_cm_value() { - local namespace="$1" - local name="$2" - local key="$3" - kubectl get configmap "${name}" -n "${namespace}" -o "jsonpath={.data.${key}}" 2>/dev/null || true -} - -load_cloud_tools_or_exit() { - local required_functions=( - ensure_global_values_ready_for_component - fetch_configmap_data_key - global_http_disable_https - global_http_external_url - info - read_cert_tls_reject_unauthorized - read_jwt_internal - read_yaml_file_path - warn - ) - local missing_functions=() - local function_name - - if [ ! -f "${TOOLS_FILE}" ]; then - cat >&2 </dev/null 2>&1; then - missing_functions+=("${function_name}") - fi - done - - if [ "${#missing_functions[@]}" -gt 0 ]; then - cat >&2 </dev/null 2>&1; then - local ownership managed_by owner_release owner_namespace - ownership=$(kubectl -n "${namespace}" get "${kind}" "${name}" \ - -o jsonpath='{.metadata.labels.app\.kubernetes\.io/managed-by}{"|"}{.metadata.annotations.meta\.helm\.sh/release-name}{"|"}{.metadata.annotations.meta\.helm\.sh/release-namespace}') - IFS='|' read -r managed_by owner_release owner_namespace <<< "${ownership}" - if { [ "${managed_by}" = "Helm" ] || [ -n "${owner_release}" ] || [ -n "${owner_namespace}" ]; } && \ - { [ "${owner_release}" != "${RELEASE_NAME}" ] || [ "${owner_namespace}" != "${RELEASE_NAMESPACE}" ]; }; then - echo "Refusing to adopt ${kind} ${namespace}/${name}: owned by Helm release ${owner_namespace}/${owner_release}" >&2 - return 1 - fi - if [ "${managed_by}" = "Helm" ]; then - return 0 - fi - echo "Adopting ${kind} ${namespace}/${name}..." - kubectl -n "${namespace}" label "${kind}" "${name}" app.kubernetes.io/managed-by=Helm --overwrite >/dev/null - kubectl -n "${namespace}" annotate "${kind}" "${name}" meta.helm.sh/release-name="${RELEASE_NAME}" meta.helm.sh/release-namespace="${RELEASE_NAMESPACE}" --overwrite >/dev/null - fi -} - -echo "Checking and adopting existing resources..." -if kubectl get namespace "${RELEASE_NAMESPACE}" >/dev/null 2>&1; then - adopt_namespaced_resource "${RELEASE_NAMESPACE}" configmap terminal-frontend-config - adopt_namespaced_resource "${RELEASE_NAMESPACE}" service terminal-frontend - adopt_namespaced_resource "${RELEASE_NAMESPACE}" deployment terminal-frontend - adopt_namespaced_resource "${RELEASE_NAMESPACE}" ingress sealos-terminal -fi - -adopt_namespaced_resource app-system apps.app.sealos.io terminal - -SERVICE_NAME="terminal-frontend" -USER_VALUES_PATH="/root/.sealos/cloud/values/apps/terminal/terminal-values.yaml" -if [ ! -f "${USER_VALUES_PATH}" ]; then - mkdir -p "$(dirname "${USER_VALUES_PATH}")" - cp "./charts/${SERVICE_NAME}/${SERVICE_NAME}-values.yaml" "${USER_VALUES_PATH}" -fi - -echo "Deploying Helm chart..." -helm upgrade -i "${RELEASE_NAME}" -n "${RELEASE_NAMESPACE}" --create-namespace "${CHART_PATH}" \ - -f "./charts/${SERVICE_NAME}/values.yaml" \ - -f "${USER_VALUES_PATH}" \ - "${AUTO_CONFIG_HELM_OPTS[@]}" \ - "${HELM_EXTRA_ARGS[@]}" \ - "${ENFORCED_CONFIG_HELM_OPTS[@]}" diff --git a/frontend/providers/terminal/next-i18next.config.js b/frontend/providers/terminal/next-i18next.config.js deleted file mode 100644 index bbcae7bfd140..000000000000 --- a/frontend/providers/terminal/next-i18next.config.js +++ /dev/null @@ -1,16 +0,0 @@ -//next-i18next.config.js -/** - * @type {import('next-i18next').UserConfig} - */ - -module.exports = { - i18n: { - defaultLocale: 'en', - locales: ['en', 'zh'], - localeDetection: false - }, - /** To avoid issues when deploying to some paas (vercel...) */ - localePath: - typeof window === 'undefined' ? require('path').resolve('./public/locales') : '/locales', - reloadOnPrerender: process.env.NODE_ENV === 'development' -}; diff --git a/frontend/providers/terminal/next.config.js b/frontend/providers/terminal/next.config.js deleted file mode 100644 index 01c5e5e0bb2c..000000000000 --- a/frontend/providers/terminal/next.config.js +++ /dev/null @@ -1,11 +0,0 @@ -/** @type {import('next').NextConfig} */ -const path = require('path'); -const nextConfig = { - reactStrictMode: false, - output: 'standalone', - experimental: { - outputFileTracingRoot: path.join(__dirname, '../../') - }, -}; - -module.exports = nextConfig; diff --git a/frontend/providers/terminal/package.json b/frontend/providers/terminal/package.json deleted file mode 100644 index fb91f08a2439..000000000000 --- a/frontend/providers/terminal/package.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "terminal", - "version": "0.1.0", - "private": true, - "scripts": { - "dev": "next dev", - "build": "next build", - "start": "next start", - "lint": "next lint" - }, - "dependencies": { - "@chakra-ui/anatomy": "^2.2.1", - "@chakra-ui/icons": "^2.1.1", - "@chakra-ui/next-js": "^2.1.5", - "@chakra-ui/react": "^2.8.1", - "@chakra-ui/system": "^2.6.1", - "@emotion/react": "^11.11.1", - "@emotion/styled": "^11.11.0", - "@kubernetes/client-node": "0.18.0", - "@tanstack/react-query": "^4.35.3", - "axios": "1.2.1", - "clsx": "^1.2.1", - "eslint": "8.36.0", - "framer-motion": "^10.16.4", - "eslint-config-next": "13.5.9", - "i18next": "^23.11.5", - "immer": "^9.0.21", - "js-yaml": "^4.1.0", - "lodash": "^4.17.21", - "lucide-react": "^0.544.0", - "nanoid": "^4.0.2", - "next": "13.5.9", - "next-i18next": "^15.3.0", - "react": "18.2.0", - "react-dom": "18.2.0", - "react-i18next": "^14.1.2", - "@sealos/shared": "workspace:^", - "sealos-desktop-sdk": "workspace:*", - "typescript": "^5.2.2", - "zustand": "^4.4.1" - }, - "devDependencies": { - "@types/js-yaml": "^4.0.6", - "@types/lodash": "^4.14.199", - "@types/node": "18.15.5", - "@types/react": "18.2.37", - "@types/react-dom": "18.0.10", - "sass": "^1.68.0" - } -} diff --git a/frontend/providers/terminal/public/favicon.ico b/frontend/providers/terminal/public/favicon.ico deleted file mode 100644 index 7ab46433638f..000000000000 Binary files a/frontend/providers/terminal/public/favicon.ico and /dev/null differ diff --git a/frontend/providers/terminal/public/iconfont/iconfont.js b/frontend/providers/terminal/public/iconfont/iconfont.js deleted file mode 100644 index d3ac926f4348..000000000000 --- a/frontend/providers/terminal/public/iconfont/iconfont.js +++ /dev/null @@ -1 +0,0 @@ -window._iconfont_svg_string_3859970='',function(o){var a=(a=document.getElementsByTagName("script"))[a.length-1],t=a.getAttribute("data-injectcss"),a=a.getAttribute("data-disable-injectsvg");if(!a){var l,i,h,e,c,d=function(a,t){t.parentNode.insertBefore(a,t)};if(t&&!o.__iconfont__svg__cssinject__){o.__iconfont__svg__cssinject__=!0;try{document.write("")}catch(a){console&&console.log(a)}}l=function(){var a,t=document.createElement("div");t.innerHTML=o._iconfont_svg_string_3859970,(t=t.getElementsByTagName("svg")[0])&&(t.setAttribute("aria-hidden","true"),t.style.position="absolute",t.style.width=0,t.style.height=0,t.style.overflow="hidden",t=t,(a=document.body).firstChild?d(t,a.firstChild):a.appendChild(t))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(l,0):(i=function(){document.removeEventListener("DOMContentLoaded",i,!1),l()},document.addEventListener("DOMContentLoaded",i,!1)):document.attachEvent&&(h=l,e=o.document,c=!1,n(),e.onreadystatechange=function(){"complete"==e.readyState&&(e.onreadystatechange=null,s())})}function s(){c||(c=!0,h())}function n(){try{e.documentElement.doScroll("left")}catch(a){return void setTimeout(n,50)}s()}}(window); \ No newline at end of file diff --git a/frontend/providers/terminal/public/logo.svg b/frontend/providers/terminal/public/logo.svg deleted file mode 100644 index 5987d6a49d29..000000000000 --- a/frontend/providers/terminal/public/logo.svg +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/frontend/providers/terminal/src/api/terminal.ts b/frontend/providers/terminal/src/api/terminal.ts deleted file mode 100644 index 75375d38a35b..000000000000 --- a/frontend/providers/terminal/src/api/terminal.ts +++ /dev/null @@ -1,15 +0,0 @@ -import request from '@/service/request'; - -export function getEnv() { - return request.get< - any, - { - data: { - data: { - CPU_REQUIREMENT: number; - MEMORY_REQUIREMENT: number; - }; - }; - } - >('/api/env'); -} diff --git a/frontend/providers/terminal/src/components/iconfont/index.tsx b/frontend/providers/terminal/src/components/iconfont/index.tsx deleted file mode 100644 index b3b7436ec0c3..000000000000 --- a/frontend/providers/terminal/src/components/iconfont/index.tsx +++ /dev/null @@ -1,23 +0,0 @@ -type TIconfont = { - iconName: string; - color?: string; - width?: number; - height?: number; -}; - -function Iconfont(props: TIconfont) { - const { iconName, color, width, height } = props; - const style = { - fill: color, - width, - height - }; - - return ( - - ); -} - -export default Iconfont; diff --git a/frontend/providers/terminal/src/components/terminal/index.module.scss b/frontend/providers/terminal/src/components/terminal/index.module.scss deleted file mode 100644 index 3f26e5816508..000000000000 --- a/frontend/providers/terminal/src/components/terminal/index.module.scss +++ /dev/null @@ -1,35 +0,0 @@ -.tabs { - .closeIcon { - display: none; - } - - &:hover { - .closeIcon { - display: block; - } - } - - &[data-isactive='true'] { - .closeIcon { - display: block; - } - } -} - -.iframeWindow { - width: 100%; - height: 100%; -} - -.containerLeft { - width: 200px; - font-size: 12px; - font-weight: 400; -} - -@media (max-width: 768px) { - .containerLeft { - width: 136px; - font-size: 12px; - } -} diff --git a/frontend/providers/terminal/src/components/terminal/index.tsx b/frontend/providers/terminal/src/components/terminal/index.tsx deleted file mode 100644 index 497c92efe137..000000000000 --- a/frontend/providers/terminal/src/components/terminal/index.tsx +++ /dev/null @@ -1,180 +0,0 @@ -import Iconfont from '@/components/iconfont'; -import { Box, Flex, Text } from '@chakra-ui/react'; -import { debounce } from 'lodash'; -import { nanoid } from 'nanoid'; -import { useRouter } from 'next/router'; -import { useEffect, useRef, useState } from 'react'; -import styles from './index.module.scss'; -import useSessionStore from '@/store/session'; - -type Terminal = { - id: string; - command?: string; -}; - -function Terminal({ url, site }: { url: string; site: string }) { - const [tabId, setTabId] = useState(nanoid(6)); - const router = useRouter(); - const iframeRef = useRef(null); - const { query } = router; - const session = useSessionStore((s) => s.session); - const nsid = session?.user?.nsid; - const [tabContents, setTabContents] = useState([ - { - id: tabId, - command: - query?.defaultCommand && typeof query?.defaultCommand === 'string' - ? decodeURIComponent(query.defaultCommand) - : '' - } - ]); - - useEffect(() => { - const event = async (e: MessageEvent) => { - const urlOrigin = new URL(url).origin; - const whitelist = [urlOrigin, site]; - - if (!whitelist.includes(e.origin)) return; - try { - if (e.data.type === 'new terminal' && e.data.command) { - newTerminal(decodeURIComponent(e.data.command)); - } - if (e.data?.ttyd === 'ready') { - iframeRef.current?.contentWindow?.postMessage( - { - command: `kubectl config set-context --current --namespace=${nsid} && export PS1="\\u@(${nsid}) \\W\\$ " && clear` - }, - url - ); - iframeRef.current?.contentWindow?.postMessage( - { - command: `clear && echo -e "\\033[36mThis is a temporary terminal for debugging and testing. The session will automatically end \\033[1m30 minutes\\033[22m after you leave.\\033[0m\\n\\nYou are now working in namespace: \\033[1;32m${nsid}\\033[0m" && history -c` - }, - url - ); - const command = iframeRef.current?.getAttribute('data-command'); - iframeRef?.current?.contentWindow?.postMessage({ command }, url); - } - } catch (error) { - console.log(error, 'error'); - } - }; - window.addEventListener('message', event); - return () => window.removeEventListener('message', event); - }, [site, url, nsid]); - - const newTerminal = (command?: string) => { - const temp = nanoid(6); - setTabContents((pre) => { - return [ - ...pre, - { - id: temp, - command: command - } - ]; - }); - setTabId(temp); - }; - - const deleteTerminal = (key: string) => { - if (tabContents.length <= 1) return; - setTabContents((pre) => { - const temp = pre.filter((item) => item.id !== key); - setTabId(temp[temp.length - 1].id); - return temp; - }); - }; - - const onTabChange = (id: string) => { - setTabId(id); - }; - - return ( - - - newTerminal(), 500)} - > - - - Add a Terminal - - - - {tabContents?.map((item: Terminal, index: number) => { - return ( - onTabChange(item?.id)} - className={styles.tabs} - data-isactive={item?.id === tabId} - > - - - {`terminal ${index + 1}`} - - deleteTerminal(item?.id)} - > - - - - ); - })} - - - {tabContents?.map((item: Terminal) => { - return ( - -