Skip to content

Conversation

@Vafilor
Copy link
Contributor

@Vafilor Vafilor commented Jun 16, 2020

What this PR does:

Updates the workspace templates so that runtime variables like the DOMAIN are injected when the workspace is is created instead of when the workspace template is created.

This also updates the server so that it reloads data upon a detected configuration change, so variables like DOMAIN are always up to date.

Which issue(s) this PR fixes:

Fixes #348

Special notes for your reviewer:

For the runtime variables, there are 3 main places of interest.

  • When we create a template for viewing, as when we generate a dynamic template while creating/editing a workspace template. In this situation, we need to inject runtime variables for things like the Machine Type dropdown.
  • Whenever we get a Workspace Template, we need to modify the manifest to include the variables.
  • When we create the Workflow Execution for a Workspace. The Argo WorkflowTemplate needs to have the appropriate variables injected into it.

NOTE:
If you attempt to view the YAML in the workflow execution, it will not have the injected variables as it gets the Workflow Execution, and we do not know to inject the runtime variables there. We might want to eventually add a method to get the workflow execution yaml for a Workspace to get around this.

@Vafilor Vafilor requested a review from rushtehrani June 16, 2020 01:58
@Vafilor Vafilor changed the base branch from master to dev June 16, 2020 01:58
main.go Outdated
}

go Run(client, "onepanel", stopCh, func(configMap *corev1.ConfigMap) error {
log.Printf("Configmap changed")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can get rid of this, it's more for debugging.

main.go Outdated
log.Fatalf("Failed to serve RPC server: %v", err)
}

log.Infof("GRPC finished")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can get rid of this, it's more for debugging.

@rushtehrani rushtehrani added this to the v0.11.0 milestone Jun 17, 2020
@rushtehrani
Copy link
Contributor

@Vafilor getting this error when trying to create a Workspace:

image

@Vafilor
Copy link
Contributor Author

Vafilor commented Jun 17, 2020

@Vafilor getting this error when trying to create a Workspace:

image

@rushtehrani Added a migration. Please pull and try again.

@rushtehrani
Copy link
Contributor

@rushtehrani Added a migration. Please pull and try again.

That did it

@rushtehrani
Copy link
Contributor

rushtehrani commented Jun 17, 2020

@Vafilor Another issue, I think a merge/rebase has gone wrong:

Pod "rbac-test-0" is invalid: spec.containers[0].volumeMounts[1].name: Not found: "sys-dshm"

@Vafilor
Copy link
Contributor Author

Vafilor commented Jun 17, 2020

@Vafilor Another issue, I think a merge/rebase has gone wrong:

Pod "rbac-test-0" is invalid: spec.containers[0].volumeMounts[1].name: Not found: "sys-dshm"

Taking a look.

@rushtehrani
Copy link
Contributor

I think it's the missing volume

@Vafilor
Copy link
Contributor Author

Vafilor commented Jun 17, 2020

I think it's the missing volume

That's most likely it - pushed up a fix.

return nil, util.NewUserError(codes.NotFound, "Error with getting workflow template.")
}

if runtimeVars != nil && workflowTemplate.ArgoWorkflowTemplate != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this section should be here. It's unique to Workspaces only. Other calls to CreateWorkflowExecution may never have "stateful-set-resource" or VirtualService. Can we inject these into the template before it's passed in here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rushtehrani I agree, we need to separate the concerns here.

The code above gets the workflow template and that also gets the k8s argo template. At the moment, we can't modify it beforehand because it gets it in this function.

We could change the function so that we pass in the workflow template with the argo contents pre-loaded.
That way it does less work and is more configurable.

What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Vafilor parameters are showing and configuration reload is working. Is this the only change that remains?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rushtehrani Yes, I should have it ready by tomorrow morning.

return nil, err
}

_, err = c.CreateWorkflowExecution(namespace, &WorkflowExecution{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Vafilor in reference to this comment. Ideally this we want to make the override before they're passed into CreateWorkflowExecution here.

@rushtehrani
Copy link
Contributor

@Vafilor another issue I ran into is that the nodepool changes don't update after 2 or 3 changes, seems like the watcher stops working after a while.

@Vafilor
Copy link
Contributor Author

Vafilor commented Jun 17, 2020

@Vafilor another issue I ran into is that the nodepool changes don't update after 2 or 3 changes, seems like the watcher stops working after a while.

That's weird. I'll take a look.

@rushtehrani
Copy link
Contributor

@Vafilor another issue is that now sys-nodepool and other runtime params aren't showing in Workspace details.

@rushtehrani
Copy link
Contributor

@Vafilor nodepool values not updating when config is updated is still an issue. I'm testing by updating applicationNodePoolOptions values in system configmap and I don't see the changes in the UI.

@rushtehrani rushtehrani changed the base branch from dev to master June 18, 2020 20:56
@rushtehrani rushtehrani changed the base branch from master to dev June 18, 2020 20:56
pkg/config.go Outdated
}

// OnepanelDomain gets the ONEPANEL_DOMAIN value, or nil.
func (s SystemConfig) OnepanelDomain() *string {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's just call this Domain. I think we should also have FQDN here too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rushtehrani Makes sense, and sure thing. I'm slowly adding them as I encounter them in the code.

@rushtehrani rushtehrani merged commit 5fe3ef9 into dev Jun 19, 2020
@rushtehrani rushtehrani deleted the feat/onepanelio.core-348.system.updates branch June 19, 2020 02:31
@rushtehrani rushtehrani changed the title feat: runtime variables and system config change reload feat: Runtime variables and system config change reload Jun 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Runtime variables and system config change reload

3 participants