public static String generateK8sName(String baseName, boolean randomSuffix) {
    String result = ZEPPELIN;
    if (StringUtils.isNotBlank(baseName)) {
      // all to lowerCase
      result = baseName.toLowerCase();
      // Remove all disallowed values
      result = result.replaceAll("[^a-z0-9\\.-]", "");
      // Remove all multiple dots
      result = result.replaceAll("\\.+", ".");
      if (result.isEmpty() || !Character.isLetterOrDigit(result.charAt(0))) {
        result = ZEPPELIN + result;
      }
      // 253 - 7 (suffix) = 246
      if (result.length() > 246 - ZEPPELIN.length()) {
        result = result.substring(0, 246 - ZEPPELIN.length());
      }
      if (!Character.isLetterOrDigit(result.charAt(result.length() - 1))) {
        result = result + ZEPPELIN;
      }
    }
    return randomSuffix ? result + "-" + RandomStringUtils.randomAlphabetic(6).toLowerCase() : result;
  }
@Test
  void testGenerateK8sName() {
    assertEquals("zeppelin", K8sUtils.generateK8sName("", false));
    assertEquals("zeppelin", K8sUtils.generateK8sName(null, false));
    assertEquals("test", K8sUtils.generateK8sName("test", false));
    assertEquals("test", K8sUtils.generateK8sName("!test", false));
    assertEquals("zeppelin", K8sUtils.generateK8sName("!", false));
    assertEquals("zeppelin.test", K8sUtils.generateK8sName(".test", false));
    assertEquals("zeppelin.test", K8sUtils.generateK8sName("...test", false));
    assertEquals("zeppelin.test.zeppelin", K8sUtils.generateK8sName(".test.", false));
    assertEquals("zeppelin.test.zeppelin", K8sUtils.generateK8sName("...test....", false));
    assertEquals("test", K8sUtils.generateK8sName("Test", false));

    assertEquals(253 - "zeppelin".length() , K8sUtils.generateK8sName(RandomStringUtils.randomAlphabetic(260), true).length());
  }