From 20003b3c15a86f21fb06890705b8d3c025990b2e Mon Sep 17 00:00:00 2001 From: Tamal Saha Date: Mon, 30 Oct 2023 17:41:00 -0700 Subject: [PATCH] Remove registryFQDN Signed-off-by: Tamal Saha --- apis/core/v1alpha1/openapi_generated.go | 7 ---- apis/management/v1alpha1/openapi_generated.go | 7 ---- apis/meta/v1alpha1/openapi_generated.go | 7 ---- apis/shared/helm.go | 2 -- apis/shared/helpers.go | 36 +++++++------------ apis/shared/openapi_generated.go | 7 ---- apis/ui/v1alpha1/openapi_generated.go | 7 ---- 7 files changed, 12 insertions(+), 61 deletions(-) diff --git a/apis/core/v1alpha1/openapi_generated.go b/apis/core/v1alpha1/openapi_generated.go index 53024c318..58ab81867 100644 --- a/apis/core/v1alpha1/openapi_generated.go +++ b/apis/core/v1alpha1/openapi_generated.go @@ -16652,13 +16652,6 @@ func schema_kmodulesxyz_resource_metadata_apis_shared_ImageRegistrySpec(ref comm SchemaProps: spec.SchemaProps{ Type: []string{"object"}, Properties: map[string]spec.Schema{ - "registryFQDN": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, "proxies": { SchemaProps: spec.SchemaProps{ Default: map[string]interface{}{}, diff --git a/apis/management/v1alpha1/openapi_generated.go b/apis/management/v1alpha1/openapi_generated.go index 77b6e1f46..abb1ec7c8 100644 --- a/apis/management/v1alpha1/openapi_generated.go +++ b/apis/management/v1alpha1/openapi_generated.go @@ -15403,13 +15403,6 @@ func schema_kmodulesxyz_resource_metadata_apis_shared_ImageRegistrySpec(ref comm SchemaProps: spec.SchemaProps{ Type: []string{"object"}, Properties: map[string]spec.Schema{ - "registryFQDN": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, "proxies": { SchemaProps: spec.SchemaProps{ Default: map[string]interface{}{}, diff --git a/apis/meta/v1alpha1/openapi_generated.go b/apis/meta/v1alpha1/openapi_generated.go index 39e81689a..8339b6bd8 100644 --- a/apis/meta/v1alpha1/openapi_generated.go +++ b/apis/meta/v1alpha1/openapi_generated.go @@ -19372,13 +19372,6 @@ func schema_kmodulesxyz_resource_metadata_apis_shared_ImageRegistrySpec(ref comm SchemaProps: spec.SchemaProps{ Type: []string{"object"}, Properties: map[string]spec.Schema{ - "registryFQDN": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, "proxies": { SchemaProps: spec.SchemaProps{ Default: map[string]interface{}{}, diff --git a/apis/shared/helm.go b/apis/shared/helm.go index eec83f543..7f48e2bcc 100644 --- a/apis/shared/helm.go +++ b/apis/shared/helm.go @@ -28,8 +28,6 @@ type BootstrapPresets struct { } type ImageRegistrySpec struct { - //+optional - RegistryFQDN string `json:"registryFQDN"` //+optional Proxies RegistryProxies `json:"proxies"` } diff --git a/apis/shared/helpers.go b/apis/shared/helpers.go index f4c03f563..fa5e0eafa 100644 --- a/apis/shared/helpers.go +++ b/apis/shared/helpers.go @@ -95,9 +95,6 @@ func (r ResourceLocator) GraphQuery(oid kmapi.OID) (string, map[string]interface func (r ImageRegistrySpec) DockerHubProxy() string { addr := r.Proxies.DockerHub - if addr == "" { - addr = r.RegistryFQDN - } addr = strings.TrimSpace(addr) addr = strings.TrimSuffix(addr, "/") return addr @@ -108,9 +105,6 @@ func (r ImageRegistrySpec) DockerLibraryProxy() string { if addr == "" { addr = r.Proxies.DockerHub } - if addr == "" { - addr = r.RegistryFQDN - } addr = strings.TrimSpace(addr) addr = strings.TrimSuffix(addr, "/") return addr @@ -118,9 +112,6 @@ func (r ImageRegistrySpec) DockerLibraryProxy() string { func (r ImageRegistrySpec) GHCRProxy() string { addr := r.Proxies.GHCR - if addr == "" { - addr = r.RegistryFQDN - } addr = strings.TrimSpace(addr) addr = strings.TrimSuffix(addr, "/") return addr @@ -128,9 +119,6 @@ func (r ImageRegistrySpec) GHCRProxy() string { func (r ImageRegistrySpec) QuayProxy() string { addr := r.Proxies.Quay - if addr == "" { - addr = r.RegistryFQDN - } addr = strings.TrimSpace(addr) addr = strings.TrimSuffix(addr, "/") return addr @@ -138,9 +126,6 @@ func (r ImageRegistrySpec) QuayProxy() string { func (r ImageRegistrySpec) KubernetesRegistryProxy() string { addr := r.Proxies.Kubernetes - if addr == "" { - addr = r.RegistryFQDN - } addr = strings.TrimSpace(addr) addr = strings.TrimSuffix(addr, "/") return addr @@ -148,9 +133,6 @@ func (r ImageRegistrySpec) KubernetesRegistryProxy() string { func (r ImageRegistrySpec) AppsCodeRegistryProxy() string { addr := r.Proxies.AppsCode - if addr == "" { - addr = r.RegistryFQDN - } addr = strings.TrimSpace(addr) addr = strings.TrimSuffix(addr, "/") return addr @@ -159,10 +141,6 @@ func (r ImageRegistrySpec) AppsCodeRegistryProxy() string { const defaultTag = "latest" func NewRef(spec ImageRegistrySpec, img string) (string, error) { - if spec.RegistryFQDN == "" { - return img, nil - } - ref, err := name.ParseReference(img) if err != nil { return "", err @@ -174,9 +152,19 @@ func NewRef(spec ImageRegistrySpec, img string) (string, error) { var result string _, bin, found := strings.Cut(ref.Repository, "library/") if found { - result = spec.DockerLibraryProxy() + "/" + bin + addr := spec.DockerLibraryProxy() + if addr != "" { + result = addr + "/" + bin + } else { + result = bin + } } else { - result = spec.DockerHubProxy() + "/" + ref.Repository + addr := spec.DockerHubProxy() + if addr != "" { + result = addr + "/" + ref.Repository + } else { + addr = ref.Repository + } } if ref.Tag != "" && ref.Tag != defaultTag { result += ":" + ref.Tag diff --git a/apis/shared/openapi_generated.go b/apis/shared/openapi_generated.go index ad6f44c8f..cf3de9d1a 100644 --- a/apis/shared/openapi_generated.go +++ b/apis/shared/openapi_generated.go @@ -607,13 +607,6 @@ func schema_kmodulesxyz_resource_metadata_apis_shared_ImageRegistrySpec(ref comm SchemaProps: spec.SchemaProps{ Type: []string{"object"}, Properties: map[string]spec.Schema{ - "registryFQDN": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, "proxies": { SchemaProps: spec.SchemaProps{ Default: map[string]interface{}{}, diff --git a/apis/ui/v1alpha1/openapi_generated.go b/apis/ui/v1alpha1/openapi_generated.go index 8b2f975f4..e8e214309 100644 --- a/apis/ui/v1alpha1/openapi_generated.go +++ b/apis/ui/v1alpha1/openapi_generated.go @@ -15163,13 +15163,6 @@ func schema_kmodulesxyz_resource_metadata_apis_shared_ImageRegistrySpec(ref comm SchemaProps: spec.SchemaProps{ Type: []string{"object"}, Properties: map[string]spec.Schema{ - "registryFQDN": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, "proxies": { SchemaProps: spec.SchemaProps{ Default: map[string]interface{}{},