Failing on KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT must be defined
This commit is contained in:
parent
ab1d643157
commit
d71658e83a
@ -1,5 +1,7 @@
|
||||
FROM golang:1.21-alpine3.18 AS build_deps
|
||||
|
||||
ARG GROUP_NAME=api.sthome.net
|
||||
|
||||
RUN apk add --no-cache git
|
||||
|
||||
WORKDIR /workspace
|
||||
|
||||
19
main.go
19
main.go
@ -6,6 +6,7 @@ import (
|
||||
"os"
|
||||
|
||||
extapi "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
"k8s.io/client-go/rest"
|
||||
|
||||
"github.com/cert-manager/cert-manager/pkg/acme/webhook/apis/acme/v1alpha1"
|
||||
@ -13,7 +14,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
providerName = "sthome"
|
||||
providerName = "sthome-solver"
|
||||
)
|
||||
|
||||
var GroupName = os.Getenv("GROUP_NAME")
|
||||
@ -44,7 +45,7 @@ type customDNSProviderSolver struct {
|
||||
// 3. uncomment the relevant code in the Initialize method below
|
||||
// 4. ensure your webhook's service account has the required RBAC role
|
||||
// assigned to it for interacting with the Kubernetes APIs you need.
|
||||
//client kubernetes.Clientset
|
||||
client kubernetes.Clientset
|
||||
}
|
||||
|
||||
// customDNSProviderConfig is a structure that is used to decode into when
|
||||
@ -67,7 +68,7 @@ type customDNSProviderConfig struct {
|
||||
// These fields will be set by users in the
|
||||
// `issuer.spec.acme.dns01.providers.webhook.config` field.
|
||||
|
||||
//Email string `json:"email"`
|
||||
Email string `json:"email"`
|
||||
//APIKeySecretRef v1alpha1.SecretKeySelector `json:"apiKeySecretRef"`
|
||||
}
|
||||
|
||||
@ -123,12 +124,12 @@ func (c *customDNSProviderSolver) Initialize(kubeClientConfig *rest.Config, stop
|
||||
///// UNCOMMENT THE BELOW CODE TO MAKE A KUBERNETES CLIENTSET AVAILABLE TO
|
||||
///// YOUR CUSTOM DNS PROVIDER
|
||||
|
||||
//cl, err := kubernetes.NewForConfig(kubeClientConfig)
|
||||
//if err != nil {
|
||||
// return err
|
||||
//}
|
||||
//
|
||||
//c.client = cl
|
||||
cl, err := kubernetes.NewForConfig(kubeClientConfig)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
c.client = *cl
|
||||
|
||||
///// END OF CODE TO MAKE KUBERNETES CLIENTSET AVAILABLE
|
||||
return nil
|
||||
|
||||
@ -22,13 +22,13 @@ func TestRunsSuite(t *testing.T) {
|
||||
//fixture := acmetest.NewFixture(&customDNSProviderSolver{},
|
||||
// acmetest.SetResolvedZone(zone),
|
||||
// acmetest.SetAllowAmbientCredentials(false),
|
||||
// acmetest.SetManifestPath("testdata/my-custom-solver"),
|
||||
// acmetest.SetManifestPath("testdata/sthome-solver"),
|
||||
// acmetest.SetBinariesPath("_test/kubebuilder/bin"),
|
||||
//)
|
||||
solver := sthome.New("59351")
|
||||
fixture := acmetest.NewFixture(solver,
|
||||
acmetest.SetResolvedZone("sthome.net."),
|
||||
acmetest.SetManifestPath("testdata/my-custom-solver"),
|
||||
acmetest.SetManifestPath("testdata/sthome-solver"),
|
||||
acmetest.SetDNSServer("127.0.0.1:59351"),
|
||||
acmetest.SetUseAuthoritative(false),
|
||||
)
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
// package sthome contains a self-contained sthome of a webhook that passes the cert-manager
|
||||
// DNS conformance tests
|
||||
// must pass cert-manager DNS conformance tests
|
||||
package sthome
|
||||
|
||||
import (
|
||||
|
||||
Loading…
Reference in New Issue
Block a user