From c731e0d7b39c47b633d7e9ec247f659c8594dc7f Mon Sep 17 00:00:00 2001 From: Ismail Alidzhikov Date: Thu, 28 Mar 2024 15:21:11 +0200 Subject: [PATCH] Remove the v1alpha2 API (#165) --- README.md | 1 - .../migration-from-v1alpha2-to-v1alpha3.md | 48 ---- hack/update-codegen.sh | 2 +- pkg/apis/registry/install/install.go | 4 +- pkg/apis/registry/v1alpha2/conversions.go | 34 --- .../registry/v1alpha2/conversions_test.go | 89 ------- pkg/apis/registry/v1alpha2/defaults.go | 30 --- pkg/apis/registry/v1alpha2/defaults_test.go | 67 ----- pkg/apis/registry/v1alpha2/doc.go | 12 - pkg/apis/registry/v1alpha2/register.go | 32 --- pkg/apis/registry/v1alpha2/types.go | 75 ------ .../registry/v1alpha2/v1alpha2_suite_test.go | 17 -- .../v1alpha2/zz_generated.conversion.go | 244 ------------------ .../v1alpha2/zz_generated.deepcopy.go | 164 ------------ .../v1alpha2/zz_generated.defaults.go | 31 --- skaffold.yaml | 2 - 16 files changed, 2 insertions(+), 850 deletions(-) delete mode 100644 docs/usage/registry-cache/migration-from-v1alpha2-to-v1alpha3.md delete mode 100644 pkg/apis/registry/v1alpha2/conversions.go delete mode 100644 pkg/apis/registry/v1alpha2/conversions_test.go delete mode 100644 pkg/apis/registry/v1alpha2/defaults.go delete mode 100644 pkg/apis/registry/v1alpha2/defaults_test.go delete mode 100644 pkg/apis/registry/v1alpha2/doc.go delete mode 100644 pkg/apis/registry/v1alpha2/register.go delete mode 100644 pkg/apis/registry/v1alpha2/types.go delete mode 100644 pkg/apis/registry/v1alpha2/v1alpha2_suite_test.go delete mode 100644 pkg/apis/registry/v1alpha2/zz_generated.conversion.go delete mode 100644 pkg/apis/registry/v1alpha2/zz_generated.deepcopy.go delete mode 100644 pkg/apis/registry/v1alpha2/zz_generated.defaults.go diff --git a/README.md b/README.md index 8149fce4..b6ef0c24 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,6 @@ Gardener extension controller which deploys pull-through caches for container re - [Configuring the Registry Cache Extension](docs/usage/registry-cache/configuration.md) - learn what is the use-case for a pull-through cache, how to enable it and configure it - [How to provide credentials for upstream repository?](docs/usage/registry-cache/upstream-credentials.md) -- [Migration from `v1alpha2` to `v1alpha3`](docs/usage/registry-cache/migration-from-v1alpha2-to-v1alpha3.md) - learn how to migrate from the `v1alpha2` API version of the `RegistryConfig` to `v1alpha3` - [Configuring the Registry Mirror Extension](docs/usage/registry-mirror/configuration.md) - learn what is the use-case for a registry mirror, how to enable and configure it ## Local Setup and Development diff --git a/docs/usage/registry-cache/migration-from-v1alpha2-to-v1alpha3.md b/docs/usage/registry-cache/migration-from-v1alpha2-to-v1alpha3.md deleted file mode 100644 index 1f9fbdde..00000000 --- a/docs/usage/registry-cache/migration-from-v1alpha2-to-v1alpha3.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -title: Migration from `v1alpha2` to `v1alpha3` -description: Learn how to migrate from the `v1alpha2` API version of the `RegistryConfig` to `v1alpha3` ---- - -# Migration from `v1alpha2` to `v1alpha3` - -This document describes how to migrate from API version `registry.extensions.gardener.cloud/v1alpha2` of the `RegistryConfig` to `registry.extensions.gardener.cloud/v1alpha3`. - -The `registry.extensions.gardener.cloud/v1alpha2` is deprecated and will be removed in a future version. Use `registry.extensions.gardener.cloud/v1alpha3` instead. - -Let's first inspect how the `RegistryConfig` looks like in API version `registry.extensions.gardener.cloud/v1alpha2`: - -```yaml -apiVersion: registry.extensions.gardener.cloud/v1alpha2 -kind: RegistryConfig -caches: -- upstream: docker.io - volume: - size: 10Gi - storageClassName: default - garbageCollection: - enabled: true - secretReferenceName: docker-credentials -``` - -The translation of the above `RegistryConfig` in API version `registry.extensions.gardener.cloud/v1alpha3` is: - -```yaml -apiVersion: registry.extensions.gardener.cloud/v1alpha3 -kind: RegistryConfig -caches: -- upstream: docker.io - volume: - size: 10Gi - storageClassName: default - garbageCollection: - ttl: 168h - secretReferenceName: docker-credentials -``` - -As you can notice, there is one breaking change in API version `registry.extensions.gardener.cloud/v1alpha3` - the `caches[].garbageCollection.enabled` field is replaced by `caches[].garbageCollection.ttl`. - -`v1alpha2` was an API created against `distribution/distribution@2.8`. The registry-cache evolves and upgraded recently to `distribution/distribution@3.0`. In `distribution/distribution@2.8` the ttl is not configurable and it is hard-coded to `168h` (7 days). That's why in versions prior to `v1alpha3` the `storage.delete.enabled` config field in the `distribution/distribution` configuration was used to control deletion of blobs. `distribution/distribution@3.0` exposes the `proxy.ttl` config field. It is now possible to natively disable the garbage collection (expiration of blobs) by setting `proxy.ttl=0`. - -Conversions are as follows: -- `garbageCollection.enable=true` gets converted to `garbageCollection.ttl=168h` and vice versa (a positive `garbageCollection.ttl` duration is considered `garbageCollection.enable=true`) -- `garbageCollection.enable=false` gets converted to `garbageCollection.ttl=0` vice versa diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh index a7e8396c..eb40f07d 100755 --- a/hack/update-codegen.sh +++ b/hack/update-codegen.sh @@ -26,7 +26,7 @@ bash "${CODE_GEN_DIR}/generate-internal-groups.sh" \ github.com/gardener/gardener-extension-registry-cache/pkg/client \ github.com/gardener/gardener-extension-registry-cache/pkg/apis \ github.com/gardener/gardener-extension-registry-cache/pkg/apis \ - "registry:v1alpha2,v1alpha3" \ + "registry:v1alpha3" \ --go-header-file "${PROJECT_ROOT}/hack/LICENSE_BOILERPLATE.txt" bash "${CODE_GEN_DIR}/generate-internal-groups.sh" \ diff --git a/pkg/apis/registry/install/install.go b/pkg/apis/registry/install/install.go index f1f13399..48bdb5ac 100644 --- a/pkg/apis/registry/install/install.go +++ b/pkg/apis/registry/install/install.go @@ -9,13 +9,11 @@ import ( utilruntime "k8s.io/apimachinery/pkg/util/runtime" "github.com/gardener/gardener-extension-registry-cache/pkg/apis/registry" - "github.com/gardener/gardener-extension-registry-cache/pkg/apis/registry/v1alpha2" "github.com/gardener/gardener-extension-registry-cache/pkg/apis/registry/v1alpha3" ) var ( schemeBuilder = runtime.NewSchemeBuilder( - v1alpha2.AddToScheme, v1alpha3.AddToScheme, registry.AddToScheme, setVersionPriority, @@ -26,7 +24,7 @@ var ( ) func setVersionPriority(scheme *runtime.Scheme) error { - return scheme.SetVersionPriority(v1alpha3.SchemeGroupVersion, v1alpha2.SchemeGroupVersion) + return scheme.SetVersionPriority(v1alpha3.SchemeGroupVersion) } // Install installs all APIs in the scheme. diff --git a/pkg/apis/registry/v1alpha2/conversions.go b/pkg/apis/registry/v1alpha2/conversions.go deleted file mode 100644 index bfd2f707..00000000 --- a/pkg/apis/registry/v1alpha2/conversions.go +++ /dev/null @@ -1,34 +0,0 @@ -// SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Gardener contributors -// -// SPDX-License-Identifier: Apache-2.0 - -package v1alpha2 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - conversion "k8s.io/apimachinery/pkg/conversion" - - registry "github.com/gardener/gardener-extension-registry-cache/pkg/apis/registry" -) - -// Convert_v1alpha2_GarbageCollection_To_registry_GarbageCollection converts from v1alpha2.GarbageCollection to registry.GarbageCollection. -func Convert_v1alpha2_GarbageCollection_To_registry_GarbageCollection(in *GarbageCollection, out *registry.GarbageCollection, _ conversion.Scope) error { - if in.Enabled { - out.TTL = registry.DefaultTTL - } else { - out.TTL = metav1.Duration{Duration: 0} - } - - return nil -} - -// Convert_registry_GarbageCollection_To_v1alpha2_GarbageCollection converts from registry.GarbageCollection to v1alpha2.GarbageCollection. -func Convert_registry_GarbageCollection_To_v1alpha2_GarbageCollection(in *registry.GarbageCollection, out *GarbageCollection, _ conversion.Scope) error { - if in.TTL.Duration > 0 { - out.Enabled = true - } else { - out.Enabled = false - } - - return nil -} diff --git a/pkg/apis/registry/v1alpha2/conversions_test.go b/pkg/apis/registry/v1alpha2/conversions_test.go deleted file mode 100644 index 5c051abe..00000000 --- a/pkg/apis/registry/v1alpha2/conversions_test.go +++ /dev/null @@ -1,89 +0,0 @@ -// SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Gardener contributors -// -// SPDX-License-Identifier: Apache-2.0 - -package v1alpha2_test - -import ( - "time" - - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - - "github.com/gardener/gardener-extension-registry-cache/pkg/apis/registry" - "github.com/gardener/gardener-extension-registry-cache/pkg/apis/registry/v1alpha2" -) - -var _ = Describe("Conversions", func() { - - var ( - scheme *runtime.Scheme - ) - - BeforeEach(func() { - scheme = runtime.NewScheme() - Expect(v1alpha2.AddToScheme(scheme)).To(Succeed()) - }) - - Describe("#Convert_v1alpha2_GarbageCollection_To_registry_GarbageCollection", func() { - It("should convert successfully when enabled=true", func() { - in := &v1alpha2.GarbageCollection{ - Enabled: true, - } - out := ®istry.GarbageCollection{} - - Expect(scheme.Convert(in, out, nil)).To(Succeed()) - - expected := ®istry.GarbageCollection{ - TTL: metav1.Duration{Duration: 7 * 24 * time.Hour}, - } - Expect(out).To(Equal(expected)) - }) - - It("should convert successfully when enabled=false", func() { - in := &v1alpha2.GarbageCollection{ - Enabled: false, - } - out := ®istry.GarbageCollection{} - - Expect(scheme.Convert(in, out, nil)).To(Succeed()) - - expected := ®istry.GarbageCollection{ - TTL: metav1.Duration{Duration: 0}, - } - Expect(out).To(Equal(expected)) - }) - }) - - Describe("#Convert_registry_GarbageCollection_To_v1alpha2_GarbageCollection", func() { - It("should convert successfully when ttl > 0", func() { - in := ®istry.GarbageCollection{ - TTL: metav1.Duration{Duration: 7 * 24 * time.Hour}, - } - out := &v1alpha2.GarbageCollection{} - - Expect(scheme.Convert(in, out, nil)).To(Succeed()) - - expected := &v1alpha2.GarbageCollection{ - Enabled: true, - } - Expect(out).To(Equal(expected)) - }) - - It("should convert successfully when ttl = 0", func() { - in := ®istry.GarbageCollection{ - TTL: metav1.Duration{Duration: 0}, - } - out := &v1alpha2.GarbageCollection{} - - Expect(scheme.Convert(in, out, nil)).To(Succeed()) - - expected := &v1alpha2.GarbageCollection{ - Enabled: false, - } - Expect(out).To(Equal(expected)) - }) - }) -}) diff --git a/pkg/apis/registry/v1alpha2/defaults.go b/pkg/apis/registry/v1alpha2/defaults.go deleted file mode 100644 index caa1655d..00000000 --- a/pkg/apis/registry/v1alpha2/defaults.go +++ /dev/null @@ -1,30 +0,0 @@ -// SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Gardener contributors -// -// SPDX-License-Identifier: Apache-2.0 - -package v1alpha2 - -import ( - "k8s.io/apimachinery/pkg/api/resource" -) - -// SetDefaults_RegistryCache sets the defaults for a RegistryCache. -func SetDefaults_RegistryCache(cache *RegistryCache) { - if cache.Volume == nil { - cache.Volume = &Volume{} - } - - if cache.GarbageCollection == nil { - cache.GarbageCollection = &GarbageCollection{ - Enabled: true, - } - } -} - -// SetDefaults_Volume sets the defaults for a Volume. -func SetDefaults_Volume(volume *Volume) { - if volume.Size == nil { - defaultCacheSize := resource.MustParse("10Gi") - volume.Size = &defaultCacheSize - } -} diff --git a/pkg/apis/registry/v1alpha2/defaults_test.go b/pkg/apis/registry/v1alpha2/defaults_test.go deleted file mode 100644 index b1150576..00000000 --- a/pkg/apis/registry/v1alpha2/defaults_test.go +++ /dev/null @@ -1,67 +0,0 @@ -// SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Gardener contributors -// -// SPDX-License-Identifier: Apache-2.0 - -package v1alpha2_test - -import ( - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - "k8s.io/apimachinery/pkg/api/resource" - - "github.com/gardener/gardener-extension-registry-cache/pkg/apis/registry/v1alpha2" -) - -var _ = Describe("Defaults", func() { - - var ( - defaultSize = resource.MustParse("10Gi") - ) - - Describe("RegistryCache defaulting", func() { - It("should default correctly", func() { - obj := &v1alpha2.RegistryConfig{ - Caches: []v1alpha2.RegistryCache{ - {}, - }, - } - - v1alpha2.SetObjectDefaults_RegistryConfig(obj) - - expected := &v1alpha2.RegistryConfig{ - Caches: []v1alpha2.RegistryCache{ - { - Volume: &v1alpha2.Volume{ - Size: &defaultSize, - }, - GarbageCollection: &v1alpha2.GarbageCollection{ - Enabled: true, - }, - }, - }, - } - Expect(obj).To(Equal(expected)) - }) - - It("should not overwrite already set values", func() { - customSize := resource.MustParse("20Gi") - obj := &v1alpha2.RegistryConfig{ - Caches: []v1alpha2.RegistryCache{ - { - Volume: &v1alpha2.Volume{ - Size: &customSize, - }, - GarbageCollection: &v1alpha2.GarbageCollection{ - Enabled: false, - }, - }, - }, - } - expected := obj.DeepCopy() - - v1alpha2.SetObjectDefaults_RegistryConfig(obj) - - Expect(obj).To(Equal(expected)) - }) - }) -}) diff --git a/pkg/apis/registry/v1alpha2/doc.go b/pkg/apis/registry/v1alpha2/doc.go deleted file mode 100644 index df055f04..00000000 --- a/pkg/apis/registry/v1alpha2/doc.go +++ /dev/null @@ -1,12 +0,0 @@ -// SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Gardener contributors -// -// SPDX-License-Identifier: Apache-2.0 - -// +k8s:deepcopy-gen=package -// +k8s:conversion-gen=github.com/gardener/gardener-extension-registry-cache/pkg/apis/registry -// +k8s:defaulter-gen=TypeMeta -// +k8s:openapi-gen=true - -// Package v1alpha2 is a version of the API. -// +groupName=registry.extensions.gardener.cloud -package v1alpha2 // import "github.com/gardener/gardener-extension-registry-cache/pkg/apis/registry/v1alpha2" diff --git a/pkg/apis/registry/v1alpha2/register.go b/pkg/apis/registry/v1alpha2/register.go deleted file mode 100644 index f4dc58ce..00000000 --- a/pkg/apis/registry/v1alpha2/register.go +++ /dev/null @@ -1,32 +0,0 @@ -// SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Gardener contributors -// -// SPDX-License-Identifier: Apache-2.0 - -package v1alpha2 - -import ( - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" -) - -// GroupName is the group name use in this package -const GroupName = "registry.extensions.gardener.cloud" - -// SchemeGroupVersion is group version used to register these objects -var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha2"} - -var ( - localSchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes, RegisterDefaults) - // AddToScheme is a pointer to SchemeBuilder.AddToScheme. - AddToScheme = localSchemeBuilder.AddToScheme -) - -// Adds the list of known types to api.Scheme. -func addKnownTypes(scheme *runtime.Scheme) error { - scheme.AddKnownTypes(SchemeGroupVersion, - &RegistryConfig{}, - &RegistryStatus{}, - ) - - return nil -} diff --git a/pkg/apis/registry/v1alpha2/types.go b/pkg/apis/registry/v1alpha2/types.go deleted file mode 100644 index 325c151c..00000000 --- a/pkg/apis/registry/v1alpha2/types.go +++ /dev/null @@ -1,75 +0,0 @@ -// SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Gardener contributors -// -// SPDX-License-Identifier: Apache-2.0 - -package v1alpha2 - -import ( - "k8s.io/apimachinery/pkg/api/resource" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// RegistryConfig contains information about registry caches to deploy. -type RegistryConfig struct { - metav1.TypeMeta `json:",inline"` - - // Caches is a slice of registry caches to deploy. - Caches []RegistryCache `json:"caches"` -} - -// RegistryCache represents a registry cache to deploy. -type RegistryCache struct { - // Upstream is the remote registry host to cache. - // The value must be a valid DNS subdomain (RFC 1123). - Upstream string `json:"upstream"` - // Volume contains settings for the registry cache volume. - // +optional - Volume *Volume `json:"volume,omitempty"` - // GarbageCollection contains settings for the garbage collection of content from the cache. - // Defaults to enabled garbage collection. - // +optional - GarbageCollection *GarbageCollection `json:"garbageCollection,omitempty"` - // SecretReferenceName is the name of the reference for the Secret containing the upstream registry credentials. - // +optional - SecretReferenceName *string `json:"secretReferenceName,omitempty"` -} - -// Volume contains settings for the registry cache volume. -type Volume struct { - // Size is the size of the registry cache volume. - // Defaults to 10Gi. - // This field is immutable. - // +optional - Size *resource.Quantity `json:"size,omitempty"` - // StorageClassName is the name of the StorageClass used by the registry cache volume. - // This field is immutable. - // +optional - StorageClassName *string `json:"storageClassName,omitempty"` -} - -// GarbageCollection contains settings for the garbage collection of content from the cache. -type GarbageCollection struct { - // Enabled indicates whether the garbage collection is enabled. - Enabled bool `json:"enabled"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// RegistryStatus contains information about deployed registry caches. -type RegistryStatus struct { - metav1.TypeMeta `json:",inline"` - - // Caches is a slice of deployed registry caches. - Caches []RegistryCacheStatus `json:"caches"` -} - -// RegistryCacheStatus represents a deployed registry cache. -type RegistryCacheStatus struct { - // Upstream is the remote registry host. - Upstream string `json:"upstream"` - // Endpoint is the registry cache endpoint. - // Example: "http://10.4.246.205:5000" - Endpoint string `json:"endpoint"` -} diff --git a/pkg/apis/registry/v1alpha2/v1alpha2_suite_test.go b/pkg/apis/registry/v1alpha2/v1alpha2_suite_test.go deleted file mode 100644 index 1dd37b89..00000000 --- a/pkg/apis/registry/v1alpha2/v1alpha2_suite_test.go +++ /dev/null @@ -1,17 +0,0 @@ -// SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Gardener contributors -// -// SPDX-License-Identifier: Apache-2.0 - -package v1alpha2_test - -import ( - "testing" - - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" -) - -func TestV1alpha2(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "v1alpha2 Suite") -} diff --git a/pkg/apis/registry/v1alpha2/zz_generated.conversion.go b/pkg/apis/registry/v1alpha2/zz_generated.conversion.go deleted file mode 100644 index a4e958ff..00000000 --- a/pkg/apis/registry/v1alpha2/zz_generated.conversion.go +++ /dev/null @@ -1,244 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -// SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Gardener contributors -// -// SPDX-License-Identifier: Apache-2.0 -// Code generated by conversion-gen. DO NOT EDIT. - -package v1alpha2 - -import ( - unsafe "unsafe" - - registry "github.com/gardener/gardener-extension-registry-cache/pkg/apis/registry" - resource "k8s.io/apimachinery/pkg/api/resource" - conversion "k8s.io/apimachinery/pkg/conversion" - runtime "k8s.io/apimachinery/pkg/runtime" -) - -func init() { - localSchemeBuilder.Register(RegisterConversions) -} - -// RegisterConversions adds conversion functions to the given scheme. -// Public to allow building arbitrary schemes. -func RegisterConversions(s *runtime.Scheme) error { - if err := s.AddGeneratedConversionFunc((*RegistryCache)(nil), (*registry.RegistryCache)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_RegistryCache_To_registry_RegistryCache(a.(*RegistryCache), b.(*registry.RegistryCache), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*registry.RegistryCache)(nil), (*RegistryCache)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_registry_RegistryCache_To_v1alpha2_RegistryCache(a.(*registry.RegistryCache), b.(*RegistryCache), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*RegistryCacheStatus)(nil), (*registry.RegistryCacheStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_RegistryCacheStatus_To_registry_RegistryCacheStatus(a.(*RegistryCacheStatus), b.(*registry.RegistryCacheStatus), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*registry.RegistryCacheStatus)(nil), (*RegistryCacheStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_registry_RegistryCacheStatus_To_v1alpha2_RegistryCacheStatus(a.(*registry.RegistryCacheStatus), b.(*RegistryCacheStatus), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*RegistryConfig)(nil), (*registry.RegistryConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_RegistryConfig_To_registry_RegistryConfig(a.(*RegistryConfig), b.(*registry.RegistryConfig), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*registry.RegistryConfig)(nil), (*RegistryConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_registry_RegistryConfig_To_v1alpha2_RegistryConfig(a.(*registry.RegistryConfig), b.(*RegistryConfig), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*RegistryStatus)(nil), (*registry.RegistryStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_RegistryStatus_To_registry_RegistryStatus(a.(*RegistryStatus), b.(*registry.RegistryStatus), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*registry.RegistryStatus)(nil), (*RegistryStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_registry_RegistryStatus_To_v1alpha2_RegistryStatus(a.(*registry.RegistryStatus), b.(*RegistryStatus), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*Volume)(nil), (*registry.Volume)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_Volume_To_registry_Volume(a.(*Volume), b.(*registry.Volume), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*registry.Volume)(nil), (*Volume)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_registry_Volume_To_v1alpha2_Volume(a.(*registry.Volume), b.(*Volume), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*registry.GarbageCollection)(nil), (*GarbageCollection)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_registry_GarbageCollection_To_v1alpha2_GarbageCollection(a.(*registry.GarbageCollection), b.(*GarbageCollection), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*GarbageCollection)(nil), (*registry.GarbageCollection)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_GarbageCollection_To_registry_GarbageCollection(a.(*GarbageCollection), b.(*registry.GarbageCollection), scope) - }); err != nil { - return err - } - return nil -} - -func autoConvert_v1alpha2_GarbageCollection_To_registry_GarbageCollection(in *GarbageCollection, out *registry.GarbageCollection, s conversion.Scope) error { - // WARNING: in.Enabled requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_registry_GarbageCollection_To_v1alpha2_GarbageCollection(in *registry.GarbageCollection, out *GarbageCollection, s conversion.Scope) error { - // WARNING: in.TTL requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha2_RegistryCache_To_registry_RegistryCache(in *RegistryCache, out *registry.RegistryCache, s conversion.Scope) error { - out.Upstream = in.Upstream - out.Volume = (*registry.Volume)(unsafe.Pointer(in.Volume)) - if in.GarbageCollection != nil { - in, out := &in.GarbageCollection, &out.GarbageCollection - *out = new(registry.GarbageCollection) - if err := Convert_v1alpha2_GarbageCollection_To_registry_GarbageCollection(*in, *out, s); err != nil { - return err - } - } else { - out.GarbageCollection = nil - } - out.SecretReferenceName = (*string)(unsafe.Pointer(in.SecretReferenceName)) - return nil -} - -// Convert_v1alpha2_RegistryCache_To_registry_RegistryCache is an autogenerated conversion function. -func Convert_v1alpha2_RegistryCache_To_registry_RegistryCache(in *RegistryCache, out *registry.RegistryCache, s conversion.Scope) error { - return autoConvert_v1alpha2_RegistryCache_To_registry_RegistryCache(in, out, s) -} - -func autoConvert_registry_RegistryCache_To_v1alpha2_RegistryCache(in *registry.RegistryCache, out *RegistryCache, s conversion.Scope) error { - out.Upstream = in.Upstream - out.Volume = (*Volume)(unsafe.Pointer(in.Volume)) - if in.GarbageCollection != nil { - in, out := &in.GarbageCollection, &out.GarbageCollection - *out = new(GarbageCollection) - if err := Convert_registry_GarbageCollection_To_v1alpha2_GarbageCollection(*in, *out, s); err != nil { - return err - } - } else { - out.GarbageCollection = nil - } - out.SecretReferenceName = (*string)(unsafe.Pointer(in.SecretReferenceName)) - return nil -} - -// Convert_registry_RegistryCache_To_v1alpha2_RegistryCache is an autogenerated conversion function. -func Convert_registry_RegistryCache_To_v1alpha2_RegistryCache(in *registry.RegistryCache, out *RegistryCache, s conversion.Scope) error { - return autoConvert_registry_RegistryCache_To_v1alpha2_RegistryCache(in, out, s) -} - -func autoConvert_v1alpha2_RegistryCacheStatus_To_registry_RegistryCacheStatus(in *RegistryCacheStatus, out *registry.RegistryCacheStatus, s conversion.Scope) error { - out.Upstream = in.Upstream - out.Endpoint = in.Endpoint - return nil -} - -// Convert_v1alpha2_RegistryCacheStatus_To_registry_RegistryCacheStatus is an autogenerated conversion function. -func Convert_v1alpha2_RegistryCacheStatus_To_registry_RegistryCacheStatus(in *RegistryCacheStatus, out *registry.RegistryCacheStatus, s conversion.Scope) error { - return autoConvert_v1alpha2_RegistryCacheStatus_To_registry_RegistryCacheStatus(in, out, s) -} - -func autoConvert_registry_RegistryCacheStatus_To_v1alpha2_RegistryCacheStatus(in *registry.RegistryCacheStatus, out *RegistryCacheStatus, s conversion.Scope) error { - out.Upstream = in.Upstream - out.Endpoint = in.Endpoint - return nil -} - -// Convert_registry_RegistryCacheStatus_To_v1alpha2_RegistryCacheStatus is an autogenerated conversion function. -func Convert_registry_RegistryCacheStatus_To_v1alpha2_RegistryCacheStatus(in *registry.RegistryCacheStatus, out *RegistryCacheStatus, s conversion.Scope) error { - return autoConvert_registry_RegistryCacheStatus_To_v1alpha2_RegistryCacheStatus(in, out, s) -} - -func autoConvert_v1alpha2_RegistryConfig_To_registry_RegistryConfig(in *RegistryConfig, out *registry.RegistryConfig, s conversion.Scope) error { - if in.Caches != nil { - in, out := &in.Caches, &out.Caches - *out = make([]registry.RegistryCache, len(*in)) - for i := range *in { - if err := Convert_v1alpha2_RegistryCache_To_registry_RegistryCache(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Caches = nil - } - return nil -} - -// Convert_v1alpha2_RegistryConfig_To_registry_RegistryConfig is an autogenerated conversion function. -func Convert_v1alpha2_RegistryConfig_To_registry_RegistryConfig(in *RegistryConfig, out *registry.RegistryConfig, s conversion.Scope) error { - return autoConvert_v1alpha2_RegistryConfig_To_registry_RegistryConfig(in, out, s) -} - -func autoConvert_registry_RegistryConfig_To_v1alpha2_RegistryConfig(in *registry.RegistryConfig, out *RegistryConfig, s conversion.Scope) error { - if in.Caches != nil { - in, out := &in.Caches, &out.Caches - *out = make([]RegistryCache, len(*in)) - for i := range *in { - if err := Convert_registry_RegistryCache_To_v1alpha2_RegistryCache(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Caches = nil - } - return nil -} - -// Convert_registry_RegistryConfig_To_v1alpha2_RegistryConfig is an autogenerated conversion function. -func Convert_registry_RegistryConfig_To_v1alpha2_RegistryConfig(in *registry.RegistryConfig, out *RegistryConfig, s conversion.Scope) error { - return autoConvert_registry_RegistryConfig_To_v1alpha2_RegistryConfig(in, out, s) -} - -func autoConvert_v1alpha2_RegistryStatus_To_registry_RegistryStatus(in *RegistryStatus, out *registry.RegistryStatus, s conversion.Scope) error { - out.Caches = *(*[]registry.RegistryCacheStatus)(unsafe.Pointer(&in.Caches)) - return nil -} - -// Convert_v1alpha2_RegistryStatus_To_registry_RegistryStatus is an autogenerated conversion function. -func Convert_v1alpha2_RegistryStatus_To_registry_RegistryStatus(in *RegistryStatus, out *registry.RegistryStatus, s conversion.Scope) error { - return autoConvert_v1alpha2_RegistryStatus_To_registry_RegistryStatus(in, out, s) -} - -func autoConvert_registry_RegistryStatus_To_v1alpha2_RegistryStatus(in *registry.RegistryStatus, out *RegistryStatus, s conversion.Scope) error { - out.Caches = *(*[]RegistryCacheStatus)(unsafe.Pointer(&in.Caches)) - return nil -} - -// Convert_registry_RegistryStatus_To_v1alpha2_RegistryStatus is an autogenerated conversion function. -func Convert_registry_RegistryStatus_To_v1alpha2_RegistryStatus(in *registry.RegistryStatus, out *RegistryStatus, s conversion.Scope) error { - return autoConvert_registry_RegistryStatus_To_v1alpha2_RegistryStatus(in, out, s) -} - -func autoConvert_v1alpha2_Volume_To_registry_Volume(in *Volume, out *registry.Volume, s conversion.Scope) error { - out.Size = (*resource.Quantity)(unsafe.Pointer(in.Size)) - out.StorageClassName = (*string)(unsafe.Pointer(in.StorageClassName)) - return nil -} - -// Convert_v1alpha2_Volume_To_registry_Volume is an autogenerated conversion function. -func Convert_v1alpha2_Volume_To_registry_Volume(in *Volume, out *registry.Volume, s conversion.Scope) error { - return autoConvert_v1alpha2_Volume_To_registry_Volume(in, out, s) -} - -func autoConvert_registry_Volume_To_v1alpha2_Volume(in *registry.Volume, out *Volume, s conversion.Scope) error { - out.Size = (*resource.Quantity)(unsafe.Pointer(in.Size)) - out.StorageClassName = (*string)(unsafe.Pointer(in.StorageClassName)) - return nil -} - -// Convert_registry_Volume_To_v1alpha2_Volume is an autogenerated conversion function. -func Convert_registry_Volume_To_v1alpha2_Volume(in *registry.Volume, out *Volume, s conversion.Scope) error { - return autoConvert_registry_Volume_To_v1alpha2_Volume(in, out, s) -} diff --git a/pkg/apis/registry/v1alpha2/zz_generated.deepcopy.go b/pkg/apis/registry/v1alpha2/zz_generated.deepcopy.go deleted file mode 100644 index 6c0f0cf2..00000000 --- a/pkg/apis/registry/v1alpha2/zz_generated.deepcopy.go +++ /dev/null @@ -1,164 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -// SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Gardener contributors -// -// SPDX-License-Identifier: Apache-2.0 -// Code generated by deepcopy-gen. DO NOT EDIT. - -package v1alpha2 - -import ( - runtime "k8s.io/apimachinery/pkg/runtime" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *GarbageCollection) DeepCopyInto(out *GarbageCollection) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GarbageCollection. -func (in *GarbageCollection) DeepCopy() *GarbageCollection { - if in == nil { - return nil - } - out := new(GarbageCollection) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RegistryCache) DeepCopyInto(out *RegistryCache) { - *out = *in - if in.Volume != nil { - in, out := &in.Volume, &out.Volume - *out = new(Volume) - (*in).DeepCopyInto(*out) - } - if in.GarbageCollection != nil { - in, out := &in.GarbageCollection, &out.GarbageCollection - *out = new(GarbageCollection) - **out = **in - } - if in.SecretReferenceName != nil { - in, out := &in.SecretReferenceName, &out.SecretReferenceName - *out = new(string) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RegistryCache. -func (in *RegistryCache) DeepCopy() *RegistryCache { - if in == nil { - return nil - } - out := new(RegistryCache) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RegistryCacheStatus) DeepCopyInto(out *RegistryCacheStatus) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RegistryCacheStatus. -func (in *RegistryCacheStatus) DeepCopy() *RegistryCacheStatus { - if in == nil { - return nil - } - out := new(RegistryCacheStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RegistryConfig) DeepCopyInto(out *RegistryConfig) { - *out = *in - out.TypeMeta = in.TypeMeta - if in.Caches != nil { - in, out := &in.Caches, &out.Caches - *out = make([]RegistryCache, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RegistryConfig. -func (in *RegistryConfig) DeepCopy() *RegistryConfig { - if in == nil { - return nil - } - out := new(RegistryConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *RegistryConfig) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RegistryStatus) DeepCopyInto(out *RegistryStatus) { - *out = *in - out.TypeMeta = in.TypeMeta - if in.Caches != nil { - in, out := &in.Caches, &out.Caches - *out = make([]RegistryCacheStatus, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RegistryStatus. -func (in *RegistryStatus) DeepCopy() *RegistryStatus { - if in == nil { - return nil - } - out := new(RegistryStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *RegistryStatus) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Volume) DeepCopyInto(out *Volume) { - *out = *in - if in.Size != nil { - in, out := &in.Size, &out.Size - x := (*in).DeepCopy() - *out = &x - } - if in.StorageClassName != nil { - in, out := &in.StorageClassName, &out.StorageClassName - *out = new(string) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Volume. -func (in *Volume) DeepCopy() *Volume { - if in == nil { - return nil - } - out := new(Volume) - in.DeepCopyInto(out) - return out -} diff --git a/pkg/apis/registry/v1alpha2/zz_generated.defaults.go b/pkg/apis/registry/v1alpha2/zz_generated.defaults.go deleted file mode 100644 index 7fe87cfe..00000000 --- a/pkg/apis/registry/v1alpha2/zz_generated.defaults.go +++ /dev/null @@ -1,31 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -// SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Gardener contributors -// -// SPDX-License-Identifier: Apache-2.0 -// Code generated by defaulter-gen. DO NOT EDIT. - -package v1alpha2 - -import ( - runtime "k8s.io/apimachinery/pkg/runtime" -) - -// RegisterDefaults adds defaulters functions to the given scheme. -// Public to allow building arbitrary schemes. -// All generated defaulters are covering - they call all nested defaulters. -func RegisterDefaults(scheme *runtime.Scheme) error { - scheme.AddTypeDefaultingFunc(&RegistryConfig{}, func(obj interface{}) { SetObjectDefaults_RegistryConfig(obj.(*RegistryConfig)) }) - return nil -} - -func SetObjectDefaults_RegistryConfig(in *RegistryConfig) { - for i := range in.Caches { - a := &in.Caches[i] - SetDefaults_RegistryCache(a) - if a.Volume != nil { - SetDefaults_Volume(a.Volume) - } - } -} diff --git a/skaffold.yaml b/skaffold.yaml index 89e4ca0f..adae5c0f 100644 --- a/skaffold.yaml +++ b/skaffold.yaml @@ -20,7 +20,6 @@ build: - pkg/apis/registry - pkg/apis/registry/helper - pkg/apis/registry/install - - pkg/apis/registry/v1alpha2 - pkg/apis/registry/v1alpha3 - pkg/cmd - pkg/component/registrycaches @@ -68,7 +67,6 @@ build: - pkg/apis/registry - pkg/apis/registry/helper - pkg/apis/registry/install - - pkg/apis/registry/v1alpha2 - pkg/apis/registry/v1alpha3 - pkg/apis/registry/validation - pkg/constants