diff --git a/Makefile b/Makefile index 1be4fae2a..bbb5c8889 100644 --- a/Makefile +++ b/Makefile @@ -427,11 +427,15 @@ k8s_codegen: @rm -rf $(K8S_CODE_GENERATOR) k8s_codegen_operator: - @tar zxvf $(K8S_CODE_GENERATOR).tar.gz -C ./../ --no-same-owner + @tar zxvf $(K8S_CODE_GENERATOR).tar.gz --no-same-owner @chmod +x $(K8S_CODE_GENERATOR)/generate-groups.sh @$(K8S_CODE_GENERATOR)/generate-groups.sh all $(OPERATOR_KUBERNETES_PKG)/client \ - $(OPERATOR_KUBERNETES_PKG)/apis "netapp:v1" -h ./../hack/boilerplate.go.txt + $(OPERATOR_KUBERNETES_PKG)/apis "netapp:v1" -h ./hack/boilerplate.go.txt @rm -rf $(K8S_CODE_GENERATOR) + @rm -rf ./operator/controllers/orchestrator/client/* + @mv $(OPERATOR_KUBERNETES_PKG)/client/* ./operator/controllers/orchestrator/client/ + @rm -rf ./operator/controllers/orchestrator/apis/netapp/v1/zz_generated.deepcopy.go + @mv $(OPERATOR_KUBERNETES_PKG)/apis/netapp/v1/zz_generated.deepcopy.go ./operator/controllers/orchestrator/apis/netapp/v1/ mocks: @go install github.com/golang/mock/mockgen@v1.6.0 diff --git a/cli/k8s_client/k8s_client.go b/cli/k8s_client/k8s_client.go index fd1f125fb..a5c0e6c7f 100644 --- a/cli/k8s_client/k8s_client.go +++ b/cli/k8s_client/k8s_client.go @@ -59,6 +59,8 @@ const ( // CRD Finalizer name TridentFinalizer = "trident.netapp.io" + + CloudProviderAzure = "Azure" ) type LogLineCallback func(string) diff --git a/cli/k8s_client/types.go b/cli/k8s_client/types.go index aa0f322d6..39138fcd3 100644 --- a/cli/k8s_client/types.go +++ b/cli/k8s_client/types.go @@ -165,6 +165,7 @@ type DeploymentYAMLArguments struct { ServiceAccountName string `json:"serviceAccountName"` ImagePullPolicy string `json:"imagePullPolicy"` EnableForceDetach bool `json:"enableForceDetach"` + CloudProvider string `json:"cloudProvider"` ACPImage string `json:"acpImage"` EnableACP bool `json:"enableACP"` } diff --git a/cli/k8s_client/yaml_factory.go b/cli/k8s_client/yaml_factory.go index 1ba92860f..02f907c7d 100644 --- a/cli/k8s_client/yaml_factory.go +++ b/cli/k8s_client/yaml_factory.go @@ -451,6 +451,16 @@ func GetCSIDeploymentYAML(args *DeploymentYAMLArguments) string { autosupportDebugLine = "#" + autosupportDebugLine } + if strings.EqualFold(args.CloudProvider, CloudProviderAzure) { + deploymentYAML = strings.ReplaceAll(deploymentYAML, "{AZURE_CREDENTIAL_FILE_ENV}", "- name: AZURE_CREDENTIAL_FILE\n value: /etc/kubernetes/azure.json") + deploymentYAML = strings.ReplaceAll(deploymentYAML, "{AZURE_CREDENTIAL_FILE_VOLUME}", "- name: azure-cred\n hostPath:\n path: /etc/kubernetes\n type: DirectoryOrCreate") + deploymentYAML = strings.ReplaceAll(deploymentYAML, "{AZURE_CREDENTIAL_FILE_VOLUME_MOUNT}", "- name: azure-cred\n mountPath: /etc/kubernetes") + } else { + deploymentYAML = strings.ReplaceAll(deploymentYAML, "{AZURE_CREDENTIAL_FILE_ENV}", "") + deploymentYAML = strings.ReplaceAll(deploymentYAML, "{AZURE_CREDENTIAL_FILE_VOLUME}", "") + deploymentYAML = strings.ReplaceAll(deploymentYAML, "{AZURE_CREDENTIAL_FILE_VOLUME_MOUNT}", "") + } + if args.EnableACP { enableACP = "- \"-enable_acp\"" deploymentYAML = strings.ReplaceAll(deploymentYAML, "{ACP_YAML}", acpContainerYAMLTemplate) @@ -572,12 +582,14 @@ spec: value: unix://plugin/csi.sock - name: TRIDENT_SERVER value: "{IP_LOCALHOST}:8000" + {AZURE_CREDENTIAL_FILE_ENV} volumeMounts: - name: socket-dir mountPath: /plugin - name: certs mountPath: /certs readOnly: true + {AZURE_CREDENTIAL_FILE_VOLUME_MOUNT} - name: trident-autosupport image: {AUTOSUPPORT_IMAGE} imagePullPolicy: {IMAGE_PULL_POLICY} @@ -703,6 +715,7 @@ spec: emptyDir: medium: "" sizeLimit: 1Gi + {AZURE_CREDENTIAL_FILE_VOLUME} ` func GetCSIDaemonSetYAMLWindows(args *DaemonsetYAMLArguments) string { diff --git a/cli/k8s_client/yaml_factory_test.go b/cli/k8s_client/yaml_factory_test.go index 96b4b48b8..418cfe018 100644 --- a/cli/k8s_client/yaml_factory_test.go +++ b/cli/k8s_client/yaml_factory_test.go @@ -11,6 +11,7 @@ import ( "github.com/ghodss/yaml" scc "github.com/openshift/api/security/v1" "github.com/stretchr/testify/assert" + appsv1 "k8s.io/api/apps/v1" v1 "k8s.io/api/core/v1" pspv1beta1 "k8s.io/api/policy/v1beta1" csiv1 "k8s.io/api/storage/v1" @@ -435,6 +436,40 @@ func TestGetCSIDeploymentYAMLImagePullPolicy(t *testing.T) { } } +func TestGetCSIDeploymentYAMLAzure(t *testing.T) { + args := &DeploymentYAMLArguments{ + CloudProvider: CloudProviderAzure, + } + + yamlData := GetCSIDeploymentYAML(args) + deployment := appsv1.Deployment{} + err := yaml.Unmarshal([]byte(yamlData), &deployment) + if err != nil { + t.Fatalf("expected valid YAML, got %s", yamlData) + } + + var envExist, volumeExist, volumeMountExist bool + for _, env := range deployment.Spec.Template.Spec.Containers[0].Env { + if env.Name == "AZURE_CREDENTIAL_FILE" { + envExist = true + break + } + } + for _, volumeMount := range deployment.Spec.Template.Spec.Containers[0].VolumeMounts { + if volumeMount.Name == "azure-cred" { + volumeMountExist = true + break + } + } + for _, volume := range deployment.Spec.Template.Spec.Volumes { + if volume.Name == "azure-cred" { + volumeExist = true + break + } + } + assert.True(t, envExist && volumeExist && volumeMountExist, "expected env var AZURE_CREDENTIAL_FILE to exist") +} + func TestGetCSIDaemonSetYAMLLinux(t *testing.T) { versions := []string{"1.21.0", "1.23.0", "1.25.0"} diff --git a/frontend/crd/trident_backend_config.go b/frontend/crd/trident_backend_config.go index 9ea924a66..dd8ed7cbb 100644 --- a/frontend/crd/trident_backend_config.go +++ b/frontend/crd/trident_backend_config.go @@ -189,7 +189,20 @@ func (c *TridentCrdController) addBackendConfig( }).Trace("Adding backend in core.") backendDetails, err := c.orchestrator.AddBackend(ctx, string(rawJSONData), string(backendConfig.UID)) - if err != nil { + if err == nil { + newStatus := tridentv1.TridentBackendConfigStatus{ + Message: fmt.Sprintf("Backend '%v' created", backendDetails.Name), + BackendInfo: c.getBackendInfo(ctx, backendDetails.Name, backendDetails.BackendUUID), + Phase: string(tridentv1.PhaseBound), + DeletionPolicy: deletionPolicy, + LastOperationStatus: OperationStatusSuccess, + } + + if _, statusErr := c.updateTbcEventAndStatus(ctx, backendConfig, newStatus, "Backend created.", + corev1.EventTypeNormal); statusErr != nil { + err = fmt.Errorf("encountered an error while updating the status: %v", statusErr) + } + } else if !errors.IsReconcileDeferredError(err) { newStatus := tridentv1.TridentBackendConfigStatus{ Message: fmt.Sprintf("Failed to create backend: %v", err), BackendInfo: c.getBackendInfo(ctx, "", ""), @@ -203,19 +216,6 @@ func (c *TridentCrdController) addBackendConfig( err = fmt.Errorf("failed to create backend: %v; Also encountered error while updating the status: %v", err, statusErr) } - } else { - newStatus := tridentv1.TridentBackendConfigStatus{ - Message: fmt.Sprintf("Backend '%v' created", backendDetails.Name), - BackendInfo: c.getBackendInfo(ctx, backendDetails.Name, backendDetails.BackendUUID), - Phase: string(tridentv1.PhaseBound), - DeletionPolicy: deletionPolicy, - LastOperationStatus: OperationStatusSuccess, - } - - if _, statusErr := c.updateTbcEventAndStatus(ctx, backendConfig, newStatus, "Backend created.", - corev1.EventTypeNormal); statusErr != nil { - err = fmt.Errorf("encountered an error while updating the status: %v", statusErr) - } } return err diff --git a/go.mod b/go.mod index 67a1dc6fe..37ec2c029 100755 --- a/go.mod +++ b/go.mod @@ -3,8 +3,8 @@ module github.com/netapp/trident go 1.21 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v4 v4.0.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcegraph/armresourcegraph v0.7.1 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armfeatures v1.1.0 @@ -58,23 +58,36 @@ require ( k8s.io/mount-utils v0.27.3 // github.com/kubernetes/mount-utils ) +require ( + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2 v2.2.1 + sigs.k8s.io/cloud-provider-azure v1.27.6 + sigs.k8s.io/cloud-provider-azure/pkg/azclient v0.0.0-20230723234811-915dd11ba556 +) + require ( cloud.google.com/go/compute v1.20.1 // indirect cloud.google.com/go/compute/metadata v0.2.3 // indirect github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5 v5.0.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4 v4.0.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v3 v3.0.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns v1.1.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.1.1 // indirect + github.com/Azure/go-armbalancer v0.0.2 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0 // indirect github.com/Microsoft/go-winio v0.6.0 // indirect github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bits-and-blooms/bitset v1.2.0 // indirect + github.com/blang/semver/v4 v4.0.0 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/docker/go-connections v0.4.0 // indirect github.com/elastic/go-windows v1.0.0 // indirect github.com/emicklei/go-restful/v3 v3.9.0 // indirect - github.com/evanphx/json-patch v4.12.0+incompatible // indirect - github.com/go-logr/logr v1.2.3 // indirect + github.com/evanphx/json-patch v5.6.0+incompatible // indirect + github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-openapi/analysis v0.21.4 // indirect github.com/go-openapi/jsonpointer v0.19.6 // indirect @@ -116,11 +129,12 @@ require ( github.com/stretchr/objx v0.5.0 // indirect github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df // indirect go.mongodb.org/mongo-driver v1.11.3 // indirect - go.opentelemetry.io/otel v1.14.0 // indirect - go.opentelemetry.io/otel/trace v1.14.0 // indirect - golang.org/x/mod v0.9.0 // indirect + go.opentelemetry.io/otel v1.16.0 // indirect + go.opentelemetry.io/otel/metric v1.16.0 // indirect + go.opentelemetry.io/otel/trace v1.16.0 // indirect + golang.org/x/mod v0.10.0 // indirect golang.org/x/term v0.10.0 // indirect - golang.org/x/tools v0.7.0 // indirect + golang.org/x/tools v0.9.3 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect google.golang.org/protobuf v1.31.0 // indirect @@ -128,9 +142,10 @@ require ( gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect howett.net/plist v0.0.0-20181124034731-591f970eefbb // indirect + k8s.io/component-base v0.27.3 // indirect k8s.io/klog/v2 v2.90.1 // indirect k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f // indirect - k8s.io/utils v0.0.0-20230209194617-a36077c30491 // indirect + k8s.io/utils v0.0.0-20230505201702-9f6742963106 // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect sigs.k8s.io/yaml v1.3.0 // indirect diff --git a/go.sum b/go.sum index 5a7d1e00c..128bdf65f 100755 --- a/go.sum +++ b/go.sum @@ -40,20 +40,37 @@ cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RX cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 h1:SEy2xmstIphdPwNBUi7uhvjyjhVKISfwjfOJmuy7kg4= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= +github.com/Azure/azure-sdk-for-go v68.0.0+incompatible h1:fcYLmCpyNYRnvJbPerq7U0hS+6+I79yEDJBqVNcqUzU= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.0 h1:8q4SaHjFsClSvuVne0ID/5Ka8u3fcIHyqkLjcFpNRHQ= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.0/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 h1:vcYCAze6p19qBW7MhZybIsqD8sMV8js0NyQM8JDnVtg= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0/go.mod h1:OQeznEEkTZ9OrhHJoDD8ZDq51FHgXjqtP9z6bEwBq9U= github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5 v5.0.0 h1:zpMyM8MoI8ZR/KNcfTothBjV5oTm6QVpuPwz/9TXQ1Q= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5 v5.0.0/go.mod h1:mXdzU0jht34j8BVO6q+sns1M1CYmHdq1AA9mRHeFvv0= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4 v4.0.0 h1:PcCx8mii9UPb0ztRpw8JF4/pKEfxXeXtL1GETENP4pU= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4 v4.0.0/go.mod h1:FoPQz7wDNpmE619+efw24epeh69HYI6c3jbwz8jgPMw= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2 h1:mLY+pNLjCUeKhgnAJWAKhEUQM+RJQo2H1fuGSw1Ky1E= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2/go.mod h1:FbdwsQ2EzwvXxOPcMFYO8ogEc9uMMIj3YkmCdXdAFmk= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementgroups/armmanagementgroups v1.0.0 h1:pPvTJ1dY0sA35JOeFq6TsY2xj6Z85Yo23Pj4wCCvu4o= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementgroups/armmanagementgroups v1.0.0/go.mod h1:mLfWfj8v3jfWKsL9G4eoBoXVcsqcIUTapmdKy7uGOp0= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v4 v4.0.0 h1:yNyKx1DKBWXs6EP6WaaVgRuX9ilmOj8emmAyKfqHBYA= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v4 v4.0.0/go.mod h1:CLToNi36LmwVMgHuqOgfG8M0ph7VQaEUoqpO35/1wqU= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2 v2.2.1 h1:bWh0Z2rOEDfB/ywv/l0iHN1JgyazE6kW/aIA89+CEK0= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2 v2.2.1/go.mod h1:Bzf34hhAE9NSxailk8xVeLEZbUjOXcC+GnU1mMKdhLw= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v3 v3.0.0 h1:C4GK2KFbzM07iThUKZccqt3kB6MpT9mHAw147uSlOYE= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v3 v3.0.0/go.mod h1:npZqEMqFcvlOus6RnbX4vH2Wr/noDYsp/oCdX/4bWso= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns v1.1.0 h1:rR8ZW79lE/ppfXTfiYSnMFv5EzmVuY4pfZWIkscIJ64= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns v1.1.0/go.mod h1:y2zXtLSMM/X5Mfawq0lOftpWn3f4V6OCsRdINsvWBPI= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcegraph/armresourcegraph v0.7.1 h1:eoQrCw9DMThzbJ32fHXZtISnURk6r0TozXiWuTsay5s= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcegraph/armresourcegraph v0.7.1/go.mod h1:21rlzm+SuYrS9ARS92XEGxcHQeLVDcaY2YV30rHjSd4= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armfeatures v1.1.0 h1:NhvID5juwkPxMUD8hdV3no0nugxk9QM8d5OSLskjOLM= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armfeatures v1.1.0/go.mod h1:hDdPReNCfyh7kmZm6uKm3uH3OQkGn8gbeb1c/JkmEdE= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0 h1:ECsQtyERDVz3NP3kvDOTLvbQhqWp/x9EsGKtb4ogUr8= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.1.1 h1:7CBQ+Ei8SP2c6ydQTGCCrS35bDxgTMfoP2miAwK++OU= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.1.1/go.mod h1:c/wcGeGx5FUPbM/JltUYHZcKmigwyVLJlDq+4HdtXaw= +github.com/Azure/go-armbalancer v0.0.2 h1:NVnxsTWHI5/fEzL6k6TjxPUfcB/3Si3+HFOZXOu0QtA= +github.com/Azure/go-armbalancer v0.0.2/go.mod h1:yTg7MA/8YnfKQc9o97tzAJ7fbdVkod1xGsIvKmhYPRE= github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0 h1:OBhqkivkhkMqLPymWEppkm7vgPQY2XsHoEkaMQ0AdZY= github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= @@ -68,6 +85,7 @@ github.com/RoaringBitmap/roaring v1.3.0 h1:aQmu9zQxDU0uhwR8SXOH/OrqEf+X8A0LQmwW3 github.com/RoaringBitmap/roaring v1.3.0/go.mod h1:plvDsJQpxOC5bw8LRteu/MLWHsHez/3y6cubLI4/1yE= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= +github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so= github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= @@ -75,6 +93,8 @@ github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bits-and-blooms/bitset v1.2.0 h1:Kn4yilvwNtMACtf1eYDlG8H77R07mZSPbMjLyS07ChA= github.com/bits-and-blooms/bitset v1.2.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA= +github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM= +github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ= github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= @@ -100,13 +120,17 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI= +github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8= +github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v23.0.3+incompatible h1:9GhVsShNWz1hO//9BNg/dpMnZW25KydO4wtVxWAIbho= +github.com/docker/docker v23.0.3+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-plugins-helpers v0.0.0-20211224144127-6eecb7beb651 h1:YcvzLmdrP/b8kLAGJ8GT7bdncgCAiWxJZIlt84D+RJg= github.com/docker/go-plugins-helpers v0.0.0-20211224144127-6eecb7beb651/go.mod h1:LFyLie6XcDbyKGeVK6bHe+9aJTYCxWLBg5IrJZOaXKA= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= +github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= github.com/dustin/go-humanize v1.0.2-0.20230319011938-bd1b3e1a20a1 h1:xWuCuGTxFJBS1aR92jQcf67YS3N6DozQ9xhlM421MPI= github.com/dustin/go-humanize v1.0.2-0.20230319011938-bd1b3e1a20a1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= @@ -124,8 +148,8 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.m github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/evanphx/json-patch v4.12.0+incompatible h1:4onqiflcdA9EOZ4RxV643DvftH5pOlLGNtQ5lPWQu84= -github.com/evanphx/json-patch v4.12.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= +github.com/evanphx/json-patch v5.6.0+incompatible h1:jBYDEEiFBPxA0v50tFdvOzQQTCvpL6mnFh5mB2/l16U= +github.com/evanphx/json-patch v5.6.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/evanphx/json-patch/v5 v5.6.0 h1:b91NhWfaz02IuVxO9faSllyAtNXHMPkC5J8sJCLunww= github.com/evanphx/json-patch/v5 v5.6.0/go.mod h1:G79N1coSVB93tBe7j6PhzjmR3/2VvlbKOFpnXhI9Bw4= github.com/flowstack/go-jsonschema v0.1.1/go.mod h1:yL7fNggx1o8rm9RlgXv7hTBWxdBM0rVwpMwimd3F3N0= @@ -137,8 +161,8 @@ github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2 github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= +github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-openapi/analysis v0.21.2/go.mod h1:HZwRk4RRisyG8vx2Oe6aqeSQcoxRp47Xkp3+K6q+LdY= @@ -180,7 +204,8 @@ github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+ github.com/go-openapi/validate v0.22.1 h1:G+c2ub6q47kfX1sOBLwIQwzBVt8qmOAARyo/9Fqs9NU= github.com/go-openapi/validate v0.22.1/go.mod h1:rjnrwK57VJ7A8xqfpAOEKRH8yQSGUriMu5/zuPSQ1hg= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 h1:p104kn46Q8WdvHunIJ9dAyjPVtrBPhSr3KT2yUst43I= +github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= +github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= github.com/gobuffalo/attrs v0.0.0-20190224210810-a9411de4debd/go.mod h1:4duuawTqi2wkkpB4ePgWMaai6/Kc6WEz83bhFwpHzj0= github.com/gobuffalo/depgen v0.0.0-20190329151759-d478694a28d3/go.mod h1:3STtPUQYuzV0gBVOY3vy6CfMm/ljR4pABfrTeHNLHUY= github.com/gobuffalo/depgen v0.1.0/go.mod h1:+ifsuy7fhi15RWncXQQKjWS9JPkdah5sZvtHc2RXGlg= @@ -275,7 +300,8 @@ github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hf github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec= +github.com/google/pprof v0.0.0-20230602010524-ada837c32108 h1:y+JfwMOPwQwIrnh3TUPwwtOAhONoppkHiSa4sQBoK2k= +github.com/google/pprof v0.0.0-20230602010524-ada837c32108/go.mod h1:Jh3hGz2jkYak8qXPD19ryItVnUgpgeqzdkY/D0EaeuA= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -321,6 +347,7 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/secureheader v0.2.0 h1:Fe/BS3McH8EGMSc+HzaZkkRnrCyx2gq9kSVgLbyBNrA= github.com/kr/secureheader v0.2.0/go.mod h1:PfvbGMMfqBg6z+vxKGKbSJRcmASZc4klL5DiW9V5iLI= @@ -349,6 +376,7 @@ github.com/mattn/go-runewidth v0.0.10/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRC github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/maxatome/go-testdeep v1.12.0 h1:Ql7Go8Tg0C1D/uMMX59LAoYK7LffeJQ6X2T04nTH68g= +github.com/maxatome/go-testdeep v1.12.0/go.mod h1:lPZc/HAcJMP92l7yI6TRz1aZN5URwUBUAfUNvrclaNM= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= github.com/mitchellh/hashstructure/v2 v2.0.2 h1:vGKWl0YJqUNxE8d+h8f6NJLcCJrgbhC4NcD46KavDd4= @@ -378,10 +406,14 @@ github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/olekukonko/tablewriter v0.0.6-0.20230422125635-f6b4e4ae60d8 h1:eZ1u2pOgYpOBuhRmW9qo8C7tXKtqSRNI1U3PHcpcObQ= github.com/olekukonko/tablewriter v0.0.6-0.20230422125635-f6b4e4ae60d8/go.mod h1:8Hf+pH6thup1sPZPD+NLg7d6vbpsdilu9CPIeikvgMQ= -github.com/onsi/ginkgo/v2 v2.9.1 h1:zie5Ly042PD3bsCvsSOPvRnFwyo3rKe64TJlD6nu0mk= -github.com/onsi/gomega v1.27.4 h1:Z2AnStgsdSayCMDiCU42qIz+HLqEPcgiOCXjAU/w+8E= +github.com/onsi/ginkgo/v2 v2.11.0 h1:WgqUCUt/lT6yXoQ8Wef0fsNn5cAuMK7+KT9UFRz2tcU= +github.com/onsi/ginkgo/v2 v2.11.0/go.mod h1:ZhrRA5XmEE3x3rhlzamx/JJvujdZoJ2uvgI7kR0iZvM= +github.com/onsi/gomega v1.27.9 h1:qIyVWbOsvQEye2QCqLsNSeH/5L1RS9vS382erEWfT3o= +github.com/onsi/gomega v1.27.9/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= +github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.0.2 h1:9yCKha/T5XdGtO0q9Q9a6T5NUCsTn/DrBg0D7ufOcFM= +github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= github.com/openshift/api v0.0.0-20230711095040-ca06f4a23b64 h1:j7LIIr4Vrdy4Dpd4bw2j53UXUSjA1eXXC0x89g9kyAI= github.com/openshift/api v0.0.0-20230711095040-ca06f4a23b64/go.mod h1:yimSGmjsI+XF1mr+AKBs2//fSXIOhhetHGbMlBEfXbs= github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= @@ -412,6 +444,7 @@ github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= +github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sirupsen/logrus v1.4.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= @@ -477,11 +510,14 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= -go.opentelemetry.io/otel v1.14.0 h1:/79Huy8wbf5DnIPhemGB+zEPVwnN6fuQybr/SRXa6hM= -go.opentelemetry.io/otel v1.14.0/go.mod h1:o4buv+dJzx8rohcUeRmWUZhqupFvzWis188WlggnNeU= +go.opentelemetry.io/otel v1.16.0 h1:Z7GVAX/UkAXPKsy94IU+i6thsQS4nb7LviLpnaNeW8s= +go.opentelemetry.io/otel v1.16.0/go.mod h1:vl0h9NUa1D5s1nv3A5vZOYWn8av4K8Ml6JDeHrT/bx4= +go.opentelemetry.io/otel/metric v1.16.0 h1:RbrpwVG1Hfv85LgnZ7+txXioPDoh6EdbZHo26Q3hqOo= +go.opentelemetry.io/otel/metric v1.16.0/go.mod h1:QE47cpOmkwipPiefDwo2wDzwJrlfxxNYodqc4xnGCo4= go.opentelemetry.io/otel/sdk v1.14.0 h1:PDCppFRDq8A1jL9v6KMI6dYesaq+DFcDZvjsoGvxGzY= -go.opentelemetry.io/otel/trace v1.14.0 h1:wp2Mmvj41tDsyAJXiWDWpfNsOiIyd38fy85pyKcFq/M= -go.opentelemetry.io/otel/trace v1.14.0/go.mod h1:8avnQLK+CG77yNLUae4ea2JDQ6iT+gozhnZjy/rw9G8= +go.opentelemetry.io/otel/sdk v1.14.0/go.mod h1:bwIC5TjrNG6QDCHNWvW4HLHtUQ4I+VQDsnjhvyZCALM= +go.opentelemetry.io/otel/trace v1.16.0 h1:8JRpaObFoW0pxuVPapkgH8UhHQj+bJW8jJsCZEu5MQs= +go.opentelemetry.io/otel/trace v1.16.0/go.mod h1:Yt9vYq1SdNz3xdjZZK7wcXv1qv2pwLkqr2QVwea0ef0= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= @@ -532,8 +568,8 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.9.0 h1:KENHtAZL2y3NLMYZeHY9DW8HW8V+kQyJsY/V9JlKvCs= -golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk= +golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -594,7 +630,8 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI= +golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -718,8 +755,8 @@ golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.7.0 h1:W4OVu8VVOaIO0yzWMNdepAulS7YfoS3Zabrm8DOXXU4= -golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s= +golang.org/x/tools v0.9.3 h1:Gn1I8+64MsuTb/HpH+LmQtNas23LhUVr3rYZ0eKuaMM= +golang.org/x/tools v0.9.3/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -834,6 +871,8 @@ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/dnaeon/go-vcr.v3 v3.1.2 h1:F1smfXBqQqwpVifDfUBQG6zzaGjzT+EnVZakrOdr5wA= +gopkg.in/dnaeon/go-vcr.v3 v3.1.2/go.mod h1:2IMOnnlx9I6u9x+YBsM3tAMx6AlOxnJ0pWxQAzZ79Ag= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= @@ -867,17 +906,23 @@ k8s.io/apimachinery v0.27.3 h1:Ubye8oBufD04l9QnNtW05idcOe9Z3GQN8+7PqmuVcUM= k8s.io/apimachinery v0.27.3/go.mod h1:XNfZ6xklnMCOGGFNqXG7bUrQCoR04dh/E7FprV6pb+E= k8s.io/client-go v0.27.3 h1:7dnEGHZEJld3lYwxvLl7WoehK6lAq7GvgjxpA3nv1E8= k8s.io/client-go v0.27.3/go.mod h1:2MBEKuTo6V1lbKy3z1euEGnhPfGZLKTS9tiJ2xodM48= +k8s.io/component-base v0.27.3 h1:g078YmdcdTfrCE4fFobt7qmVXwS8J/3cI1XxRi/2+6k= +k8s.io/component-base v0.27.3/go.mod h1:JNiKYcGImpQ44iwSYs6dysxzR9SxIIgQalk4HaCNVUY= k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw= k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f h1:2kWPakN3i/k81b0gvD5C5FJ2kxm1WrQFanWchyKuqGg= k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f/go.mod h1:byini6yhqGC14c3ebc/QwanvYwhuMWF6yz2F8uwW8eg= k8s.io/mount-utils v0.27.3 h1:oubkDKLTZUneW27wgyOmp8a1AAZj04vGmtq+YW8wdvY= k8s.io/mount-utils v0.27.3/go.mod h1:vmcjYdi2Vg1VTWY7KkhvwJVY6WDHxb/QQhiQKkR8iNs= -k8s.io/utils v0.0.0-20230209194617-a36077c30491 h1:r0BAOLElQnnFhE/ApUsg3iHdVYYPBjNSSOMowRZxxsY= -k8s.io/utils v0.0.0-20230209194617-a36077c30491/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +k8s.io/utils v0.0.0-20230505201702-9f6742963106 h1:EObNQ3TW2D+WptiYXlApGNLVy0zm/JIBVY9i+M4wpAU= +k8s.io/utils v0.0.0-20230505201702-9f6742963106/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= +sigs.k8s.io/cloud-provider-azure v1.27.6 h1:HRbzXj4ZTU3I1hkRFtYYer8oq2LRSnGqyO0j9bojh+Q= +sigs.k8s.io/cloud-provider-azure v1.27.6/go.mod h1:SHkILxyphjhYTSVGHebkhjT7C4OuhVGULCJPEGHimig= +sigs.k8s.io/cloud-provider-azure/pkg/azclient v0.0.0-20230723234811-915dd11ba556 h1:lFPa+p1LkeQIDX0BW565eLMv7lWXX6c1NlFIg5pv3P4= +sigs.k8s.io/cloud-provider-azure/pkg/azclient v0.0.0-20230723234811-915dd11ba556/go.mod h1:Dy+UN94aM6/T751gS4rQPqTITiBKbQCigX79SllyFxs= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= sigs.k8s.io/structured-merge-diff/v4 v4.2.3 h1:PRbqxJClWWYMNV1dhaG4NsibJbArud9kFxnAMREiWFE= diff --git a/helm/trident-operator/templates/tridentorchestrator.yaml b/helm/trident-operator/templates/tridentorchestrator.yaml index a79f47d8a..e58813074 100644 --- a/helm/trident-operator/templates/tridentorchestrator.yaml +++ b/helm/trident-operator/templates/tridentorchestrator.yaml @@ -61,3 +61,4 @@ spec: {{- end }} imagePullPolicy: {{ include "imagePullPolicy" $ }} windows: {{ .Values.windows }} + cloudProvider: {{ .Values.cloudProvider }} diff --git a/helm/trident-operator/values.yaml b/helm/trident-operator/values.yaml index 0dfc6d388..88bf3e8df 100644 --- a/helm/trident-operator/values.yaml +++ b/helm/trident-operator/values.yaml @@ -123,3 +123,6 @@ enableForceDetach: false # excludePodSecurityPolicy excludes the operator pod security policy from creation. excludePodSecurityPolicy: false + +# cloudProvider indicates which cloud platform Trident is running on. +cloudProvider: "" diff --git a/operator/controllers/orchestrator/apis/netapp/v1/types.go b/operator/controllers/orchestrator/apis/netapp/v1/types.go index d4263bbc8..52cbca9e1 100644 --- a/operator/controllers/orchestrator/apis/netapp/v1/types.go +++ b/operator/controllers/orchestrator/apis/netapp/v1/types.go @@ -62,6 +62,7 @@ type TridentOrchestratorSpec struct { NodePluginTolerations []Toleration `json:"nodePluginTolerations,omitempty"` Windows bool `json:"windows,omitempty"` ImagePullPolicy string `json:"imagePullPolicy,omitempty"` + CloudProvider string `json:"cloudProvider,omitempty"` EnableACP bool `json:"enableACP,omitempty"` ACPImage string `json:"acpImage,omitempty"` } diff --git a/operator/controllers/orchestrator/apis/netapp/v1/zz_generated.deepcopy.go b/operator/controllers/orchestrator/apis/netapp/v1/zz_generated.deepcopy.go index e5f068334..f6b915940 100644 --- a/operator/controllers/orchestrator/apis/netapp/v1/zz_generated.deepcopy.go +++ b/operator/controllers/orchestrator/apis/netapp/v1/zz_generated.deepcopy.go @@ -1,7 +1,7 @@ //go:build !ignore_autogenerated // +build !ignore_autogenerated -// Copyright 2021 NetApp, Inc. All Rights Reserved. +// Copyright 2023 NetApp, Inc. All Rights Reserved. // Code generated by deepcopy-gen. DO NOT EDIT. @@ -91,6 +91,11 @@ func (in *TridentOrchestratorList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TridentOrchestratorSpec) DeepCopyInto(out *TridentOrchestratorSpec) { *out = *in + if in.DisableAuditLog != nil { + in, out := &in.DisableAuditLog, &out.DisableAuditLog + *out = new(bool) + **out = **in + } if in.ProbePort != nil { in, out := &in.ProbePort, &out.ProbePort *out = new(int64) diff --git a/operator/controllers/orchestrator/client/clientset/versioned/clientset.go b/operator/controllers/orchestrator/client/clientset/versioned/clientset.go index eea5c13d8..f37c036d0 100644 --- a/operator/controllers/orchestrator/client/clientset/versioned/clientset.go +++ b/operator/controllers/orchestrator/client/clientset/versioned/clientset.go @@ -1,4 +1,4 @@ -// Copyright 2021 NetApp, Inc. All Rights Reserved. +// Copyright 2023 NetApp, Inc. All Rights Reserved. // Code generated by client-gen. DO NOT EDIT. diff --git a/operator/controllers/orchestrator/client/clientset/versioned/doc.go b/operator/controllers/orchestrator/client/clientset/versioned/doc.go index c726f22ef..5f58c9011 100644 --- a/operator/controllers/orchestrator/client/clientset/versioned/doc.go +++ b/operator/controllers/orchestrator/client/clientset/versioned/doc.go @@ -1,4 +1,4 @@ -// Copyright 2021 NetApp, Inc. All Rights Reserved. +// Copyright 2023 NetApp, Inc. All Rights Reserved. // Code generated by client-gen. DO NOT EDIT. diff --git a/operator/controllers/orchestrator/client/clientset/versioned/fake/clientset_generated.go b/operator/controllers/orchestrator/client/clientset/versioned/fake/clientset_generated.go index 749ecc720..0b9871b31 100644 --- a/operator/controllers/orchestrator/client/clientset/versioned/fake/clientset_generated.go +++ b/operator/controllers/orchestrator/client/clientset/versioned/fake/clientset_generated.go @@ -1,4 +1,4 @@ -// Copyright 2021 NetApp, Inc. All Rights Reserved. +// Copyright 2023 NetApp, Inc. All Rights Reserved. // Code generated by client-gen. DO NOT EDIT. diff --git a/operator/controllers/orchestrator/client/clientset/versioned/fake/doc.go b/operator/controllers/orchestrator/client/clientset/versioned/fake/doc.go index 7eae831bc..e1f96a121 100644 --- a/operator/controllers/orchestrator/client/clientset/versioned/fake/doc.go +++ b/operator/controllers/orchestrator/client/clientset/versioned/fake/doc.go @@ -1,4 +1,4 @@ -// Copyright 2021 NetApp, Inc. All Rights Reserved. +// Copyright 2023 NetApp, Inc. All Rights Reserved. // Code generated by client-gen. DO NOT EDIT. diff --git a/operator/controllers/orchestrator/client/clientset/versioned/fake/register.go b/operator/controllers/orchestrator/client/clientset/versioned/fake/register.go index 453dd2b35..90960655e 100644 --- a/operator/controllers/orchestrator/client/clientset/versioned/fake/register.go +++ b/operator/controllers/orchestrator/client/clientset/versioned/fake/register.go @@ -1,4 +1,4 @@ -// Copyright 2021 NetApp, Inc. All Rights Reserved. +// Copyright 2023 NetApp, Inc. All Rights Reserved. // Code generated by client-gen. DO NOT EDIT. @@ -23,14 +23,14 @@ var localSchemeBuilder = runtime.SchemeBuilder{ // AddToScheme adds all types of this clientset into the given scheme. This allows composition // of clientsets, like in: // -// import ( -// "k8s.io/client-go/kubernetes" -// clientsetscheme "k8s.io/client-go/kubernetes/scheme" -// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" -// ) +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) // -// kclientset, _ := kubernetes.NewForConfig(c) -// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// kclientset, _ := kubernetes.NewForConfig(c) +// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) // // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types // correctly. diff --git a/operator/controllers/orchestrator/client/clientset/versioned/scheme/doc.go b/operator/controllers/orchestrator/client/clientset/versioned/scheme/doc.go index d16c8a976..02121db3d 100644 --- a/operator/controllers/orchestrator/client/clientset/versioned/scheme/doc.go +++ b/operator/controllers/orchestrator/client/clientset/versioned/scheme/doc.go @@ -1,4 +1,4 @@ -// Copyright 2021 NetApp, Inc. All Rights Reserved. +// Copyright 2023 NetApp, Inc. All Rights Reserved. // Code generated by client-gen. DO NOT EDIT. diff --git a/operator/controllers/orchestrator/client/clientset/versioned/scheme/register.go b/operator/controllers/orchestrator/client/clientset/versioned/scheme/register.go index a257fe93d..205d4174d 100644 --- a/operator/controllers/orchestrator/client/clientset/versioned/scheme/register.go +++ b/operator/controllers/orchestrator/client/clientset/versioned/scheme/register.go @@ -1,4 +1,4 @@ -// Copyright 2021 NetApp, Inc. All Rights Reserved. +// Copyright 2023 NetApp, Inc. All Rights Reserved. // Code generated by client-gen. DO NOT EDIT. @@ -23,14 +23,14 @@ var localSchemeBuilder = runtime.SchemeBuilder{ // AddToScheme adds all types of this clientset into the given scheme. This allows composition // of clientsets, like in: // -// import ( -// "k8s.io/client-go/kubernetes" -// clientsetscheme "k8s.io/client-go/kubernetes/scheme" -// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" -// ) +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) // -// kclientset, _ := kubernetes.NewForConfig(c) -// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// kclientset, _ := kubernetes.NewForConfig(c) +// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) // // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types // correctly. diff --git a/operator/controllers/orchestrator/client/clientset/versioned/typed/netapp/v1/doc.go b/operator/controllers/orchestrator/client/clientset/versioned/typed/netapp/v1/doc.go index a856cf979..2c4fa60ac 100644 --- a/operator/controllers/orchestrator/client/clientset/versioned/typed/netapp/v1/doc.go +++ b/operator/controllers/orchestrator/client/clientset/versioned/typed/netapp/v1/doc.go @@ -1,4 +1,4 @@ -// Copyright 2021 NetApp, Inc. All Rights Reserved. +// Copyright 2023 NetApp, Inc. All Rights Reserved. // Code generated by client-gen. DO NOT EDIT. diff --git a/operator/controllers/orchestrator/client/clientset/versioned/typed/netapp/v1/fake/doc.go b/operator/controllers/orchestrator/client/clientset/versioned/typed/netapp/v1/fake/doc.go index 396c6e2b0..0ed352683 100644 --- a/operator/controllers/orchestrator/client/clientset/versioned/typed/netapp/v1/fake/doc.go +++ b/operator/controllers/orchestrator/client/clientset/versioned/typed/netapp/v1/fake/doc.go @@ -1,4 +1,4 @@ -// Copyright 2021 NetApp, Inc. All Rights Reserved. +// Copyright 2023 NetApp, Inc. All Rights Reserved. // Code generated by client-gen. DO NOT EDIT. diff --git a/operator/controllers/orchestrator/client/clientset/versioned/typed/netapp/v1/fake/fake_netapp_client.go b/operator/controllers/orchestrator/client/clientset/versioned/typed/netapp/v1/fake/fake_netapp_client.go index d254eadac..70153a002 100644 --- a/operator/controllers/orchestrator/client/clientset/versioned/typed/netapp/v1/fake/fake_netapp_client.go +++ b/operator/controllers/orchestrator/client/clientset/versioned/typed/netapp/v1/fake/fake_netapp_client.go @@ -1,4 +1,4 @@ -// Copyright 2021 NetApp, Inc. All Rights Reserved. +// Copyright 2023 NetApp, Inc. All Rights Reserved. // Code generated by client-gen. DO NOT EDIT. diff --git a/operator/controllers/orchestrator/client/clientset/versioned/typed/netapp/v1/fake/fake_tridentorchestrator.go b/operator/controllers/orchestrator/client/clientset/versioned/typed/netapp/v1/fake/fake_tridentorchestrator.go index 4350c140b..9f1f7c53f 100644 --- a/operator/controllers/orchestrator/client/clientset/versioned/typed/netapp/v1/fake/fake_tridentorchestrator.go +++ b/operator/controllers/orchestrator/client/clientset/versioned/typed/netapp/v1/fake/fake_tridentorchestrator.go @@ -1,4 +1,4 @@ -// Copyright 2021 NetApp, Inc. All Rights Reserved. +// Copyright 2023 NetApp, Inc. All Rights Reserved. // Code generated by client-gen. DO NOT EDIT. diff --git a/operator/controllers/orchestrator/client/clientset/versioned/typed/netapp/v1/generated_expansion.go b/operator/controllers/orchestrator/client/clientset/versioned/typed/netapp/v1/generated_expansion.go index cfd36c097..7135c9dac 100644 --- a/operator/controllers/orchestrator/client/clientset/versioned/typed/netapp/v1/generated_expansion.go +++ b/operator/controllers/orchestrator/client/clientset/versioned/typed/netapp/v1/generated_expansion.go @@ -1,4 +1,4 @@ -// Copyright 2021 NetApp, Inc. All Rights Reserved. +// Copyright 2023 NetApp, Inc. All Rights Reserved. // Code generated by client-gen. DO NOT EDIT. diff --git a/operator/controllers/orchestrator/client/clientset/versioned/typed/netapp/v1/netapp_client.go b/operator/controllers/orchestrator/client/clientset/versioned/typed/netapp/v1/netapp_client.go index b491fbc82..cb9075601 100644 --- a/operator/controllers/orchestrator/client/clientset/versioned/typed/netapp/v1/netapp_client.go +++ b/operator/controllers/orchestrator/client/clientset/versioned/typed/netapp/v1/netapp_client.go @@ -1,4 +1,4 @@ -// Copyright 2021 NetApp, Inc. All Rights Reserved. +// Copyright 2023 NetApp, Inc. All Rights Reserved. // Code generated by client-gen. DO NOT EDIT. diff --git a/operator/controllers/orchestrator/client/clientset/versioned/typed/netapp/v1/tridentorchestrator.go b/operator/controllers/orchestrator/client/clientset/versioned/typed/netapp/v1/tridentorchestrator.go index 52c35cc70..505bac55b 100644 --- a/operator/controllers/orchestrator/client/clientset/versioned/typed/netapp/v1/tridentorchestrator.go +++ b/operator/controllers/orchestrator/client/clientset/versioned/typed/netapp/v1/tridentorchestrator.go @@ -1,4 +1,4 @@ -// Copyright 2021 NetApp, Inc. All Rights Reserved. +// Copyright 2023 NetApp, Inc. All Rights Reserved. // Code generated by client-gen. DO NOT EDIT. diff --git a/operator/controllers/orchestrator/client/informers/externalversions/factory.go b/operator/controllers/orchestrator/client/informers/externalversions/factory.go index ec1297632..7f56bc1ce 100644 --- a/operator/controllers/orchestrator/client/informers/externalversions/factory.go +++ b/operator/controllers/orchestrator/client/informers/externalversions/factory.go @@ -1,4 +1,4 @@ -// Copyright 2021 NetApp, Inc. All Rights Reserved. +// Copyright 2023 NetApp, Inc. All Rights Reserved. // Code generated by informer-gen. DO NOT EDIT. diff --git a/operator/controllers/orchestrator/client/informers/externalversions/generic.go b/operator/controllers/orchestrator/client/informers/externalversions/generic.go index f3ba8fa7c..966d1f1f0 100644 --- a/operator/controllers/orchestrator/client/informers/externalversions/generic.go +++ b/operator/controllers/orchestrator/client/informers/externalversions/generic.go @@ -1,4 +1,4 @@ -// Copyright 2021 NetApp, Inc. All Rights Reserved. +// Copyright 2023 NetApp, Inc. All Rights Reserved. // Code generated by informer-gen. DO NOT EDIT. diff --git a/operator/controllers/orchestrator/client/informers/externalversions/internalinterfaces/factory_interfaces.go b/operator/controllers/orchestrator/client/informers/externalversions/internalinterfaces/factory_interfaces.go index 04cd642f4..20457a9f6 100644 --- a/operator/controllers/orchestrator/client/informers/externalversions/internalinterfaces/factory_interfaces.go +++ b/operator/controllers/orchestrator/client/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -1,4 +1,4 @@ -// Copyright 2021 NetApp, Inc. All Rights Reserved. +// Copyright 2023 NetApp, Inc. All Rights Reserved. // Code generated by informer-gen. DO NOT EDIT. diff --git a/operator/controllers/orchestrator/client/informers/externalversions/netapp/interface.go b/operator/controllers/orchestrator/client/informers/externalversions/netapp/interface.go index dde656213..bc21b7157 100644 --- a/operator/controllers/orchestrator/client/informers/externalversions/netapp/interface.go +++ b/operator/controllers/orchestrator/client/informers/externalversions/netapp/interface.go @@ -1,4 +1,4 @@ -// Copyright 2021 NetApp, Inc. All Rights Reserved. +// Copyright 2023 NetApp, Inc. All Rights Reserved. // Code generated by informer-gen. DO NOT EDIT. diff --git a/operator/controllers/orchestrator/client/informers/externalversions/netapp/v1/interface.go b/operator/controllers/orchestrator/client/informers/externalversions/netapp/v1/interface.go index 75d43864c..c2988b25d 100644 --- a/operator/controllers/orchestrator/client/informers/externalversions/netapp/v1/interface.go +++ b/operator/controllers/orchestrator/client/informers/externalversions/netapp/v1/interface.go @@ -1,4 +1,4 @@ -// Copyright 2021 NetApp, Inc. All Rights Reserved. +// Copyright 2023 NetApp, Inc. All Rights Reserved. // Code generated by informer-gen. DO NOT EDIT. diff --git a/operator/controllers/orchestrator/client/informers/externalversions/netapp/v1/tridentorchestrator.go b/operator/controllers/orchestrator/client/informers/externalversions/netapp/v1/tridentorchestrator.go index 728cffdd9..f1b9b223c 100644 --- a/operator/controllers/orchestrator/client/informers/externalversions/netapp/v1/tridentorchestrator.go +++ b/operator/controllers/orchestrator/client/informers/externalversions/netapp/v1/tridentorchestrator.go @@ -1,4 +1,4 @@ -// Copyright 2021 NetApp, Inc. All Rights Reserved. +// Copyright 2023 NetApp, Inc. All Rights Reserved. // Code generated by informer-gen. DO NOT EDIT. diff --git a/operator/controllers/orchestrator/client/listers/netapp/v1/expansion_generated.go b/operator/controllers/orchestrator/client/listers/netapp/v1/expansion_generated.go index 3476e5a6e..3f9e69781 100644 --- a/operator/controllers/orchestrator/client/listers/netapp/v1/expansion_generated.go +++ b/operator/controllers/orchestrator/client/listers/netapp/v1/expansion_generated.go @@ -1,4 +1,4 @@ -// Copyright 2021 NetApp, Inc. All Rights Reserved. +// Copyright 2023 NetApp, Inc. All Rights Reserved. // Code generated by lister-gen. DO NOT EDIT. diff --git a/operator/controllers/orchestrator/client/listers/netapp/v1/tridentorchestrator.go b/operator/controllers/orchestrator/client/listers/netapp/v1/tridentorchestrator.go index fd320dc4c..42e2ef315 100644 --- a/operator/controllers/orchestrator/client/listers/netapp/v1/tridentorchestrator.go +++ b/operator/controllers/orchestrator/client/listers/netapp/v1/tridentorchestrator.go @@ -1,4 +1,4 @@ -// Copyright 2021 NetApp, Inc. All Rights Reserved. +// Copyright 2023 NetApp, Inc. All Rights Reserved. // Code generated by lister-gen. DO NOT EDIT. diff --git a/operator/controllers/orchestrator/installer/installer.go b/operator/controllers/orchestrator/installer/installer.go index c26f883bc..62ebbf5b3 100644 --- a/operator/controllers/orchestrator/installer/installer.go +++ b/operator/controllers/orchestrator/installer/installer.go @@ -67,6 +67,7 @@ var ( imageRegistry string kubeletDir string imagePullPolicy string + cloudProvider string acpImage string enableACP bool @@ -398,6 +399,7 @@ func (i *Installer) setInstallationParams( if cr.Spec.ImagePullPolicy != "" { imagePullPolicy = cr.Spec.ImagePullPolicy } + cloudProvider = cr.Spec.CloudProvider // Owner Reference details set on each of the Trident object created by the operator controllingCRDetails := make(map[string]string) @@ -1413,6 +1415,7 @@ func (i *Installer) createOrPatchTridentDeployment( ServiceAccountName: serviceAccName, ImagePullPolicy: imagePullPolicy, EnableForceDetach: enableForceDetach, + CloudProvider: cloudProvider, ACPImage: acpImage, EnableACP: enableACP, } diff --git a/storage/factory/factory.go b/storage/factory/factory.go index c883027e3..d5341056a 100644 --- a/storage/factory/factory.go +++ b/storage/factory/factory.go @@ -99,7 +99,7 @@ func NewStorageBackendForConfig( Logc(ctx).WithField("error", err).Error("Could not initialize storage driver.") sb = storage.NewFailedStorageBackend(ctx, storageDriver) - err = fmt.Errorf("problem initializing storage driver '%s': %v", commonConfig.StorageDriverName, err) + err = fmt.Errorf("problem initializing storage driver '%s': %w", commonConfig.StorageDriverName, err) } else { Logc(ctx).WithField("driver", commonConfig.StorageDriverName).Info("Storage driver initialized.") diff --git a/storage_drivers/azure/api/azure.go b/storage_drivers/azure/api/azure.go index da7d9aa34..6ac39de91 100644 --- a/storage_drivers/azure/api/azure.go +++ b/storage_drivers/azure/api/azure.go @@ -8,6 +8,7 @@ import ( "encoding/json" "fmt" "io" + "net" "net/http" "regexp" "time" @@ -16,11 +17,14 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" netapp "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v4" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2" resourcegraph "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcegraph/armresourcegraph" features "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armfeatures" "github.com/cenkalti/backoff/v4" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient" + "sigs.k8s.io/cloud-provider-azure/pkg/nodeipam/ipam/cidrset" . "github.com/netapp/trident/logging" "github.com/netapp/trident/storage" @@ -39,6 +43,13 @@ const ( SDKMaxRetryDelay = 15 * time.Second CorrelationIDHeader = "X-Ms-Correlation-Request-Id" SubvolumeNameSeparator = "-file-" + DefaultCredentialFilePath = "/etc/kubernetes/azure.json" + DefaultAccountNamePrefix = "aks-anf-account-" + DefaultPoolNamePrefix = "aks-anf-pool-" + DefaultSubnetNamePrefix = "aks-anf-subnet-" + DefaultServiceLevel = netapp.ServiceLevelStandard + DefaultPoolSize = 10 * 1099511627776 // 10 TiB + DefaultSubnetMaskSize = 24 ) var ( @@ -53,11 +64,12 @@ var ( // ClientConfig holds configuration data for the API driver object. type ClientConfig struct { // Azure API authentication parameters - SubscriptionID string - TenantID string - ClientID string - ClientSecret string - Location string + azclient.AzureAuthConfig + SubscriptionID string `json:"subscriptionId"` + Location string `json:"location"` + ResourceGroup string `json:"resourceGroup"` + VnetName string `json:"vnetName"` + VnetResourceGroup string `json:"vnetResourceGroup"` StorageDriverName string // Options @@ -68,12 +80,16 @@ type ClientConfig struct { // AzureClient holds operational Azure SDK objects. type AzureClient struct { - Credential *azidentity.ClientSecretCredential + Credential azcore.TokenCredential FeaturesClient *features.Client GraphClient *resourcegraph.Client VolumesClient *netapp.VolumesClient SnapshotsClient *netapp.SnapshotsClient SubvolumesClient *netapp.SubvolumesClient + AccountClient *netapp.AccountsClient + PoolsClient *netapp.PoolsClient + SubnetsClient *armnetwork.SubnetsClient + VnetClient *armnetwork.VirtualNetworksClient AzureResources } @@ -136,8 +152,7 @@ func NewDriver(config ClientConfig) (Azure, error) { if config.Location == "" { return nil, errors.New("location must be specified in the config") } - - credential, err := azidentity.NewClientSecretCredential(config.TenantID, config.ClientID, config.ClientSecret, nil) + credential, err := GetAzureCredential(config) if err != nil { return nil, err } @@ -183,6 +198,20 @@ func NewDriver(config ClientConfig) (Azure, error) { if err != nil { return nil, err } + accountClient, err := netapp.NewAccountsClient(config.SubscriptionID, credential, clientOptions) + if err != nil { + return nil, err + } + poolsClient, err := netapp.NewPoolsClient(config.SubscriptionID, credential, clientOptions) + if err != nil { + return nil, err + } + networkClientFactory, err := armnetwork.NewClientFactory(config.SubscriptionID, credential, clientOptions) + if err != nil { + return nil, err + } + subnetsClient := networkClientFactory.NewSubnetsClient() + vnetClient := networkClientFactory.NewVirtualNetworksClient() sdkClient := &AzureClient{ Credential: credential, @@ -191,6 +220,10 @@ func NewDriver(config ClientConfig) (Azure, error) { VolumesClient: volumesClient, SnapshotsClient: snapshotsClient, SubvolumesClient: subvolumesClient, + AccountClient: accountClient, + PoolsClient: poolsClient, + SubnetsClient: subnetsClient, + VnetClient: vnetClient, } return Client{ @@ -199,13 +232,230 @@ func NewDriver(config ClientConfig) (Azure, error) { }, nil } +func GetAzureCredential(config ClientConfig) (credential azcore.TokenCredential, err error) { + clientOptions, err := azclient.GetDefaultAuthClientOption(nil) + if err != nil { + return nil, errors.New("error getting default auth client option: " + err.Error()) + } + authProvider, err := azclient.NewAuthProvider(config.AzureAuthConfig, clientOptions) + if err != nil { + return nil, errors.New("error creating azure auth provider: " + err.Error()) + } + return authProvider.GetAzIdentity() +} + // Init runs startup logic after allocating the driver resources. func (c Client) Init(ctx context.Context, pools map[string]storage.Pool) error { // Map vpools to backend c.registerStoragePools(pools) // Find out what we have to work with in Azure - return c.RefreshAzureResources(ctx) + err := c.RefreshAzureResources(ctx) + if errors.IsNotFoundError(err) && shouldGenerateAzureResources(pools) { + Logc(ctx).WithError(err).Info("Generate Azure resources when not found.") + if err := c.GenerateAzureResources(ctx); err != nil { + return err + } + message := "Azure resources generated successfully, reconcile again to update cache." + Logc(ctx).Info(message) + return errors.ReconcileDeferredError(message) + } + + return err +} + +func shouldGenerateAzureResources(pools map[string]storage.Pool) bool { + for _, pool := range pools { + if pool.InternalAttributes()[PVirtualNetwork] != "" || + pool.InternalAttributes()[PSubnet] != "" || + pool.InternalAttributes()[PResourceGroups] != "" || + pool.InternalAttributes()[PCapacityPools] != "" || + pool.InternalAttributes()[PNetappAccounts] != "" { + return false + } + } + return true +} + +// GenerateAzureResources creates the Azure resources needed by Trident. +func (c Client) GenerateAzureResources(ctx context.Context) error { + accountName, exist, err := c.accountExists(ctx) + if err != nil { + return err + } + if !exist { + Logc(ctx).Info("Creating Azure NetApp Account") + accountName = DefaultAccountNamePrefix + utils.RandomNumber(8) + accountPollerResp, err := c.sdkClient.AccountClient.BeginCreateOrUpdate( + ctx, + c.config.ResourceGroup, + accountName, + netapp.Account{ + Location: to.Ptr(c.config.Location), + }, nil) + if err != nil { + return err + } + _, err = accountPollerResp.PollUntilDone(ctx, nil) + if err != nil { + return err + } + } + + exist, err = c.poolExists(ctx, accountName) + if err != nil { + return err + } + if !exist { + Logc(ctx).Info("Creating Azure NetApp Capacity Pools") + poolName := DefaultPoolNamePrefix + utils.RandomNumber(8) + poolPollerResp, err := c.sdkClient.PoolsClient.BeginCreateOrUpdate( + ctx, + c.config.ResourceGroup, + accountName, + poolName, + netapp.CapacityPool{ + Location: to.Ptr(c.config.Location), + Properties: &netapp.PoolProperties{ + ServiceLevel: to.Ptr(DefaultServiceLevel), + Size: to.Ptr[int64](DefaultPoolSize), + }, + }, nil) + if err != nil { + return err + } + _, err = poolPollerResp.PollUntilDone(ctx, nil) + if err != nil { + return err + } + } + + vnetGetResp, exist, err := c.subnetExists(ctx) + if err != nil { + return err + } + if !exist { + Logc(ctx).Info("Get Available Subnet address range") + vnetAddressSpace := vnetGetResp.Properties.AddressSpace.AddressPrefixes[0] + var existingSubnetAddressSpaces []*string + for _, subnet := range vnetGetResp.Properties.Subnets { + existingSubnetAddressSpaces = append(existingSubnetAddressSpaces, subnet.Properties.AddressPrefix) + existingSubnetAddressSpaces = append(existingSubnetAddressSpaces, subnet.Properties.AddressPrefixes...) + } + availableSubnetAddressRange, err := getAvailableSubnetAddressRange(vnetAddressSpace, existingSubnetAddressSpaces, DefaultSubnetMaskSize) + if err != nil { + return err + } + + Logc(ctx).Info("Creating and delegating subnet") + vnetResourceGroup := c.config.VnetResourceGroup + if vnetResourceGroup == "" { + vnetResourceGroup = c.config.ResourceGroup + } + subnetName := DefaultSubnetNamePrefix + utils.RandomNumber(8) + subnetPollerResp, err := c.sdkClient.SubnetsClient.BeginCreateOrUpdate( + ctx, + vnetResourceGroup, + c.config.VnetName, + subnetName, + armnetwork.Subnet{ + Properties: &armnetwork.SubnetPropertiesFormat{ + Delegations: to.SliceOfPtrs(armnetwork.Delegation{ + Name: to.Ptr("Microsoft.Netapp/volumes"), + Properties: &armnetwork.ServiceDelegationPropertiesFormat{ + ServiceName: to.Ptr("Microsoft.Netapp/volumes"), + }, + }), + AddressPrefix: to.Ptr(availableSubnetAddressRange), + }, + }, nil) + if err != nil { + return err + } + _, err = subnetPollerResp.PollUntilDone(ctx, nil) + if err != nil { + return err + } + } + + return nil +} + +func (c Client) accountExists(ctx context.Context) (string, bool, error) { + pager := c.sdkClient.AccountClient.NewListPager(c.config.ResourceGroup, nil) + accounts := make([]*netapp.Account, 0) + for pager.More() { + resp, err := pager.NextPage(ctx) + if err != nil { + return "", false, err + } + accounts = append(accounts, resp.Value...) + } + if len(accounts) == 0 { + return "", false, nil + } + return *accounts[0].Name, true, nil +} + +func (c Client) poolExists(ctx context.Context, accountName string) (bool, error) { + pager := c.sdkClient.PoolsClient.NewListPager(c.config.ResourceGroup, accountName, nil) + pools := make([]*netapp.CapacityPool, 0) + for pager.More() { + resp, err := pager.NextPage(ctx) + if err != nil { + return false, err + } + pools = append(pools, resp.Value...) + } + return len(pools) > 0, nil +} + +func (c Client) subnetExists(ctx context.Context) (*armnetwork.VirtualNetworksClientGetResponse, bool, error) { + vnetResourceGroup := c.config.VnetResourceGroup + if vnetResourceGroup == "" { + vnetResourceGroup = c.config.ResourceGroup + } + vnetGetResp, err := c.sdkClient.VnetClient.Get(ctx, vnetResourceGroup, c.config.VnetName, nil) + if err != nil { + return nil, false, err + } + for _, subnet := range vnetGetResp.Properties.Subnets { + for _, delegation := range subnet.Properties.Delegations { + if *delegation.Properties.ServiceName == "Microsoft.Netapp/volumes" { + Logc(ctx).Infof("The 'Microsoft.NetApp/volumes' delegation can only exist on one subnet within a VNet. There is already a delegation on subnet %s, skip creating subnet", *subnet.Name) + return nil, true, nil + } + } + } + return &vnetGetResp, false, nil +} + +// getAvailableSubnetAddressRange returns an available subnet address range, which must be unique within the VNet address space +// and can't overlap with other subnet address ranges in the virtual network. +func getAvailableSubnetAddressRange(vnetAddressSpace *string, existingSubnetAddressSpaces []*string, maskSize int) (string, error) { + _, vnetCIDR, _ := net.ParseCIDR(*vnetAddressSpace) + cidrSet, err := cidrset.NewCIDRSet(vnetCIDR, maskSize) + if err != nil { + return "", err + } + + var cidrIntersect = func(cidr1, cidr2 *net.IPNet) bool { + return cidr1.Contains(cidr2.IP) || cidr2.Contains(cidr1.IP) + } + + var cidr *net.IPNet + for cidr, err = cidrSet.AllocateNext(); err == nil; cidr, err = cidrSet.AllocateNext() { + for _, subnetAddressSpace := range existingSubnetAddressSpaces { + _, subnetCIDR, _ := net.ParseCIDR(*subnetAddressSpace) + if cidrIntersect(cidr, subnetCIDR) { + goto CONTINUE + } + } + return cidr.String(), nil + CONTINUE: + } + + return "", err } // RegisterStoragePool makes a note of pools defined by the driver for later mapping. diff --git a/storage_drivers/azure/api/azure_discovery.go b/storage_drivers/azure/api/azure_discovery.go index 2f4443d0d..7c380f6d2 100644 --- a/storage_drivers/azure/api/azure_discovery.go +++ b/storage_drivers/azure/api/azure_discovery.go @@ -199,13 +199,13 @@ func (c Client) DiscoverAzureResources(ctx context.Context) (returnError error) numSubnets := len(newSubnetMap) if numResourceGroups == 0 { - return errors.New("no resource groups discovered; check connectivity, credentials") + return errors.NotFoundError("no resource groups discovered; check connectivity, credentials") } if numCapacityPools == 0 { - return errors.New("no capacity pools discovered; volume provisioning may fail until corrected") + return errors.NotFoundError("no capacity pools discovered; volume provisioning may fail until corrected") } if numSubnets == 0 { - return errors.New("no ANF subnets discovered; volume provisioning may fail until corrected") + return errors.NotFoundError("no ANF subnets discovered; volume provisioning may fail until corrected") } Logc(ctx).WithFields(LogFields{ @@ -576,7 +576,7 @@ func (c Client) discoverCapacityPools(ctx context.Context) (*[]*CapacityPool, er if resourceList.Data == nil || resourceList.Count == nil || *resourceList.Count == 0 { Logc(ctx).WithFields(logFields).Error("Capacity pool query returned no data.") - return nil, errors.New("capacity pool query returned no data") + return nil, errors.NotFoundError("capacity pool query returned no data") } else if data, ok = resourceList.Data.([]interface{}); !ok { Logc(ctx).WithFields(logFields).Error("Capacity pool query returned invalid data.") return nil, errors.New("capacity pool query returned invalid data") @@ -730,7 +730,7 @@ func (c Client) discoverSubnets(ctx context.Context) (*[]*Subnet, error) { if resourceList.Data == nil || resourceList.Count == nil || *resourceList.Count == 0 { Logc(ctx).WithFields(logFields).Error("Subnet query returned no data.") - return nil, errors.New("subnet query returned no data") + return nil, errors.NotFoundError("subnet query returned no data") } else if data, ok = resourceList.Data.([]interface{}); !ok { Logc(ctx).WithFields(logFields).Error("Subnet query returned invalid data.") return nil, errors.New("subnet pool query returned invalid data") diff --git a/storage_drivers/azure/azure_anf.go b/storage_drivers/azure/azure_anf.go index f930953c7..024a4d689 100644 --- a/storage_drivers/azure/azure_anf.go +++ b/storage_drivers/azure/azure_anf.go @@ -6,7 +6,9 @@ import ( "context" "encoding/json" "fmt" + "io/ioutil" "net" + "os" "reflect" "regexp" "strconv" @@ -16,6 +18,7 @@ import ( "github.com/RoaringBitmap/roaring" "github.com/google/uuid" "go.uber.org/multierr" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient" tridentconfig "github.com/netapp/trident/config" . "github.com/netapp/trident/logging" @@ -57,6 +60,8 @@ const ( nfsVersion3 = "3" nfsVersion4 = "4" nfsVersion41 = "4.1" + + DefaultCredentialFilePath = "/etc/kubernetes/azure.json" ) var ( @@ -179,7 +184,7 @@ func (d *NASStorageDriver) Initialize( d.initializeTelemetry(ctx, backendUUID) if err = d.initializeAzureSDKClient(ctx, &d.Config); err != nil { - return fmt.Errorf("error initializing %s SDK client. %v", d.Name(), err) + return fmt.Errorf("error initializing %s SDK client. %w", d.Name(), err) } if err = d.validate(ctx); err != nil { @@ -529,17 +534,36 @@ func (d *NASStorageDriver) initializeAzureSDKClient( } } - client, err := api.NewDriver(api.ClientConfig{ - SubscriptionID: config.SubscriptionID, - TenantID: config.TenantID, - ClientID: config.ClientID, - ClientSecret: config.ClientSecret, + var clientConfig = api.ClientConfig{ + SubscriptionID: config.SubscriptionID, + AzureAuthConfig: azclient.AzureAuthConfig{ + TenantID: config.TenantID, + AADClientID: config.ClientID, + AADClientSecret: config.ClientSecret, + }, Location: config.Location, StorageDriverName: config.StorageDriverName, DebugTraceFlags: config.DebugTraceFlags, SDKTimeout: sdkTimeout, MaxCacheAge: maxCacheAge, - }) + } + + if config.ClientSecret == "" && config.ClientID == "" { + credFilePath := os.Getenv("AZURE_CREDENTIAL_FILE") + if credFilePath == "" { + credFilePath = DefaultCredentialFilePath + } + Logc(ctx).WithField("credFilePath", credFilePath).Info("Using Azure credential config file.") + credFile, err := ioutil.ReadFile(credFilePath) + if err != nil { + return errors.New("error reading from azure config file: " + err.Error()) + } + if err = json.Unmarshal(credFile, &clientConfig); err != nil { + return errors.New("error parsing azureAuthConfig: " + err.Error()) + } + } + + client, err := api.NewDriver(clientConfig) if err != nil { return err } diff --git a/storage_drivers/azure/azure_anf_subvolume.go b/storage_drivers/azure/azure_anf_subvolume.go index 18495cc91..595515fb3 100644 --- a/storage_drivers/azure/azure_anf_subvolume.go +++ b/storage_drivers/azure/azure_anf_subvolume.go @@ -7,6 +7,8 @@ import ( "crypto/sha256" "encoding/json" "fmt" + "io/ioutil" + "os" "reflect" "regexp" "strconv" @@ -14,6 +16,7 @@ import ( "time" "github.com/RoaringBitmap/roaring" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient" tridentconfig "github.com/netapp/trident/config" . "github.com/netapp/trident/logging" @@ -566,17 +569,36 @@ func (d *NASBlockStorageDriver) initializeAzureSDKClient( } } - client, err := api.NewDriver(api.ClientConfig{ - SubscriptionID: config.SubscriptionID, - TenantID: config.TenantID, - ClientID: config.ClientID, - ClientSecret: config.ClientSecret, + var clientConfig = api.ClientConfig{ + SubscriptionID: config.SubscriptionID, + AzureAuthConfig: azclient.AzureAuthConfig{ + TenantID: config.TenantID, + AADClientID: config.ClientID, + AADClientSecret: config.ClientSecret, + }, Location: config.Location, StorageDriverName: config.StorageDriverName, DebugTraceFlags: config.DebugTraceFlags, SDKTimeout: sdkTimeout, MaxCacheAge: maxCacheAge, - }) + } + + if config.ClientSecret == "" && config.ClientID == "" { + credFilePath := os.Getenv("AZURE_CREDENTIAL_FILE") + if credFilePath == "" { + credFilePath = DefaultCredentialFilePath + } + Logc(ctx).WithField("credFilePath", credFilePath).Info("Using Azure credential config file.") + credFile, err := ioutil.ReadFile(credFilePath) + if err != nil { + return errors.New("error reading from azure config file: " + err.Error()) + } + if err = json.Unmarshal(credFile, &clientConfig); err != nil { + return errors.New("error parsing azureAuthConfig: " + err.Error()) + } + } + + client, err := api.NewDriver(clientConfig) if err != nil { return err } diff --git a/storage_drivers/types.go b/storage_drivers/types.go index 7b42e87a4..99ccd6f5a 100644 --- a/storage_drivers/types.go +++ b/storage_drivers/types.go @@ -558,10 +558,6 @@ func (d AzureNASStorageDriverConfig) SpecOnlyValidation() error { return fmt.Errorf("input contains forbidden attributes: %v", forbiddenList) } - if !d.HasCredentials() { - return fmt.Errorf("input is missing the credentials field") - } - return nil } diff --git a/utils/utils.go b/utils/utils.go index 2db01c968..aad88c927 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -321,9 +321,7 @@ func GetV(opts map[string]string, keys, defaultValue string) string { return defaultValue } -// RandomString returns a string of the specified length consisting only of alphabetic characters. -func RandomString(strSize int) string { - chars := "ABCDEFGHIJKLMNOPQRSTUVWXYZ" +func Random(chars string, strSize int) string { bytes := make([]byte, strSize) _, err := rand.Read(bytes) if err != nil { @@ -335,6 +333,15 @@ func RandomString(strSize int) string { return string(bytes) } +// RandomString returns a string of the specified length consisting only of alphabetic characters. +func RandomString(strSize int) string { + return Random("ABCDEFGHIJKLMNOPQRSTUVWXYZ", strSize) +} + +func RandomNumber(numSize int) string { + return Random("0123456789", numSize) +} + // StringInSlice checks whether a string is in a list of strings func StringInSlice(s string, list []string) bool { for _, item := range list {