Skip to content

Commit

Permalink
rel 0.25.0
Browse files Browse the repository at this point in the history
  • Loading branch information
derailed committed Nov 16, 2021
2 parents 0059a57 + 4e20e5f commit e4eaf4d
Show file tree
Hide file tree
Showing 106 changed files with 2,485 additions and 1,063 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,8 @@ K9s uses aliases to navigate most K8s resources.
## K9s Configuration
K9s keeps its configurations inside of a `k9s` directory and the location depends on your operating system. K9s leverages [XDG](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html) to load its various configurations files.
K9s keeps its configurations inside of a `k9s` directory and the location depends on your operating system. K9s leverages [XDG](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html) to load its various configurations files. For information on the default locations for your OS please see [this link](https://github.com/adrg/xdg/blob/master/README.md). If you are still confused a quick `k9s info` will reveal where k9s is loading its configurations from.
| Unix | macOS | Windows |
|-----------------|-----------------------------|-----------------------|
Expand Down
45 changes: 37 additions & 8 deletions change_logs/release_v0.25.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ On Slack? Please join us [K9slackers](https://join.slack.com/t/k9sers/shared_inv

## ♫ Sounds Behind The Release ♭

* [High Fidelity - By Elvis Costello (yup! he started as a computer operator. Can u tell?)](https://www.youtube.com/watch?v=DJS-2kacmpU)
* [High Fidelity - By Elvis Costello (Yup! he started is career as a computer operator. Can u tell??)](https://www.youtube.com/watch?v=DJS-2kacmpU)
* [Walk With A Big Stick - Foster The People](https://www.youtube.com/watch?v=XMY1VMTyl8s)
* [Beirut - Steps Ahead -- Love this band!! with the ever so talented and sadly late Michael Brecker ;(](https://www.youtube.com/watch?v=UExKTZ3veB8)

Expand All @@ -25,20 +25,31 @@ On Slack? Please join us [K9slackers](https://join.slack.com/t/k9sers/shared_inv
I want to recognize the following folks that have been kind enough to join our sponsorship program and opted to `pay it forward`!

* [Andrew Regan](https://github.com/poblish)
* [Astraea](https://github.com/s22s)
* [DataRoots](https://github.com/datarootsio)
* [Bruno Brito](https://github.com/brunohbrito)
* [ScubaDrew](https://github.com/ScubaDrew)
* [mike-code](https://github.com/mike-code)
* [Andrew Aadland](https://github.com/DaemonDude23)
* [Michael Albers](https://github.com/michaeljohnalbers)

So if you feel K9s is helping with your productivity while administering your Kubernetes clusters, please consider pitching in as it will go a long way in ensuring a thriving environment for this repo and our k9ers community at large.

Also please take some time and give a huge shoot out to all the good folks below that have spent time plowing thru the code to help improve K9s for all of us!

Thank you!!

---

## Forward That!
## Personal Note...

I had so many distractions this cycle so expect some `disturbance in the farce!` on this drop.
To boot rat holed quiet a bit on improving speed. So I might have drop some stuff on the floor in the process...
Please report back if that's the case and we will address shortly. Tx!!

## Port It Forward??

Ever been in a situation where you need to constantly port-forward on a given pod with multiple containers exposing multiple ports? If so it might be cumbersome to have to type in the full container:port specification to activate a forward. If you fall in this use cases, you can now specify which container and port you would rather port-forward to by default. In this drop, we introduce a new annotation that you can use to specify and container/port to forward to by default. If set the port-forward dialog will know default to your settings.
Ever been in a situation where you need to constantly port-forward on a given pod with multiple containers or exposing multiple ports? If so it might be cumbersome to have to type in the full container:port specification to activate a forward. If you fall in this use cases, you can now specify which container and port you would rather port-forward to by default. In this drop, we introduce a new annotation that you can use to specify and container/port to forward to by default. If set, the port-forward dialog will know to default to your settings.

> NOTE: you can either use a port name or number in your annotation.
> NOTE: you can either use a container port name or number in your annotation!
```yaml
# Pod fred
Expand All @@ -47,9 +58,10 @@ kind: Pod
metadata:
name: fred
annotations:
k9s.imhotep.io/default-portforward-container: bozo:p1 # => will default to container bozo port named p1
k9scli.io/auto-portforwards: zorg::5556 # => will default to container zorg port 5556 and local port 5566. No port-forward dialog will be shown.
# Or...
k9s.imhotep.io/default-portforward-container: bozo:8081 # => will default to container bozo port number 8081
k9scli.io/portforward: bozo::6666:p1 # => launches the port-forward dialog selecting default port-forward on container bozo port named p1(8081)
# mapping to local port 6666.
...
spec:
containers:
Expand All @@ -67,18 +79,35 @@ spec:
...
```

The annotation value must specify a container to forward to as well as a local port and container port. The container port may be specified as either a port number or port name. If the local port is omitted then the local port will default to the container port number. Here are a few examples:

1. bozo::http - creates a pf on container `bozo` with port name http. If http specifies port number 8080 then the local port will be 8080 as well.
2. bozo::9090:http - creates a pf on container `bozo` mapping local port 9090->http(8080)
3. bozo::9090:8080 - creates a pf on container `bozo` mapping local port 9090->8080

---

## Resolved Issues

* [Issue #1299](https://github.com/derailed/k9s/issues/1299) After upgrade to 0.24.15 sorting shortcuts not working
* [Issue #1298](https://github.com/derailed/k9s/issues/1298) Install K9s through go get reporting ambiguous import error
* [Issue #1296](https://github.com/derailed/k9s/issues/1296) Crash when clicking between border of K9s and terminal pane
* [Issue #1289](https://github.com/derailed/k9s/issues/1289) Homebrew calling bottle :unneeded is deprecated! There is no replacement
* [Issue #1273](https://github.com/derailed/k9s/issues/1273) Not loading config from correct default location when XDG_CONFIG_HOME is unset
* [Issue #1268](https://github.com/derailed/k9s/issues/1268) Age sorting wrong for years
* [Issue #1258](https://github.com/derailed/k9s/issues/1258) Configurable or recent use based port-forward
* [Issue #1257](https://github.com/derailed/k9s/issues/1257) Why is the latest chocolatey on 0.24.10
* [Issue #1243](https://github.com/derailed/k9s/issues/1243) Port forward fails in kind on windows 10

---

## PRs

* [PR #1300](https://github.com/derailed/k9s/pull/1300) move from io/ioutil to io/os packages
* [PR #1287](https://github.com/derailed/k9s/pull/1287) Add missing styles to kiss
* [PR #1286](https://github.com/derailed/k9s/pull/1286) Some small color modifications
* [PR #1284](https://github.com/derailed/k9s/pull/1284) Fix a small typo which comes from cluster view info
* [PR #1271](https://github.com/derailed/k9s/pull/1271) Removed cursor colors that are too light to read
* [PR #1266](https://github.com/derailed/k9s/pull/1266) Skin to preserve your terminal session background color
* [PR #1264](https://github.com/derailed/k9s/pull/1205) Adding note on popeye config
* [PR #1261](https://github.com/derailed/k9s/pull/1261) Blurry logo
Expand Down
26 changes: 13 additions & 13 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,25 +94,25 @@ func loadConfiguration() *config.Config {
k9sCfg.K9s.OverrideWrite(*k9sFlags.Write)
k9sCfg.K9s.OverrideCommand(*k9sFlags.Command)

if err := k9sCfg.Refine(k8sFlags, k9sFlags); err != nil {
if err := k9sCfg.Refine(k8sFlags, k9sFlags, k8sCfg); err != nil {
log.Error().Err(err).Msgf("refine failed")
}
conn, err := client.InitConnection(k8sCfg)
k9sCfg.SetConnection(conn)
if err != nil {
log.Error().Err(err).Msgf("failed to connect to cluster")
} else {
// Try to access server version if that fail. Connectivity issue?
if !k9sCfg.GetConnection().CheckConnectivity() {
log.Panic().Msgf("K9s can't connect to cluster")
}
if !k9sCfg.GetConnection().ConnectionOK() {
panic("No connectivity")
}
log.Info().Msg("✅ Kubernetes connectivity")
if err := k9sCfg.Save(); err != nil {
log.Error().Err(err).Msg("Config save")
}
return k9sCfg
}
// Try to access server version if that fail. Connectivity issue?
if !k9sCfg.GetConnection().CheckConnectivity() {
log.Panic().Msgf("Cannot connect to cluster")
}
if !k9sCfg.GetConnection().ConnectionOK() {
panic("No connectivity")
}
log.Info().Msg("✅ Kubernetes connectivity")
if err := k9sCfg.Save(); err != nil {
log.Error().Err(err).Msg("Config save")
}

return k9sCfg
Expand Down
6 changes: 1 addition & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,14 @@ require (
github.com/cenkalti/backoff v2.2.1+incompatible
github.com/cenkalti/backoff/v4 v4.1.1
github.com/derailed/popeye v0.9.7
github.com/derailed/tview v0.6.1
github.com/derailed/tview v0.6.3
github.com/fatih/color v1.12.0
github.com/fsnotify/fsnotify v1.5.1
github.com/fvbommel/sortorder v1.0.2
github.com/gdamore/tcell/v2 v2.3.1
github.com/ghodss/yaml v1.0.0
github.com/kylelemons/godebug v1.1.0 // indirect
github.com/mattn/go-runewidth v0.0.13
// BOZO!! revamp with latest...
// github.com/openfaas/faas v0.0.0-20200207215241-6afae214e3ec
// github.com/openfaas/faas-cli v0.0.0-20200124160744-30b7cec9634c
// github.com/openfaas/faas-provider v0.15.0
github.com/petergtz/pegomock v2.9.0+incompatible
github.com/rakyll/hey v0.1.4
github.com/rs/zerolog v1.25.0
Expand Down
5 changes: 2 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ github.com/derailed/popeye v0.9.7 h1:EnOl8rwvAlN4KJo62+V7J713ZAWFQmKCrTBBBBBkbmQ
github.com/derailed/popeye v0.9.7/go.mod h1:Ih3wTG7wBOuxdqz5tlCuCFq/vyB+Te/IpqY5HwgUTEA=
github.com/derailed/tcell/v2 v2.3.1-rc.2 h1:9TmZB/IwL3MA1Jf4pC4rfMaPTcVYIN62IwE7X7A9emU=
github.com/derailed/tcell/v2 v2.3.1-rc.2/go.mod h1:wegJ+SscH+jPjEQIAV/dI/grLTRm5R4IE2M479NDSL0=
github.com/derailed/tview v0.6.1 h1:dB+9bO7r6a1Yg1HE+XNJj61hioauJnGBFq2biC5bjAk=
github.com/derailed/tview v0.6.1/go.mod h1:5Wjopun0Jw3zxOFtafwc/GlrkFJix1hZz1oQetWpnwE=
github.com/derailed/tview v0.6.3 h1:4GFzcmuVjHYHKlLEpU8lSiUBVfHeYQEC0z5tlBLp4CI=
github.com/derailed/tview v0.6.3/go.mod h1:j2GwRsCb3NZe7lRjKIeplvZLkg8duyNWG6I4y+bZwEE=
github.com/dgrijalva/jwt-go v0.0.0-20170104182250-a601269ab70c/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
Expand Down Expand Up @@ -1144,7 +1144,6 @@ golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210415045647-66c3f260301c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210426230700-d19ff857e887/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
Expand Down
19 changes: 7 additions & 12 deletions internal/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func InitConnection(config *Config) (*APIClient, error) {
}
err := a.supportsMetricsResources()
if err != nil {
log.Error().Err(err).Msgf("Checking metrics-server")
log.Error().Err(err).Msgf("Fail to locate metrics-server")
}
if errors.Is(err, noMetricServerErr) || errors.Is(err, metricsUnsupportedErr) {
return &a, nil
Expand Down Expand Up @@ -120,11 +120,11 @@ func (a *APIClient) IsActiveNamespace(ns string) bool {

// ActiveNamespace returns the current namespace.
func (a *APIClient) ActiveNamespace() string {
ns, err := a.CurrentNamespaceName()
if err != nil {
return AllNamespaces
if ns, err := a.CurrentNamespaceName(); err == nil {
return ns
}
return ns

return AllNamespaces
}

func (a *APIClient) clearCache() {
Expand Down Expand Up @@ -261,7 +261,7 @@ func (a *APIClient) CheckConnectivity() bool {
a.reset()
}
} else {
log.Error().Err(err).Msgf("K9s can't connect to cluster")
log.Error().Err(err).Msgf("can't connect to cluster")
a.connOK = false
}

Expand Down Expand Up @@ -301,11 +301,7 @@ func (a *APIClient) Dial() (kubernetes.Interface, error) {

// RestConfig returns a rest api client.
func (a *APIClient) RestConfig() (*restclient.Config, error) {
cfg, err := a.config.RESTConfig()
if err != nil {
return nil, err
}
return cfg, nil
return a.config.RESTConfig()
}

// CachedDiscovery returns a cached discovery client.
Expand Down Expand Up @@ -430,7 +426,6 @@ func (a *APIClient) supportsMetricsResources() error {
}
apiGroups, err := dial.ServerGroups()
if err != nil {
log.Warn().Err(err).Msgf("Unable to fetch APIGroups")
return err
}
for _, grp := range apiGroups.Groups {
Expand Down
Loading

0 comments on commit e4eaf4d

Please sign in to comment.