diff --git a/hack/kubeadminkubeconfig/kubetoken.go b/hack/kubeadminkubeconfig/kubetoken.go index be349b8f7..2d32772ab 100644 --- a/hack/kubeadminkubeconfig/kubetoken.go +++ b/hack/kubeadminkubeconfig/kubetoken.go @@ -45,6 +45,10 @@ func getTokenURLFromConsoleURL(consoleURL string) (*url.URL, error) { func getAuthorizedToken(ctx context.Context, tokenURL *url.URL, username, password string) (string, error) { req, err := http.NewRequestWithContext(ctx, "GET", tokenURL.String(), nil) + if err != nil { + return "", err + } + req.SetBasicAuth(username, password) req.Header.Add("X-CSRF-Token", "1") diff --git a/pkg/api/admin/register.go b/pkg/api/admin/register.go index 35def49ce..15ed83224 100644 --- a/pkg/api/admin/register.go +++ b/pkg/api/admin/register.go @@ -10,11 +10,6 @@ import ( // APIVersion contains a version string as it will be used by clients const APIVersion = "admin" -const ( - resourceProviderNamespace = "Microsoft.RedHatOpenShift" - resourceType = "openShiftClusters" -) - func init() { api.APIs[APIVersion] = &api.Version{ OpenShiftClusterConverter: func() api.OpenShiftClusterConverter { diff --git a/pkg/backend/openshiftcluster/openshiftcluster.go b/pkg/backend/openshiftcluster/openshiftcluster.go index 24ce2dd5a..a2fe40fbe 100644 --- a/pkg/backend/openshiftcluster/openshiftcluster.go +++ b/pkg/backend/openshiftcluster/openshiftcluster.go @@ -12,7 +12,6 @@ import ( "github.com/Azure/ARO-RP/pkg/api/validate" "github.com/Azure/ARO-RP/pkg/database" "github.com/Azure/ARO-RP/pkg/env" - "github.com/Azure/ARO-RP/pkg/util/acrtoken" pkgacrtoken "github.com/Azure/ARO-RP/pkg/util/acrtoken" "github.com/Azure/ARO-RP/pkg/util/azureclient/mgmt/features" "github.com/Azure/ARO-RP/pkg/util/azureclient/mgmt/network" @@ -39,7 +38,7 @@ type Manager struct { keyvault keyvault.Manager privateendpoint privateendpoint.Manager subnet subnet.Manager - acrtoken acrtoken.Manager + acrtoken pkgacrtoken.Manager doc *api.OpenShiftClusterDocument } diff --git a/pkg/database/extensions.go b/pkg/database/extensions.go index d467fb2b3..109d25331 100644 --- a/pkg/database/extensions.go +++ b/pkg/database/extensions.go @@ -10,7 +10,6 @@ import ( "github.com/Azure/ARO-RP/pkg/api" "github.com/Azure/ARO-RP/pkg/util/encryption" - encrypt "github.com/Azure/ARO-RP/pkg/util/encryption" ) var _ codec.InterfaceExt = (*secureBytesExt)(nil) @@ -45,7 +44,7 @@ func (s secureBytesExt) UpdateExt(dest interface{}, v interface{}) { var _ codec.InterfaceExt = (*secureStringExt)(nil) type secureStringExt struct { - cipher encrypt.Cipher + cipher encryption.Cipher } func (s secureStringExt) ConvertExt(v interface{}) interface{} { diff --git a/pkg/deploy/generator/resources.go b/pkg/deploy/generator/resources.go index 51b70a966..4d6f09029 100644 --- a/pkg/deploy/generator/resources.go +++ b/pkg/deploy/generator/resources.go @@ -669,20 +669,20 @@ func (g *generator) vmss() *arm.Resource { } parts = append(parts, - fmt.Sprintf("'LOCATION=$(base64 -d <<<'''"), - fmt.Sprintf("base64(resourceGroup().location)"), + "'LOCATION=$(base64 -d <<<'''", + "base64(resourceGroup().location)", "''')\n'", ) parts = append(parts, - fmt.Sprintf("'SUBSCRIPTIONID=$(base64 -d <<<'''"), - fmt.Sprintf("base64(subscription().subscriptionId)"), + "'SUBSCRIPTIONID=$(base64 -d <<<'''", + "base64(subscription().subscriptionId)", "''')\n'", ) parts = append(parts, - fmt.Sprintf("'RESOURCEGROUPNAME=$(base64 -d <<<'''"), - fmt.Sprintf("base64(resourceGroup().name)"), + "'RESOURCEGROUPNAME=$(base64 -d <<<'''", + "base64(resourceGroup().name)", "''')\n'", ) diff --git a/pkg/frontend/admin_openshiftcluster_list_test.go b/pkg/frontend/admin_openshiftcluster_list_test.go index dc3a1147b..4b2c9030d 100644 --- a/pkg/frontend/admin_openshiftcluster_list_test.go +++ b/pkg/frontend/admin_openshiftcluster_list_test.go @@ -67,7 +67,6 @@ func TestAdminListOpenShiftCluster(t *testing.T) { type test struct { name string mocks func(*gomock.Controller, *mock_database.MockOpenShiftClusters, *mock_clusterdata.MockOpenShiftClusterEnricher, *mock_encryption.MockCipher) - skipToken string wantStatusCode int wantResponse []*admin.OpenShiftCluster wantError string diff --git a/pkg/install/consolebranding_test.go b/pkg/install/consolebranding_test.go index 144749bb6..4f71e97c7 100644 --- a/pkg/install/consolebranding_test.go +++ b/pkg/install/consolebranding_test.go @@ -8,7 +8,6 @@ import ( "testing" operatorv1 "github.com/openshift/api/operator/v1" - v1 "github.com/openshift/api/operator/v1" "github.com/openshift/client-go/operator/clientset/versioned/fake" "github.com/sirupsen/logrus" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -21,16 +20,16 @@ func TestUpdateConsoleBranding(t *testing.T) { i := &Installer{ log: logrus.NewEntry(logrus.StandardLogger()), - operatorcli: fake.NewSimpleClientset(&v1.Console{ + operatorcli: fake.NewSimpleClientset(&operatorv1.Console{ ObjectMeta: metav1.ObjectMeta{ Name: consoleName, }, - Status: v1.ConsoleStatus{ - OperatorStatus: v1.OperatorStatus{ - Conditions: []v1.OperatorCondition{ + Status: operatorv1.ConsoleStatus{ + OperatorStatus: operatorv1.OperatorStatus{ + Conditions: []operatorv1.OperatorCondition{ { Type: "DeploymentAvailable", - Status: v1.ConditionTrue, + Status: operatorv1.ConditionTrue, }, }, }, diff --git a/pkg/metrics/statsd/k8s/metrics.go b/pkg/metrics/statsd/k8s/metrics.go index bcc961e55..e051cbb71 100644 --- a/pkg/metrics/statsd/k8s/metrics.go +++ b/pkg/metrics/statsd/k8s/metrics.go @@ -12,11 +12,6 @@ import ( "github.com/Azure/ARO-RP/pkg/metrics" ) -type metric struct { - t time.Time - name string -} - var _ k8smetrics.LatencyMetric = (*tracer)(nil) var _ k8smetrics.ResultMetric = (*tracer)(nil) diff --git a/pkg/util/billing/billing.go b/pkg/util/billing/billing.go index 4e502f74f..e036d49d7 100644 --- a/pkg/util/billing/billing.go +++ b/pkg/util/billing/billing.go @@ -55,9 +55,6 @@ func NewManager(_env env.Interface, billing database.Billing, sub database.Subsc } e2estorage := storage.NewAccountsClient(_env.E2EStorageAccountSubID(), localFPAuthorizer) - if err != nil { - return nil, err - } keys, err := e2estorage.ListKeys(context.Background(), _env.E2EStorageAccountRGName(), _env.E2EStorageAccountName(), "") if err != nil { diff --git a/pkg/util/clusterdata/worker_profiles_task.go b/pkg/util/clusterdata/worker_profiles_task.go index 4de0282b0..44196fbfd 100644 --- a/pkg/util/clusterdata/worker_profiles_task.go +++ b/pkg/util/clusterdata/worker_profiles_task.go @@ -67,8 +67,12 @@ func (ef *workerProfilesEnricherTask) FetchData(callbacks chan<- func(), errs ch return } - workerProfiles := make([]api.WorkerProfile, len(machinesets.Items), len(machinesets.Items)) + workerProfiles := make([]api.WorkerProfile, len(machinesets.Items)) for i, machineset := range machinesets.Items { + if machineset.Spec.Template.Spec.ProviderSpec.Value == nil { + continue + } + o, _, err := codecs.UniversalDeserializer().Decode(machineset.Spec.Template.Spec.ProviderSpec.Value.Raw, nil, nil) if err != nil { ef.log.Error(err)