Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verified provider in management server before doing anything else #165

Merged
merged 1 commit into from
Sep 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"request": "launch",
"mode": "debug",
"program": "${workspaceRoot}/cmd/management",
"envFile": "${workspaceRoot}/.vscode/management.private.env",
"envFile": "${workspaceRoot}/.vscode/private.env",
"showLog": true,
"args": [
"start",
Expand Down
16 changes: 11 additions & 5 deletions internal/app/management/servers/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,17 @@ func (k *Kubernetes) Create(ctx context.Context, r *module.ModuleCreateRequest)
// a unique ID for this creation
id := fmt.Sprintf("%s-%s", r.Modulename, genID())

// Validate provider
useAzureBatchProvider := false
switch strings.ToLower(r.Provider) {
case "azurebatch":
useAzureBatchProvider = true
case "kubernetes":
// noop
default:
return nil, fmt.Errorf("unrecognized provider %s", r.Provider)
}

// Create a configmap to store the configuration details
// needed by the module. These will be mounted into the
// dispatcher as a volume and then passed on when it
Expand Down Expand Up @@ -224,11 +235,6 @@ func (k *Kubernetes) Create(ctx context.Context, r *module.ModuleCreateRequest)

configMapFilePath := "/etc/config"

useAzureBatchProvider := false
if r.Provider == "azurebatch" {
useAzureBatchProvider = true
}

// Create an argument list to provide the the dispatcher binary
dispatcherArgs := []string{
"start",
Expand Down