Skip to content

Commit 47cb18e

Browse files
fix: improve errors displayed on obs creation failure, do not fail clusterization
1 parent 91fd6de commit 47cb18e

File tree

3 files changed

+17
-14
lines changed

3 files changed

+17
-14
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ proxy_url = VALUE
466466
| <a name="input_function_app_storage_account_prefix"></a> [function\_app\_storage\_account\_prefix](#input\_function\_app\_storage\_account\_prefix) | Weka storage account name prefix | `string` | `"weka"` | no |
467467
| <a name="input_function_app_subnet_delegation_cidr"></a> [function\_app\_subnet\_delegation\_cidr](#input\_function\_app\_subnet\_delegation\_cidr) | Subnet delegation enables you to designate a specific subnet for an Azure PaaS service. | `string` | `"10.0.1.0/25"` | no |
468468
| <a name="input_function_app_subnet_delegation_id"></a> [function\_app\_subnet\_delegation\_id](#input\_function\_app\_subnet\_delegation\_id) | Required to specify if subnet\_name were used to specify pre-defined subnets for weka. Function subnet delegation requires an additional subnet, and in the case of pre-defined networking this one also should be pre-defined | `string` | `""` | no |
469-
| <a name="input_function_app_version"></a> [function\_app\_version](#input\_function\_app\_version) | Function app code version (hash) | `string` | `"bef288291e94411aa8c388613e355c4a"` | no |
469+
| <a name="input_function_app_version"></a> [function\_app\_version](#input\_function\_app\_version) | Function app code version (hash) | `string` | `"239d469255a978f32c3795d70ed84706"` | no |
470470
| <a name="input_get_weka_io_token"></a> [get\_weka\_io\_token](#input\_get\_weka\_io\_token) | The token to download the Weka release from get.weka.io. | `string` | `""` | no |
471471
| <a name="input_hotspare"></a> [hotspare](#input\_hotspare) | Number of hotspares to set on weka cluster. Refer to https://docs.weka.io/overview/ssd-capacity-management#hot-spare | `number` | `1` | no |
472472
| <a name="input_install_cluster_dpdk"></a> [install\_cluster\_dpdk](#input\_install\_cluster\_dpdk) | Install weka cluster with DPDK | `bool` | `true` | no |

function-app/code/functions/clusterize/clusterize.go

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,18 @@ import (
88
"os"
99
"strconv"
1010
"strings"
11-
"weka-deployment/common"
12-
"weka-deployment/functions/azure_functions_def"
13-
14-
"github.com/weka/go-cloud-lib/join"
15-
"github.com/weka/go-cloud-lib/utils"
1611

1712
"github.com/lithammer/dedent"
18-
1913
"github.com/weka/go-cloud-lib/clusterize"
2014
cloudCommon "github.com/weka/go-cloud-lib/common"
2115
"github.com/weka/go-cloud-lib/functions_def"
16+
"github.com/weka/go-cloud-lib/join"
2217
"github.com/weka/go-cloud-lib/logging"
2318
"github.com/weka/go-cloud-lib/protocol"
19+
"github.com/weka/go-cloud-lib/utils"
20+
21+
"weka-deployment/common"
22+
"weka-deployment/functions/azure_functions_def"
2423
)
2524

2625
func GetObsScript(obsParams common.AzureObsParams) string {
@@ -105,13 +104,16 @@ func PrepareWekaObs(ctx context.Context, p *ClusterizationParams) (err error) {
105104
}
106105

107106
if noExistingObs {
107+
common.ReportMsg(ctx, p.Vm.Name, p.StateParams, "debug", "creating OBS as no access key was provided")
108+
108109
p.Obs.AccessKey, err = common.CreateStorageAccount(
109110
ctx, p.SubscriptionId, p.ResourceGroupName, p.Location, p.Obs,
110111
)
111112
if err != nil {
112113
err = fmt.Errorf("failed to create storage account: %w", err)
114+
common.ReportMsg(ctx, p.Vm.Name, p.StateParams, "error", err.Error())
113115
logger.Error().Err(err).Send()
114-
return
116+
return nil
115117
}
116118

117119
if p.Obs.NetworkAccess == "Disabled" && p.CreateBlobPrivateEndpoint {
@@ -120,9 +122,10 @@ func PrepareWekaObs(ctx context.Context, p *ClusterizationParams) (err error) {
120122

121123
err = common.CreateStorageAccountBlobPrivateEndpoint(ctx, p.SubscriptionId, p.ResourceGroupName, p.Location, p.Obs.Name, endpointName, p.SubnetId, p.PrivateDNSZoneId)
122124
if err != nil {
123-
err = fmt.Errorf("failed to create private endpoint: %w", err)
125+
err = fmt.Errorf("failed to create private endpoint for storage account: %w", err)
126+
common.ReportMsg(ctx, p.Vm.Name, p.StateParams, "error", err.Error())
124127
logger.Error().Err(err).Send()
125-
return
128+
return nil
126129
}
127130
}
128131
}

variables.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -404,13 +404,13 @@ variable "function_app_storage_account_container_prefix" {
404404
variable "function_app_version" {
405405
type = string
406406
description = "Function app code version (hash)"
407-
default = "bef288291e94411aa8c388613e355c4a"
407+
default = "239d469255a978f32c3795d70ed84706"
408408
}
409409

410410
variable "function_app_dist" {
411411
type = string
412412
description = "Function app code dist"
413-
default = "release"
413+
default = "dev"
414414

415415
validation {
416416
condition = contains(["dev", "release"], var.function_app_dist)
@@ -500,12 +500,12 @@ variable "tiering_enable_ssd_percent" {
500500
variable "tiering_obs_container_name" {
501501
type = string
502502
default = ""
503-
description = "Name of existing obs conatiner name"
503+
description = "Name of existing obs container name."
504504
}
505505

506506
variable "tiering_blob_obs_access_key" {
507507
type = string
508-
description = "The access key of the existing Blob object store container."
508+
description = "The access key of the existing Blob object store container. If not provided, new obs will be created with given name (tiering_obs_name)."
509509
sensitive = true
510510
default = ""
511511
}

0 commit comments

Comments
 (0)