posh-providers/stern/stern
Kevin Franklin Kim 3c3b26fc13
feat: add gokazi
2025-04-07 16:08:19 +02:00
..
command.go feat: add gokazi 2025-04-07 16:08:19 +02:00
config_test.go feat: add schema 2025-04-04 16:44:08 +02:00
config.go feat(stern/stern): add queries 2025-04-04 16:45:36 +02:00
config.schema.json feat: add schema 2025-04-04 16:44:08 +02:00
query.go feat(stern/stern): add queries 2025-04-04 16:45:36 +02:00
README.md docs(stern/stern): add config 2025-04-04 16:47:50 +02:00

POSH stern provider

Usage

Plugin

package main

type Plugin struct {
  l        log.Logger
  cache    cache.Cache
  kubectl  *kubectl.Kubectl
  commands command.Commands
}

func New(l log.Logger) (plugin.Plugin, error) {
  var err error
  inst := &Plugin{
    l:        l,
    cache:    &cache.MemoryCache{},
    commands: command.Commands{},
  }

  // ...

  inst.kubectl, err = kubectl.New(l, inst.cache)
  if err != nil {
    return nil, errors.Wrap(err, "failed to create kubectl")
  }

  inst.squadron, err = squadron.New(l, inst.kubectl)
  if err != nil {
    return nil, errors.Wrap(err, "failed to create squadron")
  }

  // ...

  inst.commands.MustAdd(stern.NewCommand(l, inst.kubectl, inst.squadron))

  // ...

  return inst, nil
}

Config

stern:
  queries:
    all:
      query: ['.*', '--all-namespaces']
      queries:
        panic:
          query: ['--include', 'panic']
        fatal:
          query: ['--include', '"\"level\":\"fatal\""']
        errors:
          query: ['--include', '"\"level\":\"error\""']

Ownbrew

To install binary locally, add:

ownbrew:
  packages:
    ## https://github.com/stern/stern/releases
    - name: stern
      tap: foomo/tap/stern/stern
      version: 1.27.0