diff --git a/api/v1alpha1/frontendenvironment_types.go b/api/v1alpha1/frontendenvironment_types.go index a6080574..ba476c96 100644 --- a/api/v1alpha1/frontendenvironment_types.go +++ b/api/v1alpha1/frontendenvironment_types.go @@ -88,6 +88,9 @@ type FrontendEnvironmentSpec struct { EnableAkamaiCacheBust bool `json:"enableAkamaiCacheBust,omitempty"` // Set Akamai Cache Bust Image AkamaiCacheBustImage string `json:"akamaiCacheBustImage,omitempty"` + // Deprecated: Users should move to AkamaiCacheBustURLs + // Preserving for backwards compatibility + AkamaiCacheBustURL string `json:"akamaiCacheBustURL,omitempty"` // Set Akamai Cache Bust URL that the files will hang off of AkamaiCacheBustURLs []string `json:"akamaiCacheBustURLs,omitempty"` // The name of the secret we will use to get the akamai credentials diff --git a/config/crd/bases/cloud.redhat.com_frontendenvironments.yaml b/config/crd/bases/cloud.redhat.com_frontendenvironments.yaml index fda58459..cb70d4e2 100644 --- a/config/crd/bases/cloud.redhat.com_frontendenvironments.yaml +++ b/config/crd/bases/cloud.redhat.com_frontendenvironments.yaml @@ -52,6 +52,11 @@ spec: akamaiCacheBustImage: description: Set Akamai Cache Bust Image type: string + akamaiCacheBustURL: + description: |- + Deprecated: Users should move to AkamaiCacheBustURLs + Preserving for backwards compatibility + type: string akamaiCacheBustURLs: description: Set Akamai Cache Bust URL that the files will hang off of diff --git a/controllers/reconcile.go b/controllers/reconcile.go index a7df3e45..d4b800d6 100644 --- a/controllers/reconcile.go +++ b/controllers/reconcile.go @@ -228,12 +228,18 @@ func createCachePurgePathList(frontend *crd.Frontend, frontendEnvironment *crd.F return false } - // Return early if there are no AkamaiCacheBustURLs - if frontendEnvironment.Spec.AkamaiCacheBustURLs == nil { + cacheBustUrls := frontendEnvironment.Spec.AkamaiCacheBustURLs + + if frontendEnvironment.Spec.AkamaiCacheBustURL != "" { + cacheBustUrls = append(cacheBustUrls, frontendEnvironment.Spec.AkamaiCacheBustURL) + } + + // Return early if we have no cache bust URLs of any kind to process + if len(cacheBustUrls) == 0 { return purgePaths } - for _, cacheBustURL := range frontendEnvironment.Spec.AkamaiCacheBustURLs { + for _, cacheBustURL := range cacheBustUrls { // Ensure the URL begins with https:// and has no trailing / purgeHost := strings.TrimSuffix(fmt.Sprintf("https://%s", strings.TrimPrefix(cacheBustURL, "https://")), "/") diff --git a/deploy.yml b/deploy.yml index 92976216..478d3d39 100644 --- a/deploy.yml +++ b/deploy.yml @@ -255,6 +255,11 @@ objects: akamaiCacheBustImage: description: Set Akamai Cache Bust Image type: string + akamaiCacheBustURL: + description: 'Deprecated: Users should move to AkamaiCacheBustURLs + + Preserving for backwards compatibility' + type: string akamaiCacheBustURLs: description: Set Akamai Cache Bust URL that the files will hang off of diff --git a/docs/antora/modules/ROOT/pages/api_reference.adoc b/docs/antora/modules/ROOT/pages/api_reference.adoc index a3f15e4d..1145558c 100644 --- a/docs/antora/modules/ROOT/pages/api_reference.adoc +++ b/docs/antora/modules/ROOT/pages/api_reference.adoc @@ -458,6 +458,8 @@ parts should be generated for the bundles. We want to do + do this in epehemeral environments but not in production + | | | *`enableAkamaiCacheBust`* __boolean__ | Enable Akamai Cache Bust + | | | *`akamaiCacheBustImage`* __string__ | Set Akamai Cache Bust Image + | | +| *`akamaiCacheBustURL`* __string__ | Deprecated: Users should move to AkamaiCacheBustURLs + +Preserving for backwards compatibility + | | | *`akamaiCacheBustURLs`* __string array__ | Set Akamai Cache Bust URL that the files will hang off of + | | | *`akamaiSecretName`* __string__ | The name of the secret we will use to get the akamai credentials + | | | *`targetNamespaces`* __string array__ | List of namespaces that should receive a copy of the frontend configuration as a config map + diff --git a/tests/e2e/cachebust/01-create-resources.yaml b/tests/e2e/cachebust/01-create-resources.yaml index eccd3ef5..58520b83 100644 --- a/tests/e2e/cachebust/01-create-resources.yaml +++ b/tests/e2e/cachebust/01-create-resources.yaml @@ -10,8 +10,7 @@ spec: sso: https://sso.foo.redhat.com enableAkamaiCacheBust: true akamaiCacheBustImage: "quay.io/rh_ee_addrew/hi_true_bye:add_alias" - akamaiCacheBustURLs: - - "console.doesntexist.redhat.com" + akamaiCacheBustURL: "console.doesntexist.redhat.com" --- apiVersion: cloud.redhat.com/v1alpha1 kind: Frontend