lightbend / cloudflow

Cloudflow enables users to quickly develop, orchestrate, and operate distributed streaming applications on Kubernetes.
https://cloudflow.io
Apache License 2.0
321 stars 90 forks source link

Cloudflow operator crashes on metadata.labels in Kafka topic that exceeds 63 chars. github #205 #335

Closed michaelpnash closed 4 years ago

michaelpnash commented 4 years ago

User reported:

Just ran into another problem with the deployment after I changed the name of some of our Streamlets, Inlets and Outlets. Thecloudflow-operatorcrashes because the name is too long for the kafka topic.

2020-03-27 10:12:31,093 ERROR [ActorSystemImpl] - The actions stream failed, terminating.
skuber.api.client.package$K8SException: Status(v1,Status,ListMeta(,,None),Some(Failure),Some(KafkaTopic.kafka.strimzi.io "<name>" is invalid: metadata.labels: Invalid value: "<name>": must be no more than 63 characters),Some(Invalid),Some({"name":"<name>","group":"kafka.strimzi.io","kind":"KafkaTopic","causes":[{"reason":"FieldValueInvalid","message":"Invalid value: \"<name>\": must be no more than 63 characters","field":"metadata.labels"}]}),Some(422))

Seehttps://github.com/lightbend/cloudflow/issues/205

michaelpnash commented 4 years ago

Raymond Roestenburg commented in Jira:

HeyChaoran YuThis:

"<name>" is invalid: metadata.labels: Invalid value: "<name>": must be no more than 63 characters),Some(Invalid),Some({"name":"<name>",

Might have been confusing. We redacted the value of label to . The name of the topic isnotthe issue, the issue is the **metadata.labels**, which is set in

labels = labels(savepoint.name) + ("strimzi.io/cluster" -> clusterName)

Here:

https://github.com/lightbend/cloudflow/blob/5d4dba6c11d32cf0e816897312f9ae360efe73c6/core/cloudflow-operator/src/main/scala/cloudflow/operator/action/SavepointActions.scala#L107

One of these values is too big.

It seems labels are only allowed 63 chars, so we should actually truncate all labels that we set to that, add a function toName, likeName.ofLabeland use that appropriately, also inCloudflowLabels