From 349ff000ea63b964f945d954f6e89117410ce501 Mon Sep 17 00:00:00 2001 From: Antonio Gamez Diaz Date: Fri, 26 Jan 2024 18:45:02 +0100 Subject: [PATCH] Run auto-formatter tool Signed-off-by: Antonio Gamez Diaz --- .../server/postgresql_utils_test.go | 2 +- cmd/asset-syncer/server/utils.go | 2 +- cmd/asset-syncer/server/utils_test.go | 28 ++++---- .../core/plugins/v1alpha1/plugins.go | 6 +- .../v1alpha1/chart_integration_test.go | 2 +- .../fluxv2/packages/v1alpha1/chart_test.go | 2 +- .../fluxv2/packages/v1alpha1/repo_test.go | 2 +- .../fluxv2/packages/v1alpha1/server_test.go | 2 +- .../packages/v1alpha1/server.go | 8 +-- .../packages/v1alpha1/server_test.go | 72 +++++++++---------- .../packages/v1alpha1/server_utils_test.go | 8 +-- pkg/http-client/httpclient_test.go | 2 +- .../latest/howto/OIDC/OAuth2OIDC-keycloak.md | 41 +++++------ 13 files changed, 87 insertions(+), 90 deletions(-) diff --git a/cmd/asset-syncer/server/postgresql_utils_test.go b/cmd/asset-syncer/server/postgresql_utils_test.go index 56e61b4872b..83252d0eb1f 100644 --- a/cmd/asset-syncer/server/postgresql_utils_test.go +++ b/cmd/asset-syncer/server/postgresql_utils_test.go @@ -172,7 +172,7 @@ func Test_PGinsertFiles(t *testing.T) { namespace = "my-namespace" repoName = "my-repo" chartID string = repoName + "/wordpress" - filesID string = chartID + "-2.1.3" + filesID = chartID + "-2.1.3" ) files := models.ChartFiles{ID: filesID, Readme: "foo", DefaultValues: "bar", Repo: &models.AppRepository{Namespace: namespace, Name: repoName}} mock.ExpectQuery(`INSERT INTO files \(chart_id, repo_name, repo_namespace, chart_files_ID, info\)*`). diff --git a/cmd/asset-syncer/server/utils.go b/cmd/asset-syncer/server/utils.go index 3d6b8147f16..5d724782060 100644 --- a/cmd/asset-syncer/server/utils.go +++ b/cmd/asset-syncer/server/utils.go @@ -21,7 +21,7 @@ import ( "sync" "time" - semver "github.com/Masterminds/semver/v3" + "github.com/Masterminds/semver/v3" "github.com/containerd/containerd/remotes/docker" "github.com/disintegration/imaging" "github.com/itchyny/gojq" diff --git a/cmd/asset-syncer/server/utils_test.go b/cmd/asset-syncer/server/utils_test.go index 42e5abcd76d..d55599b4319 100644 --- a/cmd/asset-syncer/server/utils_test.go +++ b/cmd/asset-syncer/server/utils_test.go @@ -222,8 +222,8 @@ func Test_parseFilters(t *testing.T) { func Test_fetchRepoIndex(t *testing.T) { fakeServer := newFakeServer(t, map[string]*http.Response{ - "/index.yaml": &http.Response{StatusCode: 200}, - "/subpath/index.yaml": &http.Response{StatusCode: 200}, + "/index.yaml": {StatusCode: 200}, + "/subpath/index.yaml": {StatusCode: 200}, }) defer fakeServer.Close() addr := fakeServer.URL @@ -397,19 +397,19 @@ func Test_fetchAndImportIcon(t *testing.T) { svgHeader.Set("Content-Type", "image/svg") server := newFakeServer(t, map[string]*http.Response{ - "/valid_icon.png": &http.Response{ + "/valid_icon.png": { StatusCode: 200, Body: io.NopCloser(bytes.NewReader(iconBytes())), }, - "/valid_svg_icon.svg": &http.Response{ + "/valid_svg_icon.svg": { StatusCode: 200, Body: io.NopCloser(bytes.NewReader([]byte(""))), Header: svgHeader, }, - "/download_fail.png": &http.Response{ + "/download_fail.png": { StatusCode: 500, }, - "/invalid_icon.png": &http.Response{ + "/invalid_icon.png": { StatusCode: 200, Body: io.NopCloser(bytes.NewReader([]byte("not a valid png"))), }, @@ -707,7 +707,7 @@ func Test_fetchAndImportFiles(t *testing.T) { func Test_ociAPICli(t *testing.T) { t.Run("TagList - failed request", func(t *testing.T) { server := newFakeServer(t, map[string]*http.Response{ - "/v2/apache/tags/list": &http.Response{ + "/v2/apache/tags/list": { StatusCode: 500, }, }) @@ -736,7 +736,7 @@ func Test_ociAPICli(t *testing.T) { t.Run("TagList - successful request", func(t *testing.T) { server := newFakeServer(t, map[string]*http.Response{ - "/v2/apache/tags/list": &http.Response{ + "/v2/apache/tags/list": { StatusCode: 200, Body: io.NopCloser(strings.NewReader(`{"name":"apache","tags":["7.5.1","8.1.1"]}`)), }, @@ -760,7 +760,7 @@ func Test_ociAPICli(t *testing.T) { t.Run("IsHelmChart - failed request", func(t *testing.T) { server := newFakeServer(t, map[string]*http.Response{ - "/v2/apache-bad/manifests/7.5.1": &http.Response{ + "/v2/apache-bad/manifests/7.5.1": { StatusCode: 500, }, }) @@ -854,7 +854,7 @@ func Test_ociAPICli(t *testing.T) { t.Run("CatalogAvailable - successful request", func(t *testing.T) { server := newFakeServer(t, map[string]*http.Response{ - "/v2/test/project/charts-index/manifests/latest": &http.Response{ + "/v2/test/project/charts-index/manifests/latest": { StatusCode: 200, Body: io.NopCloser(strings.NewReader(chartsIndexManifestJSON)), }, @@ -882,7 +882,7 @@ func Test_ociAPICli(t *testing.T) { t.Run("CatalogAvailable - returns false for incorrect media type", func(t *testing.T) { server := newFakeServer(t, map[string]*http.Response{ - "/v2/test/project/charts-index/manifests/latest": &http.Response{ + "/v2/test/project/charts-index/manifests/latest": { StatusCode: 200, Body: io.NopCloser(strings.NewReader(`{"config": {"mediaType": "something-else"}}`)), }, @@ -909,7 +909,7 @@ func Test_ociAPICli(t *testing.T) { t.Run("CatalogAvailable - returns false for a 404", func(t *testing.T) { server := newFakeServer(t, map[string]*http.Response{ - "/v2/test/project/charts-index/manifests/latest": &http.Response{ + "/v2/test/project/charts-index/manifests/latest": { StatusCode: 200, Body: io.NopCloser(strings.NewReader(`{"config": {"mediaType": "something-else"}}`)), }, @@ -1029,11 +1029,11 @@ func Test_ociAPICli(t *testing.T) { t.Run("Catalog - successful request", func(t *testing.T) { server := newFakeServer(t, map[string]*http.Response{ - "/v2/test/project/charts-index/manifests/latest": &http.Response{ + "/v2/test/project/charts-index/manifests/latest": { StatusCode: 200, Body: io.NopCloser(strings.NewReader(chartsIndexManifestJSON)), }, - "/v2/test/project/charts-index/blobs/sha256:f9f7df0ae3f50aaf9ff390034cec4286d2aa43f061ce4bc7aa3c9ac862800aba": &http.Response{ + "/v2/test/project/charts-index/blobs/sha256:f9f7df0ae3f50aaf9ff390034cec4286d2aa43f061ce4bc7aa3c9ac862800aba": { StatusCode: 200, Body: io.NopCloser(strings.NewReader(chartsIndexMultipleJSON)), }, diff --git a/cmd/kubeapps-apis/core/plugins/v1alpha1/plugins.go b/cmd/kubeapps-apis/core/plugins/v1alpha1/plugins.go index 36ff7fac308..18809a9f9ee 100644 --- a/cmd/kubeapps-apis/core/plugins/v1alpha1/plugins.go +++ b/cmd/kubeapps-apis/core/plugins/v1alpha1/plugins.go @@ -172,7 +172,7 @@ func (s *PluginsServer) registerGRPC(p *plugin.Plugin, pluginDetail *plugins.Plu grpcFn, ok := grpcRegFn.(grpcRegisterFunctionType) if !ok { - var stubFn grpcRegisterFunctionType = func(GRPCPluginRegistrationOptions) (interface{}, error) { + var stubFn = func(GRPCPluginRegistrationOptions) (interface{}, error) { return nil, nil } return nil, fmt.Errorf("unable to use %q in plugin %v due to mismatched signature.\nwant: %T\ngot: %T", grpcRegisterFunction, pluginDetail, stubFn, grpcRegFn) @@ -225,7 +225,7 @@ func getPluginDetail(p *plugin.Plugin, pluginPath string) (*plugins.Plugin, erro fn, ok := pluginDetailFn.(pluginDetailFunctionType) if !ok { - var stubFn pluginDetailFunctionType = func() *plugins.Plugin { return &plugins.Plugin{} } + var stubFn = func() *plugins.Plugin { return &plugins.Plugin{} } return nil, fmt.Errorf("unable to use %q in plugin %q due to a mismatched signature. \nwant: %T\ngot: %T", pluginDetailFunction, pluginPath, stubFn, pluginDetailFn) } @@ -243,7 +243,7 @@ func registerHTTP(p *plugin.Plugin, pluginDetail *plugins.Plugin, gwArgs core.Ga if !ok { // Create a stubFn only so we can ensure the correct type is shown in case // of an error. - var stubFn gatewayRegisterFunctionType = func(context.Context, *runtime.ServeMux, string, []grpc.DialOption) error { return nil } + var stubFn = func(context.Context, *runtime.ServeMux, string, []grpc.DialOption) error { return nil } return fmt.Errorf("unable to use %q in plugin %v due to mismatched signature.\nwant: %T\ngot: %T", gatewayRegisterFunction, pluginDetail, stubFn, gwRegFn) } return gwfn(gwArgs.Ctx, gwArgs.Mux, gwArgs.Addr, gwArgs.DialOptions) diff --git a/cmd/kubeapps-apis/plugins/fluxv2/packages/v1alpha1/chart_integration_test.go b/cmd/kubeapps-apis/plugins/fluxv2/packages/v1alpha1/chart_integration_test.go index 8042756fc24..0cea7c06925 100644 --- a/cmd/kubeapps-apis/plugins/fluxv2/packages/v1alpha1/chart_integration_test.go +++ b/cmd/kubeapps-apis/plugins/fluxv2/packages/v1alpha1/chart_integration_test.go @@ -18,7 +18,7 @@ import ( fluxplugin "github.com/vmware-tanzu/kubeapps/cmd/kubeapps-apis/gen/plugins/fluxv2/packages/v1alpha1" "github.com/vmware-tanzu/kubeapps/cmd/kubeapps-apis/plugins/fluxv2/packages/v1alpha1/common" "golang.org/x/sync/semaphore" - grpc "google.golang.org/grpc" + "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" apiv1 "k8s.io/api/core/v1" diff --git a/cmd/kubeapps-apis/plugins/fluxv2/packages/v1alpha1/chart_test.go b/cmd/kubeapps-apis/plugins/fluxv2/packages/v1alpha1/chart_test.go index 938ec268ee1..a164241ae9f 100644 --- a/cmd/kubeapps-apis/plugins/fluxv2/packages/v1alpha1/chart_test.go +++ b/cmd/kubeapps-apis/plugins/fluxv2/packages/v1alpha1/chart_test.go @@ -17,7 +17,7 @@ import ( fluxmeta "github.com/fluxcd/pkg/apis/meta" sourcev1 "github.com/fluxcd/source-controller/api/v1" sourcev1beta2 "github.com/fluxcd/source-controller/api/v1beta2" - redismock "github.com/go-redis/redismock/v8" + "github.com/go-redis/redismock/v8" corev1 "github.com/vmware-tanzu/kubeapps/cmd/kubeapps-apis/gen/core/packages/v1alpha1" "github.com/vmware-tanzu/kubeapps/cmd/kubeapps-apis/plugins/fluxv2/packages/v1alpha1/cache" "github.com/vmware-tanzu/kubeapps/cmd/kubeapps-apis/plugins/fluxv2/packages/v1alpha1/common" diff --git a/cmd/kubeapps-apis/plugins/fluxv2/packages/v1alpha1/repo_test.go b/cmd/kubeapps-apis/plugins/fluxv2/packages/v1alpha1/repo_test.go index 1ea51db8793..00d78266d6e 100644 --- a/cmd/kubeapps-apis/plugins/fluxv2/packages/v1alpha1/repo_test.go +++ b/cmd/kubeapps-apis/plugins/fluxv2/packages/v1alpha1/repo_test.go @@ -20,7 +20,7 @@ import ( fluxmeta "github.com/fluxcd/pkg/apis/meta" sourcev1 "github.com/fluxcd/source-controller/api/v1" sourcev1beta2 "github.com/fluxcd/source-controller/api/v1beta2" - redismock "github.com/go-redis/redismock/v8" + "github.com/go-redis/redismock/v8" "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" corev1 "github.com/vmware-tanzu/kubeapps/cmd/kubeapps-apis/gen/core/packages/v1alpha1" diff --git a/cmd/kubeapps-apis/plugins/fluxv2/packages/v1alpha1/server_test.go b/cmd/kubeapps-apis/plugins/fluxv2/packages/v1alpha1/server_test.go index 73dc5e81cbb..5b91702b186 100644 --- a/cmd/kubeapps-apis/plugins/fluxv2/packages/v1alpha1/server_test.go +++ b/cmd/kubeapps-apis/plugins/fluxv2/packages/v1alpha1/server_test.go @@ -17,7 +17,7 @@ import ( fluxmeta "github.com/fluxcd/pkg/apis/meta" sourcev1beta2 "github.com/fluxcd/source-controller/api/v1beta2" "github.com/go-redis/redis/v8" - redismock "github.com/go-redis/redismock/v8" + "github.com/go-redis/redismock/v8" corev1 "github.com/vmware-tanzu/kubeapps/cmd/kubeapps-apis/gen/core/packages/v1alpha1" "github.com/vmware-tanzu/kubeapps/cmd/kubeapps-apis/plugins/fluxv2/packages/v1alpha1/cache" "github.com/vmware-tanzu/kubeapps/cmd/kubeapps-apis/plugins/fluxv2/packages/v1alpha1/common" diff --git a/cmd/kubeapps-apis/plugins/kapp_controller/packages/v1alpha1/server.go b/cmd/kubeapps-apis/plugins/kapp_controller/packages/v1alpha1/server.go index 133dc257fdf..22e72779fa1 100644 --- a/cmd/kubeapps-apis/plugins/kapp_controller/packages/v1alpha1/server.go +++ b/cmd/kubeapps-apis/plugins/kapp_controller/packages/v1alpha1/server.go @@ -28,10 +28,10 @@ import ( type kappClientsGetter func(headers http.Header, cluster, namespace string) (ctlapp.Apps, ctlres.IdentifiedResources, *kappcmdapp.FailingAPIServicesPolicy, ctlres.ResourceFilter, error) const ( - fallbackGlobalPackagingNamespace = "kapp-controller-packaging-global" - fallbackDefaultUpgradePolicy pkgutils.UpgradePolicy = pkgutils.UpgradePolicyNone - fallbackDefaultAllowDowngrades = false - fallbackTimeoutSeconds = 300 + fallbackGlobalPackagingNamespace = "kapp-controller-packaging-global" + fallbackDefaultUpgradePolicy = pkgutils.UpgradePolicyNone + fallbackDefaultAllowDowngrades = false + fallbackTimeoutSeconds = 300 ) func fallbackDefaultPrereleasesVersionSelection() []string { diff --git a/cmd/kubeapps-apis/plugins/kapp_controller/packages/v1alpha1/server_test.go b/cmd/kubeapps-apis/plugins/kapp_controller/packages/v1alpha1/server_test.go index 61c9e79978a..d8ac2feea86 100644 --- a/cmd/kubeapps-apis/plugins/kapp_controller/packages/v1alpha1/server_test.go +++ b/cmd/kubeapps-apis/plugins/kapp_controller/packages/v1alpha1/server_test.go @@ -1774,7 +1774,7 @@ func TestGetInstalledPackageSummaries(t *testing.T) { }, Paused: false, Canceled: false, - SyncPeriod: &metav1.Duration{Duration: (time.Second * 30)}, + SyncPeriod: &metav1.Duration{Duration: time.Second * 30}, NoopDelete: false, }, Status: packagingv1alpha1.PackageInstallStatus{ @@ -1908,7 +1908,7 @@ func TestGetInstalledPackageSummaries(t *testing.T) { }, Paused: false, Canceled: false, - SyncPeriod: &metav1.Duration{Duration: (time.Second * 30)}, + SyncPeriod: &metav1.Duration{Duration: time.Second * 30}, NoopDelete: false, }, Status: packagingv1alpha1.PackageInstallStatus{ @@ -2036,7 +2036,7 @@ func TestGetInstalledPackageSummaries(t *testing.T) { }, Paused: false, Canceled: false, - SyncPeriod: &metav1.Duration{Duration: (time.Second * 30)}, + SyncPeriod: &metav1.Duration{Duration: time.Second * 30}, NoopDelete: false, }, Status: packagingv1alpha1.PackageInstallStatus{ @@ -2140,7 +2140,7 @@ func TestGetInstalledPackageSummaries(t *testing.T) { }, Paused: false, Canceled: false, - SyncPeriod: &metav1.Duration{Duration: (time.Second * 30)}, + SyncPeriod: &metav1.Duration{Duration: time.Second * 30}, NoopDelete: false, }, Status: packagingv1alpha1.PackageInstallStatus{ @@ -2272,7 +2272,7 @@ func TestGetInstalledPackageSummaries(t *testing.T) { }, Paused: false, Canceled: false, - SyncPeriod: &metav1.Duration{Duration: (time.Second * 30)}, + SyncPeriod: &metav1.Duration{Duration: time.Second * 30}, NoopDelete: false, }, Status: packagingv1alpha1.PackageInstallStatus{ @@ -2316,7 +2316,7 @@ func TestGetInstalledPackageSummaries(t *testing.T) { }, Paused: false, Canceled: false, - SyncPeriod: &metav1.Duration{Duration: (time.Second * 30)}, + SyncPeriod: &metav1.Duration{Duration: time.Second * 30}, NoopDelete: false, }, Status: packagingv1alpha1.PackageInstallStatus{ @@ -2464,7 +2464,7 @@ func TestGetInstalledPackageSummaries(t *testing.T) { }, Paused: false, Canceled: false, - SyncPeriod: &metav1.Duration{Duration: (time.Second * 30)}, + SyncPeriod: &metav1.Duration{Duration: time.Second * 30}, NoopDelete: false, }, }, @@ -2606,7 +2606,7 @@ func TestGetInstalledPackageSummaries(t *testing.T) { }, Paused: false, Canceled: false, - SyncPeriod: &metav1.Duration{Duration: (time.Second * 30)}, + SyncPeriod: &metav1.Duration{Duration: time.Second * 30}, NoopDelete: false, }, Status: packagingv1alpha1.PackageInstallStatus{ @@ -2741,7 +2741,7 @@ func TestGetInstalledPackageSummaries(t *testing.T) { }, Paused: false, Canceled: false, - SyncPeriod: &metav1.Duration{Duration: (time.Second * 30)}, + SyncPeriod: &metav1.Duration{Duration: time.Second * 30}, NoopDelete: false, }, Status: packagingv1alpha1.PackageInstallStatus{ @@ -2945,7 +2945,7 @@ func TestGetInstalledPackageDetail(t *testing.T) { }, Paused: false, Canceled: false, - SyncPeriod: &metav1.Duration{Duration: (time.Second * 30)}, + SyncPeriod: &metav1.Duration{Duration: time.Second * 30}, NoopDelete: false, }, Status: packagingv1alpha1.PackageInstallStatus{ @@ -2974,7 +2974,7 @@ func TestGetInstalledPackageDetail(t *testing.T) { Name: "my-installation", }, Spec: kappctrlv1alpha1.AppSpec{ - SyncPeriod: &metav1.Duration{Duration: (time.Second * 30)}, + SyncPeriod: &metav1.Duration{Duration: time.Second * 30}, }, Status: kappctrlv1alpha1.AppStatus{ Deploy: &kappctrlv1alpha1.AppStatusDeploy{ @@ -3180,7 +3180,7 @@ fetchStderr }, Paused: false, Canceled: false, - SyncPeriod: &metav1.Duration{Duration: (time.Second * 30)}, + SyncPeriod: &metav1.Duration{Duration: time.Second * 30}, NoopDelete: false, }, Status: packagingv1alpha1.PackageInstallStatus{ @@ -3209,7 +3209,7 @@ fetchStderr Name: "my-installation", }, Spec: kappctrlv1alpha1.AppSpec{ - SyncPeriod: &metav1.Duration{Duration: (time.Second * 30)}, + SyncPeriod: &metav1.Duration{Duration: time.Second * 30}, }, Status: kappctrlv1alpha1.AppStatus{ Deploy: &kappctrlv1alpha1.AppStatusDeploy{ @@ -3377,7 +3377,7 @@ fetchStderr }, Paused: false, Canceled: false, - SyncPeriod: &metav1.Duration{Duration: (time.Second * 30)}, + SyncPeriod: &metav1.Duration{Duration: time.Second * 30}, NoopDelete: false, }, Status: packagingv1alpha1.PackageInstallStatus{ @@ -3406,7 +3406,7 @@ fetchStderr Name: "my-installation", }, Spec: kappctrlv1alpha1.AppSpec{ - SyncPeriod: &metav1.Duration{Duration: (time.Second * 30)}, + SyncPeriod: &metav1.Duration{Duration: time.Second * 30}, }, Status: kappctrlv1alpha1.AppStatus{ Deploy: &kappctrlv1alpha1.AppStatusDeploy{ @@ -3621,7 +3621,7 @@ func TestCreateInstalledPackage(t *testing.T) { Name: "my-installation", }, Spec: kappctrlv1alpha1.AppSpec{ - SyncPeriod: &metav1.Duration{Duration: (time.Second * 30)}, + SyncPeriod: &metav1.Duration{Duration: time.Second * 30}, }, Status: kappctrlv1alpha1.AppStatus{ Deploy: &kappctrlv1alpha1.AppStatusDeploy{ @@ -3861,7 +3861,7 @@ func TestCreateInstalledPackage(t *testing.T) { Name: "my-installation", }, Spec: kappctrlv1alpha1.AppSpec{ - SyncPeriod: &metav1.Duration{Duration: (time.Second * 30)}, + SyncPeriod: &metav1.Duration{Duration: time.Second * 30}, }, Status: kappctrlv1alpha1.AppStatus{ Deploy: &kappctrlv1alpha1.AppStatusDeploy{ @@ -4016,7 +4016,7 @@ func TestCreateInstalledPackage(t *testing.T) { Name: "my-installation", }, Spec: kappctrlv1alpha1.AppSpec{ - SyncPeriod: &metav1.Duration{Duration: (time.Second * 30)}, + SyncPeriod: &metav1.Duration{Duration: time.Second * 30}, }, Status: kappctrlv1alpha1.AppStatus{ Deploy: &kappctrlv1alpha1.AppStatusDeploy{ @@ -4081,7 +4081,7 @@ func TestCreateInstalledPackage(t *testing.T) { }, Paused: true, Canceled: false, - SyncPeriod: &metav1.Duration{Duration: (time.Second * 99)}, + SyncPeriod: &metav1.Duration{Duration: time.Second * 99}, NoopDelete: false, }, Status: packagingv1alpha1.PackageInstallStatus{ @@ -4173,7 +4173,7 @@ func TestCreateInstalledPackage(t *testing.T) { Name: "my-installation", }, Spec: kappctrlv1alpha1.AppSpec{ - SyncPeriod: &metav1.Duration{Duration: (time.Second * 30)}, + SyncPeriod: &metav1.Duration{Duration: time.Second * 30}, }, Status: kappctrlv1alpha1.AppStatus{ Deploy: &kappctrlv1alpha1.AppStatusDeploy{ @@ -4331,7 +4331,7 @@ func TestCreateInstalledPackage(t *testing.T) { Name: "my-installation", }, Spec: kappctrlv1alpha1.AppSpec{ - SyncPeriod: &metav1.Duration{Duration: (time.Second * 30)}, + SyncPeriod: &metav1.Duration{Duration: time.Second * 30}, }, Status: kappctrlv1alpha1.AppStatus{ Deploy: &kappctrlv1alpha1.AppStatusDeploy{ @@ -4443,7 +4443,7 @@ func TestCreateInstalledPackage(t *testing.T) { Name: "my-installation", }, Spec: kappctrlv1alpha1.AppSpec{ - SyncPeriod: &metav1.Duration{Duration: (time.Second * 30)}, + SyncPeriod: &metav1.Duration{Duration: time.Second * 30}, }, Status: kappctrlv1alpha1.AppStatus{ Deploy: &kappctrlv1alpha1.AppStatusDeploy{ @@ -4601,7 +4601,7 @@ func TestCreateInstalledPackage(t *testing.T) { Name: "my-installation", }, Spec: kappctrlv1alpha1.AppSpec{ - SyncPeriod: &metav1.Duration{Duration: (time.Second * 30)}, + SyncPeriod: &metav1.Duration{Duration: time.Second * 30}, }, Status: kappctrlv1alpha1.AppStatus{ Deploy: &kappctrlv1alpha1.AppStatusDeploy{ @@ -4755,7 +4755,7 @@ func TestCreateInstalledPackage(t *testing.T) { Name: "my-installation", }, Spec: kappctrlv1alpha1.AppSpec{ - SyncPeriod: &metav1.Duration{Duration: (time.Second * 30)}, + SyncPeriod: &metav1.Duration{Duration: time.Second * 30}, }, Status: kappctrlv1alpha1.AppStatus{ Deploy: &kappctrlv1alpha1.AppStatusDeploy{ @@ -4912,7 +4912,7 @@ func TestCreateInstalledPackage(t *testing.T) { Name: "my-installation", }, Spec: kappctrlv1alpha1.AppSpec{ - SyncPeriod: &metav1.Duration{Duration: (time.Second * 30)}, + SyncPeriod: &metav1.Duration{Duration: time.Second * 30}, }, Status: kappctrlv1alpha1.AppStatus{ Deploy: &kappctrlv1alpha1.AppStatusDeploy{ @@ -5069,7 +5069,7 @@ func TestCreateInstalledPackage(t *testing.T) { Name: "my-installation", }, Spec: kappctrlv1alpha1.AppSpec{ - SyncPeriod: &metav1.Duration{Duration: (time.Second * 30)}, + SyncPeriod: &metav1.Duration{Duration: time.Second * 30}, }, Status: kappctrlv1alpha1.AppStatus{ Deploy: &kappctrlv1alpha1.AppStatusDeploy{ @@ -5226,7 +5226,7 @@ func TestCreateInstalledPackage(t *testing.T) { Name: "my-installation", }, Spec: kappctrlv1alpha1.AppSpec{ - SyncPeriod: &metav1.Duration{Duration: (time.Second * 30)}, + SyncPeriod: &metav1.Duration{Duration: time.Second * 30}, }, Status: kappctrlv1alpha1.AppStatus{ Deploy: &kappctrlv1alpha1.AppStatusDeploy{ @@ -5383,7 +5383,7 @@ func TestCreateInstalledPackage(t *testing.T) { Name: "my-installation", }, Spec: kappctrlv1alpha1.AppSpec{ - SyncPeriod: &metav1.Duration{Duration: (time.Second * 30)}, + SyncPeriod: &metav1.Duration{Duration: time.Second * 30}, }, Status: kappctrlv1alpha1.AppStatus{ Deploy: &kappctrlv1alpha1.AppStatusDeploy{ @@ -5616,7 +5616,7 @@ func TestUpdateInstalledPackage(t *testing.T) { }, Paused: false, Canceled: false, - SyncPeriod: &metav1.Duration{Duration: (time.Second * 30)}, + SyncPeriod: &metav1.Duration{Duration: time.Second * 30}, NoopDelete: false, }, Status: packagingv1alpha1.PackageInstallStatus{ @@ -5680,7 +5680,7 @@ func TestUpdateInstalledPackage(t *testing.T) { }, Paused: false, Canceled: false, - SyncPeriod: &metav1.Duration{Duration: (time.Second * 30)}, + SyncPeriod: &metav1.Duration{Duration: time.Second * 30}, NoopDelete: false, }, Status: packagingv1alpha1.PackageInstallStatus{ @@ -5790,7 +5790,7 @@ func TestUpdateInstalledPackage(t *testing.T) { }, Paused: false, Canceled: false, - SyncPeriod: &metav1.Duration{Duration: (time.Second * 30)}, + SyncPeriod: &metav1.Duration{Duration: time.Second * 30}, NoopDelete: false, }, Status: packagingv1alpha1.PackageInstallStatus{ @@ -5920,7 +5920,7 @@ func TestDeleteInstalledPackage(t *testing.T) { }, Paused: false, Canceled: false, - SyncPeriod: &metav1.Duration{Duration: (time.Second * 30)}, + SyncPeriod: &metav1.Duration{Duration: time.Second * 30}, NoopDelete: false, }, Status: packagingv1alpha1.PackageInstallStatus{ @@ -5989,7 +5989,7 @@ func TestDeleteInstalledPackage(t *testing.T) { }, Paused: false, Canceled: false, - SyncPeriod: &metav1.Duration{Duration: (time.Second * 30)}, + SyncPeriod: &metav1.Duration{Duration: time.Second * 30}, NoopDelete: false, }, Status: packagingv1alpha1.PackageInstallStatus{ @@ -6110,7 +6110,7 @@ func TestGetInstalledPackageResourceRefs(t *testing.T) { }, Paused: false, Canceled: false, - SyncPeriod: &metav1.Duration{Duration: (time.Second * 30)}, + SyncPeriod: &metav1.Duration{Duration: time.Second * 30}, NoopDelete: false, }, Status: packagingv1alpha1.PackageInstallStatus{ @@ -6209,7 +6209,7 @@ func TestGetInstalledPackageResourceRefs(t *testing.T) { }, Paused: false, Canceled: false, - SyncPeriod: &metav1.Duration{Duration: (time.Second * 30)}, + SyncPeriod: &metav1.Duration{Duration: time.Second * 30}, NoopDelete: false, }, Status: packagingv1alpha1.PackageInstallStatus{ @@ -6308,7 +6308,7 @@ func TestGetInstalledPackageResourceRefs(t *testing.T) { }, Paused: false, Canceled: false, - SyncPeriod: &metav1.Duration{Duration: (time.Second * 30)}, + SyncPeriod: &metav1.Duration{Duration: time.Second * 30}, NoopDelete: false, }, Status: packagingv1alpha1.PackageInstallStatus{ diff --git a/cmd/kubeapps-apis/plugins/kapp_controller/packages/v1alpha1/server_utils_test.go b/cmd/kubeapps-apis/plugins/kapp_controller/packages/v1alpha1/server_utils_test.go index 07b0068438c..5683449ff50 100644 --- a/cmd/kubeapps-apis/plugins/kapp_controller/packages/v1alpha1/server_utils_test.go +++ b/cmd/kubeapps-apis/plugins/kapp_controller/packages/v1alpha1/server_utils_test.go @@ -288,7 +288,7 @@ func TestBuildPostInstallationNotes(t *testing.T) { Name: "my-installation", }, Spec: kappctrlv1alpha1.AppSpec{ - SyncPeriod: &metav1.Duration{Duration: (time.Second * 30)}, + SyncPeriod: &metav1.Duration{Duration: time.Second * 30}, }, Status: kappctrlv1alpha1.AppStatus{ Deploy: &kappctrlv1alpha1.AppStatusDeploy{ @@ -341,7 +341,7 @@ fetchStderr Name: "my-installation", }, Spec: kappctrlv1alpha1.AppSpec{ - SyncPeriod: &metav1.Duration{Duration: (time.Second * 30)}, + SyncPeriod: &metav1.Duration{Duration: time.Second * 30}, }, Status: kappctrlv1alpha1.AppStatus{ Deploy: &kappctrlv1alpha1.AppStatusDeploy{ @@ -377,7 +377,7 @@ fetchStdout Name: "my-installation", }, Spec: kappctrlv1alpha1.AppSpec{ - SyncPeriod: &metav1.Duration{Duration: (time.Second * 30)}, + SyncPeriod: &metav1.Duration{Duration: time.Second * 30}, }, Status: kappctrlv1alpha1.AppStatus{ Deploy: &kappctrlv1alpha1.AppStatusDeploy{ @@ -415,7 +415,7 @@ fetchStderr Name: "my-installation", }, Spec: kappctrlv1alpha1.AppSpec{ - SyncPeriod: &metav1.Duration{Duration: (time.Second * 30)}, + SyncPeriod: &metav1.Duration{Duration: time.Second * 30}, }, Status: kappctrlv1alpha1.AppStatus{ Fetch: &kappctrlv1alpha1.AppStatusFetch{ diff --git a/pkg/http-client/httpclient_test.go b/pkg/http-client/httpclient_test.go index 9201214fad8..0a4f8a07007 100644 --- a/pkg/http-client/httpclient_test.go +++ b/pkg/http-client/httpclient_test.go @@ -6,7 +6,7 @@ package httpclient import ( "crypto/tls" "crypto/x509" - errors "errors" + "errors" "fmt" "io" "net/http" diff --git a/site/content/docs/latest/howto/OIDC/OAuth2OIDC-keycloak.md b/site/content/docs/latest/howto/OIDC/OAuth2OIDC-keycloak.md index e1e7406cd7b..848c486dc45 100644 --- a/site/content/docs/latest/howto/OIDC/OAuth2OIDC-keycloak.md +++ b/site/content/docs/latest/howto/OIDC/OAuth2OIDC-keycloak.md @@ -22,28 +22,25 @@ The certificate must be a SAN certificate and should be capable of using wildcar To create the certificate, it is useful to create a openssl config file, something like the following (_certificate.config_): ```properties -[req] -default_bits = 2048 -distinguished_name = req_dn -x509_extensions = req_ext - -[req_dn] -countryName = Country Name (2 letter code) -countryName_default = US -stateOrProvinceName = State or Province Name (full name) -stateOrProvinceName_default = CA -localityName = Locality Name (eg, city) -localityName_default = Campbell -organizationName = Organization Name (eg, company) -organizationName_default = vmware.com -commonName = Common Name (e.g. server FQDN or YOUR name) -commonName_default = keycloak - -[req_ext] -subjectAltName = @alt_names - -[alt_names] -DNS.1 = *.us-east-2.elb.amazonaws.com +[req]= +default_bits=2048 +distinguished_name=req_dn +x509_extensions=req_ext +[req_dn]= +countryName=Country Name (2 letter code) +countryName_default=US +stateOrProvinceName=State or Province Name (full name) +stateOrProvinceName_default=CA +localityName=Locality Name (eg, city) +localityName_default=Campbell +organizationName=Organization Name (eg, company) +organizationName_default=vmware.com +commonName=Common Name (e.g. server FQDN or YOUR name) +commonName_default=keycloak +[req_ext]= +subjectAltName=@alt_names +[alt_names]= +DNS.1=*.us-east-2.elb.amazonaws.com ``` The important section of the config is the `[req_ext]` extension section with alternate names. As the load balancer URL is created during installation, we use the wildcard mechanism so the final hostname can be verified by the certificates (here `DNS.1` illustrates a cluster on AWS). Other hostnames, e.g. localhost, can also be added following the numbers pattern (`DNS.x`).