From 75f9aca24cb459cd4ae4c162ceda4928276fb407 Mon Sep 17 00:00:00 2001 From: luckysideburn Date: Mon, 30 Dec 2024 09:24:45 +0000 Subject: [PATCH] fix clusterrole --- README.md | 24 ++++++++++++++++++ .../kubeinvaders/templates/rbac-cluster.yaml | 21 +++++++++++++++ html/images/sprite_invader_vm_stopping.png | Bin 0 -> 4369 bytes html/index.html | 6 ++++- html/js/kubeinvaders.js | 4 +-- 5 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 html/images/sprite_invader_vm_stopping.png diff --git a/README.md b/README.md index 9ac4098..cefaf76 100644 --- a/README.md +++ b/README.md @@ -105,6 +105,30 @@ metadata: namespace: kubeinvaders annotations: kubernetes.io/service-account.name: kinv-sa +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + namespace: default + name: kubevirt-vm-restart-role +rules: +- apiGroups: ["subresources.kubevirt.io"] + resources: ["virtualmachines/restart"] + verbs: ["update"] +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: kubevirt-vm-restart-binding + namespace: default +subjects: +- kind: ServiceAccount + name: kubeinvaders + namespace: kubeinvaders +roleRef: + kind: Role + name: kubevirt-vm-restart-role + apiGroup: rbac.authorization.k8s.io EOF ``` diff --git a/helm-charts/kubeinvaders/templates/rbac-cluster.yaml b/helm-charts/kubeinvaders/templates/rbac-cluster.yaml index 5c4f88e..004ff26 100644 --- a/helm-charts/kubeinvaders/templates/rbac-cluster.yaml +++ b/helm-charts/kubeinvaders/templates/rbac-cluster.yaml @@ -43,4 +43,25 @@ roleRef: kind: ClusterRole name: {{ template "kubeinvaders.clusterRoleName" . }} {{- end -}} +kind: Role +metadata: + namespace: {{ .Release.Namespace }} + name: kubevirt-vm-restart-role +rules: +- apiGroups: ["subresources.kubevirt.io"] + resources: ["virtualmachines/restart"] + verbs: ["update"] +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: kubevirt-vm-restart-binding + namespace: {{ .Release.Namespace }} +subjects: +- kind: ServiceAccount + name: {{ template "kubeinvaders.serviceAccountName" . }} + namespace: {{ .Release.Namespace }} +roleRef: + kind: Role + name: kubevirt-vm-restart-role + apiGroup: rbac.authorization.k8s.io {{- end -}} diff --git a/html/images/sprite_invader_vm_stopping.png b/html/images/sprite_invader_vm_stopping.png new file mode 100644 index 0000000000000000000000000000000000000000..54420e63d662c6b8198e24c5b867a23416c779fd GIT binary patch literal 4369 zcmeH~e^3)=8plJ$iU^D+jO9>qZ&57LO?Ed4WY+{lf{;ou{3iZnlYJAmkZjm2Bw(di z7<)Z`fb<7PJ>=ACuf1NYv@*5Qj#}la7PWJyOtpGapglNCxt`TBSEs#q6Mo)x=7yQ; ze`F@v-RFJY&-*;z=Xu}B{@Rq49vU1KER)GX4H^0zc-2bZpoifv{ouL)FK4Usio_ho zgSZ6V#+3m?ta1SacsZL)=Dp!CeHwZe4|-tVS${e{Yw3-*_~pY}Mssl@W)ZIeq4_=pD~CsPo_}Up zXJ@tx(~PtgRk+H#ubs)CADFzlWl2lK=ELWHSiWN+5xw}^zFY5qcx%<_lDuYH#ifV# zIe$CIuIc)spz|N`Xk<$A2SFFQ$S;<~&A$D0MT2bXaIf~GA8!8c<-$uFLxP??_jVWV z=nd^1G=AFi-ulI0xp{fgis;0_+H(z?3bi$Tn?!TZOWDfjTUXRC*wqBC!D1hqh0UL3Q79;TX7vZdtWg)eb{x?9PF+lV6kf)qAmq5h;ZRJT;TF>> zA!Ib5AD!XOgPT;51KfOtUpgPzI-4WSmwYp&(q&L5>Yq zs|l5wz+hbgrqU#8FioP(hN)FJpwu=(r2*G(A&RtEG`K~h#3+!+ zLKIG53`N>7C8@Ge2_&IbQH&2I)qzei8FVNq$0sbNGDfuVfvsL{sZ)x`+T7S(mI5%9s%4hO#sa#O*fAT+;alXBTAiiBeGgf~JZl)5j zzBnPvKV&UooOS?@kI{Y|vvWVv3mS`xO3)AtW>c!wQaj<8#iFEO0TW3;5hSn>|3P>2 zHqpZfAjJ-Kgj&J=^l61W>Mvp3)L=X%K&lT^3?oQvLa~HV#T26%E2L9nEM=|YzeLgc z93~wzaGu`=k1u!{D#nk)QPHG>=O_G(7UL&e0itIXnU=mYa?Qv!Ed{3KJkwn>a!pHt zX*thy*Z)nf;E5M1;DmpJJn(htsx#CKU$q{#tV`F+K9&W@!tY%iz5*?CT^VM#Og1lE z`Uc4MwM0VW9MND*n==ryWI<5WHgkS4G@Uf)Q}RmwI&?iHtPT&+XV;z_Xs;IDytd@l zBP(PWYKKSDBm6+{s9GM$C(t9v}k*PFbLFhX=yJPlCO|c^u?d4qZ}h4DbT%;j$+{Q5PpCP1hcRy6u&=mwPg8!WS@H58nqp7PB2Rty`M{w=sk@(A h7Z{$2!&vs7pW~Egv6OE@c1! literal 0 HcmV?d00001 diff --git a/html/index.html b/html/index.html index c7da385..90abc26 100644 --- a/html/index.html +++ b/html/index.html @@ -682,6 +682,10 @@ k8s_jobs: VM Starting restarting +
  • + VM Starting + stopping +
  • VM Stopped stopped @@ -741,7 +745,7 @@ k8s_jobs:
    -

    version: 2024-12-30 08:58:24

    +

    version: 2024-12-30 09:11:59

    diff --git a/html/js/kubeinvaders.js b/html/js/kubeinvaders.js index 83cf04b..68a708f 100644 --- a/html/js/kubeinvaders.js +++ b/html/js/kubeinvaders.js @@ -339,9 +339,9 @@ function startChaosNode(node_name) { function rebootVirtualMachine(vm_name) { var oReq = new XMLHttpRequest(); oReq.onload = function () { - $('#alert_placeholder').replaceWith(alert_div + 'Latest action: Prepareing reboot virtual machine ' + vm_name + ''); + $('#alert_placeholder').replaceWith(alert_div + 'Latest action: Reboot virtual machine ' + vm_name + ''); };; - $('#alert_placeholder').replaceWith(alert_div + 'Latest action: Reboot virtual machine ' + vm_name + ''); + $('#alert_placeholder').replaceWith(alert_div + 'Latest action: Preparing virtual machine ' + vm_name + ''); oReq.open("GET", k8s_url + "/kube/vm_reboot?vm_name=" + vm_name + "&namespace=" + namespace); oReq.send(); }