Add EAB Config options (#101)

This commit is contained in:
Nila 2022-08-22 12:26:01 +02:00 committed by GitHub
parent 769911d4f8
commit d00dc597d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 26 additions and 2 deletions

View File

@ -53,6 +53,8 @@ The command removes all the Kubernetes components associated with the chart and
| image.tag | string | `"latest"` | |
| imagePullSecrets | list | `[]` | |
| ingressController.config.acmeCA | string | `""` | |
| ingressController.config.acmeEABKeyId | string | `""` | |
| ingressController.config.acmeEABMacKey | string | `""` | |
| ingressController.config.debug | bool | `false` | |
| ingressController.config.email | string | `""` | |
| ingressController.config.metrics | bool | `true` | |

View File

@ -110,6 +110,14 @@
}
]
},
"acmeEABKeyId": {
"$id": "#/properties/ingressController/properties/config/properties/acmeEABKeyId",
"type": "string"
},
"acmeEABMacKey": {
"$id": "#/properties/ingressController/properties/config/properties/acmeEABMacKey",
"type": "string"
},
"debug": {
"$id": "#/properties/ingressController/properties/config/properties/debug",
"type": "boolean"

View File

@ -25,6 +25,8 @@ ingressController:
classNameRequired: false
leaseId: ""
config:
acmeEABKeyId: ""
acmeEABMacKey: ""
# -- Acme Server URL
acmeCA: ""
debug: false

View File

@ -2,11 +2,13 @@ package global
import (
"encoding/json"
caddy2 "github.com/caddyserver/caddy/v2"
"github.com/caddyserver/caddy/v2/caddyconfig"
"github.com/caddyserver/caddy/v2/modules/caddytls"
"github.com/caddyserver/ingress/pkg/converter"
"github.com/caddyserver/ingress/pkg/store"
"github.com/mholt/acmez/acme"
)
type ConfigMapPlugin struct{}
@ -39,6 +41,13 @@ func (p ConfigMapPlugin) GlobalHandler(config *converter.Config, store *store.St
acmeIssuer.CA = cfgMap.AcmeCA
}
if cfgMap.AcmeEABKeyId != "" && cfgMap.AcmeEABMacKey != "" {
acmeIssuer.ExternalAccount = &acme.EAB{
KeyID: cfgMap.AcmeEABKeyId,
MACKey: cfgMap.AcmeEABMacKey,
}
}
if cfgMap.Email != "" {
acmeIssuer.Email = cfgMap.Email
}

View File

@ -1,18 +1,21 @@
package store
import (
"reflect"
"time"
"github.com/caddyserver/caddy/v2"
"github.com/mitchellh/mapstructure"
"github.com/pkg/errors"
apiv1 "k8s.io/api/core/v1"
"reflect"
"time"
)
// ConfigMapOptions represents global options set through a configmap
type ConfigMapOptions struct {
Debug bool `json:"debug,omitempty"`
AcmeCA string `json:"acmeCA,omitempty"`
AcmeEABKeyId string `json:"acmeEABKeyId,omitempty"`
AcmeEABMacKey string `json:"acmeEABMacKey,omitempty"`
Email string `json:"email,omitempty"`
ExperimentalSmartSort bool `json:"experimentalSmartSort,omitempty"`
ProxyProtocol bool `json:"proxyProtocol,omitempty"`