Skip to content

Commit

Permalink
Merge branch 'main' into bump-kind
Browse files Browse the repository at this point in the history
  • Loading branch information
franknstyle authored Jun 14, 2023
2 parents 2a47049 + 4b36969 commit e859b4d
Show file tree
Hide file tree
Showing 174 changed files with 3,531 additions and 166 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ jobs:
- name: golangci-lint run
uses: golangci/golangci-lint-action@v3
with:
version: v1.50
version: v1.52.2
skip-pkg-cache: true
skip-build-cache: true
args: --timeout=2m0s -v
args: --timeout=5m0s -v
bash-lint:
runs-on: ubuntu-latest
steps:
Expand Down
53 changes: 31 additions & 22 deletions cmd/sonobuoy/app/args.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,28 +36,29 @@ import (
)

const (
namespaceFlag = "namespace"
sonobuoyImageFlag = "sonobuoy-image"
imagePullPolicyFlag = "image-pull-policy"
forceImagePullPolicyFlag = "force-image-pull-policy"
pluginFlag = "plugin"
timeoutFlag = "timeout"
waitOutputFlag = "wait-output"
customRegistryFlag = "custom-registry"
kubeconfig = "kubeconfig"
kubecontext = "context"
e2eFocusFlag = "e2e-focus"
e2eSkipFlag = "e2e-skip"
e2eParallelFlag = "e2e-parallel"
e2eRegistryConfigFlag = "e2e-repo-config"
e2eRegistryFlag = "e2e-repo"
pluginImageFlag = "plugin-image"
filenameFlag = "filename"
retrievePathFlag = "retrieve-path"
securityContextModeFlag = "security-context-mode"
aggregatorPermissionsFlag = "aggregator-permissions"
serviceAccountNameFlag = "service-account-name"
existingServiceAccountFlag = "existing-service-account"
namespaceFlag = "namespace"
sonobuoyImageFlag = "sonobuoy-image"
imagePullPolicyFlag = "image-pull-policy"
forceImagePullPolicyFlag = "force-image-pull-policy"
pluginFlag = "plugin"
timeoutFlag = "timeout"
waitOutputFlag = "wait-output"
customRegistryFlag = "custom-registry"
kubeconfig = "kubeconfig"
kubecontext = "context"
e2eFocusFlag = "e2e-focus"
e2eSkipFlag = "e2e-skip"
e2eParallelFlag = "e2e-parallel"
e2eRegistryConfigFlag = "e2e-repo-config"
e2eRegistryFlag = "e2e-repo"
pluginImageFlag = "plugin-image"
filenameFlag = "filename"
retrievePathFlag = "retrieve-path"
securityContextModeFlag = "security-context-mode"
aggregatorPermissionsFlag = "aggregator-permissions"
serviceAccountNameFlag = "service-account-name"
existingServiceAccountFlag = "existing-service-account"
namespacePSAEnforceLevelFlag = "namespace-psa-enforce-level"
)

// AddNamespaceFlag initialises a namespace flag.
Expand Down Expand Up @@ -470,6 +471,14 @@ func AddRetrievePathFlag(str *string, flags *pflag.FlagSet) {
)
}

// AddNamespacePSAEnforceLevelFlag adds a flag for labelling the namespace
func AddNamespacePSAEnforceLevelFlag(str *string, flags *pflag.FlagSet) {
flags.StringVar(
str, namespacePSAEnforceLevelFlag, config.DefaultNamespacePSAEnforceLevel,
"The PSA enforce level for the namespace.",
)
}

