Skip to content

web_terminal_front #207

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions artifacts/dashboard/kubeconfig.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: v1
kind: Config
clusters:
- name: karmada-apiserver
cluster:
server: https://karmada-apiserver.karmada-system.svc.cluster.local:5443
insecure-skip-tls-verify: true
users:
- name: karmada-apiserver
user:
token: ""
contexts:
- name: karmada-apiserver
context:
cluster: karmada-apiserver
user: karmada-apiserver
current-context: karmada-apiserver
55 changes: 55 additions & 0 deletions artifacts/dashboard/ttyd-pod.yaml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we will not use the pod file directly, we can integrate the pod file with golang, like followoing:

pod := &v1.Pod{
        ObjectMeta: metav1.ObjectMeta{
            Name:      "ttyd-cbf14e3f-f53a-4e0c-99e2-b39ebc0d221d",
            Namespace: "karmada-system",
        },
        Spec: v1.PodSpec{
            Containers: []v1.Container{
                {
                    Name:  "ttyd-cbf14e3f-f53a-4e0c-99e2-b39ebc0d221d",
                    Image: "docker.io/sayem4604/ttyd:latest",
                    Ports: []v1.ContainerPort{
                        {
                            ContainerPort: 7681,
                        },
                    },
                },
            },
        },
    }
    podsClient := clientset.CoreV1().Pods("karmada-system")
    result, err := podsClient.Create(context.TODO(), pod, metav1.CreateOptions{})
    if err != nil {
        panic(err.Error())
    }

!!! Above is just an example, don't use it directly in your programe.

Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
apiVersion: v1
kind: Pod
metadata:
name: ttyd-cbf14e3f-f53a-4e0c-99e2-b39ebc0d221d
namespace: karmada-system
spec:
containers:
- image: docker.io/sayem4604/ttyd:latest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you provide with the original Dockerfile for building docker.io/sayem4604/ttyd:latest image, it will help our customer to clarify what we add in the image, also we can make some customization to to ttyd image, make it more convenient for karmada community.

imagePullPolicy: IfNotPresent
livenessProbe:
failureThreshold: 3
initialDelaySeconds: 5
periodSeconds: 10
successThreshold: 1
tcpSocket:
port: 7681
timeoutSeconds: 1
name: ttyd-cbf14e3f-f53a-4e0c-99e2-b39ebc0d221d
ports:
- containerPort: 7681
name: tcp
protocol: TCP
readinessProbe:
failureThreshold: 3
initialDelaySeconds: 5
periodSeconds: 10
successThreshold: 1
tcpSocket:
port: 7681
timeoutSeconds: 1
volumeMounts:
- mountPath: /var/run/secrets/kubernetes.io/serviceaccount
name: kube-api-access-qqjwf
readOnly: true
dnsPolicy: ClusterFirst
enableServiceLinks: true
volumes:
- name: kube-api-access-qqjwf
projected:
defaultMode: 420
sources:
- serviceAccountToken:
expirationSeconds: 3607
path: token
- configMap:
items:
- key: ca.crt
path: ca.crt
name: kube-root-ca.crt
- downwardAPI:
items:
- fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
path: namespace
9 changes: 9 additions & 0 deletions cmd/api/app/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import (
"github.com/karmada-io/dashboard/pkg/client"
"github.com/karmada-io/dashboard/pkg/config"
"github.com/karmada-io/dashboard/pkg/environment"
"github.com/karmada-io/dashboard/cmd/terminalsetup"
)

// NewAPICommand creates a *cobra.Command object with default parameters
Expand Down Expand Up @@ -109,6 +110,7 @@ func run(ctx context.Context, opts *options.Options) error {
client.WithInsecureTLSSkipVerify(opts.SkipKubeApiserverTLSVerify),
)
ensureAPIServerConnectionOrDie()
webterminal()
serve(opts)
config.InitDashboardConfig(client.InClusterClient(), ctx.Done())
<-ctx.Done()
Expand Down Expand Up @@ -141,3 +143,10 @@ func serve(opts *options.Options) {
klog.Fatal(router.Router().Run(insecureAddress))
}()
}


// Custom function to initialize the application
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 here the logic for terminial is clear

func webterminal() {
terminalsetup.Init()// Call the init function
}

3 changes: 3 additions & 0 deletions cmd/api/app/router/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import (
"github.com/gin-gonic/gin"

"github.com/karmada-io/dashboard/pkg/environment"

//terminalsetup "github.com/karmada-io/dashboard/cmd/terminalsetup"
)

var (
Expand All @@ -36,6 +38,7 @@ func init() {
router = gin.Default()
_ = router.SetTrustedProxies(nil)
v1 = router.Group("/api/v1")
//terminalsetup.Init()
member = v1.Group("/member/:clustername")
member.Use(EnsureMemberClusterMiddleware())

Expand Down
Loading