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

feat: multiple inline environments #414

Closed
wants to merge 1 commit into from

Conversation

Duologic
Copy link
Member

@Duologic Duologic commented Oct 29, 2020

With inline environments, we are now blocking the ability to handle multiple inline environments in. This PR proposes a solution to that. This also resolves #432.

Example Jsonnet:

{
  main(namespace, cluster)::
    (import 'main.libsonnet')
    {
      _config+:: {
        namespace: namespace,
        cluster_name: cluster,
      },
    },

  env(cluster, apiServer):: {
    local this = self,
    apiVersion: 'tanka.dev/v1alpha1',
    kind: 'Environment',
    metadata: {
      labels: {
        cluster: cluster,
      },
      name: '%s.%s' % [self.labels.cluster, this.spec.namespace],
    },
    spec: {
      apiServer: apiServer,
      injectLabels: true,
      namespace: 'kube-system',
    },
    data: $.main(self.spec.namespace, cluster),
  },

  envs: {
    dev: $.env('dev-eu', 'https://4.3.2.1'),
    qa: $.env('qa-us', 'https://1.2.3.4'),
  },

  // tk eval -e specs <this file>, get specs without the data
  // tk env should probably do something like this
  specs:: std.mapWithKey(
    function(k, obj)
      obj { data:: {} },
    $.envs
  ),
}

@stale
Copy link

stale bot commented Nov 28, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Nov 28, 2020
@Duologic Duologic marked this pull request as draft December 4, 2020 21:02
@stale stale bot removed the stale label Dec 4, 2020
@@ -77,18 +77,6 @@ func setupConfiguration(baseDir string) *v1alpha1.Environment {
if verbose {
fmt.Print(err)
}
// no spec.json is found, try parsing main.jsonnet
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is function is now only used in cmd/tk/env.go:envSetCmd(), which has no affinity with inline environments.

@stale
Copy link

stale bot commented Jan 6, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jan 6, 2021
@Duologic
Copy link
Member Author

Duologic commented Jan 6, 2021

This will be superseeded in the near future.

@Duologic Duologic closed this Jan 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Export muliple inline environments
1 participant