mirror of
https://github.com/eliasstepanik/caddy-ingess.git
synced 2026-01-10 20:18:28 +00:00
Update to use latest Caddy 2 module interface
This commit is contained in:
parent
c46d8ff2e5
commit
c36b7f3536
2
go.mod
2
go.mod
@ -5,7 +5,7 @@ go 1.12
|
|||||||
require (
|
require (
|
||||||
github.com/caddyserver/caddy/v2 v2.0.0-beta6
|
github.com/caddyserver/caddy/v2 v2.0.0-beta6
|
||||||
github.com/docker/distribution v2.7.1+incompatible // indirect
|
github.com/docker/distribution v2.7.1+incompatible // indirect
|
||||||
github.com/mholt/certmagic v0.8.3
|
github.com/mholt/certmagic v0.7.5
|
||||||
github.com/opencontainers/go-digest v1.0.0-rc1 // indirect
|
github.com/opencontainers/go-digest v1.0.0-rc1 // indirect
|
||||||
github.com/pkg/errors v0.8.1
|
github.com/pkg/errors v0.8.1
|
||||||
github.com/prometheus/client_golang v1.1.0
|
github.com/prometheus/client_golang v1.1.0
|
||||||
|
|||||||
1
go.sum
1
go.sum
@ -244,6 +244,7 @@ github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzp
|
|||||||
github.com/mattn/go-tty v0.0.0-20180219170247-931426f7535a/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE=
|
github.com/mattn/go-tty v0.0.0-20180219170247-931426f7535a/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE=
|
||||||
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
|
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
|
||||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||||
|
github.com/mholt/certmagic v0.7.5 h1:1ZGHwUI4+zg1S17tPUj5Xxb9Q1ghTjLcUZE5G4yV5SM=
|
||||||
github.com/mholt/certmagic v0.7.5/go.mod h1:91uJzK5K8IWtYQqTi5R2tsxV1pCde+wdGfaRaOZi6aQ=
|
github.com/mholt/certmagic v0.7.5/go.mod h1:91uJzK5K8IWtYQqTi5R2tsxV1pCde+wdGfaRaOZi6aQ=
|
||||||
github.com/mholt/certmagic v0.8.3 h1:JOUiX9IAZbbgyjNP2GY6v/6lorH+9GkZsc7ktMpGCSo=
|
github.com/mholt/certmagic v0.8.3 h1:JOUiX9IAZbbgyjNP2GY6v/6lorH+9GkZsc7ktMpGCSo=
|
||||||
github.com/mholt/certmagic v0.8.3/go.mod h1:91uJzK5K8IWtYQqTi5R2tsxV1pCde+wdGfaRaOZi6aQ=
|
github.com/mholt/certmagic v0.8.3/go.mod h1:91uJzK5K8IWtYQqTi5R2tsxV1pCde+wdGfaRaOZi6aQ=
|
||||||
|
|||||||
@ -110,15 +110,7 @@ func NewCaddyController(kubeClient *kubernetes.Clientset, restClient rest.Interf
|
|||||||
controller.dispatchSync()
|
controller.dispatchSync()
|
||||||
|
|
||||||
// register kubernetes specific cert-magic storage module
|
// register kubernetes specific cert-magic storage module
|
||||||
caddy.RegisterModule(caddy.Module{
|
caddy.RegisterModule(storage.SecretStorage{})
|
||||||
Name: "caddy.storage.secret_store",
|
|
||||||
New: func() interface{} {
|
|
||||||
return &storage.SecretStorage{
|
|
||||||
Namespace: podInfo.Namespace,
|
|
||||||
KubeClient: kubeClient,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
return controller
|
return controller
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import (
|
|||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/caddyserver/caddy/v2"
|
||||||
"github.com/mholt/certmagic"
|
"github.com/mholt/certmagic"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
@ -34,6 +35,13 @@ type SecretStorage struct {
|
|||||||
KubeClient *kubernetes.Clientset
|
KubeClient *kubernetes.Clientset
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (SecretStorage) CaddyModule() caddy.ModuleInfo {
|
||||||
|
return caddy.ModuleInfo{
|
||||||
|
Name: "caddy.storage.secret_store",
|
||||||
|
New: func() caddy.Module { return new(SecretStorage) },
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// CertMagicStorage returns a certmagic storage type to be used by caddy.
|
// CertMagicStorage returns a certmagic storage type to be used by caddy.
|
||||||
func (s *SecretStorage) CertMagicStorage() (certmagic.Storage, error) {
|
func (s *SecretStorage) CertMagicStorage() (certmagic.Storage, error) {
|
||||||
return s, nil
|
return s, nil
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user