Skip to content

Commit

Permalink
Add namespace field to cluster config (#124)
Browse files Browse the repository at this point in the history
  • Loading branch information
erwinvaneyk authored and nabadger committed Jan 13, 2020
1 parent 98596cb commit 41b4243
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions examples/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ clusters:
# Specify 1 or more clusters
- name: example-cluster

# Default namespace (optional)
namespace: my-namespace

# Descriptions used in the WebUI
short_description: "Example Cluster"
description: "Example Cluster Long Description..."
Expand Down
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ func (d debugTransport) RoundTrip(req *http.Request) (*http.Response, error) {
// Define each cluster
type Cluster struct {
Name string
Namespace string
Short_Description string
Description string
Issuer string
Expand Down
2 changes: 2 additions & 0 deletions templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ type templateData struct {
Web_Path_Prefix string
StaticContextName bool
KubectlVersion string
Namespace string
}

func (cluster *Cluster) renderToken(w http.ResponseWriter,
Expand Down Expand Up @@ -86,6 +87,7 @@ func (cluster *Cluster) renderToken(w http.ResponseWriter,
LogoURI: logoURI,
Web_Path_Prefix: webPathPrefix,
StaticContextName: cluster.Static_Context_Name,
Namespace: cluster.Namespace,
KubectlVersion: kubectlVersion}

err = templates.ExecuteTemplate(w, "kubeconfig.html", token_data)
Expand Down
2 changes: 1 addition & 1 deletion templates/linux-mac-common.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ <h3>Run configuration commands</h3>
<img class="clippy" width="13" src="{{ .Web_Path_Prefix }}static/clippy.svg" alt="">
</button>
<pre><code class="hljs">kubectl config set-context {{ if not .StaticContextName }}{{ .Username }}-{{ end }}{{ .ClusterName }} \
--cluster={{ .ClusterName }} \
--cluster={{ .ClusterName }}{{ if .Namespace }} --namespace={{ .Namespace }}{{ end }} \
--user={{ .Username}}-{{.ClusterName }}</code></pre>
</div>

Expand Down

0 comments on commit 41b4243

Please sign in to comment.