Skip to content

Commit

Permalink
fix k8s code generation
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinWeindel committed Oct 22, 2024
1 parent 6af0474 commit 1d89bf0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 38 deletions.
47 changes: 10 additions & 37 deletions hack/update-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,47 +8,20 @@ set -o errexit
set -o nounset
set -o pipefail

PROJECT_ROOT="$(dirname $0)"/..

# setup virtual GOPATH
source "$GARDENER_HACK_DIR"/vgopath-setup.sh

CODE_GEN_DIR=$(go list -m -f '{{.Dir}}' k8s.io/code-generator)

# We need to explicitly pass GO111MODULE=off to k8s.io/code-generator as it is significantly slower otherwise,
# see https://github.com/kubernetes/code-generator/issues/100.
export GO111MODULE=off
source "${CODE_GEN_DIR}/kube_codegen.sh"

rm -f $GOPATH/bin/*-gen

bash "${CODE_GEN_DIR}"/generate-internal-groups.sh \
deepcopy,defaulter \
github.com/gardener/gardener-extension-shoot-dns-service/pkg/client \
github.com/gardener/gardener-extension-shoot-dns-service/pkg \
github.com/gardener/gardener-extension-shoot-dns-service/pkg \
"apis:v1alpha1" \
--go-header-file "${GARDENER_HACK_DIR}/LICENSE_BOILERPLATE.txt"

bash "${CODE_GEN_DIR}"/generate-internal-groups.sh \
conversion \
github.com/gardener/gardener-extension-shoot-dns-service/pkg/client \
github.com/gardener/gardener-extension-shoot-dns-service/pkg \
github.com/gardener/gardener-extension-shoot-dns-service/pkg \
"apis:v1alpha1" \
--extra-peer-dirs=github.com/gardener/gardener-extension-shoot-dns-service/pkg/apis/v1alpha1,github.com/gardener/external-dns-management/pkg/apis/dns/v1alpha1,k8s.io/apimachinery/pkg/apis/meta/v1,k8s.io/apimachinery/pkg/conversion,k8s.io/apimachinery/pkg/runtime \
--go-header-file "${GARDENER_HACK_DIR}/LICENSE_BOILERPLATE.txt"

bash "${CODE_GEN_DIR}"/generate-internal-groups.sh \
deepcopy,defaulter \
github.com/gardener/gardener-extension-shoot-dns-service/pkg/client \
github.com/gardener/gardener-extension-shoot-dns-service/pkg/apis \
github.com/gardener/gardener-extension-shoot-dns-service/pkg/apis \
"service:v1alpha1" \
--go-header-file "${GARDENER_HACK_DIR}/LICENSE_BOILERPLATE.txt"

bash "${CODE_GEN_DIR}"/generate-internal-groups.sh \
conversion \
github.com/gardener/gardener-extension-shoot-dns-service/pkg/client \
github.com/gardener/gardener-extension-shoot-dns-service/pkg/apis \
github.com/gardener/gardener-extension-shoot-dns-service/pkg/apis \
"service:v1alpha1" \
--extra-peer-dirs=github.com/gardener/gardener-extension-shoot-dns-service/pkg/apis/service,github.com/gardener/gardener-extension-shoot-dns-service/pkg/apis/service/v1alpha1,k8s.io/apimachinery/pkg/apis/meta/v1,k8s.io/apimachinery/pkg/conversion,k8s.io/apimachinery/pkg/runtime \
--go-header-file "${GARDENER_HACK_DIR}/LICENSE_BOILERPLATE.txt"
kube::codegen::gen_helpers \
--boilerplate "${GARDENER_HACK_DIR}/LICENSE_BOILERPLATE.txt" \
--extra-peer-dir k8s.io/apimachinery/pkg/apis/meta/v1 \
--extra-peer-dir k8s.io/apimachinery/pkg/conversion \
--extra-peer-dir k8s.io/component-base/config \
--extra-peer-dir k8s.io/component-base/config/v1alpha1 \
"${PROJECT_ROOT}/pkg/apis"
9 changes: 8 additions & 1 deletion pkg/controller/replication/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,12 @@ func AddToManager(ctx context.Context, mgr manager.Manager) error {
return err
}
predicate := ForService(common.ShootDNSEntryLabelKey)
return ctrl.Watch(source.Kind(mgr.GetCache(), &dnsapi.DNSEntry{}), &handler.EnqueueRequestForObject{}, predicate)
return ctrl.Watch(
source.Kind[client.Object](
mgr.GetCache(),
&dnsapi.DNSEntry{},
&handler.EnqueueRequestForObject{},
predicate,
),
)
}

0 comments on commit 1d89bf0

Please sign in to comment.