mirror of
https://github.com/eliasstepanik/caddy-ingess.git
synced 2026-01-11 12:38:27 +00:00
25 lines
660 B
Go
25 lines
660 B
Go
package ingress
|
|
|
|
import v1 "k8s.io/api/networking/v1"
|
|
|
|
const (
|
|
annotationPrefix = "caddy.ingress.kubernetes.io"
|
|
rewriteToAnnotation = "rewrite-to"
|
|
rewriteStripPrefixAnnotation = "rewrite-strip-prefix"
|
|
disableSSLRedirect = "disable-ssl-redirect"
|
|
backendProtocol = "backend-protocol"
|
|
insecureSkipVerify = "insecure-skip-verify"
|
|
)
|
|
|
|
func getAnnotation(ing *v1.Ingress, rule string) string {
|
|
return ing.Annotations[annotationPrefix+"/"+rule]
|
|
}
|
|
|
|
func getAnnotationBool(ing *v1.Ingress, rule string, def bool) bool {
|
|
val := getAnnotation(ing, rule)
|
|
if val == "" {
|
|
return def
|
|
}
|
|
return val == "true"
|
|
}
|