Skip to content

Commit

Permalink
Express distaste for all people named Kate (#371)
Browse files Browse the repository at this point in the history
  • Loading branch information
lekko-jonathan authored May 2, 2024
1 parent e331197 commit b5a9abe
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 421 deletions.
79 changes: 0 additions & 79 deletions cmd/lekko/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@ import (
goflag "flag"
"fmt"
"os"
"path/filepath"
"strconv"

"github.com/AlecAivazis/survey/v2"
"github.com/bufbuild/connect-go"
"github.com/lainio/err2"
"github.com/mitchellh/go-homedir"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
Expand All @@ -34,7 +32,6 @@ import (
bffv1beta1 "buf.build/gen/go/lekkodev/cli/protocolbuffers/go/lekko/bff/v1beta1"
"github.com/lekkodev/cli/pkg/feature"
"github.com/lekkodev/cli/pkg/gh"
"github.com/lekkodev/cli/pkg/k8s"
"github.com/lekkodev/cli/pkg/lekko"
"github.com/lekkodev/cli/pkg/logging"
"github.com/lekkodev/cli/pkg/repo"
Expand Down Expand Up @@ -67,9 +64,6 @@ func main() {
// auth
rootCmd.AddCommand(authCmd())
// exp
k8sCmd.AddCommand(applyCmd())
k8sCmd.AddCommand(listCmd())
experimentalCmd.AddCommand(k8sCmd)
experimentalCmd.AddCommand(parseCmd())
experimentalCmd.AddCommand(cleanupCmd)
experimentalCmd.AddCommand(formatCmd())
Expand Down Expand Up @@ -425,79 +419,6 @@ func (p *provider) Type() string {
return "provider"
}

var k8sCmd = &cobra.Command{
Use: "k8s",
Short: "manage lekko configurations in kubernetes. Uses the current k8s context set in your kubeconfig file.",
}

func localKubeParams(cmd *cobra.Command, kubeConfig *string) {
var defaultKubeconfig string
// ref: https://github.com/kubernetes/client-go/blob/master/examples/out-of-cluster-client-configuration/main.go
home, err := homedir.Dir()
if err == nil {
defaultKubeconfig = filepath.Join(home, ".kube", "config")
}
cmd.Flags().StringVarP(kubeConfig, "kubeconfig", "c", defaultKubeconfig, "absolute path to the kube config file")
}

func applyCmd() *cobra.Command {
var kubeConfig, wd string
ret := &cobra.Command{
Use: "apply",
Short: "apply local configurations to kubernetes configmaps",
RunE: func(cmd *cobra.Command, args []string) error {
if err := cmd.ParseFlags(args); err != nil {
return errors.Wrap(err, "failed to parse flags")
}
rs := secrets.NewSecretsOrFail(secrets.RequireGithub())
r, err := repo.NewLocal(wd, rs)
if err != nil {
return errors.Wrap(err, "new repo")
}
ctx := cmd.Context()
if err := r.Verify(ctx, &repo.VerifyRequest{}); err != nil {
return errors.Wrap(err, "verify")
}
kube, err := k8s.NewKubernetes(kubeConfig, r)
if err != nil {
return errors.Wrap(err, "failed to build k8s client")
}
if err := kube.Apply(ctx, rs.GetUsername()); err != nil {
return errors.Wrap(err, "apply")
}

return nil
},
}
localKubeParams(ret, &kubeConfig)
ret.Flags().StringVar(&wd, "config-path", ".", "path to configuration repository")
return ret
}

func listCmd() *cobra.Command {
var kubeConfig string
ret := &cobra.Command{
Use: "list",
Short: "list lekko configurations currently in kubernetes",
RunE: func(cmd *cobra.Command, args []string) error {
if err := cmd.ParseFlags(args); err != nil {
return errors.Wrap(err, "failed to parse flags")
}

kube, err := k8s.NewKubernetes(kubeConfig, nil)
if err != nil {
return errors.Wrap(err, "failed to build k8s client")
}
if err := kube.List(cmd.Context()); err != nil {
return errors.Wrap(err, "list")
}
return nil
},
}
localKubeParams(ret, &kubeConfig)
return ret
}

var experimentalCmd = &cobra.Command{
Use: "exp",
Short: "experimental commands",
Expand Down
29 changes: 0 additions & 29 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ require (
github.com/lekkodev/go-sdk v0.4.0
github.com/lekkodev/rules v1.5.3-0.20240206041635-dda452b36d1c
github.com/migueleliasweb/go-github-mock v0.0.16
github.com/mitchellh/go-homedir v1.1.0
github.com/olekukonko/tablewriter v0.0.5
github.com/shurcooL/githubv4 v0.0.0-20231126234147-1cffa1f02456
github.com/spf13/cobra v1.5.0
Expand All @@ -34,7 +33,6 @@ require (
google.golang.org/protobuf v1.33.0
gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.1
k8s.io/apimachinery v0.25.0
)

require (
Expand All @@ -43,45 +41,28 @@ require (
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/OneOfOne/xxhash v1.2.8 // indirect
github.com/ProtonMail/go-crypto v1.0.0 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/alessio/shellescape v1.4.1 // indirect
github.com/antlr4-go/antlr/v4 v4.13.0 // indirect
github.com/cli/safeexec v1.0.0 // indirect
github.com/cloudflare/circl v1.3.7 // indirect
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
github.com/danieljoos/wincred v1.2.0 // indirect
github.com/emicklei/go-restful/v3 v3.8.0 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/fatih/color v1.7.0 // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.19.5 // indirect
github.com/go-openapi/swag v0.19.14 // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/go-github/v50 v50.0.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/gofuzz v1.1.0 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/imdario/mergo v0.3.15 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/mailru/easyjson v0.7.6 // indirect
github.com/mattn/go-colorable v0.1.2 // indirect
github.com/mattn/go-isatty v0.0.8 // indirect
github.com/mattn/go-runewidth v0.0.9 // indirect
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pjbgf/sha1cd v0.3.0 // indirect
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect
github.com/shurcooL/graphql v0.0.0-20230722043721-ed46e5a46466 // indirect
Expand All @@ -91,19 +72,10 @@ require (
golang.org/x/net v0.22.0 // indirect
golang.org/x/term v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect
golang.org/x/tools v0.16.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20201019141844-1ed22bb0c154 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
k8s.io/api v0.25.0 // indirect
k8s.io/klog/v2 v2.70.1 // indirect
k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1 // indirect
k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed // indirect
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/yaml v1.2.0 // indirect
)

require (
Expand All @@ -117,5 +89,4 @@ require (
github.com/stripe/skycfg v0.1.1-0.20220125220303-4571141c5da1
go.starlark.net v0.0.0-20231121155337-90ade8b19d09
golang.org/x/sys v0.18.0 // indirect
k8s.io/client-go v0.25.0
)
Loading

0 comments on commit b5a9abe

Please sign in to comment.