mirror of
https://github.com/eliasstepanik/caddy-ingess.git
synced 2026-01-10 03:58:28 +00:00
Add config options for class name and class name required (#99)
This commit is contained in:
parent
1ba3f761ec
commit
f7739a6837
@ -76,6 +76,12 @@ spec:
|
||||
{{- if .Values.ingressController.verbose }}
|
||||
- -v
|
||||
{{- end }}
|
||||
{{- if .Values.ingressController.className }}
|
||||
- -class-name={{ .Values.ingressController.className }}
|
||||
{{- end }}
|
||||
{{- if .Values.ingressController.classNameRequired }}
|
||||
- -class-name-required={{ .Values.ingressController.classNameRequired }}
|
||||
{{- end }}
|
||||
readinessProbe:
|
||||
initialDelaySeconds: 3
|
||||
periodSeconds: 10
|
||||
|
||||
@ -21,7 +21,8 @@ ingressController:
|
||||
verbose: false
|
||||
rbac:
|
||||
create: true
|
||||
|
||||
className: "caddy"
|
||||
classNameRequired: false
|
||||
leaseId: ""
|
||||
config:
|
||||
# -- Acme Server URL
|
||||
@ -47,7 +48,8 @@ serviceAccount:
|
||||
|
||||
podAnnotations: {}
|
||||
|
||||
podSecurityContext: {}
|
||||
podSecurityContext:
|
||||
{}
|
||||
# fsGroup: 2000
|
||||
|
||||
podDisruptionBudget:
|
||||
@ -64,7 +66,8 @@ securityContext:
|
||||
runAsUser: 0
|
||||
runAsGroup: 0
|
||||
|
||||
resources: {}
|
||||
resources:
|
||||
{}
|
||||
# We usually recommend not to specify default resources and to leave this as a conscious
|
||||
# choice for the user. This also increases chances charts run on environments with little
|
||||
# resources, such as Minikube. If you do want to specify resources, uncomment the following
|
||||
|
||||
@ -2,14 +2,21 @@ package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"github.com/caddyserver/ingress/pkg/store"
|
||||
"strings"
|
||||
|
||||
"github.com/caddyserver/ingress/pkg/store"
|
||||
)
|
||||
|
||||
func parseFlags() store.Options {
|
||||
var namespace string
|
||||
flag.StringVar(&namespace, "namespace", "", "the namespace that you would like to observe kubernetes ingress resources in.")
|
||||
|
||||
var className string
|
||||
flag.StringVar(&className, "class-name", "caddy", "class name of the ingress controller")
|
||||
|
||||
var classNameRequired bool
|
||||
flag.BoolVar(&classNameRequired, "class-name-required", false, "only allow ingress resources with a matching ingress class name")
|
||||
|
||||
var configMapName string
|
||||
flag.StringVar(&configMapName, "config-map", "", "defines the config map name from where to load global options")
|
||||
|
||||
@ -25,10 +32,12 @@ func parseFlags() store.Options {
|
||||
flag.Parse()
|
||||
|
||||
return store.Options{
|
||||
WatchNamespace: namespace,
|
||||
ConfigMapName: configMapName,
|
||||
Verbose: verbose,
|
||||
LeaseId: leaseId,
|
||||
PluginsOrder: strings.Split(pluginsOrder, ","),
|
||||
WatchNamespace: namespace,
|
||||
ClassName: className,
|
||||
ClassNameRequired: classNameRequired,
|
||||
ConfigMapName: configMapName,
|
||||
Verbose: verbose,
|
||||
LeaseId: leaseId,
|
||||
PluginsOrder: strings.Split(pluginsOrder, ","),
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,6 +5,9 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/caddyserver/caddy/v2"
|
||||
"github.com/caddyserver/certmagic"
|
||||
"github.com/caddyserver/ingress/internal/k8s"
|
||||
@ -18,8 +21,6 @@ import (
|
||||
"k8s.io/client-go/kubernetes"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
"k8s.io/client-go/util/workqueue"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
// load required caddy plugins
|
||||
_ "github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy"
|
||||
@ -123,10 +124,9 @@ func NewCaddyController(
|
||||
|
||||
// Watch ingress resources in selected namespaces
|
||||
ingressParams := k8s.IngressParams{
|
||||
InformerFactory: controller.factories.WatchedNamespace,
|
||||
// TODO Add configuration for that
|
||||
ClassName: "caddy",
|
||||
ClassNameRequired: false,
|
||||
InformerFactory: controller.factories.WatchedNamespace,
|
||||
ClassName: opts.ClassName,
|
||||
ClassNameRequired: opts.ClassNameRequired,
|
||||
}
|
||||
controller.informers.Ingress = k8s.WatchIngresses(ingressParams, k8s.IngressHandlers{
|
||||
AddFunc: controller.onIngressAdded,
|
||||
|
||||
@ -2,9 +2,11 @@ package store
|
||||
|
||||
// Options represents ingress controller config received through cli arguments.
|
||||
type Options struct {
|
||||
WatchNamespace string
|
||||
ConfigMapName string
|
||||
Verbose bool
|
||||
LeaseId string
|
||||
PluginsOrder []string
|
||||
WatchNamespace string
|
||||
ConfigMapName string
|
||||
ClassName string
|
||||
ClassNameRequired bool
|
||||
Verbose bool
|
||||
LeaseId string
|
||||
PluginsOrder []string
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user