GithubHelp home page GithubHelp logo

turkenh / kubecontext Goto Github PK

View Code? Open in Web Editor NEW
397.0 8.0 19.0 70.46 MB

Menu Bar App for Managing Kubernetes Contexts on Mac

License: Apache License 2.0

Swift 100.00%
kubernetes kubernetes-monitoring kubernetes-setup kubeconfig kubernetes-context

kubecontext's Introduction

KubeContext

A small menu bar app for managing Kubernetes contexts.

  • Easily switch between contexts
  • Import/export contexts from/to kubeconfig files
  • Context name in menu bar
  • Assign colors to your contexts
  • Easy context management UI for renaming context, setting namespace and more.

Installation

Please note: App Store version offers pro features as IAP, however other installation options bring all features as unlocked and free ;)

Demo

Switch Between Contexts

switch context

Import Additional Kubeconfig Files

import kubeconfig

Context management UI

management UI

kubecontext's People

Contributors

andyast avatar daxmc99 avatar turkenh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kubecontext's Issues

Bug after using minikube to set context

I get this alert after using minikube to set the context

Could not parse config file 
typeMismatch(Yams.Node.Mapping, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "clusters", intValue: nil), _YAMLCodingKey(stringValue: "Index 9", intValue: 9), CodingKeys(stringValue: "cluster", intValue: nil), CodingKeys(stringValue: "extensions", intValue: nil)], debugDescription: "Expected to decode Mapping but found Node instead.", underlyingError: nil))

if config file deleted app raises error

Hi there,

when I load a config from eg. my desktop, imported it and then delete it from my desktop, this error message appears, and makes the app stop. (not able close the app nor change the context:'

Could not parse config file 
Error Domain=NSCocoaErrorDomain Code=260 "The file “civo.txt” couldn’t be opened because there is no such file." UserInfo={NSFilePath=/Users/jan/Desktop/civo.txt, NSUnderlyingError=0x600002969860 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}

Bildschirmfoto 2021-11-09 um 19 42 06

It would be good, when the app, changes to some default context or asks for a new file.

Feature Request: Handling multiple config files

Hi turkenh,

your tool looks quite cool, but unfortunately I do have multiple kubeconfig files that I would like to use.
Basically I split the config files by customer, and merging them together would make them quite messy.

On the commandline, I can use the KUBECONFIG environment variable to merge these files and they work fine with kubectl, kubectx, lens,...

my directory structure (~/.kube/config.d in my case) would look like:

$ ls -1
00_preferences
customer_1
customer_2
customer_3
private_cluster

The preferences file is basically being used to hold the current context and global preferences, the other files look like normal kubeconfig files:

apiVersion: v1
kind: Config
contexts:
- name: customer1-develop
  context:
    cluster: customer1-develop
    user: 5nafu@customer1
- name: customer1-production
  context:
    cluster: customer1-production
    user: 5nafu@customer1
- name: test@customer1-develop
  context:
    cluster: customer1-develop
    user: test@customer1

clusters:
- name: customer1-develop
  cluster:
    server: https://<URL redacted>
- name: customer_1-production
  cluster:
    server: https://<URL redacted>

users:
- name: 5nafu@customer1
  user:
    token: <TOKEN redacted>
- name: test@customer1
  user:
    token: <TOKEN redacted>

It would be great if KubeContext could support this kind of multiple files structure.

License Needed

Can you add a license so we know how we can use this code?

namespaces with numbers fail

when namespaces are a number (e.g. "namespace":"973585995"), the quotes around the config are removed after changing contexts using KubeContext

kube config before using KubeContext

contexts:
- context:
    cluster: somecluster
    namespace: "973585995"
    user: someuser
  name: somename

kube config after using KubeContext

contexts:
- context:
    cluster: somecluster
    namespace: 973585995
    user: someuser
  name: somename

resulting in the following error:

$ kubectl config get-contexts

error: Error loading config file "/Users/mark/.kube/config": v1.Config.Contexts: []v1.NamedContext: v1.NamedContext.Context: v1.Context.Namespace: ReadString: expects " or n, but found 9, error found in #10 byte of ...|mespace":973585995,"|..., bigger context ...|ext"},{"context":{"cluster":"somecluster","namespace":973585995,"user":"someuser"},"name":"somename"},{"c|...

Feature request: Is the environment healthy

Would like to get the status of all the deployments,
If no deployments are failing or currently deploying turn the icon Green, otherwise turn it Yellow

I use extensively skaffold for development and have to constantly switch between the terminal and the project I am working on. Since I have to monitor the state of the cluster as I develop.

This seem like a no-brainer but its something that I have not found anywhere else. Alternatively it would be nice to add a how to compile guide and I can look into adding this feature myself

Could not parse selected kubeconfig file - typeMismatch

Version 1.05 from the App Store

When selecting the kubeconfig file:

Could not parse selected kubeconfig file
 typeMismatch(Yams.Node.Sequence, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "users", intValue: nil), _YAMLCodingKey(stringValue: "Index 0", intValue: 0), CodingKeys(stringValue: "user", intValue: nil), CodingKeys(stringValue: "exec", intValue: nil), CodingKeys(stringValue: "env", intValue: nil)], debugDescription: "Expected to decode Sequence but found Node instead.", underlyingError: nil))

