Class KubeVirtNamingStrategy

java.lang.Object
io.jenkins.plugins.kubevirt.KubeVirtNamingStrategy

public class KubeVirtNamingStrategy extends Object
Strategy for generating RFC 1123 compliant node names for KubeVirt VMs. Generates names in the format: jenkins-{template-name}-{build-number}-{random} RFC 1123 requirements: - Lowercase alphanumeric characters - Dashes (-) and dots (.) allowed - Must start and end with alphanumeric character

This class is thread-safe. The SecureRandom instance is stored in a ThreadLocal to avoid contention between threads while maintaining cryptographic security.

  • Constructor Details

    • KubeVirtNamingStrategy

      public KubeVirtNamingStrategy()
  • Method Details

    • generateNodeName

      public String generateNodeName(String templateName)
      Generates a valid RFC 1123 compliant node name. Format: jenkins-{sanitized-template-name}-{build-number}-{random-suffix}

      This method is thread-safe and can be called concurrently.

      Parameters:
      templateName - The template name to include in the generated name
      Returns:
      A valid Kubernetes-compatible node name