remove controller-runtime deps

This commit is contained in:
Ali Orouji 2021-02-18 04:23:39 +03:30
parent 618978c81e
commit 1b44d99799
6 changed files with 46 additions and 1125 deletions

View file

@ -131,10 +131,6 @@ type DomainZoneList struct {
Items []DomainZone `json:"items"`
}
func init() {
SchemeBuilder.Register(&DomainZone{}, &DomainZoneList{})
}
// Type returns type of the record
// TODO(ali) SPF, TLSA, CAA, SMIME?, LOC, SSHP
func (r *Record) Type() string {

View file

@ -1,36 +0,0 @@
/*
Copyright 2019 Cafe Bazaar Cloud.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Package v1beta1 contains API Schema definitions for the delivery v1beta1 API group
// +kubebuilder:object:generate=true
// +groupName=delivery.cafebazaar.cloud
package v1beta1
import (
"k8s.io/apimachinery/pkg/runtime/schema"
"sigs.k8s.io/controller-runtime/pkg/scheme"
)
var (
// GroupVersion is group version used to register these objects
GroupVersion = schema.GroupVersion{Group: "delivery.cafebazaar.cloud", Version: "v1beta1"}
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
// AddToScheme adds the types in this group-version to the given scheme.
AddToScheme = SchemeBuilder.AddToScheme
)

27
api/v1beta1/register.go Normal file
View file

@ -0,0 +1,27 @@
package v1beta1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)
const GroupName = "delivery.cafebazaar.cloud"
const GroupVersion = "v1beta1"
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: GroupVersion}
var (
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
AddToScheme = SchemeBuilder.AddToScheme
)
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&DomainZone{},
&DomainZoneList{},
)
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil
}

32
go.mod
View file

@ -3,54 +3,28 @@ module github.com/aliorouji/cert-manager-webhook-sotoon
go 1.13
require (
cloud.google.com/go v0.54.0 // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.5 // indirect
github.com/Venafi/vcert v0.0.0-20190613103158-62139eb19b25 // indirect
github.com/blang/semver v3.5.1+incompatible // indirect
github.com/coreos/etcd v3.3.15+incompatible // indirect
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815 // indirect
github.com/evanphx/json-patch v4.9.0+incompatible // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/fvbommel/sortorder v1.0.1 // indirect
github.com/go-logr/zapr v0.1.1 // indirect
github.com/go-playground/validator/v10 v10.4.1
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
github.com/golang/protobuf v1.4.3 // indirect
github.com/google/go-cmp v0.5.2 // indirect
github.com/google/go-github v17.0.0+incompatible // indirect
github.com/google/uuid v1.1.2 // indirect
github.com/gorilla/context v1.1.1 // indirect
github.com/gorilla/mux v1.6.2 // indirect
github.com/hashicorp/vault/api v1.0.4 // indirect
github.com/jetstack/cert-manager v1.2.0
github.com/mattbaird/jsonpatch v0.0.0-20171005235357-81af80346b1a // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/moby/term v0.0.0-20200312100748-672ec06f55cd // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/prometheus/client_golang v1.7.1 // indirect
github.com/prometheus/procfs v0.2.0 // indirect
github.com/sirupsen/logrus v1.6.0 // indirect
github.com/spf13/cobra v1.1.1 // indirect
github.com/stretchr/testify v1.6.1 // indirect
golang.org/x/mod v0.3.0 // indirect
golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0 // indirect
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b // indirect
golang.org/x/sys v0.0.0-20201112073958-5cba982894dd // indirect
golang.org/x/text v0.3.4 // indirect
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e // indirect
golang.org/x/tools v0.0.0-20200616133436-c1934b75d054 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
gomodules.xyz/jsonpatch/v2 v2.0.1 // indirect
gonum.org/v1/netlib v0.0.0-20190331212654-76723241ea4e // indirect
google.golang.org/grpc v1.27.1 // indirect
google.golang.org/protobuf v1.25.0 // indirect
k8s.io/api v0.19.0
k8s.io/apiextensions-apiserver v0.19.0
k8s.io/apimachinery v0.19.0
k8s.io/client-go v0.19.0
k8s.io/component-helpers v0.20.0-alpha.2 // indirect
k8s.io/gengo v0.0.0-20201113003025-83324d819ded // indirect
k8s.io/klog/v2 v2.4.0 // indirect
k8s.io/kubectl v0.19.0
k8s.io/utils v0.0.0-20201110183641-67b214c5f920 // indirect
sigs.k8s.io/controller-runtime v0.6.2
sigs.k8s.io/structured-merge-diff v1.0.1-0.20191108220359-b1b620dd3f06 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.0.2 // indirect
)

1067
go.sum

File diff suppressed because it is too large Load diff

View file

@ -8,6 +8,7 @@ import (
"strings"
extapi "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/runtime/serializer"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
@ -36,8 +37,6 @@ func main() {
panic("GROUP_NAME must be specified")
}
fmt.Println("salaaaam")
// This will register our custom DNS provider with the webhook serving
// library, making it available as an API under the provided GroupName.
// You can register multiple DNS provider implementations with a single
@ -120,7 +119,7 @@ func (c *sotoonDNSProviderSolver) sotoonClient(ch *v1alpha1.ChallengeRequest, cf
restConfig.Host = cfg.Endpoint
restConfig.APIPath = "/apis"
restConfig.BearerToken = apiToken
restConfig.ContentConfig.GroupVersion = &v1beta1.GroupVersion
restConfig.ContentConfig.GroupVersion = &schema.GroupVersion{Group: v1beta1.GroupName, Version: v1beta1.GroupVersion}
restConfig.NegotiatedSerializer = serializer.NewCodecFactory(scheme.Scheme)
restConfig.UserAgent = rest.DefaultKubernetesUserAgent()