Skip to content

Commit

Permalink
Drop PodSecurityPolicy
Browse files Browse the repository at this point in the history
  • Loading branch information
Ladicle committed Apr 18, 2024
1 parent 20357e6 commit e05a5a5
Show file tree
Hide file tree
Showing 9 changed files with 163 additions and 559 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ GIT_COMMIT := $(shell git rev-parse --short HEAD)

OUTDIR=_output

GOLDFLAGS=-w -X $(PKGROOT)/cmd.version=$(VERSION) -X $(PKGROOT)/cmd.command=$(CMD) -X $(PKGROOT)/cmd.commit=$(GIT_COMMIT)
GOLDFLAGS=-w -X $(PKGROOT)/cmd.version=$(VERSION) -X $(PKGROOT)/cmd.commit=$(GIT_COMMIT)

export GO111MODULE=on

Expand Down
1 change: 0 additions & 1 deletion clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

echo; echo "Clean up..."
kubectl delete sa test-user
kubectl delete psp test-psp
kubectl delete role test-role
kubectl delete rolebinding test
kubectl delete clusterrolebinding test
Expand Down
16 changes: 7 additions & 9 deletions cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package cmd

import (
"context"
"errors"
"fmt"
"os"

Expand All @@ -26,7 +25,6 @@ import (

var (
// set values via build flags
command string
version string
commit string

Expand All @@ -52,7 +50,7 @@ func NewRolesumCmd() *cobra.Command {
cmd := &cobra.Command{
Use: fmt.Sprintf("rolesum [options] <%v>",
aurora.Yellow("SubjectName")),
Version: version,
Version: fmt.Sprintf("%v (commit %v)", version, commit),
DisableFlagsInUseLine: true,
SilenceUsage: true,
SilenceErrors: true,
Expand Down Expand Up @@ -90,16 +88,16 @@ func (o *Option) Validate(cmd *cobra.Command, args []string) error {
}

if len(args) == 0 {
return errors.New(fmt.Sprintf("<%v> is required argument",
aurora.Cyan("SubjectName").Bold()))
return fmt.Errorf("<%v> is required argument",
aurora.Cyan("SubjectName").Bold())
}
o.SubjectName = args[0]

switch o.SubjectKind {
case subject.KindGroup, subject.KindSA, subject.KindUser:
default:
return errors.New(fmt.Sprintf("\"%v\" is unknown SubjectKind",
aurora.Cyan(o.SubjectKind).Bold()))
return fmt.Errorf("\"%v\" is unknown SubjectKind",
aurora.Cyan(o.SubjectKind).Bold())
}
return nil
}
Expand Down Expand Up @@ -145,8 +143,8 @@ func (o *Option) Run() error {
sa, err := client.CoreV1().ServiceAccounts(sub.Namespace).
Get(ctx, sub.Name, metav1.GetOptions{})
if apierrors.IsNotFound(err) {
return errors.New(fmt.Sprintf("ServiceAccount \"%v\" not found",
aurora.Cyan(fmt.Sprintf("%v/%v", sub.Namespace, sub.Name)).Bold()))
return fmt.Errorf("ServiceAccount \"%v\" not found",
aurora.Cyan(fmt.Sprintf("%v/%v", sub.Namespace, sub.Name)).Bold())
} else if err != nil {
return err
}
Expand Down
81 changes: 42 additions & 39 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,80 +1,83 @@
module github.com/Ladicle/kubectl-rolesum

go 1.20
go 1.22.0

toolchain go1.22.2

require (
github.com/logrusorgru/aurora/v3 v3.0.0
github.com/olekukonko/tablewriter v0.0.5
github.com/spf13/cobra v1.6.1
github.com/spf13/cobra v1.7.0
github.com/spf13/pflag v1.0.5
k8s.io/api v0.26.2
k8s.io/apimachinery v0.26.2
k8s.io/cli-runtime v0.26.2
k8s.io/client-go v0.26.2
k8s.io/kubectl v0.26.2
k8s.io/api v0.30.0
k8s.io/apimachinery v0.30.0
k8s.io/cli-runtime v0.30.0
k8s.io/client-go v0.30.0
k8s.io/kubectl v0.30.0
)

require (
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
github.com/MakeNowJust/heredoc v1.0.0 // indirect
github.com/chai2010/gettext-go v1.0.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d // indirect
github.com/go-errors/errors v1.0.1 // 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.20.0 // indirect
github.com/go-openapi/swag v0.19.14 // indirect
github.com/go-errors/errors v1.4.2 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/btree v1.0.1 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/gofuzz v1.1.0 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/google/uuid v1.1.2 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 // indirect
github.com/imdario/mergo v0.3.6 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect
github.com/mailru/easyjson v0.7.6 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-runewidth v0.0.14 // indirect
github.com/mitchellh/go-wordwrap v1.0.0 // indirect
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/moby/spdystream v0.2.0 // indirect
github.com/moby/term v0.0.0-20220808134915-39b0c02b01ae // indirect
github.com/moby/term v0.0.0-20221205130635-1aeaba878587 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/stretchr/objx v0.4.0 // indirect
github.com/xlab/treeprint v1.1.0 // indirect
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/term v0.5.0 // indirect
golang.org/x/text v0.7.0 // indirect
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect
github.com/xlab/treeprint v1.2.0 // indirect
go.starlark.net v0.0.0-20230525235612-a134d8f9ddca // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/oauth2 v0.10.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/term v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.3.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.28.1 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/component-base v0.26.2 // indirect
k8s.io/klog/v2 v2.80.1 // indirect
k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 // indirect
k8s.io/utils v0.0.0-20221107191617-1a15be271d1d // indirect
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
sigs.k8s.io/kustomize/api v0.12.1 // indirect
sigs.k8s.io/kustomize/kyaml v0.13.9 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
k8s.io/component-base v0.30.0 // indirect
k8s.io/klog/v2 v2.120.1 // indirect
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/kustomize/api v0.13.5-0.20230601165947-6ce0bf390ce3 // indirect
sigs.k8s.io/kustomize/kyaml v0.14.3-0.20230601165947-6ce0bf390ce3 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)
Loading

0 comments on commit e05a5a5

Please sign in to comment.