-
Notifications
You must be signed in to change notification settings - Fork 72
feat: Runtime variables and system config change reload #352
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
Conversation
… updates the server accordingly.
… as it depends on config.
main.go
Outdated
| } | ||
|
|
||
| go Run(client, "onepanel", stopCh, func(configMap *corev1.ConfigMap) error { | ||
| log.Printf("Configmap changed") |
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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.
|
@Vafilor getting this error when trying to create a Workspace: |
@rushtehrani Added a migration. Please pull and try again. |
That did it |
|
@Vafilor Another issue, I think a merge/rebase has gone wrong: |
Taking a look. |
|
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 { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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{ |
There was a problem hiding this comment.
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.
|
@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. |
|
@Vafilor another issue is that now |
|
@Vafilor nodepool values not updating when config is updated is still an issue. I'm testing by updating |
… updates the server accordingly.
… as it depends on config.
…onepanelio/core into feat/onepanelio.core-348.system.updates
pkg/config.go
Outdated
| } | ||
|
|
||
| // OnepanelDomain gets the ONEPANEL_DOMAIN value, or nil. | ||
| func (s SystemConfig) OnepanelDomain() *string { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.

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.
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.