-
Notifications
You must be signed in to change notification settings - Fork 184
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
chore: refactor 1.0 parameter api #8441
base: main
Are you sure you want to change the base?
chore: refactor 1.0 parameter api #8441
Conversation
@@ -143,6 +143,8 @@ func (r *ClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct | |||
&clusterServiceTransformer{}, | |||
// handle the restore for cluster | |||
&clusterRestoreTransformer{}, | |||
// rerender parameters after v-scale and h-scale | |||
&clusterParametersTransformer{}, |
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.
It should be moved out of the cluster controller since the apps package has no knowledge about the parameters and doesn't depend on it too.
return nil | ||
} | ||
|
||
configRender, paramsDefs, err := intctrlutil.ResolveCmpdParametersDefs(transCtx, transCtx.Client, transCtx.CompDef) |
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.
Ditto
@@ -318,7 +318,7 @@ type ComponentDefinitionSpec struct { | |||
// +listType=map | |||
// +listMapKey=name | |||
// +optional | |||
Configs []ComponentConfigSpec `json:"configs,omitempty"` | |||
Configs []ComponentTemplateSpec `json:"configs,omitempty"` |
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.
The ComponentConfigSpec could be deleted from this package?
// Specifies the initialization parameters. | ||
// | ||
// +optional | ||
InitParameters ComponentParameters `json:"initParameters,omitempty"` |
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.
It should be added into spec.components.configs, and be used as init values to render config templates.
7455b95
to
cd36433
Compare
6ac1501
to
115978a
Compare
@@ -146,6 +147,7 @@ func init() { | |||
model.AddScheme(snapshotv1beta1.AddToScheme) | |||
model.AddScheme(extensionsv1alpha1.AddToScheme) | |||
model.AddScheme(workloadsv1.AddToScheme) | |||
model.AddScheme(parametersv1alpha1.AddToScheme) |
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.
From the perspective of their functionality and relationships, apps should no longer depend on parameters.
@@ -161,6 +162,7 @@ func kindsForDelete() ([]client.ObjectList, []client.ObjectList) { | |||
&corev1.SecretList{}, | |||
&dpv1alpha1.BackupPolicyList{}, | |||
&dpv1alpha1.BackupScheduleList{}, | |||
¶metersv1alpha1.ComponentParameterList{}, |
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.
Should delete parameter resources in parameters controller.
@@ -216,15 +217,15 @@ func (t *componentStatusTransformer) isAllConfigSynced(transCtx *componentTransf | |||
|
|||
configurationKey := client.ObjectKey{ |
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.
This condition for component status should be removed, since there are no more custom resources to maintain for config/script templates.
var configmaps []*corev1.ConfigMap | ||
cachedObjs := resolveRerenderDependOnObjects(dag) | ||
for _, tpls := range [][]appsv1.ComponentTemplateSpec{synthesizeComp.ScriptTemplates, synthesizeComp.ConfigTemplates} { | ||
objects, err := configctrl.RenderTemplate(reconcileCtx, cluster, synthesizeComp, comp, cachedObjs, tpls) |
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.
Cloud you move the rendering out of the configuration and define it in a separate package, so that both apps and configuration can use it independently?
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.
And, when rendering config/script templates, simply replace the variables defined by the API, no need to provide unexposed objects and built-in functions.
return nil | ||
} | ||
|
||
return configctrl.BuildReloadActionContainer(reconcileCtx, cluster, synthesizeComp, transCtx.CompDef, configmaps) |
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.
Should be switched to the reconfigure action.
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.
OK, this will be implemented in another pr: merge reloadAction into kbagent.
…o parameters controller
9c98199
to
949fa18
Compare
@@ -378,3 +383,5 @@ const ( | |||
// FailedComponentPhase indicates that there are some pods of the component not in a 'Running' state. | |||
FailedComponentPhase ComponentPhase = "Failed" | |||
) | |||
|
|||
type ComponentParameters map[string]*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.
// Better with {name:, value:}, perhaps a parameter will come from a secret or config map?
No description provided.