Release target date: October 2, 2023
When installing the operator, users must replace INSERT-SOURCE-NAME with a some string.
But many don't, which makes this a common source (no pun intended O of errors for customers.
Is there a way to force them to insert a source name during operator installation? Or just automagically generate a source name from some source (eg cluster id) data?
from mskarbek
I think there are 2 options to accomplish this:
- create a validation pattern for the source name. This would be a regex that excludes INSERT-SOURCE-NAME as a valid source name. This route prevents a user from creating a CR with INSERT-SOURCE-NAME as their source name.
- do not validate the name, but check the sourceName in the code, and change it to the cluster-id if the sourceName is defined as INSERT-SOURCE-NAME.
I tried the a regex pattern (which we would add here in the api definition):
// +kubebuilder:validation:Pattern=`^((?!INSERT-SOURCE-NAME).)*$`
but that failed with:
The CustomResourceDefinition "kokumetricsconfigs.koku-metrics-cfg.openshift.io" is invalid: spec.validation.openAPIV3Schema.properties[spec].properties[source].properties[name].pattern: Invalid value: "^((?! must be a valid regular expression, but isn't: error parsing regexp: invalid or unsupported Perl syntax: `(?!` make: *** [install] Error 1
Basically, that regex pattern is not compatible with Go regex. So we would need to figure out how to construction a regex that excludes INSERT-SOURCE-NAME that is go compatible.
For the code route, we probably want to check the value of the source name here. Then we could do something like:
StringReflectSpec(r, cr, &cr.Spec.Source.SourceName, &cr.Status.Source.SourceName, "") if cr.Status.Source.SourceName == "INSERT-SOURCE-NAME" { cr.Status.Source.SourceName = cr.Status.ClusterID }
- blocks
-
COST-4107 release epic for V3.0.0
- Closed
- clones
-
COST-4035 Get rid of INSERT-SOURCE-NAME
- Closed
- is duplicated by
-
COST-1618 Operator: replace INSERT_SOURCE_NAME with cluster-uuid if CR is not updated
- Closed
- is related to
-
COST-4107 release epic for V3.0.0
- Closed
- relates to
-
COST-1618 Operator: replace INSERT_SOURCE_NAME with cluster-uuid if CR is not updated
- Closed
- links to
-
RHEA-2023:120538 Cost Management enhancement update