posh-providers/kubernets/kubectl
2023-05-25 10:03:43 +02:00
..
cluster.go feat: update tools 2023-05-25 10:03:43 +02:00
config.go feat: add initial providers 2023-01-27 11:15:32 +01:00
kubectl.go refactor: use single shell helper 2023-02-14 17:32:11 +01:00
README.md docs: update README 2023-05-16 10:03:15 +02:00

POSH kubectl provider

Usage

package main

import (
  "github.com/foomo/posh/provider/foomo/gotsrpc"
  "github.com/foomo/posh/pkg/command"
  "github.com/foomo/posh/pkg/log"
  "github.com/foomo/posh/pkg/plugin"
  "github.com/spf13/viper"
)

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

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

  // ...

  if value, err := kubectl.New(l, inst.cache); err != nil {
    return nil, err
  } else {
    inst.kubectl = value
  }

  // ...

  return inst, nil
}

Environment:

Add this to your environment:

env:
  - name: KUBECONFIG
    value: "${PROJECT_ROOT}/.posh/config/kubeconfig.yaml"

Configuration:

kubectl:
  path: devops/config/kubectl