-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[NU-2048] (K8s DM) Fix for: k8s object name sanitizing strategy somet…
…imes generated invalid object names, in other cases, (#7616) it generated names with unnecessary characters appended
- Loading branch information
Showing
16 changed files
with
255 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...ager/src/main/scala/pl/touk/nussknacker/k8s/manager/OptionalNussknackerInstanceName.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package pl.touk.nussknacker.k8s.manager | ||
|
||
import net.ceedubs.ficus.Ficus | ||
import net.ceedubs.ficus.Ficus._ | ||
import net.ceedubs.ficus.readers.ValueReader | ||
|
||
class OptionalNussknackerInstanceName private (val valueOpt: Option[String]) { | ||
def isEmpty: Boolean = valueOpt.isEmpty | ||
|
||
def objectNameWithoutSanitization(mainObjectNamePart: String): String = | ||
instanceNamePrefix + mainObjectNamePart | ||
|
||
def instanceNamePrefix: String = valueOpt.map(_ + "-").getOrElse("") | ||
} | ||
|
||
object OptionalNussknackerInstanceName { | ||
val empty: OptionalNussknackerInstanceName = new OptionalNussknackerInstanceName(None) | ||
|
||
// This method is for unit tests purpose only, for production usage, this name is parsed from configuration | ||
def forInstanceName(value: String): OptionalNussknackerInstanceName = new OptionalNussknackerInstanceName(Some(value)) | ||
|
||
implicit val valueReader: ValueReader[OptionalNussknackerInstanceName] = | ||
Ficus.optionValueReader[String].map(new OptionalNussknackerInstanceName(_)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.