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

Feature request: config files with contexts only #124

Open
reinoud opened this issue Dec 12, 2022 · 1 comment
Open

Feature request: config files with contexts only #124

reinoud opened this issue Dec 12, 2022 · 1 comment

Comments

@reinoud
Copy link

reinoud commented Dec 12, 2022

Hi,

we use a cluster with a lot of namespace, and I would like to use a separate context for each.

I have a config file downloaded from Rancher, that defines the cluster, user and a single context. This file obviously contains my private token

I would like to use a separate config with only additional contexts defined. We would like to maintain this file centrally, so all Kubernetes admins can git pull this file to have all context definitions updated.

When I try this now, kubie complains:

contexts.yml: missing fieldclustersat line 4 column 9

since it is not a complete config file.

The contexts.yml file looks like this:

---
# list of all cluster-namespace combinations for cluster production

contexts:
- name: "production-namespace1"
  context:
    user: "myuser"
    cluster: "production"
    namespace: "namespace1"

- name: "production-namespace2"
  context:
    user: "myuser"
    cluster: "production"
    namespace: "namespace2"

- name: "production-namespace3"
  context:
    user: "myuser"
    cluster: "production"
    namespace: "namespace3"

The use-case here is that we do not have rights on the cluster to get all namespaces, so selecting a context with a set namespace makes our life much easier.

@jedvardsson
Copy link

I stumbled upon this and have a similar problem. Some clusters that I access doesn't allow listing namespaces. One thing that you can do is to merge your config with the pulled config using e.q. yq as part of the pulling. Or commit your config to the git managed config but not push it. It will get automatically merged when you pull.

One other way would be if Kubie could support getting namespaces from file (or script available on the path) rather than using kubectl get namespaces.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants