Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

oc login should avoid clobbering kubeconfig contexts

Đang mở
#283 28 bình luận 35 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@tchap đang làm issue này rồi.

Từ ngày 16/1/2026.

  • #2187 của @tchap — đang mở

Đánh giá

Issue này chưa được đánh giá.

Mô tả

Default behavior of oc login https://openshift.example.com --username=thelonelyghost --password='hunter2' is to do the following:

  • Setup a new (or if exists, update) cluster in the kubeconfig by the name of openshift-example-com:443
  • Setup a new (or if exists, update) user in the kubeconfig by the name of thelonelyghost/openshift-example-com:443
  • Setup a new (or if exists, update) context in the kubeconfig by the name of default/openshift-example-com:443/thelonelyghost.
  • Set the current context to be default/openshift-example-com:443/thelonelyghost

This is fine for initial setup, but periodically I'm forced to login again to refresh the bearer token stored in the user section of the kubeconfig. When I do that, I must run the same oc login command again. Here's the problem:

If I re-run that command, it clobbers any changes I've made to human-facing names of the cluster, the context, or the user that have zero functional effect on the file. If I renamed the default/openshift-example-com:443/thelonelyghost context to be more user-friendly, such as company-prod, logging in again adds an additional context of default/openshift-example-com:443/thelonelyghost back again. It does not update credentials in-place, it adds them if they're not named exactly what is expected.

I've written a tool in python named oc-replacement to re-authenticate in-place as I desire, but it would be much more desirable for this to be default behavior or even an option with the oc command line tool.

Ngôn ngữ chính
Go
Star
250
Fork
491
Merge trung bình
9 ngày 3 giờ
Pull request đã merge (30 ngày)
10

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của openshift/oc

Tất cả issue của openshift/oc

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.