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

fix: immutableParameters will be show as dynamicParameters (#5945) #75

Merged
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
14 changes: 9 additions & 5 deletions pkg/cmd/cluster/config_observer.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,10 @@ func (r *configObserverOptions) printExplainConfigure(configSpecs configSpecsTyp
}
schema.Schema = apiSchema
}
return r.printConfigConstraint(schema.Schema, cfgutil.NewSet(confSpec.StaticParameters...), cfgutil.NewSet(confSpec.DynamicParameters...))
return r.printConfigConstraint(schema.Schema,
cfgutil.NewSet(confSpec.StaticParameters...),
cfgutil.NewSet(confSpec.DynamicParameters...),
cfgutil.NewSet(confSpec.ImmutableParameters...))
}

func (r *configObserverOptions) getReconfigureMeta(configSpecs configSpecsType) ([]types.ConfigTemplateInfo, error) {
Expand Down Expand Up @@ -286,8 +289,7 @@ func (r *configObserverOptions) isSpecificParam(paramName string) bool {
return r.paramName == paramName
}

func (r *configObserverOptions) printConfigConstraint(schema *apiext.JSONSchemaProps,
staticParameters, dynamicParameters *cfgutil.Sets) error {
func (r *configObserverOptions) printConfigConstraint(schema *apiext.JSONSchemaProps, staticParameters, dynamicParameters, immutableParameters *cfgutil.Sets) error {
var (
maxDocumentLength = 100
maxEnumLength = 20
Expand All @@ -308,7 +310,7 @@ func (r *configObserverOptions) printConfigConstraint(schema *apiext.JSONSchemaP
return err
}
pt.scope = "Global"
pt.dynamic = isDynamicType(pt, staticParameters, dynamicParameters)
pt.dynamic = isDynamicType(pt, staticParameters, dynamicParameters, immutableParameters)

if r.hasSpecificParam() {
printSingleParameterSchema(pt)
Expand Down Expand Up @@ -361,8 +363,10 @@ func getValidUpdatedParams(status appsv1alpha1.OpsRequestStatus) string {
return string(b)
}

func isDynamicType(pt *parameterSchema, staticParameters, dynamicParameters *cfgutil.Sets) bool {
func isDynamicType(pt *parameterSchema, staticParameters, dynamicParameters, immutableParameters *cfgutil.Sets) bool {
switch {
case immutableParameters.InArray(pt.name):
return false
case staticParameters.InArray(pt.name):
return false
case dynamicParameters.InArray(pt.name):
Expand Down