Skip to content

Commit

Permalink
Restructure VMSS bootstrap bash scripts for increased reliability, an…
Browse files Browse the repository at this point in the history
…d easier debugging

Move all shared code into a commonly shared file to be sourced by all
bootstrapping scripts. This allows for code reuse, minimal duplication.
Fix mdm mdsd certificate download script
Increase rpm retry time to 30 minutes total, every 30 seconds.
  • Loading branch information
s-fairchild committed Jun 10, 2024
1 parent 1a7df46 commit 965aa00
Show file tree
Hide file tree
Showing 11 changed files with 1,576 additions and 1,116 deletions.
2 changes: 1 addition & 1 deletion pkg/deploy/assets/env-development.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pkg/deploy/assets/gateway-production.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pkg/deploy/assets/rp-production.json

Large diffs are not rendered by default.

11 changes: 10 additions & 1 deletion pkg/deploy/generator/resources_dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,16 @@ func (g *generator) devProxyVMSS() *arm.Resource {
)
}

trailer := base64.StdEncoding.EncodeToString(scriptDevProxyVMSS)
var sb strings.Builder

// VMSS extensions only support one custom script
// Because of this, the commonVMSS.sh is prefixed to the bootstrapping script
// main is called at the end of the bootstrapping script, so appending commonVMSS.sh won't work
sb.WriteString(string(scriptCommonVMSS))
sb.WriteString("\n#Start of devProxyVMSS.sh\n")
sb.WriteString(string(scriptDevProxyVMSS))

trailer := base64.StdEncoding.EncodeToString([]byte(sb.String()))

parts = append(parts, "'\n'", fmt.Sprintf("base64ToString('%s')", trailer))

Expand Down
11 changes: 10 additions & 1 deletion pkg/deploy/generator/resources_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,16 @@ func (g *generator) gatewayVMSS() *arm.Resource {
"''')\n'",
)

trailer := base64.StdEncoding.EncodeToString(scriptGatewayVMSS)
var sb strings.Builder

// VMSS extensions only support one custom script
// Because of this, the commonVMSS.sh is prefixed to the bootstrapping script
// main is called at the end of the bootstrapping script, so appending commonVMSS.sh won't work
sb.WriteString(string(scriptCommonVMSS))
sb.WriteString("\n#Start of gatewayVMSS.sh\n")
sb.WriteString(string(scriptGatewayVMSS))

trailer := base64.StdEncoding.EncodeToString([]byte(sb.String()))

parts = append(parts, "'\n'", fmt.Sprintf("base64ToString('%s')", trailer))

Expand Down
11 changes: 10 additions & 1 deletion pkg/deploy/generator/resources_rp.go
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,16 @@ func (g *generator) rpVMSS() *arm.Resource {
"''')\n'",
)

trailer := base64.StdEncoding.EncodeToString(scriptRpVMSS)
var sb strings.Builder

// VMSS extensions only support one custom script
// Because of this, the commonVMSS.sh is prefixed to the bootstrapping script
// main is called at the end of the bootstrapping script, so appending commonVMSS.sh won't work
sb.WriteString(string(scriptCommonVMSS))
sb.WriteString("\n#Start of rpVMSS.sh\n")
sb.WriteString(string(scriptRpVMSS))

trailer := base64.StdEncoding.EncodeToString([]byte(sb.String()))

parts = append(parts, "'\n'", fmt.Sprintf("base64ToString('%s')", trailer))

Expand Down
3 changes: 3 additions & 0 deletions pkg/deploy/generator/scripts.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ var scriptGatewayVMSS []byte

//go:embed scripts/rpVMSS.sh
var scriptRpVMSS []byte

//go:embed scripts/commonVMSS.sh
var scriptCommonVMSS []byte
Loading

0 comments on commit 965aa00

Please sign in to comment.