Skip to content

Commit

Permalink
Merge pull request #17775 from marcnuri-forks/feat/addons-yakd
Browse files Browse the repository at this point in the history
Add YAKD - Kubernetes Dashboard addon
  • Loading branch information
spowelljr authored Dec 20, 2023
2 parents 48a81a8 + 1bdbc58 commit ed91699
Show file tree
Hide file tree
Showing 11 changed files with 198 additions and 1 deletion.
4 changes: 4 additions & 0 deletions deploy/addons/assets.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,4 +170,8 @@ var (
// NvidiaDevicePlugin assets for nvidia-device-plugin addon
//go:embed nvidia-device-plugin/*.tmpl
NvidiaDevicePlugin embed.FS

// YakdAssets assets for yakd addon
//go:embed yakd/*.yaml yakd/*.tmpl
YakdAssets embed.FS
)
16 changes: 16 additions & 0 deletions deploy/addons/yakd/yakd-crb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: yakd-dashboard
labels:
app.kubernetes.io/name: yakd-dashboard
kubernetes.io/minikube-addons: yakd-dashboard
addonmanager.kubernetes.io/mode: Reconcile
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: yakd-dashboard
namespace: yakd-dashboard
69 changes: 69 additions & 0 deletions deploy/addons/yakd/yakd-dp.yaml.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
kind: Deployment
apiVersion: apps/v1
metadata:
labels:
app.kubernetes.io/name: yakd-dashboard
app.kubernetes.io/instance: yakd-dashboard
kubernetes.io/minikube-addons: yakd-dashboard
addonmanager.kubernetes.io/mode: Reconcile
name: yakd-dashboard
namespace: yakd-dashboard
spec:
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
app.kubernetes.io/name: yakd-dashboard
app.kubernetes.io/instance: yakd-dashboard
template:
metadata:
labels:
app.kubernetes.io/name: yakd-dashboard
app.kubernetes.io/instance: yakd-dashboard
gcp-auth-skip-secret: "true"
spec:
containers:
- name: yakd
image: {{.CustomRegistries.Yakd | default .ImageRepository | default .Registries.Yakd }}{{.Images.Yakd}}
imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: 8080
protocol: TCP
env:
- name: KUBERNETES_NAMESPACE
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
- name: HOSTNAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.name
resources:
limits:
memory: 256Mi
requests:
memory: 128Mi
securityContext:
allowPrivilegeEscalation: false
privileged: false
runAsUser: 1001
runAsGroup: 2001
livenessProbe:
httpGet:
path: /
port: 8080
initialDelaySeconds: 10
timeoutSeconds: 10
readinessProbe:
httpGet:
path: /
port: 8080
initialDelaySeconds: 10
timeoutSeconds: 10
restartPolicy: Always
serviceAccountName: yakd-dashboard
nodeSelector:
"kubernetes.io/os": linux
7 changes: 7 additions & 0 deletions deploy/addons/yakd/yakd-ns.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v1
kind: Namespace
metadata:
name: yakd-dashboard
labels:
kubernetes.io/minikube-addons: yakd-dashboard
addonmanager.kubernetes.io/mode: Reconcile
9 changes: 9 additions & 0 deletions deploy/addons/yakd/yakd-sa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app.kubernetes.io/name: yakd-dashboard
kubernetes.io/minikube-addons: yakd-dashboard
addonmanager.kubernetes.io/mode: Reconcile
name: yakd-dashboard
namespace: yakd-dashboard
17 changes: 17 additions & 0 deletions deploy/addons/yakd/yakd-svc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
kind: Service
apiVersion: v1
metadata:
labels:
app.kubernetes.io/name: yakd-dashboard
kubernetes.io/minikube-addons: yakd-dashboard
addonmanager.kubernetes.io/mode: Reconcile
name: yakd-dashboard
namespace: yakd-dashboard
spec:
type: NodePort
ports:
- port: 80
targetPort: 8080
selector:
app.kubernetes.io/name: yakd-dashboard
app.kubernetes.io/instance: yakd-dashboard
6 changes: 6 additions & 0 deletions pkg/addons/addons.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,12 @@ kubectl get secret $SECRET --namespace headlamp --template=\{\{.data.token\}\} |
minikube{{.profileArg}} addons enable metrics-server
`, out.V{"profileArg": tipProfileArg})
case "yakd":
out.Styled(style.Tip, `To access YAKD - Kubernetes Dashboard, wait for Pod to be ready and run the following command:
minikube{{.profileArg}} service yakd-dashboard -n yakd-dashboard
`, out.V{"profileArg": tipProfileArg})
}
}
Expand Down
5 changes: 5 additions & 0 deletions pkg/addons/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,4 +232,9 @@ var Addons = []*Addon{
set: SetBool,
callbacks: []setFn{EnableOrDisableAddon},
},
{
name: "yakd",
set: SetBool,
callbacks: []setFn{EnableOrDisableAddon},
},
}
13 changes: 13 additions & 0 deletions pkg/minikube/assets/addons.go
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,19 @@ var Addons = map[string]*Addon{
}, map[string]string{
"NvidiaDevicePlugin": "nvcr.io",
}),
"yakd": NewAddon([]*BinAsset{
MustBinAsset(addons.YakdAssets, "yakd/yakd-ns.yaml", vmpath.GuestAddonsDir, "yakd-ns.yaml", "0640"),
MustBinAsset(addons.YakdAssets, "yakd/yakd-sa.yaml", vmpath.GuestAddonsDir, "yakd-sa.yaml", "0640"),
MustBinAsset(addons.YakdAssets, "yakd/yakd-crb.yaml", vmpath.GuestAddonsDir, "yakd-crb.yaml", "0640"),
MustBinAsset(addons.YakdAssets, "yakd/yakd-svc.yaml", vmpath.GuestAddonsDir, "yakd-svc.yaml", "0640"),
MustBinAsset(addons.YakdAssets, "yakd/yakd-dp.yaml.tmpl", vmpath.GuestAddonsDir, "yakd-dp.yaml", "0640"),
}, false, "yakd", "3rd party (marcnuri.com)", "manusa", "https://minikube.sigs.k8s.io/docs/handbook/addons/yakd/",
map[string]string{
"Yakd": "marcnuri/yakd:0.0.4@sha256:a3f540278e4c11373e15605311851dd9c64d208f4d63e727bccc0e39f9329310",
},
map[string]string{
"Yakd": "docker.io",
}),
}

// parseMapString creates a map based on `str` which is encoded as <key1>=<value1>,<key2>=<value2>,...
Expand Down
42 changes: 42 additions & 0 deletions site/content/en/docs/handbook/addons/yakd-kubernetes-dashboard.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
title: "Using the YAKD - Kubernetes Dashboard Addon"
linkTitle: "YAKD - Kubernetes Dashboard"
weight: 1
date: 2023-12-12
---

## YAKD - Kubernetes Dashboard Addon

[YAKD - Kubernetes Dashboard](https://github.com/manusa/yakd) is a full-featured web-based Kubernetes Dashboard with special functionality for minikube.

The dashboard features a real-time Search pane that allows you to search for Kubernetes resources and see them update in real-time as you type.

### Enable YAKD - Kubernetes Dashboard on minikube

To enable this addon, simply run:

```shell script
minikube addons enable yakd
```

Once the addon is enabled, you can access the YAKD - Kubernetes Dashboard's web UI using the following command.

```shell script
minikube service yakd-dashboard -n yakd-dashboard
```

The dashboard will open in a new browser window and you should be able to start using it with no further hassle.

YAKD - Kubernetes Dashboard is also compatible with metrics-server. To install it, run:

```shell script
minikube addons enable metrics-server
```

### Disable YAKD - Kubernetes Dashboard

To disable this addon, simply run:

```shell script
minikube addons disable yakd
```
11 changes: 10 additions & 1 deletion test/integration/addons_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func TestAddons(t *testing.T) {
// so we override that here to let minikube auto-detect appropriate cgroup driver
os.Setenv(constants.MinikubeForceSystemdEnv, "")

args := append([]string{"start", "-p", profile, "--wait=true", "--memory=4000", "--alsologtostderr", "--addons=registry", "--addons=metrics-server", "--addons=volumesnapshots", "--addons=csi-hostpath-driver", "--addons=gcp-auth", "--addons=cloud-spanner", "--addons=inspektor-gadget", "--addons=storage-provisioner-rancher", "--addons=nvidia-device-plugin"}, StartArgs()...)
args := append([]string{"start", "-p", profile, "--wait=true", "--memory=4000", "--alsologtostderr", "--addons=registry", "--addons=metrics-server", "--addons=volumesnapshots", "--addons=csi-hostpath-driver", "--addons=gcp-auth", "--addons=cloud-spanner", "--addons=inspektor-gadget", "--addons=storage-provisioner-rancher", "--addons=nvidia-device-plugin", "--addons=yakd"}, StartArgs()...)
if !NoneDriver() { // none driver does not support ingress
args = append(args, "--addons=ingress", "--addons=ingress-dns")
}
Expand Down Expand Up @@ -134,6 +134,7 @@ func TestAddons(t *testing.T) {
{"CloudSpanner", validateCloudSpannerAddon},
{"LocalPath", validateLocalPathAddon},
{"NvidiaDevicePlugin", validateNvidiaDevicePlugin},
{"Yakd", validateYakdAddon},
}
for _, tc := range tests {
tc := tc
Expand Down Expand Up @@ -955,3 +956,11 @@ func validateNvidiaDevicePlugin(ctx context.Context, t *testing.T, profile strin
t.Errorf("failed to disable nvidia-device-plugin: args %q : %v", rr.Command(), err)
}
}

func validateYakdAddon(ctx context.Context, t *testing.T, profile string) {
defer PostMortemLogs(t, profile)

if _, err := PodWait(ctx, t, profile, "yakd-dashboard", "app.kubernetes.io/name=yakd-dashboard", Minutes(2)); err != nil {
t.Fatalf("failed waiting for YAKD - Kubernetes Dashboard pod: %v", err)
}
}

0 comments on commit ed91699

Please sign in to comment.