// Used if we're just setting the given string as the value; focus and skip need
// regexp validation first.
type envVarModierFlag struct {
Expand Down
3 changes: 3 additions & 0 deletions cmd/sonobuoy/app/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ type deleteFlags struct {
wait int
kubeconfig Kubeconfig
waitOutput WaitOutputMode
dryRun bool
}

func NewCmdDelete() *cobra.Command {
Expand All @@ -49,6 +50,7 @@ func NewCmdDelete() *cobra.Command {
AddNamespaceFlag(&f.namespace, cmd.Flags())
AddRBACModeFlags(&f.rbacMode, cmd.Flags(), DetectRBACMode)
AddDeleteAllFlag(&f.deleteAll, cmd.Flags())
AddDryRunFlag(&f.dryRun, cmd.Flags())
AddDeleteWaitFlag(&f.wait, cmd.Flags())
if features.Enabled(features.WaitOutputProgressByDefault) {
AddWaitOutputFlag(&f.waitOutput, cmd.Flags(), ProgressOutputMode)
Expand Down Expand Up @@ -84,6 +86,7 @@ func deleteSonobuoyRun(f *deleteFlags) func(cmd *cobra.Command, args []string) {
DeleteAll: f.deleteAll,
Wait: time.Duration(f.wait) * time.Minute,
WaitOutput: f.waitOutput.String(),
DryRun: f.dryRun,
}

if err := sbc.Delete(deleteCfg); err != nil {
Expand Down
Binary file added cmd/sonobuoy/app/e2e/testLists/v1.23.17.gz
Binary file not shown.
Binary file added cmd/sonobuoy/app/e2e/testLists/v1.24.11.gz
Binary file not shown.
Binary file added cmd/sonobuoy/app/e2e/testLists/v1.25.7.gz
Binary file not shown.
Binary file added cmd/sonobuoy/app/e2e/testLists/v1.26.2.gz
Binary file not shown.
1 change: 1 addition & 0 deletions cmd/sonobuoy/app/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ func GenFlagSet(cfg *genFlags, rbac RBACMode) *pflag.FlagSet {
AddAggregatorPermissionsFlag(&cfg.sonobuoyConfig.AggregatorPermissions, genset)
AddServiceAccountNameFlag(&cfg.sonobuoyConfig.ServiceAccountName, genset)
AddExistingServiceAccountFlag(&cfg.sonobuoyConfig.ExistingServiceAccount, genset)
AddNamespacePSAEnforceLevelFlag(&cfg.sonobuoyConfig.NamespacePSAEnforceLevel, genset)

AddNamespaceFlag(&cfg.sonobuoyConfig.Namespace, genset)
AddDNSNamespaceFlag(&cfg.dnsNamespace, genset)
Expand Down
54 changes: 48 additions & 6 deletions cmd/sonobuoy/app/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,7 @@ var (
)

func runListImages(flags imagesFlags) {
var client image.Client
if flags.dryRun {
client = image.DryRunClient{}
} else {
client = image.NewDockerClient()
}
client := image.NewDockerClient()
version, err := getClusterVersion(flags.k8sVersion, flags.kubeconfig)
if err != nil {
errlog.LogError(err)
Expand All @@ -72,6 +67,23 @@ func runListImages(flags imagesFlags) {
}
}

func runInspectImages(flags imagesFlags) {
client := image.NewDockerClient()
version, err := getClusterVersion(flags.k8sVersion, flags.kubeconfig)
if err != nil {
errlog.LogError(err)
os.Exit(1)
}

if errs := inspectImages(flags.plugins, flags.pluginEnvs, version, client); err != nil {
for _, err := range errs {
errlog.LogError(err)
}
os.Exit(1)
}
logrus.Info("configured images available")
}

func NewCmdImages() *cobra.Command {
var flags imagesFlags
// Main command
Expand All @@ -95,10 +107,31 @@ func NewCmdImages() *cobra.Command {
cmd.AddCommand(pushCmd())
cmd.AddCommand(downloadCmd())
cmd.AddCommand(deleteCmd())
cmd.AddCommand(inspectCmd())

return cmd
}

func inspectCmd() *cobra.Command {
var flags imagesFlags

inspectCmd := &cobra.Command{
Use: "inspect",
Short: "Inspect images",
Long: "Inspect if image is available in the registry",
Run: func(cmd *cobra.Command, args []string) {
runInspectImages(flags)
},
Args: cobra.ExactArgs(0),
}
AddKubeconfigFlag(&flags.kubeconfig, inspectCmd.Flags())
AddPluginListFlag(&flags.plugins, inspectCmd.Flags())
AddDryRunFlag(&flags.dryRun, inspectCmd.Flags())
AddKubernetesVersionFlag(&flags.k8sVersion, &transformSink, inspectCmd.Flags())

return inspectCmd
}

func listCmd() *cobra.Command {
var flags imagesFlags

Expand Down Expand Up @@ -296,6 +329,15 @@ func listImages(plugins []string, pluginEnvs PluginEnvVars, k8sVersion string, c
return nil
}

func inspectImages(plugins []string, pluginEnvs PluginEnvVars, k8sVersion string, client image.Client) []error {
images, err := collectPluginsImages(plugins, pluginEnvs, k8sVersion, client)
if err != nil {
return []error{err, errors.Errorf("unable to collect images of plugins")}
}
sort.Strings(images)
return client.InspectImages(images)
}

func pullImages(plugins []string, pluginEnvs PluginEnvVars, e2eRegistry, e2eRegistryConfig, k8sVersion string, client image.Client) []error {
images, err := collectPluginsImages(plugins, pluginEnvs, k8sVersion, client)
if err != nil {
Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ require (
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.14.0
golang.org/x/sync v0.1.0
golang.org/x/term v0.3.0
golang.org/x/text v0.5.0
golang.org/x/term v0.5.0
golang.org/x/text v0.7.0
gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.1
k8s.io/api v0.26.0
Expand Down Expand Up @@ -66,9 +66,9 @@ require (
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/subosito/gotenv v1.4.1 // indirect
golang.org/x/net v0.4.0 // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/oauth2 v0.3.0 // indirect
golang.org/x/sys v0.3.0 // indirect
golang.org/x/sys v0.5.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
Expand Down
16 changes: 8 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,8 @@ golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.4.0 h1:Q5QPcMlvfxFTAPV0+07Xz/MpK9NTXu2VDUuy0FeMfaU=
golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE=
golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g=
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
Expand Down Expand Up @@ -435,11 +435,11 @@ golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ=
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.3.0 h1:qoo4akIqOcDME5bhc/NgxUdovd6BSS2uMsVjB56q1xI=
golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA=
golang.org/x/term v0.5.0 h1:n2a8QNdAb0sZNpU9R1ALUXBbY+w51fCQDN+7EdxNBsY=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand All @@ -448,8 +448,8 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.5.0 h1:OLmvp0KP+FVG99Ct/qFiL/Fhk4zp4QQnZ7b2U+5piUM=
golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
Expand Down
2 changes: 1 addition & 1 deletion pkg/buildinfo/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ package buildinfo

// Version is the current version of Sonobuoy, set by the go linker's -X flag at build time.
// Ensure that this is bumped manually as well so that Sonobuoy, as a library, also has the right version.
var Version = "v0.56.15"
var Version = "v0.56.16"

// GitSHA is the actual commit that is being built, set by the go linker's -X flag at build time.
var GitSHA string
Expand Down
Loading

0 comments on commit e859b4d

Please sign in to comment.