Skip to content

Commit

Permalink
Revendor Gardener 1.96 (#432)
Browse files Browse the repository at this point in the history
  • Loading branch information
majst01 authored Oct 23, 2024
1 parent 086140c commit ce10424
Show file tree
Hide file tree
Showing 21 changed files with 681 additions and 315 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ helm
hack/tools/bin/*
gardener-extension-provider-metal
!gardener-extension-provider-metal/
.ci
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.22 AS builder
FROM golang:1.23 AS builder

WORKDIR /go/src/github.com/metal-stack/gardener-extension-provider-metal
COPY . .
Expand Down
54 changes: 26 additions & 28 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
ENSURE_GARDENER_MOD := $(shell go get github.com/gardener/gardener@$$(go list -m -f "{{.Version}}" github.com/gardener/gardener))
GARDENER_HACK_DIR := $(shell go list -m -f "{{.Dir}}" github.com/gardener/gardener)/hack
IMAGE_TAG := $(or ${GITHUB_TAG_NAME}, latest)
REGISTRY := ghcr.io/metal-stack
IMAGE_PREFIX := $(REGISTRY)
Expand All @@ -9,8 +11,8 @@ VERIFY := true
LEADER_ELECTION := false
IGNORE_OPERATION_ANNOTATION := false
WEBHOOK_CONFIG_URL := localhost
GO_VERSION := 1.22
GOLANGCI_LINT_VERSION := v1.56.2
GO_VERSION := 1.23
GOLANGCI_LINT_VERSION := v1.61.0

ifeq ($(CI),true)
DOCKER_TTY_ARG=""
Expand All @@ -20,23 +22,22 @@ endif

export GO111MODULE := on

TOOLS_DIR := hack/tools
-include vendor/github.com/gardener/gardener/hack/tools.mk

TOOLS_DIR := $(HACK_DIR)/tools
include $(GARDENER_HACK_DIR)/tools.mk

#################################################################
# Rules related to binary build, Docker image build and release #
#################################################################

.PHONY: install
install: tidy $(HELM)
@LD_FLAGS="-w -X github.com/gardener/$(EXTENSION_PREFIX)-$(NAME)/pkg/version.Version=$(VERSION)" \
bash $(GARDENER_HACK_DIR)/install.sh ./...

.PHONY: build
build:
go build -ldflags $(LD_FLAGS) -tags netgo ./cmd/gardener-extension-provider-metal

.PHONY: install
install: revendor $(HELM)
@LD_FLAGS="-w -X github.com/gardener/$(EXTENSION_PREFIX)-$(NAME)/pkg/version.Version=$(VERSION)" \
$(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/install.sh ./...

.PHONY: docker-image
docker-image:
@docker build --no-cache \
Expand All @@ -61,34 +62,31 @@ update-crds:
# Rules for verification, formatting, linting, testing and cleaning #
#####################################################################

.PHONY: revendor
revendor:
@GO111MODULE=on go mod vendor
.PHONY: tidy
tidy:
@GO111MODULE=on go mod tidy
@chmod +x $(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/*
@chmod +x $(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/.ci/*
@$(REPO_ROOT)/hack/update-github-templates.sh
@mkdir -p $(REPO_ROOT)/.ci/hack && cp $(GARDENER_HACK_DIR)/.ci/* $(REPO_ROOT)/.ci/hack/ && chmod +xw $(REPO_ROOT)/.ci/hack/*

.PHONY: clean
clean:
@$(shell find ./example -type f -name "controller-registration.yaml" -exec rm '{}' \;)
@$(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/clean.sh ./cmd/... ./pkg/...
@bash $(GARDENER_HACK_DIR)/clean.sh ./cmd/... ./pkg/...

.PHONY: check-generate
check-generate:
@$(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/check-generate.sh $(REPO_ROOT)
@bash $(GARDENER_HACK_DIR)/check-generate.sh $(REPO_ROOT)

.PHONY: check
check: $(GOIMPORTS) $(GOLANGCI_LINT) $(HELM)
@$(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/check.sh --golangci-lint-config=./.golangci.yaml ./cmd/... ./pkg/...
@$(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/check-charts.sh ./charts
@REPO_ROOT=$(REPO_ROOT) bash $(GARDENER_HACK_DIR)/check.sh --golangci-lint-config=./.golangci.yaml ./cmd/... ./pkg/...
@REPO_ROOT=$(REPO_ROOT) bash $(GARDENER_HACK_DIR)/check-charts.sh ./charts

.PHONY: generate
generate: $(HELM) $(YQ)
@$(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/generate-sequential.sh ./charts/... ./cmd/... ./pkg/...
generate: $(VGOPATH) $(HELM) $(YQ)
@REPO_ROOT=$(REPO_ROOT) VGOPATH=$(VGOPATH) GARDENER_HACK_DIR=$(GARDENER_HACK_DIR) bash $(GARDENER_HACK_DIR)/generate-sequential.sh ./charts/... ./cmd/... ./pkg/...

.PHONY: generate-in-docker
generate-in-docker: revendor update-crds $(HELM)
generate-in-docker: tidy update-crds $(HELM)
echo $(shell git describe --abbrev=0 --tags) > VERSION
docker run --rm -i$(DOCKER_TTY_ARG) \
--volume $(PWD):/go/src/github.com/metal-stack/gardener-extension-provider-metal golang:$(GO_VERSION) \
Expand All @@ -98,14 +96,14 @@ generate-in-docker: revendor update-crds $(HELM)

.PHONY: format
format: $(GOIMPORTS)
@$(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/format.sh ./cmd ./pkg
@bash $(GARDENER_HACK_DIR)/format.sh ./cmd ./pkg

.PHONY: test
test:
@SKIP_FETCH_TOOLS=1 $(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/test.sh ./cmd/... ./pkg/...
@bash $(GARDENER_HACK_DIR)/test.sh ./cmd/... ./pkg/...

.PHONY: test-in-docker
test-in-docker: revendor
test-in-docker: tidy
docker run --rm -i$(DOCKER_TTY_ARG) \
--user $$(id -u):$$(id -g) \
--mount type=tmpfs,destination=/.cache \
Expand All @@ -115,11 +113,11 @@ test-in-docker: revendor

.PHONY: test-cov
test-cov:
@SKIP_FETCH_TOOLS=1 $(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/test-cover.sh -r ./cmd/... ./pkg/...
@SKIP_FETCH_TOOLS=1 $(GARDENER_HACK_DIR)/test-cover.sh -r ./cmd/... ./pkg/...

.PHONY: test-clean
test-clean:
@$(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/test-cover-clean.sh
$(GARDENER_HACK_DIR)/test-cover-clean.sh

.PHONY: verify
verify: check format test
2 changes: 1 addition & 1 deletion charts/gardener-extension-provider-metal/doc.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:generate sh -c "../../vendor/github.com/gardener/gardener/hack/generate-controller-registration.sh provider-metal . $(cat ../../VERSION) ../../example/controller-registration.yaml ControlPlane:metal Infrastructure:metal Worker:metal"
//go:generate sh -c "bash $GARDENER_HACK_DIR/generate-controller-registration.sh provider-metal . $(cat ../../VERSION) ../../example/controller-registration.yaml ControlPlane:metal Infrastructure:metal Worker:metal"

// Package chart enables go:generate support for generating the correct controller registration.
package chart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
controller-gen.kubebuilder.io/version: v0.16.3
name: clusterwidenetworkpolicies.metal-stack.io
spec:
group: metal-stack.io
Expand Down Expand Up @@ -95,7 +95,6 @@ spec:
If present, only traffic on the specified protocol AND port will be matched.
x-kubernetes-int-or-string: true
protocol:
default: TCP
description: |-
protocol represents the protocol (TCP, UDP, or SCTP) which traffic must match.
If not specified, this field defaults to TCP.
Expand Down Expand Up @@ -227,7 +226,6 @@ spec:
If present, only traffic on the specified protocol AND port will be matched.
x-kubernetes-int-or-string: true
protocol:
default: TCP
description: |-
protocol represents the protocol (TCP, UDP, or SCTP) which traffic must match.
If not specified, this field defaults to TCP.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
controller-gen.kubebuilder.io/version: v0.16.3
name: clusterwidenetworkpolicies.metal-stack.io
spec:
group: metal-stack.io
Expand Down Expand Up @@ -95,7 +95,6 @@ spec:
If present, only traffic on the specified protocol AND port will be matched.
x-kubernetes-int-or-string: true
protocol:
default: TCP
description: |-
protocol represents the protocol (TCP, UDP, or SCTP) which traffic must match.
If not specified, this field defaults to TCP.
Expand Down Expand Up @@ -227,7 +226,6 @@ spec:
If present, only traffic on the specified protocol AND port will be matched.
x-kubernetes-int-or-string: true
protocol:
default: TCP
description: |-
protocol represents the protocol (TCP, UDP, or SCTP) which traffic must match.
If not specified, this field defaults to TCP.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,8 @@ spec:
runAsUser: 65534
allowPrivilegeEscalation: false
runAsNonRoot: true
{{- if semverCompare ">= 1.19" .Capabilities.KubeVersion.GitVersion }}
seccompProfile:
type: RuntimeDefault
{{- end }}
capabilities:
drop:
- ALL
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{{- if semverCompare ">= 1.17" .Capabilities.KubeVersion.GitVersion }}
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.0
api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/419"
api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/814"
controller-gen.kubebuilder.io/version: v0.12.0
creationTimestamp: null
name: volumesnapshotclasses.snapshot.storage.k8s.io
spec:
Expand All @@ -14,14 +13,18 @@ spec:
kind: VolumeSnapshotClass
listKind: VolumeSnapshotClassList
plural: volumesnapshotclasses
shortNames:
- vsclass
- vsclasses
singular: volumesnapshotclass
scope: Cluster
versions:
- additionalPrinterColumns:
- jsonPath: .driver
name: Driver
type: string
- description: Determines whether a VolumeSnapshotContent created through the VolumeSnapshotClass should be deleted when its bound VolumeSnapshot is deleted.
- description: Determines whether a VolumeSnapshotContent created through the
VolumeSnapshotClass should be deleted when its bound VolumeSnapshot is deleted.
jsonPath: .deletionPolicy
name: DeletionPolicy
type: string
Expand All @@ -31,27 +34,44 @@ spec:
name: v1
schema:
openAPIV3Schema:
description: VolumeSnapshotClass specifies parameters that a underlying storage system uses when creating a volume snapshot. A specific VolumeSnapshotClass is used by specifying its name in a VolumeSnapshot object. VolumeSnapshotClasses are non-namespaced
description: VolumeSnapshotClass specifies parameters that a underlying storage
system uses when creating a volume snapshot. A specific VolumeSnapshotClass
is used by specifying its name in a VolumeSnapshot object. VolumeSnapshotClasses
are non-namespaced
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
deletionPolicy:
description: deletionPolicy determines whether a VolumeSnapshotContent created through the VolumeSnapshotClass should be deleted when its bound VolumeSnapshot is deleted. Supported values are "Retain" and "Delete". "Retain" means that the VolumeSnapshotContent and its physical snapshot on underlying storage system are kept. "Delete" means that the VolumeSnapshotContent and its physical snapshot on underlying storage system are deleted. Required.
description: deletionPolicy determines whether a VolumeSnapshotContent
created through the VolumeSnapshotClass should be deleted when its bound
VolumeSnapshot is deleted. Supported values are "Retain" and "Delete".
"Retain" means that the VolumeSnapshotContent and its physical snapshot
on underlying storage system are kept. "Delete" means that the VolumeSnapshotContent
and its physical snapshot on underlying storage system are deleted.
Required.
enum:
- Delete
- Retain
type: string
driver:
description: driver is the name of the storage driver that handles this VolumeSnapshotClass. Required.
description: driver is the name of the storage driver that handles this
VolumeSnapshotClass. Required.
type: string
kind:
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
parameters:
additionalProperties:
type: string
description: parameters is a key-value map with storage driver specific parameters for creating snapshots. These values are opaque to Kubernetes.
description: parameters is a key-value map with storage driver specific
parameters for creating snapshots. These values are opaque to Kubernetes.
type: object
required:
- deletionPolicy
Expand Down Expand Up @@ -105,7 +125,7 @@ spec:
- deletionPolicy
- driver
type: object
served: true
served: false
storage: false
subresources: {}
status:
Expand All @@ -114,4 +134,3 @@ status:
plural: ""
conditions: []
storedVersions: []
{{- end }}
Loading

0 comments on commit ce10424

Please sign in to comment.