From 1e1c0f62bc9f3a0c18a6a50ba0a1c3752ef5edc5 Mon Sep 17 00:00:00 2001 From: Salah Al Saleh Date: Fri, 23 Feb 2024 18:21:52 +0000 Subject: [PATCH 1/3] Fix templating LicenseFieldValue on license sync --- .gitignore | 1 + pkg/handlers/config.go | 9 +- pkg/handlers/identity.go | 9 +- pkg/handlers/registry.go | 2 +- pkg/handlers/upload.go | 9 +- pkg/operator/operator.go | 10 +- pkg/preflight/preflight.go | 11 +- pkg/registry/registry.go | 33 ++- pkg/render/helper/appfile.go | 11 +- pkg/render/render.go | 68 +++-- pkg/render/types/interface.go | 22 +- pkg/store/kotsstore/license_store.go | 8 +- pkg/store/kotsstore/version_store.go | 30 +- pkg/store/store.go | 1 + .../simple/archiveDir/base/kustomization.yaml | 7 + .../archiveDir/base/subdir/configmap.yaml | 25 ++ .../simple/archiveDir/kotsKinds/config.yaml | 19 ++ .../archiveDir/kotsKinds/userdata/config.yaml | 10 + .../kotsKinds/userdata/installation.yaml | 9 + .../kotsKinds/userdata/license.yaml | 50 ++++ .../this-cluster/kustomization.yaml | 4 + .../midstream/backup-label-transformer.yaml | 39 +++ .../overlays/midstream/kustomization.yaml | 10 + .../archiveDir/overlays/midstream/secret.yaml | 28 ++ .../kotsadm-replicated-registry-secret.yaml | 17 ++ .../this-cluster/my-app-registry-secret.yaml | 17 ++ .../test-licenseinfo-configmap.yaml | 33 +++ .../simple/archiveDir/upstream/config.yaml | 15 + .../archiveDir/upstream/subdir/configmap.yaml | 25 ++ .../archiveDir/upstream/userdata/config.yaml | 10 + .../upstream/userdata/installation.yaml | 9 + .../archiveDir/upstream/userdata/license.yaml | 49 ++++ .../renderdir/cases/simple/testcase.yaml | 9 + .../wantResults/base/kustomization.yaml | 7 + .../wantResults/base/subdir/configmap.yaml | 25 ++ .../simple/wantResults/kotsKinds/config.yaml | 19 ++ .../kotsKinds/userdata/config.yaml | 10 + .../kotsKinds/userdata/installation.yaml | 9 + .../kotsKinds/userdata/license.yaml | 49 ++++ .../this-cluster/kustomization.yaml | 4 + .../midstream/backup-label-transformer.yaml | 39 +++ .../overlays/midstream/kustomization.yaml | 10 + .../overlays/midstream/secret.yaml | 28 ++ .../kotsadm-replicated-registry-secret.yaml | 17 ++ .../this-cluster/my-app-registry-secret.yaml | 17 ++ .../test-licenseinfo-configmap.yaml | 33 +++ .../simple/wantResults/upstream/config.yaml | 15 + .../upstream/subdir/configmap.yaml | 25 ++ .../wantResults/upstream/userdata/config.yaml | 10 + .../upstream/userdata/installation.yaml | 9 + .../upstream/userdata/license.yaml | 49 ++++ pkg/tests/renderdir/renderdir_test.go | 256 ++++++++++++++++++ pkg/version/metrics.go | 11 +- 53 files changed, 1194 insertions(+), 57 deletions(-) create mode 100644 pkg/tests/renderdir/cases/simple/archiveDir/base/kustomization.yaml create mode 100644 pkg/tests/renderdir/cases/simple/archiveDir/base/subdir/configmap.yaml create mode 100644 pkg/tests/renderdir/cases/simple/archiveDir/kotsKinds/config.yaml create mode 100644 pkg/tests/renderdir/cases/simple/archiveDir/kotsKinds/userdata/config.yaml create mode 100644 pkg/tests/renderdir/cases/simple/archiveDir/kotsKinds/userdata/installation.yaml create mode 100644 pkg/tests/renderdir/cases/simple/archiveDir/kotsKinds/userdata/license.yaml create mode 100644 pkg/tests/renderdir/cases/simple/archiveDir/overlays/downstreams/this-cluster/kustomization.yaml create mode 100644 pkg/tests/renderdir/cases/simple/archiveDir/overlays/midstream/backup-label-transformer.yaml create mode 100644 pkg/tests/renderdir/cases/simple/archiveDir/overlays/midstream/kustomization.yaml create mode 100644 pkg/tests/renderdir/cases/simple/archiveDir/overlays/midstream/secret.yaml create mode 100644 pkg/tests/renderdir/cases/simple/archiveDir/rendered/this-cluster/kotsadm-replicated-registry-secret.yaml create mode 100644 pkg/tests/renderdir/cases/simple/archiveDir/rendered/this-cluster/my-app-registry-secret.yaml create mode 100644 pkg/tests/renderdir/cases/simple/archiveDir/rendered/this-cluster/test-licenseinfo-configmap.yaml create mode 100644 pkg/tests/renderdir/cases/simple/archiveDir/upstream/config.yaml create mode 100644 pkg/tests/renderdir/cases/simple/archiveDir/upstream/subdir/configmap.yaml create mode 100644 pkg/tests/renderdir/cases/simple/archiveDir/upstream/userdata/config.yaml create mode 100644 pkg/tests/renderdir/cases/simple/archiveDir/upstream/userdata/installation.yaml create mode 100644 pkg/tests/renderdir/cases/simple/archiveDir/upstream/userdata/license.yaml create mode 100644 pkg/tests/renderdir/cases/simple/testcase.yaml create mode 100644 pkg/tests/renderdir/cases/simple/wantResults/base/kustomization.yaml create mode 100644 pkg/tests/renderdir/cases/simple/wantResults/base/subdir/configmap.yaml create mode 100644 pkg/tests/renderdir/cases/simple/wantResults/kotsKinds/config.yaml create mode 100644 pkg/tests/renderdir/cases/simple/wantResults/kotsKinds/userdata/config.yaml create mode 100644 pkg/tests/renderdir/cases/simple/wantResults/kotsKinds/userdata/installation.yaml create mode 100644 pkg/tests/renderdir/cases/simple/wantResults/kotsKinds/userdata/license.yaml create mode 100644 pkg/tests/renderdir/cases/simple/wantResults/overlays/downstreams/this-cluster/kustomization.yaml create mode 100644 pkg/tests/renderdir/cases/simple/wantResults/overlays/midstream/backup-label-transformer.yaml create mode 100644 pkg/tests/renderdir/cases/simple/wantResults/overlays/midstream/kustomization.yaml create mode 100644 pkg/tests/renderdir/cases/simple/wantResults/overlays/midstream/secret.yaml create mode 100644 pkg/tests/renderdir/cases/simple/wantResults/rendered/this-cluster/kotsadm-replicated-registry-secret.yaml create mode 100644 pkg/tests/renderdir/cases/simple/wantResults/rendered/this-cluster/my-app-registry-secret.yaml create mode 100644 pkg/tests/renderdir/cases/simple/wantResults/rendered/this-cluster/test-licenseinfo-configmap.yaml create mode 100644 pkg/tests/renderdir/cases/simple/wantResults/upstream/config.yaml create mode 100644 pkg/tests/renderdir/cases/simple/wantResults/upstream/subdir/configmap.yaml create mode 100644 pkg/tests/renderdir/cases/simple/wantResults/upstream/userdata/config.yaml create mode 100644 pkg/tests/renderdir/cases/simple/wantResults/upstream/userdata/installation.yaml create mode 100644 pkg/tests/renderdir/cases/simple/wantResults/upstream/userdata/license.yaml create mode 100644 pkg/tests/renderdir/renderdir_test.go diff --git a/.gitignore b/.gitignore index 7850f288c6..a999a148ad 100644 --- a/.gitignore +++ b/.gitignore @@ -34,6 +34,7 @@ kotsdata/ sbom/ cosign.key pkg/tests/pull/cases/*/results +pkg/tests/renderdir/cases/*/results melange.rsa melange.rsa.pub diff --git a/pkg/handlers/config.go b/pkg/handlers/config.go index 9aee7e35c6..408889d081 100644 --- a/pkg/handlers/config.go +++ b/pkg/handlers/config.go @@ -28,6 +28,7 @@ import ( "github.com/replicatedhq/kots/pkg/preflight" registrytypes "github.com/replicatedhq/kots/pkg/registry/types" "github.com/replicatedhq/kots/pkg/render" + rendertypes "github.com/replicatedhq/kots/pkg/render/types" "github.com/replicatedhq/kots/pkg/replicatedapp" "github.com/replicatedhq/kots/pkg/store" storetypes "github.com/replicatedhq/kots/pkg/store/types" @@ -893,7 +894,13 @@ func updateAppConfig(updateApp *apptypes.App, sequence int64, configGroups []kot renderSequence = nextAppSequence } - err = render.RenderDir(archiveDir, app, downstreams, registrySettings, renderSequence) + err = render.RenderDir(rendertypes.RenderDirOptions{ + ArchiveDir: archiveDir, + App: app, + Downstreams: downstreams, + RegistrySettings: registrySettings, + Sequence: renderSequence, + }) if err != nil { cause := errors.Cause(err) if _, ok := cause.(util.ActionableError); ok { diff --git a/pkg/handlers/identity.go b/pkg/handlers/identity.go index f0e9b4459b..e5f2f083da 100644 --- a/pkg/handlers/identity.go +++ b/pkg/handlers/identity.go @@ -25,6 +25,7 @@ import ( "github.com/replicatedhq/kots/pkg/preflight" "github.com/replicatedhq/kots/pkg/rbac" "github.com/replicatedhq/kots/pkg/render" + rendertypes "github.com/replicatedhq/kots/pkg/render/types" "github.com/replicatedhq/kots/pkg/store" "github.com/replicatedhq/kots/pkg/util" "github.com/replicatedhq/kots/pkg/version" @@ -455,7 +456,13 @@ func (h *Handler) ConfigureAppIdentityService(w http.ResponseWriter, r *http.Req return } - err = render.RenderDir(archiveDir, a, downstreams, registrySettings, nextAppSequence) + err = render.RenderDir(rendertypes.RenderDirOptions{ + ArchiveDir: archiveDir, + App: a, + Downstreams: downstreams, + RegistrySettings: registrySettings, + Sequence: nextAppSequence, + }) if err != nil { err = errors.Wrap(err, "failed to render archive directory") logger.Error(err) diff --git a/pkg/handlers/registry.go b/pkg/handlers/registry.go index ebabf8a05b..42c4594d6c 100644 --- a/pkg/handlers/registry.go +++ b/pkg/handlers/registry.go @@ -238,7 +238,7 @@ func (h *Handler) UpdateAppRegistry(w http.ResponseWriter, r *http.Request) { appDir, err := registry.RewriteImages( foundApp.ID, latestSequence, updateAppRegistryRequest.Hostname, updateAppRegistryRequest.Username, registryPassword, - updateAppRegistryRequest.Namespace, skipImagePush, nil) + updateAppRegistryRequest.Namespace, skipImagePush) if err != nil { // log credential errors at info level causeErr := errors.Cause(err) diff --git a/pkg/handlers/upload.go b/pkg/handlers/upload.go index f87b18bec7..fcd2a14ba9 100644 --- a/pkg/handlers/upload.go +++ b/pkg/handlers/upload.go @@ -15,6 +15,7 @@ import ( "github.com/replicatedhq/kots/pkg/logger" "github.com/replicatedhq/kots/pkg/preflight" "github.com/replicatedhq/kots/pkg/render" + rendertypes "github.com/replicatedhq/kots/pkg/render/types" "github.com/replicatedhq/kots/pkg/store" storetypes "github.com/replicatedhq/kots/pkg/store/types" "github.com/replicatedhq/kots/pkg/util" @@ -158,7 +159,13 @@ func (h *Handler) UploadExistingApp(w http.ResponseWriter, r *http.Request) { return } - err = render.RenderDir(archiveDir, a, downstreams, registrySettings, nextAppSequence) + err = render.RenderDir(rendertypes.RenderDirOptions{ + ArchiveDir: archiveDir, + App: a, + Downstreams: downstreams, + RegistrySettings: registrySettings, + Sequence: nextAppSequence, + }) if err != nil { cause := errors.Cause(err) if _, ok := cause.(util.ActionableError); ok { diff --git a/pkg/operator/operator.go b/pkg/operator/operator.go index 7b5c4f306e..003b9ef12c 100644 --- a/pkg/operator/operator.go +++ b/pkg/operator/operator.go @@ -886,7 +886,15 @@ func (o *Operator) renderKotsApplicationSpec(app *apptypes.App, sequence int64, return nil, errors.Wrap(err, "failed to marshal kots app spec") } - renderedKotsAppSpec, err := renderer.RenderFile(kotsKinds, registrySettings, app.Slug, sequence, app.IsAirgap, namespace, []byte(marshalledKotsAppSpec)) + renderedKotsAppSpec, err := renderer.RenderFile(rendertypes.RenderFileOptions{ + KotsKinds: kotsKinds, + RegistrySettings: registrySettings, + AppSlug: app.Slug, + Sequence: sequence, + IsAirgap: app.IsAirgap, + Namespace: namespace, + InputContent: []byte(marshalledKotsAppSpec), + }) if err != nil { return nil, errors.Wrap(err, "failed to render preflights") } diff --git a/pkg/preflight/preflight.go b/pkg/preflight/preflight.go index d1d46c2cc9..d32e69a03c 100644 --- a/pkg/preflight/preflight.go +++ b/pkg/preflight/preflight.go @@ -20,6 +20,7 @@ import ( registrytypes "github.com/replicatedhq/kots/pkg/registry/types" "github.com/replicatedhq/kots/pkg/render" "github.com/replicatedhq/kots/pkg/render/helper" + rendertypes "github.com/replicatedhq/kots/pkg/render/types" "github.com/replicatedhq/kots/pkg/reporting" "github.com/replicatedhq/kots/pkg/store" storetypes "github.com/replicatedhq/kots/pkg/store/types" @@ -107,7 +108,15 @@ func Run(appID string, appSlug string, sequence int64, isAirgap bool, archiveDir return errors.Wrap(err, "failed to marshal rendered preflight") } - renderedPreflight, err := render.RenderFile(kotsKinds, registrySettings, appSlug, sequence, isAirgap, util.PodNamespace, []byte(renderedMarshalledPreflights)) + renderedPreflight, err := render.RenderFile(rendertypes.RenderFileOptions{ + KotsKinds: kotsKinds, + RegistrySettings: registrySettings, + AppSlug: appSlug, + Sequence: sequence, + IsAirgap: isAirgap, + Namespace: util.PodNamespace, + InputContent: []byte(renderedMarshalledPreflights), + }) if err != nil { return errors.Wrap(err, "failed to render preflights") } diff --git a/pkg/registry/registry.go b/pkg/registry/registry.go index cca11302b5..91917dd119 100644 --- a/pkg/registry/registry.go +++ b/pkg/registry/registry.go @@ -21,7 +21,6 @@ import ( "github.com/replicatedhq/kots/pkg/rewrite" "github.com/replicatedhq/kots/pkg/store" "github.com/replicatedhq/kots/pkg/util" - kotsv1beta1 "github.com/replicatedhq/kotskinds/apis/kots/v1beta1" corev1 "k8s.io/api/core/v1" kuberneteserrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -30,7 +29,7 @@ import ( // RewriteImages will use the app (a) and send the images to the registry specified. It will create patches for these // and create a new version of the application // the caller is responsible for deleting the appDir returned -func RewriteImages(appID string, sequence int64, hostname string, username string, password string, namespace string, isReadOnly bool, configValues *kotsv1beta1.ConfigValues) (appDir string, finalError error) { +func RewriteImages(appID string, sequence int64, hostname string, username string, password string, namespace string, isReadOnly bool) (appDir string, finalError error) { if err := store.GetStore().SetTaskStatus("image-rewrite", "Updating registry settings", "running"); err != nil { return "", errors.Wrap(err, "failed to set task status") } @@ -76,15 +75,6 @@ func RewriteImages(appID string, sequence int64, hostname string, username strin return "", errors.Wrap(err, "failed to get app version archive") } - kotsKinds, err := kotsutil.LoadKotsKinds(appDir) - if err != nil { - return "", errors.Wrap(err, "failed to load kotskinds from path") - } - - if configValues == nil { - configValues = kotsKinds.ConfigValues - } - // get the downstream names only downstreams, err := store.GetStore().ListDownstreamsForApp(appID) if err != nil { @@ -123,15 +113,30 @@ func RewriteImages(appID string, sequence int64, hostname string, username strin return "", errors.Wrap(err, "failed to get next app sequence") } + installation, err := kotsutil.LoadInstallationFromPath(filepath.Join(appDir, "upstream", "userdata", "installation.yaml")) + if err != nil { + return "", errors.Wrap(err, "failed to load installation from path") + } + + license, err := kotsutil.LoadLicenseFromPath(filepath.Join(appDir, "upstream", "userdata", "license.yaml")) + if err != nil { + return "", errors.Wrap(err, "failed to load license from path") + } + + configValues, err := kotsutil.LoadConfigValuesFromFile(filepath.Join(appDir, "upstream", "userdata", "config.yaml")) + if err != nil && !os.IsNotExist(errors.Cause(err)) { + return "", errors.Wrap(err, "failed to load config values from path") + } + options := rewrite.RewriteOptions{ RootDir: appDir, - UpstreamURI: fmt.Sprintf("replicated://%s", kotsKinds.License.Spec.AppSlug), + UpstreamURI: fmt.Sprintf("replicated://%s", license.Spec.AppSlug), UpstreamPath: filepath.Join(appDir, "upstream"), - Installation: &kotsKinds.Installation, + Installation: installation, Downstreams: downstreamNames, CreateAppDir: false, ExcludeKotsKinds: true, - License: kotsKinds.License, + License: license, ConfigValues: configValues, K8sNamespace: appNamespace, ReportWriter: pipeWriter, diff --git a/pkg/render/helper/appfile.go b/pkg/render/helper/appfile.go index 1c89a9a674..c8bb94b37a 100644 --- a/pkg/render/helper/appfile.go +++ b/pkg/render/helper/appfile.go @@ -6,6 +6,7 @@ import ( "github.com/replicatedhq/kots/pkg/kotsutil" registrytypes "github.com/replicatedhq/kots/pkg/registry/types" "github.com/replicatedhq/kots/pkg/render" + rendertypes "github.com/replicatedhq/kots/pkg/render/types" "github.com/replicatedhq/kots/pkg/store" "github.com/replicatedhq/kots/pkg/util" ) @@ -33,5 +34,13 @@ func RenderAppFile(a types.AppType, overrideSequence *int64, inputContent []byte registrySettings = s } - return render.RenderFile(kotsKinds, registrySettings, a.GetSlug(), sequence, a.GetIsAirgap(), namespace, inputContent) + return render.RenderFile(rendertypes.RenderFileOptions{ + KotsKinds: kotsKinds, + RegistrySettings: registrySettings, + AppSlug: a.GetSlug(), + Sequence: sequence, + IsAirgap: a.GetIsAirgap(), + Namespace: namespace, + InputContent: []byte(inputContent), + }) } diff --git a/pkg/render/render.go b/pkg/render/render.go index 16ecee507d..d63e10ae14 100644 --- a/pkg/render/render.go +++ b/pkg/render/render.go @@ -6,11 +6,10 @@ import ( "path/filepath" "github.com/pkg/errors" - downstreamtypes "github.com/replicatedhq/kots/pkg/api/downstream/types" - apptypes "github.com/replicatedhq/kots/pkg/app/types" "github.com/replicatedhq/kots/pkg/crypto" "github.com/replicatedhq/kots/pkg/kotsutil" registrytypes "github.com/replicatedhq/kots/pkg/registry/types" + types "github.com/replicatedhq/kots/pkg/render/types" "github.com/replicatedhq/kots/pkg/reporting" "github.com/replicatedhq/kots/pkg/rewrite" "github.com/replicatedhq/kots/pkg/template" @@ -23,28 +22,29 @@ type Renderer struct { // RenderFile renders a single file // this is useful for upstream/kotskinds files that are not rendered in the dir -func (r Renderer) RenderFile(kotsKinds *kotsutil.KotsKinds, registrySettings registrytypes.RegistrySettings, appSlug string, sequence int64, isAirgap bool, namespace string, inputContent []byte) ([]byte, error) { - return RenderFile(kotsKinds, registrySettings, appSlug, sequence, isAirgap, namespace, inputContent) +func (r Renderer) RenderFile(opts types.RenderFileOptions) ([]byte, error) { + return RenderFile(opts) } -func RenderFile(kotsKinds *kotsutil.KotsKinds, registrySettings registrytypes.RegistrySettings, appSlug string, sequence int64, isAirgap bool, namespace string, inputContent []byte) ([]byte, error) { - fixedUpContent, err := kotsutil.FixUpYAML(inputContent) +func RenderFile(opts types.RenderFileOptions) ([]byte, error) { + fixedUpContent, err := kotsutil.FixUpYAML(opts.InputContent) if err != nil { return nil, errors.Wrap(err, "failed to fix up yaml") } + opts.InputContent = fixedUpContent - return RenderContent(kotsKinds, registrySettings, appSlug, sequence, isAirgap, namespace, fixedUpContent) + return RenderContent(opts) } // RenderContent renders any string/content // this is useful for rendering single values, like a status informer -func RenderContent(kotsKinds *kotsutil.KotsKinds, registrySettings registrytypes.RegistrySettings, appSlug string, sequence int64, isAirgap bool, namespace string, inputContent []byte) ([]byte, error) { - builder, err := NewBuilder(kotsKinds, registrySettings, appSlug, sequence, isAirgap, namespace) +func RenderContent(opts types.RenderFileOptions) ([]byte, error) { + builder, err := NewBuilder(opts.KotsKinds, opts.RegistrySettings, opts.AppSlug, opts.Sequence, opts.IsAirgap, opts.Namespace) if err != nil { return nil, errors.Wrap(err, "failed to create builder") } - rendered, err := builder.RenderTemplate(string(inputContent), string(inputContent)) + rendered, err := builder.RenderTemplate(string(opts.InputContent), string(opts.InputContent)) if err != nil { return nil, errors.Wrap(err, "failed to render") } @@ -97,18 +97,28 @@ func NewBuilder(kotsKinds *kotsutil.KotsKinds, registrySettings registrytypes.Re // RenderDir renders an app archive dir // this is useful for when the license/config have updated, and template functions need to be evaluated again -func (r Renderer) RenderDir(archiveDir string, a *apptypes.App, downstreams []downstreamtypes.Downstream, registrySettings registrytypes.RegistrySettings, sequence int64) error { - return RenderDir(archiveDir, a, downstreams, registrySettings, sequence) +func (r Renderer) RenderDir(opts types.RenderDirOptions) error { + return RenderDir(opts) } -func RenderDir(archiveDir string, a *apptypes.App, downstreams []downstreamtypes.Downstream, registrySettings registrytypes.RegistrySettings, sequence int64) error { - kotsKinds, err := kotsutil.LoadKotsKinds(archiveDir) +func RenderDir(opts types.RenderDirOptions) error { + installation, err := kotsutil.LoadInstallationFromPath(filepath.Join(opts.ArchiveDir, "upstream", "userdata", "installation.yaml")) if err != nil { - return errors.Wrap(err, "failed to load kotskinds from path") + return errors.Wrap(err, "failed to load installation from path") + } + + license, err := kotsutil.LoadLicenseFromPath(filepath.Join(opts.ArchiveDir, "upstream", "userdata", "license.yaml")) + if err != nil { + return errors.Wrap(err, "failed to load license from path") + } + + configValues, err := kotsutil.LoadConfigValuesFromFile(filepath.Join(opts.ArchiveDir, "upstream", "userdata", "config.yaml")) + if err != nil && !os.IsNotExist(errors.Cause(err)) { + return errors.Wrap(err, "failed to load config values from path") } downstreamNames := []string{} - for _, d := range downstreams { + for _, d := range opts.Downstreams { downstreamNames = append(downstreamNames, d.Name) } @@ -118,25 +128,25 @@ func RenderDir(archiveDir string, a *apptypes.App, downstreams []downstreamtypes } reOptions := rewrite.RewriteOptions{ - RootDir: archiveDir, - UpstreamURI: fmt.Sprintf("replicated://%s", kotsKinds.License.Spec.AppSlug), - UpstreamPath: filepath.Join(archiveDir, "upstream"), - Installation: &kotsKinds.Installation, + RootDir: opts.ArchiveDir, + UpstreamURI: fmt.Sprintf("replicated://%s", license.Spec.AppSlug), + UpstreamPath: filepath.Join(opts.ArchiveDir, "upstream"), + Installation: installation, Downstreams: downstreamNames, Silent: true, CreateAppDir: false, ExcludeKotsKinds: true, - License: kotsKinds.License, - ConfigValues: kotsKinds.ConfigValues, + License: license, + ConfigValues: configValues, K8sNamespace: appNamespace, CopyImages: false, - IsAirgap: a.IsAirgap, - AppID: a.ID, - AppSlug: a.Slug, - IsGitOps: a.IsGitOps, - AppSequence: sequence, - ReportingInfo: reporting.GetReportingInfo(a.ID), - RegistrySettings: registrySettings, + IsAirgap: opts.App.IsAirgap, + AppID: opts.App.ID, + AppSlug: opts.App.Slug, + IsGitOps: opts.App.IsGitOps, + AppSequence: opts.Sequence, + ReportingInfo: reporting.GetReportingInfo(opts.App.ID), + RegistrySettings: opts.RegistrySettings, // TODO: pass in as arguments if this is ever called from CLI HTTPProxyEnvValue: os.Getenv("HTTP_PROXY"), diff --git a/pkg/render/types/interface.go b/pkg/render/types/interface.go index 0d9a7abf62..8bc5d85808 100644 --- a/pkg/render/types/interface.go +++ b/pkg/render/types/interface.go @@ -7,7 +7,25 @@ import ( registrytypes "github.com/replicatedhq/kots/pkg/registry/types" ) +type RenderFileOptions struct { + KotsKinds *kotsutil.KotsKinds + RegistrySettings registrytypes.RegistrySettings + AppSlug string + Sequence int64 + IsAirgap bool + Namespace string + InputContent []byte +} + +type RenderDirOptions struct { + ArchiveDir string + App *apptypes.App + Downstreams []downstreamtypes.Downstream + RegistrySettings registrytypes.RegistrySettings + Sequence int64 +} + type Renderer interface { - RenderFile(kotsKinds *kotsutil.KotsKinds, registrySettings registrytypes.RegistrySettings, appSlug string, sequence int64, isAirgap bool, namespace string, inputContent []byte) ([]byte, error) - RenderDir(archiveDir string, a *apptypes.App, downstreams []downstreamtypes.Downstream, registrySettings registrytypes.RegistrySettings, sequence int64) error + RenderFile(opts RenderFileOptions) ([]byte, error) + RenderDir(opts RenderDirOptions) error } diff --git a/pkg/store/kotsstore/license_store.go b/pkg/store/kotsstore/license_store.go index 1890e34726..bcf32fb9fc 100644 --- a/pkg/store/kotsstore/license_store.go +++ b/pkg/store/kotsstore/license_store.go @@ -185,7 +185,13 @@ func (s *KOTSStore) createNewVersionForLicenseChangeStatements(appID string, bas return nil, int64(0), errors.Wrap(err, "failed to get next app sequence") } - if err := renderer.RenderDir(archiveDir, app, downstreams, registrySettings, nextAppSequence); err != nil { + if err := renderer.RenderDir(rendertypes.RenderDirOptions{ + ArchiveDir: archiveDir, + App: app, + Downstreams: downstreams, + RegistrySettings: registrySettings, + Sequence: nextAppSequence, + }); err != nil { return nil, int64(0), errors.Wrap(err, "failed to render new version") } diff --git a/pkg/store/kotsstore/version_store.go b/pkg/store/kotsstore/version_store.go index 37ffdf6956..6424967f17 100644 --- a/pkg/store/kotsstore/version_store.go +++ b/pkg/store/kotsstore/version_store.go @@ -141,7 +141,15 @@ func (s *KOTSStore) IsSnapshotsSupportedForVersion(a *apptypes.App, sequence int } // as far as I can tell, this is the only place within pkg/store that uses templating - rendered, err := renderer.RenderFile(kotsKinds, registrySettings, a.Slug, sequence, a.IsAirgap, util.PodNamespace, []byte(backupSpecStr.String)) + rendered, err := renderer.RenderFile(rendertypes.RenderFileOptions{ + KotsKinds: kotsKinds, + RegistrySettings: registrySettings, + AppSlug: a.Slug, + Sequence: sequence, + IsAirgap: a.IsAirgap, + Namespace: util.PodNamespace, + InputContent: []byte(backupSpecStr.String), + }) if err != nil { return false, errors.Wrap(err, "failed to render backup spec") } @@ -1070,7 +1078,15 @@ func (s *KOTSStore) renderPreflightSpec(appID string, appSlug string, sequence i return nil, errors.Wrap(err, "failed to get registry settings for app") } - renderedPreflight, err := renderer.RenderFile(kotsKinds, registrySettings, appSlug, sequence, isAirgap, util.PodNamespace, []byte(renderedMarshalledPreflights)) + renderedPreflight, err := renderer.RenderFile(rendertypes.RenderFileOptions{ + KotsKinds: kotsKinds, + RegistrySettings: registrySettings, + AppSlug: appSlug, + Sequence: sequence, + IsAirgap: isAirgap, + Namespace: util.PodNamespace, + InputContent: []byte(renderedMarshalledPreflights), + }) if err != nil { return nil, errors.Wrap(err, "failed to render preflights") } @@ -1098,7 +1114,15 @@ func (s *KOTSStore) renderApplicationSpec(appID string, appSlug string, sequence return nil, errors.Wrap(err, "failed to get registry settings for app") } - renderedApplication, err := renderer.RenderFile(kotsKinds, registrySettings, appSlug, sequence, isAirgap, util.PodNamespace, []byte(renderedMarshalledPreflights)) + renderedApplication, err := renderer.RenderFile(rendertypes.RenderFileOptions{ + KotsKinds: kotsKinds, + RegistrySettings: registrySettings, + AppSlug: appSlug, + Sequence: sequence, + IsAirgap: isAirgap, + Namespace: util.PodNamespace, + InputContent: []byte(renderedMarshalledPreflights), + }) if err != nil { return nil, errors.Wrap(err, "failed to render application") } diff --git a/pkg/store/store.go b/pkg/store/store.go index 6b33204202..409eb32e97 100644 --- a/pkg/store/store.go +++ b/pkg/store/store.go @@ -28,6 +28,7 @@ func SetStore(s Store) { if s == nil { hasStore = false globalStore = nil + return } hasStore = true globalStore = s diff --git a/pkg/tests/renderdir/cases/simple/archiveDir/base/kustomization.yaml b/pkg/tests/renderdir/cases/simple/archiveDir/base/kustomization.yaml new file mode 100644 index 0000000000..b746efdcde --- /dev/null +++ b/pkg/tests/renderdir/cases/simple/archiveDir/base/kustomization.yaml @@ -0,0 +1,7 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +metadata: + annotations: + kots.io/kustomization: base +resources: +- subdir/configmap.yaml diff --git a/pkg/tests/renderdir/cases/simple/archiveDir/base/subdir/configmap.yaml b/pkg/tests/renderdir/cases/simple/archiveDir/base/subdir/configmap.yaml new file mode 100644 index 0000000000..cb312455ad --- /dev/null +++ b/pkg/tests/renderdir/cases/simple/archiveDir/base/subdir/configmap.yaml @@ -0,0 +1,25 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: test-licenseinfo +data: + dockerCfg: eyJhdXRocyI6eyJwcm94eS5yZXBsaWNhdGVkLmNvbSI6eyJhdXRoIjoiTVhaMWMwOXZhM2hCVm5BeGRHdFNSM1Y1ZUc1R01qTlFTbU54T2pGMmRYTlBiMnQ0UVZad01YUnJVa2QxZVhodVJqSXpVRXBqY1E9PSJ9LCJyZWdpc3RyeS5yZXBsaWNhdGVkLmNvbSI6eyJhdXRoIjoiTVhaMWMwOXZhM2hCVm5BeGRHdFNSM1Y1ZUc1R01qTlFTbU54T2pGMmRYTlBiMnQ0UVZad01YUnJVa2QxZVhodVJqSXpVRXBqY1E9PSJ9fX0= + licenseFieldValueIsGitOpsSupported: true + licenseFieldValueIsIdentityServiceSupported: false + licenseFieldValueIsGeoaxisSupported: false + licenseFieldValueIsAirgapSupported: true + licenseFieldValueLicenseType: prod + licenseFieldValueLicenseSequence: 7 + licenseFieldValueSignature: '{"licenseData":"eyJhcGlWZXJzaW9uIjoia290cy5pby92MWJldGExIiwia2luZCI6IkxpY2Vuc2UiLCJtZXRhZGF0YSI6eyJuYW1lIjoidGVzdGN1c3RvbWVyIn0sInNwZWMiOnsibGljZW5zZUlEIjoiMXZ1c09va3hBVnAxdGtSR3V5eG5GMjNQSmNxIiwibGljZW5zZVR5cGUiOiJwcm9kIiwiY3VzdG9tZXJOYW1lIjoiVGVzdCBDdXN0b21lciIsImFwcFNsdWciOiJteS1hcHAiLCJjaGFubmVsSUQiOiIxdnVzSVlaTEFWeE1HNnE3NjBPSm1SS2o1aTUiLCJjaGFubmVsTmFtZSI6Ik15IENoYW5uZWwiLCJsaWNlbnNlU2VxdWVuY2UiOjcsImVuZHBvaW50IjoiaHR0cHM6Ly9yZXBsaWNhdGVkLmFwcCIsImVudGl0bGVtZW50cyI6eyJib29sX2ZpZWxkIjp7InRpdGxlIjoiQm9vbCBGaWVsZCIsInZhbHVlIjp0cnVlLCJ2YWx1ZVR5cGUiOiJCb29sZWFuIn0sImV4cGlyZXNfYXQiOnsidGl0bGUiOiJFeHBpcmF0aW9uIiwiZGVzY3JpcHRpb24iOiJMaWNlbnNlIEV4cGlyYXRpb24iLCJ2YWx1ZSI6IjIwMzAtMDctMjdUMDA6MDA6MDBaIiwidmFsdWVUeX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plVXRvTUZGVmEwVTRRVzlHUlhKUE1YRlBSMVpRU1RCNllWaHpWVXBtY0RSbE1UQk9OV3RSVnpWT1NWY3ZSVXRFU0hsbU9VbFhkM1IwY1VsYWNXRjBSa05EYUZkcmJ6VkRSM0JYTDI1Rk1YYzJlV3RJVVhBMlUxSlJiSFpwUkUwMFZEUktUMkZsUVd0c1RWUk1UVWNyWTBaTGIzZE9TVm95YkhORGRsTnZRakZaZVdOTlNVSmxabEpuZWtSdU0xRTlQU0lzSW1kc2IySmhiRXRsZVVsa0lqb2lZbVJsWlRVMk5UWXdZMlppTkROak9XSXlPR0ptT1RobFlXTmhabUUyTkRZaWZRPT0ifQ=="}' + licenseFieldValueAppSlug: my-app + licenseFieldValueChannelID: 1vusIYZLAVxMG6q760OJmRKj5i5 + licenseFieldValueChannelName: My Channel + licenseFieldValueCustomerName: Test Customer + licenseFieldValueEndpoint: https://replicated.app + licenseFieldValueLicenseID: 1vusOokxAVp1tkRGuyxnF23PJcq + licenseFieldValueLicenseId: 1vusOokxAVp1tkRGuyxnF23PJcq + licenseFieldValueCustomIntField: 123 + licenseFieldValueCustomStringField: single line text + licenseFieldValueCustomTextField: "multi\nline\ntext" + licenseFieldValueCustomBoolField: "true" + licenseFieldValueCustomHiddenField: "this is secret" diff --git a/pkg/tests/renderdir/cases/simple/archiveDir/kotsKinds/config.yaml b/pkg/tests/renderdir/cases/simple/archiveDir/kotsKinds/config.yaml new file mode 100644 index 0000000000..af995cc7f7 --- /dev/null +++ b/pkg/tests/renderdir/cases/simple/archiveDir/kotsKinds/config.yaml @@ -0,0 +1,19 @@ +apiVersion: kots.io/v1beta1 +kind: Config +metadata: + creationTimestamp: null + name: my-app +spec: + groups: + - items: + - default: "" + help_text: | + Use this field to provide a hostname for your Example Application installation. + name: hostname + required: true + title: Hostname + type: text + value: my-app.somebigbank.com + name: setup + title: Setup +status: {} diff --git a/pkg/tests/renderdir/cases/simple/archiveDir/kotsKinds/userdata/config.yaml b/pkg/tests/renderdir/cases/simple/archiveDir/kotsKinds/userdata/config.yaml new file mode 100644 index 0000000000..4b2800d1ad --- /dev/null +++ b/pkg/tests/renderdir/cases/simple/archiveDir/kotsKinds/userdata/config.yaml @@ -0,0 +1,10 @@ +apiVersion: kots.io/v1beta1 +kind: ConfigValues +metadata: + creationTimestamp: null + name: replicated-kots-app +spec: + values: + hostname: + value: my-app.somebigbank.com +status: {} diff --git a/pkg/tests/renderdir/cases/simple/archiveDir/kotsKinds/userdata/installation.yaml b/pkg/tests/renderdir/cases/simple/archiveDir/kotsKinds/userdata/installation.yaml new file mode 100644 index 0000000000..b0c5471181 --- /dev/null +++ b/pkg/tests/renderdir/cases/simple/archiveDir/kotsKinds/userdata/installation.yaml @@ -0,0 +1,9 @@ +apiVersion: kots.io/v1beta1 +kind: Installation +metadata: + creationTimestamp: null + name: replicated-kots-app +spec: + channelID: 1vusIYZLAVxMG6q760OJmRKj5i5 + channelName: My Channel +status: {} diff --git a/pkg/tests/renderdir/cases/simple/archiveDir/kotsKinds/userdata/license.yaml b/pkg/tests/renderdir/cases/simple/archiveDir/kotsKinds/userdata/license.yaml new file mode 100644 index 0000000000..daa549c24c --- /dev/null +++ b/pkg/tests/renderdir/cases/simple/archiveDir/kotsKinds/userdata/license.yaml @@ -0,0 +1,50 @@ +apiVersion: kots.io/v1beta1 +kind: License +metadata: + creationTimestamp: null + name: testcustomer +spec: + appSlug: my-app + channelID: old-1vusIYZLAVxMG6q760OJmRKj5i5 + channelName: My Old Channel + customerName: Test Customer + endpoint: https://replicated.app + entitlements: + bool_field: + title: Bool Field + value: false + valueType: Boolean + expires_at: + description: License Expiration + title: Expiration + value: "2029-07-27T00:00:00Z" + valueType: String + hidden_field: + isHidden: true + title: Hidden Field + value: this is an old secret + valueType: String + int_field: + title: Int Field + value: 12 + valueType: Integer + string_field: + title: StringField + value: old single line text + valueType: String + text_field: + title: Text Field + value: |- + old + multi + line + text + valueType: Text + isAirgapSupported: false + isGitOpsSupported: false + isSnapshotSupported: false +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scWIybFpiVkpzV2xSVk1rNVVXWGRaTWxwcFRrUk9hazlYU1hsUFIwcHRUMVJvYkZsWFRtaGFiVVV5VGtSWmFXWlJQVDBpZlE9PSJ9 +status: {} diff --git a/pkg/tests/renderdir/cases/simple/archiveDir/overlays/downstreams/this-cluster/kustomization.yaml b/pkg/tests/renderdir/cases/simple/archiveDir/overlays/downstreams/this-cluster/kustomization.yaml new file mode 100644 index 0000000000..73a609d8fa --- /dev/null +++ b/pkg/tests/renderdir/cases/simple/archiveDir/overlays/downstreams/this-cluster/kustomization.yaml @@ -0,0 +1,4 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +bases: +- ../../midstream +kind: Kustomization diff --git a/pkg/tests/renderdir/cases/simple/archiveDir/overlays/midstream/backup-label-transformer.yaml b/pkg/tests/renderdir/cases/simple/archiveDir/overlays/midstream/backup-label-transformer.yaml new file mode 100644 index 0000000000..c3acc6c5b9 --- /dev/null +++ b/pkg/tests/renderdir/cases/simple/archiveDir/overlays/midstream/backup-label-transformer.yaml @@ -0,0 +1,39 @@ +apiVersion: builtin +kind: LabelTransformer +metadata: + name: backup-label-transformer +labels: + kots.io/app-slug: my-app + kots.io/backup: velero +fieldSpecs: +- path: metadata/labels + create: true +- version: v1 + kind: ReplicationController + path: spec/template/metadata/labels + create: true +- kind: Deployment + path: spec/template/metadata/labels + create: true +- kind: ReplicaSet + path: spec/template/metadata/labels + create: true +- kind: DaemonSet + path: spec/template/metadata/labels + create: true +- group: apps + kind: StatefulSet + path: spec/template/metadata/labels + create: true +- group: batch + kind: Job + path: spec/template/metadata/labels + create: true +- group: batch + kind: CronJob + path: spec/jobTemplate/metadata/labels + create: true +- group: batch + kind: CronJob + path: spec/jobTemplate/spec/template/metadata/labels + create: true diff --git a/pkg/tests/renderdir/cases/simple/archiveDir/overlays/midstream/kustomization.yaml b/pkg/tests/renderdir/cases/simple/archiveDir/overlays/midstream/kustomization.yaml new file mode 100644 index 0000000000..bb6f5b2615 --- /dev/null +++ b/pkg/tests/renderdir/cases/simple/archiveDir/overlays/midstream/kustomization.yaml @@ -0,0 +1,10 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +bases: +- ../../base +commonAnnotations: + kots.io/app-slug: my-app +kind: Kustomization +resources: +- secret.yaml +transformers: +- backup-label-transformer.yaml diff --git a/pkg/tests/renderdir/cases/simple/archiveDir/overlays/midstream/secret.yaml b/pkg/tests/renderdir/cases/simple/archiveDir/overlays/midstream/secret.yaml new file mode 100644 index 0000000000..4d81bc057f --- /dev/null +++ b/pkg/tests/renderdir/cases/simple/archiveDir/overlays/midstream/secret.yaml @@ -0,0 +1,28 @@ +apiVersion: v1 +data: + .dockerconfigjson: eyJhdXRocyI6eyJwcm94eS5yZXBsaWNhdGVkLmNvbSI6eyJhdXRoIjoiTVhaMWMwOXZhM2hCVm5BeGRHdFNSM1Y1ZUc1R01qTlFTbU54T2pGMmRYTlBiMnQ0UVZad01YUnJVa2QxZVhodVJqSXpVRXBqY1E9PSJ9LCJyZWdpc3RyeS5yZXBsaWNhdGVkLmNvbSI6eyJhdXRoIjoiTVhaMWMwOXZhM2hCVm5BeGRHdFNSM1Y1ZUc1R01qTlFTbU54T2pGMmRYTlBiMnQ0UVZad01YUnJVa2QxZVhodVJqSXpVRXBqY1E9PSJ9fX0= +kind: Secret +metadata: + annotations: + helm.sh/hook: pre-install,pre-upgrade + helm.sh/hook-weight: "-9999" + kots.io/creation-phase: "-9999" + creationTimestamp: null + name: my-app-registry + namespace: app-namespace +type: kubernetes.io/dockerconfigjson + +--- +apiVersion: v1 +data: + .dockerconfigjson: eyJhdXRocyI6eyJwcm94eS5yZXBsaWNhdGVkLmNvbSI6eyJhdXRoIjoiTVhaMWMwOXZhM2hCVm5BeGRHdFNSM1Y1ZUc1R01qTlFTbU54T2pGMmRYTlBiMnQ0UVZad01YUnJVa2QxZVhodVJqSXpVRXBqY1E9PSJ9LCJyZWdpc3RyeS5yZXBsaWNhdGVkLmNvbSI6eyJhdXRoIjoiTVhaMWMwOXZhM2hCVm5BeGRHdFNSM1Y1ZUc1R01qTlFTbU54T2pGMmRYTlBiMnQ0UVZad01YUnJVa2QxZVhodVJqSXpVRXBqY1E9PSJ9fX0= +kind: Secret +metadata: + annotations: + helm.sh/hook: pre-install,pre-upgrade + helm.sh/hook-weight: "-9999" + kots.io/creation-phase: "-9999" + creationTimestamp: null + name: kotsadm-replicated-registry + namespace: app-namespace +type: kubernetes.io/dockerconfigjson diff --git a/pkg/tests/renderdir/cases/simple/archiveDir/rendered/this-cluster/kotsadm-replicated-registry-secret.yaml b/pkg/tests/renderdir/cases/simple/archiveDir/rendered/this-cluster/kotsadm-replicated-registry-secret.yaml new file mode 100644 index 0000000000..6f52289831 --- /dev/null +++ b/pkg/tests/renderdir/cases/simple/archiveDir/rendered/this-cluster/kotsadm-replicated-registry-secret.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +data: + .dockerconfigjson: eyJhdXRocyI6eyJwcm94eS5yZXBsaWNhdGVkLmNvbSI6eyJhdXRoIjoiTVhaMWMwOXZhM2hCVm5BeGRHdFNSM1Y1ZUc1R01qTlFTbU54T2pGMmRYTlBiMnQ0UVZad01YUnJVa2QxZVhodVJqSXpVRXBqY1E9PSJ9LCJyZWdpc3RyeS5yZXBsaWNhdGVkLmNvbSI6eyJhdXRoIjoiTVhaMWMwOXZhM2hCVm5BeGRHdFNSM1Y1ZUc1R01qTlFTbU54T2pGMmRYTlBiMnQ0UVZad01YUnJVa2QxZVhodVJqSXpVRXBqY1E9PSJ9fX0= +kind: Secret +metadata: + annotations: + helm.sh/hook: pre-install,pre-upgrade + helm.sh/hook-weight: "-9999" + kots.io/app-slug: my-app + kots.io/creation-phase: "-9999" + creationTimestamp: null + labels: + kots.io/app-slug: my-app + kots.io/backup: velero + name: kotsadm-replicated-registry + namespace: app-namespace +type: kubernetes.io/dockerconfigjson \ No newline at end of file diff --git a/pkg/tests/renderdir/cases/simple/archiveDir/rendered/this-cluster/my-app-registry-secret.yaml b/pkg/tests/renderdir/cases/simple/archiveDir/rendered/this-cluster/my-app-registry-secret.yaml new file mode 100644 index 0000000000..a8b369b451 --- /dev/null +++ b/pkg/tests/renderdir/cases/simple/archiveDir/rendered/this-cluster/my-app-registry-secret.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +data: + .dockerconfigjson: eyJhdXRocyI6eyJwcm94eS5yZXBsaWNhdGVkLmNvbSI6eyJhdXRoIjoiTVhaMWMwOXZhM2hCVm5BeGRHdFNSM1Y1ZUc1R01qTlFTbU54T2pGMmRYTlBiMnQ0UVZad01YUnJVa2QxZVhodVJqSXpVRXBqY1E9PSJ9LCJyZWdpc3RyeS5yZXBsaWNhdGVkLmNvbSI6eyJhdXRoIjoiTVhaMWMwOXZhM2hCVm5BeGRHdFNSM1Y1ZUc1R01qTlFTbU54T2pGMmRYTlBiMnQ0UVZad01YUnJVa2QxZVhodVJqSXpVRXBqY1E9PSJ9fX0= +kind: Secret +metadata: + annotations: + helm.sh/hook: pre-install,pre-upgrade + helm.sh/hook-weight: "-9999" + kots.io/app-slug: my-app + kots.io/creation-phase: "-9999" + creationTimestamp: null + labels: + kots.io/app-slug: my-app + kots.io/backup: velero + name: my-app-registry + namespace: app-namespace +type: kubernetes.io/dockerconfigjson diff --git a/pkg/tests/renderdir/cases/simple/archiveDir/rendered/this-cluster/test-licenseinfo-configmap.yaml b/pkg/tests/renderdir/cases/simple/archiveDir/rendered/this-cluster/test-licenseinfo-configmap.yaml new file mode 100644 index 0000000000..db9a488146 --- /dev/null +++ b/pkg/tests/renderdir/cases/simple/archiveDir/rendered/this-cluster/test-licenseinfo-configmap.yaml @@ -0,0 +1,33 @@ +apiVersion: v1 +data: + dockerCfg: eyJhdXRocyI6eyJwcm94eS5yZXBsaWNhdGVkLmNvbSI6eyJhdXRoIjoiTVhaMWMwOXZhM2hCVm5BeGRHdFNSM1Y1ZUc1R01qTlFTbU54T2pGMmRYTlBiMnQ0UVZad01YUnJVa2QxZVhodVJqSXpVRXBqY1E9PSJ9LCJyZWdpc3RyeS5yZXBsaWNhdGVkLmNvbSI6eyJhdXRoIjoiTVhaMWMwOXZhM2hCVm5BeGRHdFNSM1Y1ZUc1R01qTlFTbU54T2pGMmRYTlBiMnQ0UVZad01YUnJVa2QxZVhodVJqSXpVRXBqY1E9PSJ9fX0= + licenseFieldValueAppSlug: my-app + licenseFieldValueChannelID: 1vusIYZLAVxMG6q760OJmRKj5i5 + licenseFieldValueChannelName: My Channel + licenseFieldValueCustomBoolField: "true" + licenseFieldValueCustomHiddenField: this is secret + licenseFieldValueCustomIntField: 123 + licenseFieldValueCustomStringField: single line text + licenseFieldValueCustomTextField: |- + multi + line + text + licenseFieldValueCustomerName: Test Customer + licenseFieldValueEndpoint: https://replicated.app + licenseFieldValueIsAirgapSupported: true + licenseFieldValueIsGeoaxisSupported: false + licenseFieldValueIsGitOpsSupported: true + licenseFieldValueIsIdentityServiceSupported: false + licenseFieldValueLicenseID: 1vusOokxAVp1tkRGuyxnF23PJcq + licenseFieldValueLicenseId: 1vusOokxAVp1tkRGuyxnF23PJcq + licenseFieldValueLicenseSequence: 7 + licenseFieldValueLicenseType: prod + licenseFieldValueSignature: '{"licenseData":"eyJhcGlWZXJzaW9uIjoia290cy5pby92MWJldGExIiwia2luZCI6IkxpY2Vuc2UiLCJtZXRhZGF0YSI6eyJuYW1lIjoidGVzdGN1c3RvbWVyIn0sInNwZWMiOnsibGljZW5zZUlEIjoiMXZ1c09va3hBVnAxdGtSR3V5eG5GMjNQSmNxIiwibGljZW5zZVR5cGUiOiJwcm9kIiwiY3VzdG9tZXJOYW1lIjoiVGVzdCBDdXN0b21lciIsImFwcFNsdWciOiJteS1hcHAiLCJjaGFubmVsSUQiOiIxdnVzSVlaTEFWeE1HNnE3NjBPSm1SS2o1aTUiLCJjaGFubmVsTmFtZSI6Ik15IENoYW5uZWwiLCJsaWNlbnNlU2VxdWVuY2UiOjcsImVuZHBvaW50IjoiaHR0cHM6Ly9yZXBsaWNhdGVkLmFwcCIsImVudGl0bGVt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6ZERjMVZHaExPWEJUUkZrdkwwbzNZMFZJUmxWVEwyOUhWRWxsVkVOMFRHMVZRMGN3VGxGbFkzSnRTRms0VUZOa1ZVSjBUMVl3Ymt0cFRrVnBjbkJhTVc5amJWbHFZa3hoU2xsVWJFRkVXbUZvVjFKUFdqbFJhWEZuWldoQ2FuQjNSR3MwYVZJNU5WVldWVTVyT0hKb1lVTXlhbTg0V0daeFlqVlZibXhxZEZFd055czBhVlJJVEZONmVFMHplVXRvTUZGVmEwVTRRVzlHUlhKUE1YRlBSMVpRU1RCNllWaHpWVXBtY0RSbE1UQk9OV3RSVnpWT1NWY3ZSVXRFU0hsbU9VbFhkM1IwY1VsYWNXRjBSa05EYUZkcmJ6VkRSM0JYTDI1Rk1YYzJlV3RJVVhBMlUxSlJiSFpwUkUwMFZEUktUMkZsUVd0c1RWUk1UVWNyWTBaTGIzZE9TVm95YkhORGRsTnZRakZaZVdOTlNVSmxabEpuZWtSdU0xRTlQU0lzSW1kc2IySmhiRXRsZVVsa0lqb2lZbVJsWlRVMk5UWXdZMlppTkROak9XSXlPR0ptT1RobFlXTmhabUUyTkRZaWZRPT0ifQ=="}' +kind: ConfigMap +metadata: + annotations: + kots.io/app-slug: my-app + labels: + kots.io/app-slug: my-app + kots.io/backup: velero + name: test-licenseinfo \ No newline at end of file diff --git a/pkg/tests/renderdir/cases/simple/archiveDir/upstream/config.yaml b/pkg/tests/renderdir/cases/simple/archiveDir/upstream/config.yaml new file mode 100644 index 0000000000..aff6c18cbf --- /dev/null +++ b/pkg/tests/renderdir/cases/simple/archiveDir/upstream/config.yaml @@ -0,0 +1,15 @@ +apiVersion: kots.io/v1beta1 +kind: Config +metadata: + name: my-app +spec: + groups: + - name: setup + title: Setup + items: + - name: hostname + type: text + title: Hostname + help_text: | + Use this field to provide a hostname for your Example Application installation. + required: true diff --git a/pkg/tests/renderdir/cases/simple/archiveDir/upstream/subdir/configmap.yaml b/pkg/tests/renderdir/cases/simple/archiveDir/upstream/subdir/configmap.yaml new file mode 100644 index 0000000000..73843036cb --- /dev/null +++ b/pkg/tests/renderdir/cases/simple/archiveDir/upstream/subdir/configmap.yaml @@ -0,0 +1,25 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: test-licenseinfo +data: + dockerCfg: {{repl LicenseDockerCfg }} + licenseFieldValueIsGitOpsSupported: {{repl LicenseFieldValue "isGitOpsSupported" }} + licenseFieldValueIsIdentityServiceSupported: {{repl LicenseFieldValue "isIdentityServiceSupported" }} + licenseFieldValueIsGeoaxisSupported: {{repl LicenseFieldValue "isGeoaxisSupported" }} + licenseFieldValueIsAirgapSupported: {{repl LicenseFieldValue "isAirgapSupported" }} + licenseFieldValueLicenseType: {{repl LicenseFieldValue "licenseType" }} + licenseFieldValueLicenseSequence: {{repl LicenseFieldValue "licenseSequence" }} + licenseFieldValueSignature: '{{repl LicenseFieldValue "signature" }}' + licenseFieldValueAppSlug: {{repl LicenseFieldValue "appSlug" }} + licenseFieldValueChannelID: {{repl LicenseFieldValue "channelID" }} + licenseFieldValueChannelName: {{repl LicenseFieldValue "channelName" }} + licenseFieldValueCustomerName: {{repl LicenseFieldValue "customerName" }} + licenseFieldValueEndpoint: {{repl LicenseFieldValue "endpoint" }} + licenseFieldValueLicenseID: {{repl LicenseFieldValue "licenseID" }} + licenseFieldValueLicenseId: {{repl LicenseFieldValue "licenseId" }} + licenseFieldValueCustomIntField: {{repl LicenseFieldValue "int_field" }} + licenseFieldValueCustomStringField: {{repl LicenseFieldValue "string_field" }} + licenseFieldValueCustomTextField: "{{repl LicenseFieldValue "text_field" | replace "\n" "\\n" }}" + licenseFieldValueCustomBoolField: "{{repl LicenseFieldValue "bool_field" }}" + licenseFieldValueCustomHiddenField: "{{repl LicenseFieldValue "hidden_field" }}" diff --git a/pkg/tests/renderdir/cases/simple/archiveDir/upstream/userdata/config.yaml b/pkg/tests/renderdir/cases/simple/archiveDir/upstream/userdata/config.yaml new file mode 100644 index 0000000000..4b2800d1ad --- /dev/null +++ b/pkg/tests/renderdir/cases/simple/archiveDir/upstream/userdata/config.yaml @@ -0,0 +1,10 @@ +apiVersion: kots.io/v1beta1 +kind: ConfigValues +metadata: + creationTimestamp: null + name: replicated-kots-app +spec: + values: + hostname: + value: my-app.somebigbank.com +status: {} diff --git a/pkg/tests/renderdir/cases/simple/archiveDir/upstream/userdata/installation.yaml b/pkg/tests/renderdir/cases/simple/archiveDir/upstream/userdata/installation.yaml new file mode 100644 index 0000000000..b0c5471181 --- /dev/null +++ b/pkg/tests/renderdir/cases/simple/archiveDir/upstream/userdata/installation.yaml @@ -0,0 +1,9 @@ +apiVersion: kots.io/v1beta1 +kind: Installation +metadata: + creationTimestamp: null + name: replicated-kots-app +spec: + channelID: 1vusIYZLAVxMG6q760OJmRKj5i5 + channelName: My Channel +status: {} diff --git a/pkg/tests/renderdir/cases/simple/archiveDir/upstream/userdata/license.yaml b/pkg/tests/renderdir/cases/simple/archiveDir/upstream/userdata/license.yaml new file mode 100644 index 0000000000..9fa3a14d7f --- /dev/null +++ b/pkg/tests/renderdir/cases/simple/archiveDir/upstream/userdata/license.yaml @@ -0,0 +1,49 @@ +apiVersion: kots.io/v1beta1 +kind: License +metadata: + creationTimestamp: null + name: testcustomer +spec: + appSlug: my-app + channelID: 1vusIYZLAVxMG6q760OJmRKj5i5 + channelName: My Channel + customerName: Test Customer + endpoint: https://replicated.app + entitlements: + bool_field: + title: Bool Field + value: true + valueType: Boolean + expires_at: + description: License Expiration + title: Expiration + value: "2030-07-27T00:00:00Z" + valueType: String + hidden_field: + isHidden: true + title: Hidden Field + value: this is secret + valueType: String + int_field: + title: Int Field + value: 123 + valueType: Integer + string_field: + title: StringField + value: single line text + valueType: String + text_field: + title: Text Field + value: |- + multi + line + text + valueType: Text + isAirgapSupported: true + isGitOpsSupported: true + isSnapshotSupported: true + licenseID: 1vusOokxAVp1tkRGuyxnF23PJcq + licenseSequence: 7 + licenseType: prod + signature: eyJsaWNlbnNlRGF0YSI6ImV5SmhjR2xXWlhKemFXOXV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J9 +status: {} diff --git a/pkg/tests/renderdir/cases/simple/testcase.yaml b/pkg/tests/renderdir/cases/simple/testcase.yaml new file mode 100644 index 0000000000..e84298ca5a --- /dev/null +++ b/pkg/tests/renderdir/cases/simple/testcase.yaml @@ -0,0 +1,9 @@ +Name: test simple renderdir +RenderDirOptions: + ArchiveDir: cases/simple/archiveDir + App: + ID: app-id + Slug: my-app + Downstreams: + - Name: this-cluster + Sequence: 1 \ No newline at end of file diff --git a/pkg/tests/renderdir/cases/simple/wantResults/base/kustomization.yaml b/pkg/tests/renderdir/cases/simple/wantResults/base/kustomization.yaml new file mode 100644 index 0000000000..b746efdcde --- /dev/null +++ b/pkg/tests/renderdir/cases/simple/wantResults/base/kustomization.yaml @@ -0,0 +1,7 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +metadata: + annotations: + kots.io/kustomization: base +resources: +- subdir/configmap.yaml diff --git a/pkg/tests/renderdir/cases/simple/wantResults/base/subdir/configmap.yaml b/pkg/tests/renderdir/cases/simple/wantResults/base/subdir/configmap.yaml new file mode 100644 index 0000000000..cb312455ad --- /dev/null +++ b/pkg/tests/renderdir/cases/simple/wantResults/base/subdir/configmap.yaml @@ -0,0 +1,25 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: test-licenseinfo +data: + dockerCfg: eyJhdXRocyI6eyJwcm94eS5yZXBsaWNhdGVkLmNvbSI6eyJhdXRoIjoiTVhaMWMwOXZhM2hCVm5BeGRHdFNSM1Y1ZUc1R01qTlFTbU54T2pGMmRYTlBiMnQ0UVZad01YUnJVa2QxZVhodVJqSXpVRXBqY1E9PSJ9LCJyZWdpc3RyeS5yZXBsaWNhdGVkLmNvbSI6eyJhdXRoIjoiTVhaMWMwOXZhM2hCVm5BeGRHdFNSM1Y1ZUc1R01qTlFTbU54T2pGMmRYTlBiMnQ0UVZad01YUnJVa2QxZVhodVJqSXpVRXBqY1E9PSJ9fX0= + licenseFieldValueIsGitOpsSupported: true + licenseFieldValueIsIdentityServiceSupported: false + licenseFieldValueIsGeoaxisSupported: false + licenseFieldValueIsAirgapSupported: true + licenseFieldValueLicenseType: prod + licenseFieldValueLicenseSequence: 7 + licenseFieldValueSignature: '{"licenseData":"eyJhcGlWZXJzaW9uIjoia290cy5pby92MWJldGExIiwia2luZCI6IkxpY2Vuc2UiLCJtZXRhZGF0YSI6eyJuYW1lIjoidGVzdGN1c3RvbWVyIn0sInNwZWMiOnsibGljZW5zZUlEIjoiMXZ1c09va3hBVnAxdGtSR3V5eG5GMjNQSmNxIiwibGljZW5zZVR5cGUiOiJwcm9kIiwiY3VzdG9tZXJOYW1lIjoiVGVzdCBDdXN0b21lciIsImFwcFNsdWciOiJteS1hcHAiLCJjaGFubmVsSUQiOiIxdnVzSVlaTEFWeE1HNnE3NjBPSm1SS2o1aTUiLCJjaGFubmVsTmFtZSI6Ik15IENoYW5uZWwiLCJsaWNlbnNlU2VxdWVuY2UiOjcsImVuZHBvaW50IjoiaHR0cHM6Ly9yZXBsaWNhdGVkLmFwcCIsImVudGl0bGVtZW50cyI6eyJib29sX2ZpZWxkIjp7InRpdGxlIjoiQm9vbCBGaWVsZCIsInZhbHVlIjp0cnVlLCJ2YWx1ZVR5cGUiOiJCb29sZWFuIn0sImV4cGlyZXNfYXQiOnsidGl0bGUiOiJFeHBpcmF0aW9uIiwiZGVzY3JpcHRpb24iOiJMaWNlbnNlIEV4cGlyYXRpb24iLCJ2YWx1ZSI6IjIwMzAtMDctMjdUMDA6MDA6MDBaIiwidmFsdWVUeXBlIjoiU3RyaW5nIn0sImhpZGRlbl9maWVsZCI6eyJ0aXRsZSI6IkhpZGRlbiBGaWVsZCIsInZhbHVlIjoidGhpcyBpcyBzZWNyZXQiLCJ2YWx1ZVR5cGUiOiJTdHJpbmciLCJpc0hpZGRlbiI6dHJ1ZX0sImludF9maWVsZCI6eyJ0aXRsZSI6IkludCBGaWVsZCIsInZhbHVlIjoxMjMsInZhbHVlVHlwZSI6IkludGVnZXIifSwic3RyaW5nX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SdU0xRTlQU0lzSW1kc2IySmhiRXRsZVVsa0lqb2lZbVJsWlRVMk5UWXdZMlppTkROak9XSXlPR0ptT1RobFlXTmhabUUyTkRZaWZRPT0ifQ=="}' + licenseFieldValueAppSlug: my-app + licenseFieldValueChannelID: 1vusIYZLAVxMG6q760OJmRKj5i5 + licenseFieldValueChannelName: My Channel + licenseFieldValueCustomerName: Test Customer + licenseFieldValueEndpoint: https://replicated.app + licenseFieldValueLicenseID: 1vusOokxAVp1tkRGuyxnF23PJcq + licenseFieldValueLicenseId: 1vusOokxAVp1tkRGuyxnF23PJcq + licenseFieldValueCustomIntField: 123 + licenseFieldValueCustomStringField: single line text + licenseFieldValueCustomTextField: "multi\nline\ntext" + licenseFieldValueCustomBoolField: "true" + licenseFieldValueCustomHiddenField: "this is secret" diff --git a/pkg/tests/renderdir/cases/simple/wantResults/kotsKinds/config.yaml b/pkg/tests/renderdir/cases/simple/wantResults/kotsKinds/config.yaml new file mode 100644 index 0000000000..af995cc7f7 --- /dev/null +++ b/pkg/tests/renderdir/cases/simple/wantResults/kotsKinds/config.yaml @@ -0,0 +1,19 @@ +apiVersion: kots.io/v1beta1 +kind: Config +metadata: + creationTimestamp: null + name: my-app +spec: + groups: + - items: + - default: "" + help_text: | + Use this field to provide a hostname for your Example Application installation. + name: hostname + required: true + title: Hostname + type: text + value: my-app.somebigbank.com + name: setup + title: Setup +status: {} diff --git a/pkg/tests/renderdir/cases/simple/wantResults/kotsKinds/userdata/config.yaml b/pkg/tests/renderdir/cases/simple/wantResults/kotsKinds/userdata/config.yaml new file mode 100644 index 0000000000..4b2800d1ad --- /dev/null +++ b/pkg/tests/renderdir/cases/simple/wantResults/kotsKinds/userdata/config.yaml @@ -0,0 +1,10 @@ +apiVersion: kots.io/v1beta1 +kind: ConfigValues +metadata: + creationTimestamp: null + name: replicated-kots-app +spec: + values: + hostname: + value: my-app.somebigbank.com +status: {} diff --git a/pkg/tests/renderdir/cases/simple/wantResults/kotsKinds/userdata/installation.yaml b/pkg/tests/renderdir/cases/simple/wantResults/kotsKinds/userdata/installation.yaml new file mode 100644 index 0000000000..b0c5471181 --- /dev/null +++ b/pkg/tests/renderdir/cases/simple/wantResults/kotsKinds/userdata/installation.yaml @@ -0,0 +1,9 @@ +apiVersion: kots.io/v1beta1 +kind: Installation +metadata: + creationTimestamp: null + name: replicated-kots-app +spec: + channelID: 1vusIYZLAVxMG6q760OJmRKj5i5 + channelName: My Channel +status: {} diff --git a/pkg/tests/renderdir/cases/simple/wantResults/kotsKinds/userdata/license.yaml b/pkg/tests/renderdir/cases/simple/wantResults/kotsKinds/userdata/license.yaml new file mode 100644 index 0000000000..9fa3a14d7f --- /dev/null +++ b/pkg/tests/renderdir/cases/simple/wantResults/kotsKinds/userdata/license.yaml @@ -0,0 +1,49 @@ +apiVersion: kots.io/v1beta1 +kind: License +metadata: + creationTimestamp: null + name: testcustomer +spec: + appSlug: my-app + channelID: 1vusIYZLAVxMG6q760OJmRKj5i5 + channelName: My Channel + customerName: Test Customer + endpoint: https://replicated.app + entitlements: + bool_field: + title: Bool Field + value: true + valueType: Boolean + expires_at: + description: License Expiration + title: Expiration + value: "2030-07-27T00:00:00Z" + valueType: String + hidden_field: + isHidden: true + title: Hidden Field + value: this is secret + valueType: String + int_field: + title: Int Field + value: 123 + valueType: Integer + string_field: + title: StringField + value: single line text + valueType: String + text_field: + title: Text Field + value: |- + multi + line + text + valueType: Text + isAirgapSupported: true + isGitOpsSupported: true + isSnapshotSupported: true + licenseID: 1vusOokxAVp1tkRGuyxnF23PJcq + licenseSequence: 7 + licenseType: prod + signature: eyJsaWNlbnNlRGF0YSI6ImV5SmhjR2xXWlhKemFXOXVJam9pYTI5MGN5NXBieTkyTVdKbGRHRXhJaXdpYTJsdVpDSTZJa3hwWTJWdWMyVWlMQ0p0WlhSaFpHRjBZU0k2ZXlKdVlXMWxJam9pZEdWemRHTjFjM1J2YldWeUluMHNJbk53WldNaU9uc2liR2xqWlc1elpVbEVJam9pTVhaMWMwOX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UmtaVFJFNUZVMGhLYkUxclRUTkxNSEJFVkROR2VGTnROVVJVVlRWVlltMDFiVnBGUm5sWldIQjZaRVJqTVZaSGFFeFBXRUpVVWtacmRrd3diek5aTUZaSlVteFdWRXd5T1VoV1JXeHNWa1ZPTUZSSE1WWlJNR04zVkd4R2JGa3pTblJUUm1zMFZVWk9hMVpWU2pCVU1WbDNZbXQwY0ZSclZuQmpia0poVFZjNWFtSldiSEZaYTNob1UyeHNWV0pGUmtWWGJVWnZWakZLVUZkcWJGSmhXRVp1V2xkb1EyRnVRak5TUjNNd1lWWkpOVTVXVmxkV1ZUVnlUMGhLYjFsVlRYbGhiVGcwVjBkYWVGbHFWbFppYlhoeFpFWkZkMDU1Y3pCaFZsSkpWRVpPTm1WRk1IcGxWWFJ2VFVaR1ZtRXdWVFJSVnpsSFVsaEtVRTFZUmxCU01WcFJVMVJDTmxsV2FIcFdWWEJ0WTBSU2JFMVVRazlPVjNSU1ZucFdUMU5XWTNaU1ZYUkZVMGhzYlU5VmJGaGtNMUl3WTFWc1lXTlhSakJTYTA1RVlVWmtjbUo2VmtSU00wSllUREkxUmsxWVl6SmxWM1JKVlZoQk1sVXhTbEppU0Zwd1VrVXdNRlpFVWt0VU1rWnNVVmQwYzFSV1VrMVVWV055V1RCYVRHSXpaRTlUVm05NVlraE9SR1JzVG5aUmFrWmFaVmRPVGxOVlNteGFiRXB1Wld0U2RVMHhSVGxRVTBselNXMWtjMkl5U21oaVJYUnNaVlZzYTBscWIybFpiVkpzV2xSVk1rNVVXWGRaTWxwcFRrUk9hazlYU1hsUFIwcHRUMVJvYkZsWFRtaGFiVVV5VGtSWmFXWlJQVDBpZlE9PSJ9 +status: {} diff --git a/pkg/tests/renderdir/cases/simple/wantResults/overlays/downstreams/this-cluster/kustomization.yaml b/pkg/tests/renderdir/cases/simple/wantResults/overlays/downstreams/this-cluster/kustomization.yaml new file mode 100644 index 0000000000..73a609d8fa --- /dev/null +++ b/pkg/tests/renderdir/cases/simple/wantResults/overlays/downstreams/this-cluster/kustomization.yaml @@ -0,0 +1,4 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +bases: +- ../../midstream +kind: Kustomization diff --git a/pkg/tests/renderdir/cases/simple/wantResults/overlays/midstream/backup-label-transformer.yaml b/pkg/tests/renderdir/cases/simple/wantResults/overlays/midstream/backup-label-transformer.yaml new file mode 100644 index 0000000000..c3acc6c5b9 --- /dev/null +++ b/pkg/tests/renderdir/cases/simple/wantResults/overlays/midstream/backup-label-transformer.yaml @@ -0,0 +1,39 @@ +apiVersion: builtin +kind: LabelTransformer +metadata: + name: backup-label-transformer +labels: + kots.io/app-slug: my-app + kots.io/backup: velero +fieldSpecs: +- path: metadata/labels + create: true +- version: v1 + kind: ReplicationController + path: spec/template/metadata/labels + create: true +- kind: Deployment + path: spec/template/metadata/labels + create: true +- kind: ReplicaSet + path: spec/template/metadata/labels + create: true +- kind: DaemonSet + path: spec/template/metadata/labels + create: true +- group: apps + kind: StatefulSet + path: spec/template/metadata/labels + create: true +- group: batch + kind: Job + path: spec/template/metadata/labels + create: true +- group: batch + kind: CronJob + path: spec/jobTemplate/metadata/labels + create: true +- group: batch + kind: CronJob + path: spec/jobTemplate/spec/template/metadata/labels + create: true diff --git a/pkg/tests/renderdir/cases/simple/wantResults/overlays/midstream/kustomization.yaml b/pkg/tests/renderdir/cases/simple/wantResults/overlays/midstream/kustomization.yaml new file mode 100644 index 0000000000..bb6f5b2615 --- /dev/null +++ b/pkg/tests/renderdir/cases/simple/wantResults/overlays/midstream/kustomization.yaml @@ -0,0 +1,10 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +bases: +- ../../base +commonAnnotations: + kots.io/app-slug: my-app +kind: Kustomization +resources: +- secret.yaml +transformers: +- backup-label-transformer.yaml diff --git a/pkg/tests/renderdir/cases/simple/wantResults/overlays/midstream/secret.yaml b/pkg/tests/renderdir/cases/simple/wantResults/overlays/midstream/secret.yaml new file mode 100644 index 0000000000..4d81bc057f --- /dev/null +++ b/pkg/tests/renderdir/cases/simple/wantResults/overlays/midstream/secret.yaml @@ -0,0 +1,28 @@ +apiVersion: v1 +data: + .dockerconfigjson: eyJhdXRocyI6eyJwcm94eS5yZXBsaWNhdGVkLmNvbSI6eyJhdXRoIjoiTVhaMWMwOXZhM2hCVm5BeGRHdFNSM1Y1ZUc1R01qTlFTbU54T2pGMmRYTlBiMnQ0UVZad01YUnJVa2QxZVhodVJqSXpVRXBqY1E9PSJ9LCJyZWdpc3RyeS5yZXBsaWNhdGVkLmNvbSI6eyJhdXRoIjoiTVhaMWMwOXZhM2hCVm5BeGRHdFNSM1Y1ZUc1R01qTlFTbU54T2pGMmRYTlBiMnQ0UVZad01YUnJVa2QxZVhodVJqSXpVRXBqY1E9PSJ9fX0= +kind: Secret +metadata: + annotations: + helm.sh/hook: pre-install,pre-upgrade + helm.sh/hook-weight: "-9999" + kots.io/creation-phase: "-9999" + creationTimestamp: null + name: my-app-registry + namespace: app-namespace +type: kubernetes.io/dockerconfigjson + +--- +apiVersion: v1 +data: + .dockerconfigjson: eyJhdXRocyI6eyJwcm94eS5yZXBsaWNhdGVkLmNvbSI6eyJhdXRoIjoiTVhaMWMwOXZhM2hCVm5BeGRHdFNSM1Y1ZUc1R01qTlFTbU54T2pGMmRYTlBiMnQ0UVZad01YUnJVa2QxZVhodVJqSXpVRXBqY1E9PSJ9LCJyZWdpc3RyeS5yZXBsaWNhdGVkLmNvbSI6eyJhdXRoIjoiTVhaMWMwOXZhM2hCVm5BeGRHdFNSM1Y1ZUc1R01qTlFTbU54T2pGMmRYTlBiMnQ0UVZad01YUnJVa2QxZVhodVJqSXpVRXBqY1E9PSJ9fX0= +kind: Secret +metadata: + annotations: + helm.sh/hook: pre-install,pre-upgrade + helm.sh/hook-weight: "-9999" + kots.io/creation-phase: "-9999" + creationTimestamp: null + name: kotsadm-replicated-registry + namespace: app-namespace +type: kubernetes.io/dockerconfigjson diff --git a/pkg/tests/renderdir/cases/simple/wantResults/rendered/this-cluster/kotsadm-replicated-registry-secret.yaml b/pkg/tests/renderdir/cases/simple/wantResults/rendered/this-cluster/kotsadm-replicated-registry-secret.yaml new file mode 100644 index 0000000000..6f52289831 --- /dev/null +++ b/pkg/tests/renderdir/cases/simple/wantResults/rendered/this-cluster/kotsadm-replicated-registry-secret.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +data: + .dockerconfigjson: eyJhdXRocyI6eyJwcm94eS5yZXBsaWNhdGVkLmNvbSI6eyJhdXRoIjoiTVhaMWMwOXZhM2hCVm5BeGRHdFNSM1Y1ZUc1R01qTlFTbU54T2pGMmRYTlBiMnQ0UVZad01YUnJVa2QxZVhodVJqSXpVRXBqY1E9PSJ9LCJyZWdpc3RyeS5yZXBsaWNhdGVkLmNvbSI6eyJhdXRoIjoiTVhaMWMwOXZhM2hCVm5BeGRHdFNSM1Y1ZUc1R01qTlFTbU54T2pGMmRYTlBiMnQ0UVZad01YUnJVa2QxZVhodVJqSXpVRXBqY1E9PSJ9fX0= +kind: Secret +metadata: + annotations: + helm.sh/hook: pre-install,pre-upgrade + helm.sh/hook-weight: "-9999" + kots.io/app-slug: my-app + kots.io/creation-phase: "-9999" + creationTimestamp: null + labels: + kots.io/app-slug: my-app + kots.io/backup: velero + name: kotsadm-replicated-registry + namespace: app-namespace +type: kubernetes.io/dockerconfigjson \ No newline at end of file diff --git a/pkg/tests/renderdir/cases/simple/wantResults/rendered/this-cluster/my-app-registry-secret.yaml b/pkg/tests/renderdir/cases/simple/wantResults/rendered/this-cluster/my-app-registry-secret.yaml new file mode 100644 index 0000000000..a8b369b451 --- /dev/null +++ b/pkg/tests/renderdir/cases/simple/wantResults/rendered/this-cluster/my-app-registry-secret.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +data: + .dockerconfigjson: eyJhdXRocyI6eyJwcm94eS5yZXBsaWNhdGVkLmNvbSI6eyJhdXRoIjoiTVhaMWMwOXZhM2hCVm5BeGRHdFNSM1Y1ZUc1R01qTlFTbU54T2pGMmRYTlBiMnQ0UVZad01YUnJVa2QxZVhodVJqSXpVRXBqY1E9PSJ9LCJyZWdpc3RyeS5yZXBsaWNhdGVkLmNvbSI6eyJhdXRoIjoiTVhaMWMwOXZhM2hCVm5BeGRHdFNSM1Y1ZUc1R01qTlFTbU54T2pGMmRYTlBiMnQ0UVZad01YUnJVa2QxZVhodVJqSXpVRXBqY1E9PSJ9fX0= +kind: Secret +metadata: + annotations: + helm.sh/hook: pre-install,pre-upgrade + helm.sh/hook-weight: "-9999" + kots.io/app-slug: my-app + kots.io/creation-phase: "-9999" + creationTimestamp: null + labels: + kots.io/app-slug: my-app + kots.io/backup: velero + name: my-app-registry + namespace: app-namespace +type: kubernetes.io/dockerconfigjson diff --git a/pkg/tests/renderdir/cases/simple/wantResults/rendered/this-cluster/test-licenseinfo-configmap.yaml b/pkg/tests/renderdir/cases/simple/wantResults/rendered/this-cluster/test-licenseinfo-configmap.yaml new file mode 100644 index 0000000000..db9a488146 --- /dev/null +++ b/pkg/tests/renderdir/cases/simple/wantResults/rendered/this-cluster/test-licenseinfo-configmap.yaml @@ -0,0 +1,33 @@ +apiVersion: v1 +data: + dockerCfg: eyJhdXRocyI6eyJwcm94eS5yZXBsaWNhdGVkLmNvbSI6eyJhdXRoIjoiTVhaMWMwOXZhM2hCVm5BeGRHdFNSM1Y1ZUc1R01qTlFTbU54T2pGMmRYTlBiMnQ0UVZad01YUnJVa2QxZVhodVJqSXpVRXBqY1E9PSJ9LCJyZWdpc3RyeS5yZXBsaWNhdGVkLmNvbSI6eyJhdXRoIjoiTVhaMWMwOXZhM2hCVm5BeGRHdFNSM1Y1ZUc1R01qTlFTbU54T2pGMmRYTlBiMnQ0UVZad01YUnJVa2QxZVhodVJqSXpVRXBqY1E9PSJ9fX0= + licenseFieldValueAppSlug: my-app + licenseFieldValueChannelID: 1vusIYZLAVxMG6q760OJmRKj5i5 + licenseFieldValueChannelName: My Channel + licenseFieldValueCustomBoolField: "true" + licenseFieldValueCustomHiddenField: this is secret + licenseFieldValueCustomIntField: 123 + licenseFieldValueCustomStringField: single line text + licenseFieldValueCustomTextField: |- + multi + line + text + licenseFieldValueCustomerName: Test Customer + licenseFieldValueEndpoint: https://replicated.app + licenseFieldValueIsAirgapSupported: true + licenseFieldValueIsGeoaxisSupported: false + licenseFieldValueIsGitOpsSupported: true + licenseFieldValueIsIdentityServiceSupported: false + licenseFieldValueLicenseID: 1vusOokxAVp1tkRGuyxnF23PJcq + licenseFieldValueLicenseId: 1vusOokxAVp1tkRGuyxnF23PJcq + licenseFieldValueLicenseSequence: 7 + licenseFieldValueLicenseType: prod + licenseFieldValueSignature: '{"licenseData":"eyJhcGlWZXJzaW9uIjoia290cy5pby92MWJldGExIiwia2luZCI6IkxpY2Vuc2UiLCJtZXRhZGF0YSI6eyJuYW1lIjoidGVzdGN1c3RvbWVyIn0sInNwZWMiOnsibGljZW5zZUlEIjoiMXZ1c09va3hBVnAxdGtSR3V5eG5GMjNQSmNxIiwibGljZW5zZVR5cGUiOiJwcm9kIiwiY3VzdG9tZXJOYW1lIjoiVGVzdCBDdXN0b21lciIsImFwcFNsdWciOiJteS1hcHAiLCJjaGFubmVsSUQiOiIxdnVzSVlaTEFWeE1HNnE3NjBPSm1SS2o1aTUiLCJjaGFubmVsTmFtZSI6Ik15IENoYW5uZWwiLCJsaWNlbnNlU2VxdWVuY2UiOjcsImVuZHBvaW50IjoiaHR0cHM6Ly9yZXBsaWNhdGVkLmFwcCIsImVudGl0bGVtZW50cyI6eyJib29sX2ZpZWxkIjp7InRpdGxlIjoiQm9vbCBGaWVsZCIsInZhbHVlIjp0cnVlLCJ2YWx1ZVR5cGUiOiJCb29sZWFuIn0sImV4cGlyZXNfYXQiOnsidGl0bGUiOiJFeHBpcmF0aW9uIiwiZGVzY3JpcHRpb24iOiJMaWNlbnNlIEV4cGlyYXRpb24iLCJ2YWx1ZSI6IjIwMzAtMDctMjdUMDA6MDA6MDBaIiwidmFsdWVUeXBlIjoiU3RyaW5nIn0sImhpZGRlbl9maWVsZCI6eyJ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CNllWaHpWVXBtY0RSbE1UQk9OV3RSVnpWT1NWY3ZSVXRFU0hsbU9VbFhkM1IwY1VsYWNXRjBSa05EYUZkcmJ6VkRSM0JYTDI1Rk1YYzJlV3RJVVhBMlUxSlJiSFpwUkUwMFZEUktUMkZsUVd0c1RWUk1UVWNyWTBaTGIzZE9TVm95YkhORGRsTnZRakZaZVdOTlNVSmxabEpuZWtSdU0xRTlQU0lzSW1kc2IySmhiRXRsZVVsa0lqb2lZbVJsWlRVMk5UWXdZMlppTkROak9XSXlPR0ptT1RobFlXTmhabUUyTkRZaWZRPT0ifQ=="}' +kind: ConfigMap +metadata: + annotations: + kots.io/app-slug: my-app + labels: + kots.io/app-slug: my-app + kots.io/backup: velero + name: test-licenseinfo \ No newline at end of file diff --git a/pkg/tests/renderdir/cases/simple/wantResults/upstream/config.yaml b/pkg/tests/renderdir/cases/simple/wantResults/upstream/config.yaml new file mode 100644 index 0000000000..aff6c18cbf --- /dev/null +++ b/pkg/tests/renderdir/cases/simple/wantResults/upstream/config.yaml @@ -0,0 +1,15 @@ +apiVersion: kots.io/v1beta1 +kind: Config +metadata: + name: my-app +spec: + groups: + - name: setup + title: Setup + items: + - name: hostname + type: text + title: Hostname + help_text: | + Use this field to provide a hostname for your Example Application installation. + required: true diff --git a/pkg/tests/renderdir/cases/simple/wantResults/upstream/subdir/configmap.yaml b/pkg/tests/renderdir/cases/simple/wantResults/upstream/subdir/configmap.yaml new file mode 100644 index 0000000000..73843036cb --- /dev/null +++ b/pkg/tests/renderdir/cases/simple/wantResults/upstream/subdir/configmap.yaml @@ -0,0 +1,25 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: test-licenseinfo +data: + dockerCfg: {{repl LicenseDockerCfg }} + licenseFieldValueIsGitOpsSupported: {{repl LicenseFieldValue "isGitOpsSupported" }} + licenseFieldValueIsIdentityServiceSupported: {{repl LicenseFieldValue "isIdentityServiceSupported" }} + licenseFieldValueIsGeoaxisSupported: {{repl LicenseFieldValue "isGeoaxisSupported" }} + licenseFieldValueIsAirgapSupported: {{repl LicenseFieldValue "isAirgapSupported" }} + licenseFieldValueLicenseType: {{repl LicenseFieldValue "licenseType" }} + licenseFieldValueLicenseSequence: {{repl LicenseFieldValue "licenseSequence" }} + licenseFieldValueSignature: '{{repl LicenseFieldValue "signature" }}' + licenseFieldValueAppSlug: {{repl LicenseFieldValue "appSlug" }} + licenseFieldValueChannelID: {{repl LicenseFieldValue "channelID" }} + licenseFieldValueChannelName: {{repl LicenseFieldValue "channelName" }} + licenseFieldValueCustomerName: {{repl LicenseFieldValue "customerName" }} + licenseFieldValueEndpoint: {{repl LicenseFieldValue "endpoint" }} + licenseFieldValueLicenseID: {{repl LicenseFieldValue "licenseID" }} + licenseFieldValueLicenseId: {{repl LicenseFieldValue "licenseId" }} + licenseFieldValueCustomIntField: {{repl LicenseFieldValue "int_field" }} + licenseFieldValueCustomStringField: {{repl LicenseFieldValue "string_field" }} + licenseFieldValueCustomTextField: "{{repl LicenseFieldValue "text_field" | replace "\n" "\\n" }}" + licenseFieldValueCustomBoolField: "{{repl LicenseFieldValue "bool_field" }}" + licenseFieldValueCustomHiddenField: "{{repl LicenseFieldValue "hidden_field" }}" diff --git a/pkg/tests/renderdir/cases/simple/wantResults/upstream/userdata/config.yaml b/pkg/tests/renderdir/cases/simple/wantResults/upstream/userdata/config.yaml new file mode 100644 index 0000000000..4b2800d1ad --- /dev/null +++ b/pkg/tests/renderdir/cases/simple/wantResults/upstream/userdata/config.yaml @@ -0,0 +1,10 @@ +apiVersion: kots.io/v1beta1 +kind: ConfigValues +metadata: + creationTimestamp: null + name: replicated-kots-app +spec: + values: + hostname: + value: my-app.somebigbank.com +status: {} diff --git a/pkg/tests/renderdir/cases/simple/wantResults/upstream/userdata/installation.yaml b/pkg/tests/renderdir/cases/simple/wantResults/upstream/userdata/installation.yaml new file mode 100644 index 0000000000..b0c5471181 --- /dev/null +++ b/pkg/tests/renderdir/cases/simple/wantResults/upstream/userdata/installation.yaml @@ -0,0 +1,9 @@ +apiVersion: kots.io/v1beta1 +kind: Installation +metadata: + creationTimestamp: null + name: replicated-kots-app +spec: + channelID: 1vusIYZLAVxMG6q760OJmRKj5i5 + channelName: My Channel +status: {} diff --git a/pkg/tests/renderdir/cases/simple/wantResults/upstream/userdata/license.yaml b/pkg/tests/renderdir/cases/simple/wantResults/upstream/userdata/license.yaml new file mode 100644 index 0000000000..9fa3a14d7f --- /dev/null +++ b/pkg/tests/renderdir/cases/simple/wantResults/upstream/userdata/license.yaml @@ -0,0 +1,49 @@ +apiVersion: kots.io/v1beta1 +kind: License +metadata: + creationTimestamp: null + name: testcustomer +spec: + appSlug: my-app + channelID: 1vusIYZLAVxMG6q760OJmRKj5i5 + channelName: My Channel + customerName: Test Customer + endpoint: https://replicated.app + entitlements: + bool_field: + title: Bool Field + value: true + valueType: Boolean + expires_at: + description: License Expiration + title: Expiration + value: "2030-07-27T00:00:00Z" + valueType: String + hidden_field: + isHidden: true + title: Hidden Field + value: this is secret + valueType: String + int_field: + title: Int Field + value: 123 + valueType: Integer + string_field: + title: StringField + value: single line text + valueType: String + text_field: + title: Text Field + value: |- + multi + line + text + valueType: Text + isAirgapSupported: true + isGitOpsSupported: true + isSnapshotSupported: true + licenseID: 1vusOokxAVp1tkRGuyxnF23PJcq + licenseSequence: 7 + licenseType: prod + signature: eyJsaWNlbnNlRGF0YSI6ImV5SmhjR2xXWlhKemFXOXVJam9pYTI5MGN5NXBieTkyTVdKbGRHRXhJaXdpYTJsdVpDSTZJa3hwWTJWdWMyVWlMQ0p0WlhSaFpHRjBZU0k2ZXlKdVlXMWxJam9pZEdWemRHTjFjM1J2YldWeUluMHNJbk53WldNaU9uc2liR2xqWlc1elpVbEVJam9pTVhaMWMwOXZhM2hCVm5BeGRHdFNSM1Y1ZUc1R01qTlFTbU54SWl3aWJHbGpaVzV6WlZSNWNHVWlPaUp3Y205a0lpd2lZM1Z6ZEc5dFpYSk9ZVzFsSWpvaVZHVnpkQ0JEZFhOMGIyMWx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1ZPTUZSSE1WWlJNR04zVkd4R2JGa3pTblJUUm1zMFZVWk9hMVpWU2pCVU1WbDNZbXQwY0ZSclZuQmpia0poVFZjNWFtSldiSEZaYTNob1UyeHNWV0pGUmtWWGJVWnZWakZLVUZkcWJGSmhXRVp1V2xkb1EyRnVRak5TUjNNd1lWWkpOVTVXVmxkV1ZUVnlUMGhLYjFsVlRYbGhiVGcwVjBkYWVGbHFWbFppYlhoeFpFWkZkMDU1Y3pCaFZsSkpWRVpPTm1WRk1IcGxWWFJ2VFVaR1ZtRXdWVFJSVnpsSFVsaEtVRTFZUmxCU01WcFJVMVJDTmxsV2FIcFdWWEJ0WTBSU2JFMVVRazlPVjNSU1ZucFdUMU5XWTNaU1ZYUkZVMGhzYlU5VmJGaGtNMUl3WTFWc1lXTlhSakJTYTA1RVlVWmtjbUo2VmtSU00wSllUREkxUmsxWVl6SmxWM1JKVlZoQk1sVXhTbEppU0Zwd1VrVXdNRlpFVWt0VU1rWnNVVmQwYzFSV1VrMVVWV055V1RCYVRHSXpaRTlUVm05NVlraE9SR1JzVG5aUmFrWmFaVmRPVGxOVlNteGFiRXB1Wld0U2RVMHhSVGxRVTBselNXMWtjMkl5U21oaVJYUnNaVlZzYTBscWIybFpiVkpzV2xSVk1rNVVXWGRaTWxwcFRrUk9hazlYU1hsUFIwcHRUMVJvYkZsWFRtaGFiVVV5VGtSWmFXWlJQVDBpZlE9PSJ9 +status: {} diff --git a/pkg/tests/renderdir/renderdir_test.go b/pkg/tests/renderdir/renderdir_test.go new file mode 100644 index 0000000000..df0ef77101 --- /dev/null +++ b/pkg/tests/renderdir/renderdir_test.go @@ -0,0 +1,256 @@ +package renderdir + +import ( + "fmt" + "os" + "path/filepath" + "strings" + "testing" + + envsubst "github.com/drone/envsubst/v2" + "github.com/ghodss/yaml" + "github.com/golang/mock/gomock" + cp "github.com/otiai10/copy" + "github.com/replicatedhq/kots/pkg/render" + rendertypes "github.com/replicatedhq/kots/pkg/render/types" + "github.com/replicatedhq/kots/pkg/store" + mock_store "github.com/replicatedhq/kots/pkg/store/mock" + "github.com/replicatedhq/kots/pkg/util" + kotsv1beta1 "github.com/replicatedhq/kotskinds/apis/kots/v1beta1" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +type TestCaseSpec struct { + Name string + RenderDirOptions rendertypes.RenderDirOptions + ResultsDir string +} + +type testCase struct { + Name string + RenderDirOptions rendertypes.RenderDirOptions +} + +func TestKotsRenderDir(t *testing.T) { + ctrl := gomock.NewController(t) + defer ctrl.Finish() + + mockStore := mock_store.NewMockStore(ctrl) + store.SetStore(mockStore) + defer store.SetStore(nil) + + mockStore.EXPECT().UpdateAppVersionInstallationSpec(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes() + + t.Setenv("USE_MOCK_REPORTING", "1") + defer os.Unsetenv("USE_MOCK_REPORTING") + + t.Setenv("KOTSADM_TARGET_NAMESPACE", "app-namespace") + defer os.Unsetenv("KOTSADM_TARGET_NAMESPACE") + + tests := []testCase{} + root := "cases" + + entries, err := os.ReadDir(root) + require.NoError(t, err) + + for _, entry := range entries { + path := filepath.Join(root, entry.Name()) + + if !entry.IsDir() { + continue + } + + testcaseFilepath := filepath.Join(path, "testcase.yaml") + _, err = os.Stat(testcaseFilepath) + if os.IsNotExist(err) { + t.Logf("no testcase.yaml found in directory %s", path) + continue + } else { + require.NoError(t, err, path) + } + + b, err := os.ReadFile(testcaseFilepath) + require.NoError(t, err, path) + + var spec TestCaseSpec + err = yaml.Unmarshal(b, &spec) + require.NoError(t, err, path) + + test := testCase{ + Name: spec.Name, + RenderDirOptions: spec.RenderDirOptions, + } + + tests = append(tests, test) + } + require.NoError(t, err) + + // ensure the tests are actually loaded + if len(tests) == 0 { + fmt.Printf("Kots RenderDir test cases not found") + t.FailNow() + } + + for _, tt := range tests { + t.Run(tt.Name, func(t *testing.T) { + testDir := filepath.Dir(tt.RenderDirOptions.ArchiveDir) + + // copy archiveDir to preserve original test data + resultsDir := filepath.Join(testDir, "results") + os.Mkdir(resultsDir, 0755) + err := cp.Copy(tt.RenderDirOptions.ArchiveDir, resultsDir) + require.NoError(t, err) + tt.RenderDirOptions.ArchiveDir = resultsDir + + // Comment out this line to review the generated results. + // Just be sure to delete the 'results' directory in each test manually when finished! + // defer func() { os.RemoveAll(resultsDir) }() + + fmt.Printf("running test %s\n", tt.Name) + err = render.RenderDir(tt.RenderDirOptions) + require.NoError(t, err) + + wantResultsDir := filepath.Join(testDir, "wantResults") + err = filepath.Walk(wantResultsDir, + func(path string, info os.FileInfo, err error) error { + if err != nil { + return err + } + + if info.IsDir() && info.Name() == "kotsKinds" { + return filepath.SkipDir + } + + if info.IsDir() { + return nil + } + + resultPath := strings.Replace(path, "wantResults", "results", 1) + + if _, err = os.Stat(resultPath); os.IsNotExist(err) { + fmt.Printf("expected file %s not found in results\n", resultPath) + t.FailNow() + } + + return nil + }) + + require.NoError(t, err) + + // compare result files to wanted files + err = filepath.Walk(resultsDir, + func(path string, info os.FileInfo, err error) error { + if err != nil { + return err + } + + if info.IsDir() && info.Name() == "kotsKinds" { + return filepath.SkipDir + } + + if info.IsDir() { + return nil + } + + // exclude installation.yaml as it has a randomly generated encryptionKey + if strings.HasSuffix(path, "upstream/userdata/installation.yaml") || + strings.HasSuffix(path, ".DS_Store") { + return nil + } + + contents, err := os.ReadFile(path) + if err != nil { + return err + } + + wantPath := strings.Replace(path, "results", "wantResults", 1) + + wantContents, err := os.ReadFile(wantPath) + if err != nil { + fmt.Printf("unable to open file %s\n", wantPath) + } + require.NoError(t, err, wantPath) + + contentsString := string(contents) + wantContentsString := string(wantContents) + + if ext := filepath.Ext(wantPath); ext == ".yaml" || ext == ".yml" { + wantContentsString, err = envsubst.Eval(wantContentsString, util.TestGetenv) + require.NoError(t, err, wantPath) + } + + if strings.HasSuffix(wantPath, "pullsecrets.yaml") { + // pull secret patches are not generated in a deterministic order + gotPullSecrets := strings.Split(contentsString, "---\n") + wantPullSecrets := strings.Split(wantContentsString, "---\n") + require.ElementsMatch(t, wantPullSecrets, gotPullSecrets) + return nil + } + + assert.Equal(t, wantContentsString, contentsString, wantPath) + return nil + }) + + require.NoError(t, err) + + // Check that kots kinds match. + installationPath := "" + err = filepath.Walk(filepath.Join(resultsDir, "kotsKinds"), + func(path string, info os.FileInfo, err error) error { + if err != nil { + return err + } + + if info.IsDir() { + return nil + } + + // Skip installation.yaml because known images order will differ on every generation. + if strings.HasSuffix(path, "installation.yaml") { + installationPath = path + return nil + } + + rawContents, err := os.ReadFile(path) + if err != nil { + return err + } + require.NoError(t, err, path) + + wantPath := strings.Replace(path, "results", "wantResults", 1) + rawWantContents, err := os.ReadFile(wantPath) + if err != nil { + fmt.Printf("unable to open file %s\n", wantPath) + } + require.NoError(t, err, wantPath) + + require.Equal(t, string(rawWantContents), string(rawContents), wantPath) + return nil + }) + + require.NoError(t, err) + + wantInstallationPath := strings.Replace(installationPath, "results", "wantResults", 1) + + installationContents, err := os.ReadFile(installationPath) + require.NoError(t, err) + + wantInstallationContents, err := os.ReadFile(wantInstallationPath) + require.NoError(t, err) + + installation := kotsv1beta1.Installation{} + err = yaml.Unmarshal(installationContents, &installation) + require.NoError(t, err) + + wantInstallation := kotsv1beta1.Installation{} + err = yaml.Unmarshal(wantInstallationContents, &wantInstallation) + require.NoError(t, err) + + require.ElementsMatch(t, wantInstallation.Spec.KnownImages, installation.Spec.KnownImages) + wantInstallation.Spec.KnownImages = nil + installation.Spec.KnownImages = nil + require.Equal(t, wantInstallation, installation) + }) + } +} diff --git a/pkg/version/metrics.go b/pkg/version/metrics.go index 1c3af1430d..05c9cda83d 100644 --- a/pkg/version/metrics.go +++ b/pkg/version/metrics.go @@ -15,6 +15,7 @@ import ( "github.com/replicatedhq/kots/pkg/kotsutil" "github.com/replicatedhq/kots/pkg/logger" "github.com/replicatedhq/kots/pkg/render" + rendertypes "github.com/replicatedhq/kots/pkg/render/types" "github.com/replicatedhq/kots/pkg/store" "github.com/replicatedhq/kots/pkg/util" kotsv1beta1 "github.com/replicatedhq/kotskinds/apis/kots/v1beta1" @@ -112,7 +113,15 @@ func GetGraphs(app *types.App, sequence int64, kotsStore store.Store) ([]kotsv1b return graphs, errors.Wrap(err, "failed to marshal kots application") } - renderedKotsApplication, err := render.RenderFile(kotsKinds, registrySettings, app.Slug, sequence, app.IsAirgap, util.PodNamespace, []byte(templatedKotsApplication)) + renderedKotsApplication, err := render.RenderFile(rendertypes.RenderFileOptions{ + KotsKinds: kotsKinds, + RegistrySettings: registrySettings, + AppSlug: app.Slug, + Sequence: sequence, + IsAirgap: app.IsAirgap, + Namespace: util.PodNamespace, + InputContent: []byte(templatedKotsApplication), + }) if err != nil { return graphs, errors.Wrap(err, "failed to render kots application") } From 25021d9a4c9e6f3b2bb7c99dfd4156709aedcf68 Mon Sep 17 00:00:00 2001 From: Salah Al Saleh Date: Fri, 23 Feb 2024 18:30:23 +0000 Subject: [PATCH 2/3] cleanup results dir --- pkg/tests/renderdir/renderdir_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/tests/renderdir/renderdir_test.go b/pkg/tests/renderdir/renderdir_test.go index df0ef77101..9e95b4a37f 100644 --- a/pkg/tests/renderdir/renderdir_test.go +++ b/pkg/tests/renderdir/renderdir_test.go @@ -105,7 +105,7 @@ func TestKotsRenderDir(t *testing.T) { // Comment out this line to review the generated results. // Just be sure to delete the 'results' directory in each test manually when finished! - // defer func() { os.RemoveAll(resultsDir) }() + defer func() { os.RemoveAll(resultsDir) }() fmt.Printf("running test %s\n", tt.Name) err = render.RenderDir(tt.RenderDirOptions) From b382e25e7ecb0a992da972c12e29d31cbf8278d1 Mon Sep 17 00:00:00 2001 From: Salah Al Saleh Date: Fri, 23 Feb 2024 18:39:05 +0000 Subject: [PATCH 3/3] rename test --- .../archiveDir/base/kustomization.yaml | 0 .../archiveDir/base/subdir/configmap.yaml | 0 .../archiveDir/kotsKinds/config.yaml | 0 .../archiveDir/kotsKinds}/userdata/config.yaml | 2 +- .../archiveDir/kotsKinds}/userdata/installation.yaml | 4 ++-- .../archiveDir/kotsKinds/userdata/license.yaml | 0 .../overlays/downstreams/this-cluster/kustomization.yaml | 0 .../overlays/midstream/backup-label-transformer.yaml | 0 .../archiveDir/overlays/midstream/kustomization.yaml | 0 .../archiveDir/overlays/midstream/secret.yaml | 0 .../this-cluster/kotsadm-replicated-registry-secret.yaml | 0 .../rendered/this-cluster/my-app-registry-secret.yaml | 0 .../rendered/this-cluster/test-licenseinfo-configmap.yaml | 0 .../archiveDir/upstream/config.yaml | 0 .../archiveDir/upstream/subdir/configmap.yaml | 0 .../archiveDir/upstream}/userdata/config.yaml | 0 .../archiveDir/upstream}/userdata/installation.yaml | 0 .../archiveDir/upstream/userdata/license.yaml | 0 .../cases/{simple => outdated-kotskinds}/testcase.yaml | 4 ++-- .../wantResults/base/kustomization.yaml | 0 .../wantResults/base/subdir/configmap.yaml | 0 .../wantResults/kotsKinds/config.yaml | 0 .../wantResults/kotsKinds}/userdata/config.yaml | 0 .../wantResults/kotsKinds}/userdata/installation.yaml | 0 .../wantResults/kotsKinds/userdata/license.yaml | 0 .../overlays/downstreams/this-cluster/kustomization.yaml | 0 .../overlays/midstream/backup-label-transformer.yaml | 0 .../wantResults/overlays/midstream/kustomization.yaml | 0 .../wantResults/overlays/midstream/secret.yaml | 0 .../this-cluster/kotsadm-replicated-registry-secret.yaml | 0 .../rendered/this-cluster/my-app-registry-secret.yaml | 0 .../rendered/this-cluster/test-licenseinfo-configmap.yaml | 0 .../wantResults/upstream/config.yaml | 0 .../wantResults/upstream/subdir/configmap.yaml | 0 .../wantResults/upstream}/userdata/config.yaml | 0 .../wantResults/upstream}/userdata/installation.yaml | 0 .../wantResults/upstream/userdata/license.yaml | 0 37 files changed, 5 insertions(+), 5 deletions(-) rename pkg/tests/renderdir/cases/{simple => outdated-kotskinds}/archiveDir/base/kustomization.yaml (100%) rename pkg/tests/renderdir/cases/{simple => outdated-kotskinds}/archiveDir/base/subdir/configmap.yaml (100%) rename pkg/tests/renderdir/cases/{simple => outdated-kotskinds}/archiveDir/kotsKinds/config.yaml (100%) rename pkg/tests/renderdir/cases/{simple/wantResults/upstream => outdated-kotskinds/archiveDir/kotsKinds}/userdata/config.yaml (79%) rename pkg/tests/renderdir/cases/{simple/wantResults/upstream => outdated-kotskinds/archiveDir/kotsKinds}/userdata/installation.yaml (63%) rename pkg/tests/renderdir/cases/{simple => outdated-kotskinds}/archiveDir/kotsKinds/userdata/license.yaml (100%) rename pkg/tests/renderdir/cases/{simple => outdated-kotskinds}/archiveDir/overlays/downstreams/this-cluster/kustomization.yaml (100%) rename pkg/tests/renderdir/cases/{simple => outdated-kotskinds}/archiveDir/overlays/midstream/backup-label-transformer.yaml (100%) rename pkg/tests/renderdir/cases/{simple => outdated-kotskinds}/archiveDir/overlays/midstream/kustomization.yaml (100%) rename pkg/tests/renderdir/cases/{simple => outdated-kotskinds}/archiveDir/overlays/midstream/secret.yaml (100%) rename pkg/tests/renderdir/cases/{simple => outdated-kotskinds}/archiveDir/rendered/this-cluster/kotsadm-replicated-registry-secret.yaml (100%) rename pkg/tests/renderdir/cases/{simple => outdated-kotskinds}/archiveDir/rendered/this-cluster/my-app-registry-secret.yaml (100%) rename pkg/tests/renderdir/cases/{simple => outdated-kotskinds}/archiveDir/rendered/this-cluster/test-licenseinfo-configmap.yaml (100%) rename pkg/tests/renderdir/cases/{simple => outdated-kotskinds}/archiveDir/upstream/config.yaml (100%) rename pkg/tests/renderdir/cases/{simple => outdated-kotskinds}/archiveDir/upstream/subdir/configmap.yaml (100%) rename pkg/tests/renderdir/cases/{simple/archiveDir/kotsKinds => outdated-kotskinds/archiveDir/upstream}/userdata/config.yaml (100%) rename pkg/tests/renderdir/cases/{simple/archiveDir/kotsKinds => outdated-kotskinds/archiveDir/upstream}/userdata/installation.yaml (100%) rename pkg/tests/renderdir/cases/{simple => outdated-kotskinds}/archiveDir/upstream/userdata/license.yaml (100%) rename pkg/tests/renderdir/cases/{simple => outdated-kotskinds}/testcase.yaml (57%) rename pkg/tests/renderdir/cases/{simple => outdated-kotskinds}/wantResults/base/kustomization.yaml (100%) rename pkg/tests/renderdir/cases/{simple => outdated-kotskinds}/wantResults/base/subdir/configmap.yaml (100%) rename pkg/tests/renderdir/cases/{simple => outdated-kotskinds}/wantResults/kotsKinds/config.yaml (100%) rename pkg/tests/renderdir/cases/{simple/archiveDir/upstream => outdated-kotskinds/wantResults/kotsKinds}/userdata/config.yaml (100%) rename pkg/tests/renderdir/cases/{simple/archiveDir/upstream => outdated-kotskinds/wantResults/kotsKinds}/userdata/installation.yaml (100%) rename pkg/tests/renderdir/cases/{simple => outdated-kotskinds}/wantResults/kotsKinds/userdata/license.yaml (100%) rename pkg/tests/renderdir/cases/{simple => outdated-kotskinds}/wantResults/overlays/downstreams/this-cluster/kustomization.yaml (100%) rename pkg/tests/renderdir/cases/{simple => outdated-kotskinds}/wantResults/overlays/midstream/backup-label-transformer.yaml (100%) rename pkg/tests/renderdir/cases/{simple => outdated-kotskinds}/wantResults/overlays/midstream/kustomization.yaml (100%) rename pkg/tests/renderdir/cases/{simple => outdated-kotskinds}/wantResults/overlays/midstream/secret.yaml (100%) rename pkg/tests/renderdir/cases/{simple => outdated-kotskinds}/wantResults/rendered/this-cluster/kotsadm-replicated-registry-secret.yaml (100%) rename pkg/tests/renderdir/cases/{simple => outdated-kotskinds}/wantResults/rendered/this-cluster/my-app-registry-secret.yaml (100%) rename pkg/tests/renderdir/cases/{simple => outdated-kotskinds}/wantResults/rendered/this-cluster/test-licenseinfo-configmap.yaml (100%) rename pkg/tests/renderdir/cases/{simple => outdated-kotskinds}/wantResults/upstream/config.yaml (100%) rename pkg/tests/renderdir/cases/{simple => outdated-kotskinds}/wantResults/upstream/subdir/configmap.yaml (100%) rename pkg/tests/renderdir/cases/{simple/wantResults/kotsKinds => outdated-kotskinds/wantResults/upstream}/userdata/config.yaml (100%) rename pkg/tests/renderdir/cases/{simple/wantResults/kotsKinds => outdated-kotskinds/wantResults/upstream}/userdata/installation.yaml (100%) rename pkg/tests/renderdir/cases/{simple => outdated-kotskinds}/wantResults/upstream/userdata/license.yaml (100%) diff --git a/pkg/tests/renderdir/cases/simple/archiveDir/base/kustomization.yaml b/pkg/tests/renderdir/cases/outdated-kotskinds/archiveDir/base/kustomization.yaml similarity index 100% rename from pkg/tests/renderdir/cases/simple/archiveDir/base/kustomization.yaml rename to pkg/tests/renderdir/cases/outdated-kotskinds/archiveDir/base/kustomization.yaml diff --git a/pkg/tests/renderdir/cases/simple/archiveDir/base/subdir/configmap.yaml b/pkg/tests/renderdir/cases/outdated-kotskinds/archiveDir/base/subdir/configmap.yaml similarity index 100% rename from pkg/tests/renderdir/cases/simple/archiveDir/base/subdir/configmap.yaml rename to pkg/tests/renderdir/cases/outdated-kotskinds/archiveDir/base/subdir/configmap.yaml diff --git a/pkg/tests/renderdir/cases/simple/archiveDir/kotsKinds/config.yaml b/pkg/tests/renderdir/cases/outdated-kotskinds/archiveDir/kotsKinds/config.yaml similarity index 100% rename from pkg/tests/renderdir/cases/simple/archiveDir/kotsKinds/config.yaml rename to pkg/tests/renderdir/cases/outdated-kotskinds/archiveDir/kotsKinds/config.yaml diff --git a/pkg/tests/renderdir/cases/simple/wantResults/upstream/userdata/config.yaml b/pkg/tests/renderdir/cases/outdated-kotskinds/archiveDir/kotsKinds/userdata/config.yaml similarity index 79% rename from pkg/tests/renderdir/cases/simple/wantResults/upstream/userdata/config.yaml rename to pkg/tests/renderdir/cases/outdated-kotskinds/archiveDir/kotsKinds/userdata/config.yaml index 4b2800d1ad..0e4a32e830 100644 --- a/pkg/tests/renderdir/cases/simple/wantResults/upstream/userdata/config.yaml +++ b/pkg/tests/renderdir/cases/outdated-kotskinds/archiveDir/kotsKinds/userdata/config.yaml @@ -6,5 +6,5 @@ metadata: spec: values: hostname: - value: my-app.somebigbank.com + value: old-my-app.somebigbank.com status: {} diff --git a/pkg/tests/renderdir/cases/simple/wantResults/upstream/userdata/installation.yaml b/pkg/tests/renderdir/cases/outdated-kotskinds/archiveDir/kotsKinds/userdata/installation.yaml similarity index 63% rename from pkg/tests/renderdir/cases/simple/wantResults/upstream/userdata/installation.yaml rename to pkg/tests/renderdir/cases/outdated-kotskinds/archiveDir/kotsKinds/userdata/installation.yaml index b0c5471181..03f635036a 100644 --- a/pkg/tests/renderdir/cases/simple/wantResults/upstream/userdata/installation.yaml +++ b/pkg/tests/renderdir/cases/outdated-kotskinds/archiveDir/kotsKinds/userdata/installation.yaml @@ -4,6 +4,6 @@ metadata: creationTimestamp: null name: replicated-kots-app spec: - channelID: 1vusIYZLAVxMG6q760OJmRKj5i5 - channelName: My Channel + channelID: old-1vusIYZLAVxMG6q760OJmRKj5i5 + channelName: Old My Channel status: {} diff --git a/pkg/tests/renderdir/cases/simple/archiveDir/kotsKinds/userdata/license.yaml b/pkg/tests/renderdir/cases/outdated-kotskinds/archiveDir/kotsKinds/userdata/license.yaml similarity index 100% rename from pkg/tests/renderdir/cases/simple/archiveDir/kotsKinds/userdata/license.yaml rename to pkg/tests/renderdir/cases/outdated-kotskinds/archiveDir/kotsKinds/userdata/license.yaml diff --git a/pkg/tests/renderdir/cases/simple/archiveDir/overlays/downstreams/this-cluster/kustomization.yaml b/pkg/tests/renderdir/cases/outdated-kotskinds/archiveDir/overlays/downstreams/this-cluster/kustomization.yaml similarity index 100% rename from pkg/tests/renderdir/cases/simple/archiveDir/overlays/downstreams/this-cluster/kustomization.yaml rename to pkg/tests/renderdir/cases/outdated-kotskinds/archiveDir/overlays/downstreams/this-cluster/kustomization.yaml diff --git a/pkg/tests/renderdir/cases/simple/archiveDir/overlays/midstream/backup-label-transformer.yaml b/pkg/tests/renderdir/cases/outdated-kotskinds/archiveDir/overlays/midstream/backup-label-transformer.yaml similarity index 100% rename from pkg/tests/renderdir/cases/simple/archiveDir/overlays/midstream/backup-label-transformer.yaml rename to pkg/tests/renderdir/cases/outdated-kotskinds/archiveDir/overlays/midstream/backup-label-transformer.yaml diff --git a/pkg/tests/renderdir/cases/simple/archiveDir/overlays/midstream/kustomization.yaml b/pkg/tests/renderdir/cases/outdated-kotskinds/archiveDir/overlays/midstream/kustomization.yaml similarity index 100% rename from pkg/tests/renderdir/cases/simple/archiveDir/overlays/midstream/kustomization.yaml rename to pkg/tests/renderdir/cases/outdated-kotskinds/archiveDir/overlays/midstream/kustomization.yaml diff --git a/pkg/tests/renderdir/cases/simple/archiveDir/overlays/midstream/secret.yaml b/pkg/tests/renderdir/cases/outdated-kotskinds/archiveDir/overlays/midstream/secret.yaml similarity index 100% rename from pkg/tests/renderdir/cases/simple/archiveDir/overlays/midstream/secret.yaml rename to pkg/tests/renderdir/cases/outdated-kotskinds/archiveDir/overlays/midstream/secret.yaml diff --git a/pkg/tests/renderdir/cases/simple/archiveDir/rendered/this-cluster/kotsadm-replicated-registry-secret.yaml b/pkg/tests/renderdir/cases/outdated-kotskinds/archiveDir/rendered/this-cluster/kotsadm-replicated-registry-secret.yaml similarity index 100% rename from pkg/tests/renderdir/cases/simple/archiveDir/rendered/this-cluster/kotsadm-replicated-registry-secret.yaml rename to pkg/tests/renderdir/cases/outdated-kotskinds/archiveDir/rendered/this-cluster/kotsadm-replicated-registry-secret.yaml diff --git a/pkg/tests/renderdir/cases/simple/archiveDir/rendered/this-cluster/my-app-registry-secret.yaml b/pkg/tests/renderdir/cases/outdated-kotskinds/archiveDir/rendered/this-cluster/my-app-registry-secret.yaml similarity index 100% rename from pkg/tests/renderdir/cases/simple/archiveDir/rendered/this-cluster/my-app-registry-secret.yaml rename to pkg/tests/renderdir/cases/outdated-kotskinds/archiveDir/rendered/this-cluster/my-app-registry-secret.yaml diff --git a/pkg/tests/renderdir/cases/simple/archiveDir/rendered/this-cluster/test-licenseinfo-configmap.yaml b/pkg/tests/renderdir/cases/outdated-kotskinds/archiveDir/rendered/this-cluster/test-licenseinfo-configmap.yaml similarity index 100% rename from pkg/tests/renderdir/cases/simple/archiveDir/rendered/this-cluster/test-licenseinfo-configmap.yaml rename to pkg/tests/renderdir/cases/outdated-kotskinds/archiveDir/rendered/this-cluster/test-licenseinfo-configmap.yaml diff --git a/pkg/tests/renderdir/cases/simple/archiveDir/upstream/config.yaml b/pkg/tests/renderdir/cases/outdated-kotskinds/archiveDir/upstream/config.yaml similarity index 100% rename from pkg/tests/renderdir/cases/simple/archiveDir/upstream/config.yaml rename to pkg/tests/renderdir/cases/outdated-kotskinds/archiveDir/upstream/config.yaml diff --git a/pkg/tests/renderdir/cases/simple/archiveDir/upstream/subdir/configmap.yaml b/pkg/tests/renderdir/cases/outdated-kotskinds/archiveDir/upstream/subdir/configmap.yaml similarity index 100% rename from pkg/tests/renderdir/cases/simple/archiveDir/upstream/subdir/configmap.yaml rename to pkg/tests/renderdir/cases/outdated-kotskinds/archiveDir/upstream/subdir/configmap.yaml diff --git a/pkg/tests/renderdir/cases/simple/archiveDir/kotsKinds/userdata/config.yaml b/pkg/tests/renderdir/cases/outdated-kotskinds/archiveDir/upstream/userdata/config.yaml similarity index 100% rename from pkg/tests/renderdir/cases/simple/archiveDir/kotsKinds/userdata/config.yaml rename to pkg/tests/renderdir/cases/outdated-kotskinds/archiveDir/upstream/userdata/config.yaml diff --git a/pkg/tests/renderdir/cases/simple/archiveDir/kotsKinds/userdata/installation.yaml b/pkg/tests/renderdir/cases/outdated-kotskinds/archiveDir/upstream/userdata/installation.yaml similarity index 100% rename from pkg/tests/renderdir/cases/simple/archiveDir/kotsKinds/userdata/installation.yaml rename to pkg/tests/renderdir/cases/outdated-kotskinds/archiveDir/upstream/userdata/installation.yaml diff --git a/pkg/tests/renderdir/cases/simple/archiveDir/upstream/userdata/license.yaml b/pkg/tests/renderdir/cases/outdated-kotskinds/archiveDir/upstream/userdata/license.yaml similarity index 100% rename from pkg/tests/renderdir/cases/simple/archiveDir/upstream/userdata/license.yaml rename to pkg/tests/renderdir/cases/outdated-kotskinds/archiveDir/upstream/userdata/license.yaml diff --git a/pkg/tests/renderdir/cases/simple/testcase.yaml b/pkg/tests/renderdir/cases/outdated-kotskinds/testcase.yaml similarity index 57% rename from pkg/tests/renderdir/cases/simple/testcase.yaml rename to pkg/tests/renderdir/cases/outdated-kotskinds/testcase.yaml index e84298ca5a..3d61cfa465 100644 --- a/pkg/tests/renderdir/cases/simple/testcase.yaml +++ b/pkg/tests/renderdir/cases/outdated-kotskinds/testcase.yaml @@ -1,6 +1,6 @@ -Name: test simple renderdir +Name: test outdated kots kinds RenderDirOptions: - ArchiveDir: cases/simple/archiveDir + ArchiveDir: cases/outdated-kotskinds/archiveDir App: ID: app-id Slug: my-app diff --git a/pkg/tests/renderdir/cases/simple/wantResults/base/kustomization.yaml b/pkg/tests/renderdir/cases/outdated-kotskinds/wantResults/base/kustomization.yaml similarity index 100% rename from pkg/tests/renderdir/cases/simple/wantResults/base/kustomization.yaml rename to pkg/tests/renderdir/cases/outdated-kotskinds/wantResults/base/kustomization.yaml diff --git a/pkg/tests/renderdir/cases/simple/wantResults/base/subdir/configmap.yaml b/pkg/tests/renderdir/cases/outdated-kotskinds/wantResults/base/subdir/configmap.yaml similarity index 100% rename from pkg/tests/renderdir/cases/simple/wantResults/base/subdir/configmap.yaml rename to pkg/tests/renderdir/cases/outdated-kotskinds/wantResults/base/subdir/configmap.yaml diff --git a/pkg/tests/renderdir/cases/simple/wantResults/kotsKinds/config.yaml b/pkg/tests/renderdir/cases/outdated-kotskinds/wantResults/kotsKinds/config.yaml similarity index 100% rename from pkg/tests/renderdir/cases/simple/wantResults/kotsKinds/config.yaml rename to pkg/tests/renderdir/cases/outdated-kotskinds/wantResults/kotsKinds/config.yaml diff --git a/pkg/tests/renderdir/cases/simple/archiveDir/upstream/userdata/config.yaml b/pkg/tests/renderdir/cases/outdated-kotskinds/wantResults/kotsKinds/userdata/config.yaml similarity index 100% rename from pkg/tests/renderdir/cases/simple/archiveDir/upstream/userdata/config.yaml rename to pkg/tests/renderdir/cases/outdated-kotskinds/wantResults/kotsKinds/userdata/config.yaml diff --git a/pkg/tests/renderdir/cases/simple/archiveDir/upstream/userdata/installation.yaml b/pkg/tests/renderdir/cases/outdated-kotskinds/wantResults/kotsKinds/userdata/installation.yaml similarity index 100% rename from pkg/tests/renderdir/cases/simple/archiveDir/upstream/userdata/installation.yaml rename to pkg/tests/renderdir/cases/outdated-kotskinds/wantResults/kotsKinds/userdata/installation.yaml diff --git a/pkg/tests/renderdir/cases/simple/wantResults/kotsKinds/userdata/license.yaml b/pkg/tests/renderdir/cases/outdated-kotskinds/wantResults/kotsKinds/userdata/license.yaml similarity index 100% rename from pkg/tests/renderdir/cases/simple/wantResults/kotsKinds/userdata/license.yaml rename to pkg/tests/renderdir/cases/outdated-kotskinds/wantResults/kotsKinds/userdata/license.yaml diff --git a/pkg/tests/renderdir/cases/simple/wantResults/overlays/downstreams/this-cluster/kustomization.yaml b/pkg/tests/renderdir/cases/outdated-kotskinds/wantResults/overlays/downstreams/this-cluster/kustomization.yaml similarity index 100% rename from pkg/tests/renderdir/cases/simple/wantResults/overlays/downstreams/this-cluster/kustomization.yaml rename to pkg/tests/renderdir/cases/outdated-kotskinds/wantResults/overlays/downstreams/this-cluster/kustomization.yaml diff --git a/pkg/tests/renderdir/cases/simple/wantResults/overlays/midstream/backup-label-transformer.yaml b/pkg/tests/renderdir/cases/outdated-kotskinds/wantResults/overlays/midstream/backup-label-transformer.yaml similarity index 100% rename from pkg/tests/renderdir/cases/simple/wantResults/overlays/midstream/backup-label-transformer.yaml rename to pkg/tests/renderdir/cases/outdated-kotskinds/wantResults/overlays/midstream/backup-label-transformer.yaml diff --git a/pkg/tests/renderdir/cases/simple/wantResults/overlays/midstream/kustomization.yaml b/pkg/tests/renderdir/cases/outdated-kotskinds/wantResults/overlays/midstream/kustomization.yaml similarity index 100% rename from pkg/tests/renderdir/cases/simple/wantResults/overlays/midstream/kustomization.yaml rename to pkg/tests/renderdir/cases/outdated-kotskinds/wantResults/overlays/midstream/kustomization.yaml diff --git a/pkg/tests/renderdir/cases/simple/wantResults/overlays/midstream/secret.yaml b/pkg/tests/renderdir/cases/outdated-kotskinds/wantResults/overlays/midstream/secret.yaml similarity index 100% rename from pkg/tests/renderdir/cases/simple/wantResults/overlays/midstream/secret.yaml rename to pkg/tests/renderdir/cases/outdated-kotskinds/wantResults/overlays/midstream/secret.yaml diff --git a/pkg/tests/renderdir/cases/simple/wantResults/rendered/this-cluster/kotsadm-replicated-registry-secret.yaml b/pkg/tests/renderdir/cases/outdated-kotskinds/wantResults/rendered/this-cluster/kotsadm-replicated-registry-secret.yaml similarity index 100% rename from pkg/tests/renderdir/cases/simple/wantResults/rendered/this-cluster/kotsadm-replicated-registry-secret.yaml rename to pkg/tests/renderdir/cases/outdated-kotskinds/wantResults/rendered/this-cluster/kotsadm-replicated-registry-secret.yaml diff --git a/pkg/tests/renderdir/cases/simple/wantResults/rendered/this-cluster/my-app-registry-secret.yaml b/pkg/tests/renderdir/cases/outdated-kotskinds/wantResults/rendered/this-cluster/my-app-registry-secret.yaml similarity index 100% rename from pkg/tests/renderdir/cases/simple/wantResults/rendered/this-cluster/my-app-registry-secret.yaml rename to pkg/tests/renderdir/cases/outdated-kotskinds/wantResults/rendered/this-cluster/my-app-registry-secret.yaml diff --git a/pkg/tests/renderdir/cases/simple/wantResults/rendered/this-cluster/test-licenseinfo-configmap.yaml b/pkg/tests/renderdir/cases/outdated-kotskinds/wantResults/rendered/this-cluster/test-licenseinfo-configmap.yaml similarity index 100% rename from pkg/tests/renderdir/cases/simple/wantResults/rendered/this-cluster/test-licenseinfo-configmap.yaml rename to pkg/tests/renderdir/cases/outdated-kotskinds/wantResults/rendered/this-cluster/test-licenseinfo-configmap.yaml diff --git a/pkg/tests/renderdir/cases/simple/wantResults/upstream/config.yaml b/pkg/tests/renderdir/cases/outdated-kotskinds/wantResults/upstream/config.yaml similarity index 100% rename from pkg/tests/renderdir/cases/simple/wantResults/upstream/config.yaml rename to pkg/tests/renderdir/cases/outdated-kotskinds/wantResults/upstream/config.yaml diff --git a/pkg/tests/renderdir/cases/simple/wantResults/upstream/subdir/configmap.yaml b/pkg/tests/renderdir/cases/outdated-kotskinds/wantResults/upstream/subdir/configmap.yaml similarity index 100% rename from pkg/tests/renderdir/cases/simple/wantResults/upstream/subdir/configmap.yaml rename to pkg/tests/renderdir/cases/outdated-kotskinds/wantResults/upstream/subdir/configmap.yaml diff --git a/pkg/tests/renderdir/cases/simple/wantResults/kotsKinds/userdata/config.yaml b/pkg/tests/renderdir/cases/outdated-kotskinds/wantResults/upstream/userdata/config.yaml similarity index 100% rename from pkg/tests/renderdir/cases/simple/wantResults/kotsKinds/userdata/config.yaml rename to pkg/tests/renderdir/cases/outdated-kotskinds/wantResults/upstream/userdata/config.yaml diff --git a/pkg/tests/renderdir/cases/simple/wantResults/kotsKinds/userdata/installation.yaml b/pkg/tests/renderdir/cases/outdated-kotskinds/wantResults/upstream/userdata/installation.yaml similarity index 100% rename from pkg/tests/renderdir/cases/simple/wantResults/kotsKinds/userdata/installation.yaml rename to pkg/tests/renderdir/cases/outdated-kotskinds/wantResults/upstream/userdata/installation.yaml diff --git a/pkg/tests/renderdir/cases/simple/wantResults/upstream/userdata/license.yaml b/pkg/tests/renderdir/cases/outdated-kotskinds/wantResults/upstream/userdata/license.yaml similarity index 100% rename from pkg/tests/renderdir/cases/simple/wantResults/upstream/userdata/license.yaml rename to pkg/tests/renderdir/cases/outdated-kotskinds/wantResults/upstream/userdata/license.yaml