Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Do not remove data #585

Merged
merged 2 commits into from
Aug 5, 2021
Merged

fix: Do not remove data #585

merged 2 commits into from
Aug 5, 2021

Conversation

Duologic
Copy link
Member

@Duologic Duologic commented Jul 13, 2021

It is possible to reference the data object in the environment spec, however this doesn't
work if we remove it. Hiding should be sufficient to get the speed boost from lazy
loading.

The example references this.data outside the data: {} block, which is perfectly valid although I would discourage that, I'd rather suggest that data receives information from the environment it belongs to than the other way around.

Example:

local clusterEnvConfig = { namespace: 'a' };
{
  local this = self,
  apiVersion: 'tanka.dev/v1alpha1',
  kind: 'Environment',
  metadata: {
    name: 'environments/my-app/local',
  },
  spec: {
    namespace: this.data.app._config.namespace,
  },
  data: {
    app: { _config:: { namespace: 'b' } } +
         {
           _config+:: clusterEnvConfig,
           app+: {
             _config+:: {
               image: 'localhost:5000/my-app',
             },
           },
         },
  },
}

ref: https://github.com/nabadger/tanka-export-issue (reported by @nabadger)

pkg/tanka/evaluators.go Outdated Show resolved Hide resolved
Co-authored-by: sh0rez <me@shorez.de>
@Duologic Duologic merged commit 4ea9f6b into main Aug 5, 2021
@Duologic Duologic deleted the duologic/do_not_empty_data branch August 5, 2021 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants