Skip to content
This repository was archived by the owner on Jun 12, 2025. It is now read-only.

Commit 1e811bc

Browse files
authored
Fix windows tab bearer token (#5)
* Fix windows tab bearer token * Change Copy All button appearance * Add favicon.svg
1 parent f987443 commit 1e811bc

File tree

5 files changed

+184
-18
lines changed

5 files changed

+184
-18
lines changed

html/static/favicon.svg

Lines changed: 156 additions & 0 deletions
Loading

html/static/main.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ h3 { font-size: 16px; }
1212
pre {
1313
background-color: #eff0f1;
1414
padding: 5px;
15-
overflow: auto;
15+
white-space: pre-wrap;
16+
overflow-wrap: break-word;
17+
word-break: break-all;
1618
}
1719

1820
.dex-container {

html/static/tabs.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
}
77

88
/* Style the buttons inside the tab */
9-
.tab button {
9+
.tab button:not(.tabbtn) {
1010
background-color: inherit;
1111
float: left;
1212
border: none;
@@ -18,12 +18,12 @@
1818
}
1919

2020
/* Change background color of buttons on hover */
21-
.tab button:hover {
21+
.tab button:not(.tabbtn):hover {
2222
background-color: #ddd;
2323
}
2424

2525
/* Create an active/current tablink class */
26-
.tab button.active {
26+
.tab button.active:not(.tabbtn) {
2727
background-color: #ccc;
2828
}
2929

templates/kubeconfig.html

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<link href="{{ .Web_Path_Prefix }}static/main.css" rel="stylesheet" type="text/css">
1212
<link href="{{ .Web_Path_Prefix }}static/styles.css" rel="stylesheet" type="text/css">
1313
<link href="{{ .Web_Path_Prefix }}static/tabs.css" rel="stylesheet" type="text/css">
14-
<link rel="icon" href="{{ .Web_Path_Prefix }}static/favicon.png">
14+
<link rel="icon" href="{{ .Web_Path_Prefix }}static/favicon.svg">
1515
</head>
1616

1717
<body class="theme-body">
@@ -46,7 +46,10 @@ <h2 class="theme-heading">Generated Kubernetes Token - {{ .ShortDescription }}</
4646
<button class="tablinks active" onclick="openTab(event, 'Linux')">Linux</button>
4747
<button class="tablinks" onclick="openTab(event, 'MacOS')">MacOS</button>
4848
<button class="tablinks" onclick="openTab(event, 'Windows')">Windows</button>
49-
<button class="tablinks" id="copy-all" style="float:right">Copy All</button>
49+
<button class="tabbtn" id="copy-all" style="float:right">
50+
<img width="13" src="{{ .Web_Path_Prefix }}static/clippy.svg" alt="">
51+
All
52+
</button>
5053
</div>
5154

5255
<div id="Linux" class="tabcontent" style="display: block">

templates/windows-tab.html

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
{{ define "windows-tab-content" }}
2-
<h3>Install and Set Up kubectl</h3>
3-
<div>
2+
<h3>Install and Set Up kubectl</h3>
3+
<div>
44
See
55
<a title="Install and setup kubectl" href="https://kubernetes.io/docs/tasks/tools/install-kubectl/">
66
https://kubernetes.io/docs/tasks/tools/install-kubectl
77
</a>
88

99
{{ if .KubectlVersion }}
10-
<p>
11-
Download kubectl:
12-
<a title="Download kubectl" href="https://storage.googleapis.com/kubernetes-release/release/{{.KubectlVersion}}/bin/windows/amd64/kubectl.exe">
13-
https://storage.googleapis.com/kubernetes-release/release/{{.KubectlVersion}}/bin/windows/amd64/kubectl.exe
14-
</a>
15-
</p>
10+
<p>
11+
Download kubectl:
12+
<a title="Download kubectl"
13+
href="https://storage.googleapis.com/kubernetes-release/release/{{.KubectlVersion}}/bin/windows/amd64/kubectl.exe">
14+
https://storage.googleapis.com/kubernetes-release/release/{{.KubectlVersion}}/bin/windows/amd64/kubectl.exe
15+
</a>
16+
</p>
1617
{{ end }}
1718
</div>
1819

@@ -85,17 +86,21 @@ <h3>Run configuration commands</h3>
8586
<button class="btn" style="float:right" data-clipboard-snippet="">
8687
<img class="clippy" width="13" src="{{ .Web_Path_Prefix }}static/clippy.svg" alt="">
8788
</button>
88-
<pre><code>kubectl config set-cluster {{ .ClusterName }} --certificate-authority=${HOME}/.kube/certs/{{ .ClusterName}}/k8s-ca.crt --server={{ .K8sMasterURI }}</code></pre>
89+
<pre><code>kubectl config set-cluster {{ .ClusterName }} --certificate-authority=${HOME}/.kube/certs/{{ .ClusterName}}/k8s-ca.crt --server={{ .K8sMasterURI }}</code></pre>
8990
</div>
9091

9192
<div class="command">
9293

9394
<button class="btn" style="float:right" data-clipboard-snippet="">
9495
<img class="clippy" width="13" src="{{ .Web_Path_Prefix }}static/clippy.svg" alt=""/>
9596
</button>
96-
<pre><code>kubectl config set-credentials {{ .Username }}-{{ .ClusterName }} --auth-provider=oidc --auth-provider-arg=idp-issuer-url={{ .Issuer }} --auth-provider-arg=client-id={{ .ClientID }} --auth-provider-arg=client-secret={{ .ClientSecret }} --auth-provider-arg=refresh-token={{ .RefreshToken }} --auth-provider-arg=id-token={{ .IDToken }}
97-
{{- if or (.IDPCaURI) (.IDPCaPem) }} --auth-provider-arg=idp-certificate-authority=${HOME}/.kube/certs/{{ .ClusterName }}/idp-ca.crt
98-
{{- end }}</code></pre>
97+
{{- if .BearerToken }}
98+
<pre><code>kubectl config set-credentials {{ .Username }}-{{ .ClusterName }} --token={{ .IDToken }}</code></pre>
99+
{{- else }}
100+
<pre><code>kubectl config set-credentials {{ .Username }}-{{ .ClusterName }} --auth-provider=oidc --auth-provider-arg=idp-issuer-url={{ .Issuer }} --auth-provider-arg=client-id={{ .ClientID }} --auth-provider-arg=client-secret={{ .ClientSecret }} --auth-provider-arg=refresh-token={{ .RefreshToken }} --auth-provider-arg=id-token={{ .IDToken }}
101+
{{- if or (.IDPCaURI) (.IDPCaPem) }} --auth-provider-arg=idp-certificate-authority=${HOME}/.kube/certs/{{ .ClusterName }}/idp-ca.crt
102+
{{- end }}</code></pre>
103+
{{- end }}
99104
</div>
100105
<div class="command">
101106

0 commit comments

Comments
 (0)