Skip to content

Commit 13da2a4

Browse files
authored
feat: supports k8s cluster (#3599)
1 parent 209ce31 commit 13da2a4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1591
-734
lines changed

assets/components.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ declare module 'vue' {
1212
'Carbon:circleSolid': typeof import('~icons/carbon/circle-solid')['default']
1313
'Carbon:copyFile': typeof import('~icons/carbon/copy-file')['default']
1414
'Carbon:information': typeof import('~icons/carbon/information')['default']
15+
'Carbon:logoKubernetes': typeof import('~icons/carbon/logo-kubernetes')['default']
1516
'Carbon:macShift': typeof import('~icons/carbon/mac-shift')['default']
1617
'Carbon:play': typeof import('~icons/carbon/play')['default']
1718
'Carbon:restart': typeof import('~icons/carbon/restart')['default']

assets/components/common/HostIcon.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<mdi:satellite-variant v-if="type == 'agent'" />
33
<ph:globe-simple v-else-if="type == 'remote'" />
44
<mdi:hexagon-multiple v-else-if="type == 'swarm'" />
5+
<carbon:logo-kubernetes v-else-if="type == 'k8s'" />
56
<ph:computer-tower v-else />
67
</template>
78
<script setup lang="ts">

assets/stores/hosts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export type Host = {
33
name: string;
44
nCPU: number;
55
memTotal: number;
6-
type: "agent" | "local" | "remote" | "swarm";
6+
type: "agent" | "local" | "remote" | "swarm" | "k8s";
77
endpoint: string;
88
available: boolean;
99
dockerVersion: string;

examples/ingress.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: networking.k8s.io/v1
2+
kind: Ingress
3+
metadata:
4+
name: dozzle-ingress
5+
annotations:
6+
ingress.kubernetes.io/ssl-redirect: "false"
7+
spec:
8+
rules:
9+
- host: dozzle.k3d.local
10+
http:
11+
paths:
12+
- path: /
13+
pathType: Prefix
14+
backend:
15+
service:
16+
name: dozzle-service
17+
port:
18+
number: 8080

examples/k8s.dozzle.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# rbac.yaml
2+
apiVersion: v1
3+
kind: ServiceAccount
4+
metadata:
5+
name: pod-viewer
6+
---
7+
# clusterrole.yaml
8+
apiVersion: rbac.authorization.k8s.io/v1
9+
kind: ClusterRole
10+
metadata:
11+
name: pod-viewer-role
12+
rules:
13+
- apiGroups: [""]
14+
resources: ["pods", "pods/log", "nodes"]
15+
verbs: ["get", "list", "watch"]
16+
---
17+
# clusterrolebinding.yaml
18+
apiVersion: rbac.authorization.k8s.io/v1
19+
kind: ClusterRoleBinding
20+
metadata:
21+
name: pod-viewer-binding
22+
subjects:
23+
- kind: ServiceAccount
24+
name: pod-viewer
25+
namespace: default
26+
roleRef:
27+
kind: ClusterRole
28+
name: pod-viewer-role
29+
apiGroup: rbac.authorization.k8s.io
30+
---
31+
# deployment.yaml
32+
apiVersion: apps/v1
33+
kind: Deployment
34+
metadata:
35+
name: dozzle
36+
spec:
37+
replicas: 1
38+
selector:
39+
matchLabels:
40+
app: dozzle
41+
template:
42+
metadata:
43+
labels:
44+
app: dozzle
45+
spec:
46+
serviceAccountName: pod-viewer
47+
containers:
48+
- name: dozzle
49+
image: amir20/dozzle:latest
50+
imagePullPolicy: Never
51+
ports:
52+
- containerPort: 8080
53+
env:
54+
- name: DOZZLE_MODE
55+
value: "k8s"
56+
- name: DOZZLE_LEVEL
57+
value: "debug"
58+
---
59+
# service.yaml
60+
apiVersion: v1
61+
kind: Service
62+
metadata:
63+
name: dozzle-service
64+
spec:
65+
type: ClusterIP
66+
selector:
67+
app: dozzle
68+
ports:
69+
- port: 8080
70+
targetPort: 8080
71+
protocol: TCP

go.mod

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ require (
3636
golang.org/x/sync v0.11.0
3737
google.golang.org/grpc v1.70.0
3838
google.golang.org/protobuf v1.36.5
39+
k8s.io/api v0.32.1
40+
k8s.io/apimachinery v0.32.1
41+
k8s.io/client-go v0.32.1
42+
k8s.io/metrics v0.32.1
3943
)
4044

4145
require (
@@ -45,14 +49,25 @@ require (
4549
github.com/buger/jsonparser v1.1.1 // indirect
4650
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
4751
github.com/containerd/log v0.1.0 // indirect
48-
github.com/davecgh/go-spew v1.1.1 // indirect
52+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
4953
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect
5054
github.com/distribution/reference v0.6.0 // indirect
55+
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
5156
github.com/felixge/httpsnoop v1.0.4 // indirect
57+
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
5258
github.com/go-logr/logr v1.4.2 // indirect
5359
github.com/go-logr/stdr v1.2.2 // indirect
60+
github.com/go-openapi/jsonpointer v0.21.0 // indirect
61+
github.com/go-openapi/jsonreference v0.20.2 // indirect
62+
github.com/go-openapi/swag v0.23.0 // indirect
5463
github.com/goccy/go-json v0.10.3 // indirect
55-
github.com/kr/pretty v0.2.1 // indirect
64+
github.com/golang/protobuf v1.5.4 // indirect
65+
github.com/google/gnostic-models v0.6.8 // indirect
66+
github.com/google/go-cmp v0.6.0 // indirect
67+
github.com/google/gofuzz v1.2.0 // indirect
68+
github.com/google/uuid v1.6.0 // indirect
69+
github.com/josharian/intern v1.0.0 // indirect
70+
github.com/json-iterator/go v1.1.12 // indirect
5671
github.com/lestrrat-go/blackmagic v1.0.2 // indirect
5772
github.com/lestrrat-go/httpcc v1.0.1 // indirect
5873
github.com/lestrrat-go/httprc v1.0.6 // indirect
@@ -63,18 +78,33 @@ require (
6378
github.com/mattn/go-colorable v0.1.13 // indirect
6479
github.com/mattn/go-isatty v0.0.20 // indirect
6580
github.com/moby/docker-image-spec v1.3.1 // indirect
81+
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
82+
github.com/modern-go/reflect2 v1.0.2 // indirect
83+
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
6684
github.com/pkg/errors v0.9.1 // indirect
67-
github.com/pmezard/go-difflib v1.0.0 // indirect
85+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
6886
github.com/segmentio/asm v1.2.0 // indirect
87+
github.com/spf13/pflag v1.0.5 // indirect
88+
github.com/x448/float16 v0.8.4 // indirect
6989
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.57.0 // indirect
7090
go.opentelemetry.io/otel v1.32.0 // indirect
7191
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.22.0 // indirect
7292
go.opentelemetry.io/otel/metric v1.32.0 // indirect
73-
go.opentelemetry.io/otel/sdk v1.32.0 // indirect
7493
go.opentelemetry.io/otel/trace v1.32.0 // indirect
94+
golang.org/x/oauth2 v0.25.0 // indirect
95+
golang.org/x/term v0.29.0 // indirect
7596
golang.org/x/text v0.22.0 // indirect
97+
golang.org/x/time v0.8.0 // indirect
7698
google.golang.org/genproto/googleapis/rpc v0.0.0-20241223144023-3abc09e42ca8 // indirect
99+
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
100+
gopkg.in/inf.v0 v0.9.1 // indirect
77101
gotest.tools/v3 v3.0.3 // indirect
102+
k8s.io/klog/v2 v2.130.1 // indirect
103+
k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f // indirect
104+
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 // indirect
105+
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 // indirect
106+
sigs.k8s.io/structured-merge-diff/v4 v4.4.2 // indirect
107+
sigs.k8s.io/yaml v1.4.0 // indirect
78108
)
79109

80110
go 1.23.6

0 commit comments

Comments
 (0)