This repository has been archived on 2026-05-13. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
educode-controller/internal/api/handlers.go

27 lines
448 B
Go

package api
import (
"regexp"
"k8s.io/client-go/kubernetes"
)
type Handler struct {
clientset *kubernetes.Clientset
}
// create handler with k8s clientset
func NewHandler(clientset *kubernetes.Clientset) *Handler {
return &Handler{clientset: clientset}
}
func isValidDNS1035Label(s string) bool {
if len(s) > 63 {
return false
}
if !regexp.MustCompile(`^[a-z]([-a-z0-9]*[a-z0-9])?$`).MatchString(s) {
return false
}
return true
}