Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add namespace field to cluster config #124

Merged
merged 1 commit into from
Jan 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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