kubeconfig:

apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: snipped-cert
    server: redacted-url
  name: dev-cluster
- cluster:
    certificate-authority-data: snipped-cert
    server: redacted-url
  name: prod-cluster
contexts:
- context:
    cluster: dev-cluster
    user: dev-user
  name: dev
- context:
    cluster: prod-cluster
    user: prod-user
  name: prod
current-context: dev
kind: Config
preferences: {}
users:
- name: dev-user
  user:
    exec:
      apiVersion: client.authentication.k8s.io/v1alpha1
      args:
      - token
      - -i
      - redacted-url
      - -r
      - redacted-arn
      command: aws-iam-authenticator
      env: null
- name: prod-user
  user:
    exec:
      apiVersion: client.authentication.k8s.io/v1alpha1
      args:
      - token
      - -i
      - redacted-url
      - -r
      - redacted-arn
      command: aws-iam-authenticator
      env: null

Start on Login

Hi, I can't find the setting option to make this start when I boot / login, is that available anywhere?

Exporting Functinality

After importing kubeconfigs, I don't really keep track of them but when I need to share with someone else, it's really hard to find the file again. Could we have an export functionality that we can just choose a context and export it?

Could not parse kubeconfig file - keyNotFound

Hi,

first of all great idea! :)

However, after installing and configuring the kubeconfig file I get the following error message:

Could not parse selected kubeconfig file
 keyNotFound(CodingKeys(stringValue: "env", intValue: nil), Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "users", intValue: nil), _YAMLCodingKey(stringValue: "Index 0", intValue: 0), CodingKeys(stringValue: "user", intValue: nil), CodingKeys(stringValue: "exec", intValue: nil)], debugDescription: "No value associated with key CodingKeys(stringValue: \"env\", intValue: nil) (\"env\").", underlyingError: nil))

Here the config file:

apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: <cert>
    server: https://<id>.sk1.us-east-1.eks.amazonaws.com
  name: arn:aws:eks:us-east-1:<account-id>:cluster/test2-blub
contexts:
- context:
    cluster: arn:aws:eks:us-east-1:<account-id>:cluster/test2-blub
    user: arn:aws:eks:us-east-1:<account-id>:cluster/test2-blub
  name: arn:aws:eks:us-east-1:<account-id>:cluster/test2-blub
current-context: arn:aws:eks:us-east-1:<account-id>:cluster/test2-blub
kind: Config
preferences: {}
users:
- name: arn:aws:eks:us-east-1:<account-id>:cluster/test2-blub
  user:
    exec:
      apiVersion: client.authentication.k8s.io/v1alpha1
      args:
      - token
      - -i
      - test2-blub
      command: aws-iam-authenticator

In case this is relevant: the config file is generated by aws eks update-kubeconfig --name.
Any idea how to fix this? :)

malicious software

Does anyone is getting this “KubeContext.app” can’t be opened because Apple cannot check it for malicious software.
This software needs to be updated. Contact the developer for more information.

Mac OS Big Sur 11.6

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.