grafana / tanka

Flexible, reusable and concise configuration for Kubernetes
https://tanka.dev
Apache License 2.0
2.32k stars 165 forks source link

```tk env list``` doesn't work with tla function #653

Open zephyros-dev opened 2 years ago

zephyros-dev commented 2 years ago

I have a jsonnet file like this

// environments/example/non-tla
local data = {
  namespace: {
    apiVersion: 'v1',
    kind: 'Namespace',
    metadata: {
      name: 'namespace',
    },
  },
};
local tanka = import 'github.com/grafana/jsonnet-libs/tanka-util/main.libsonnet';
{
  env: tanka.environment.new(
         name='namespace',
         namespace='namespace',
         apiserver='https://localhost:6443',
       )
       + tanka.environment.withData(data),
}

When I use tk env list with the above jsonnet file, it shows the environment normally

# tk env list environments/example/non-tla/
NAME         NAMESPACE    SERVER                    
namespace    namespace    https://localhost:6443    

But when I tried the same with a tla function, tk env list doesn't shows the environment anymore

// environments/example/tla
local data = {
  namespace: {
    apiVersion: 'v1',
    kind: 'Namespace',
    metadata: {
      name: 'namespace',
    },
  },
};
local tanka = import 'github.com/grafana/jsonnet-libs/tanka-util/main.libsonnet';
function(var='var') {
  env: tanka.environment.new(
         name='namespace',
         namespace='namespace',
         apiserver='https://localhost:6443',
       )
       + tanka.environment.withData(data),
}
# tk env list environments/example/tla/
NAME         NAMESPACE    SERVER

Both are valid jsonnet file and both render to the exact same result when I tried tk eval and tk show

stale[bot] commented 2 years ago

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.

zephyros-dev commented 2 years ago

Not stale

stale[bot] commented 2 years ago

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.

zephyros-dev commented 2 years ago

Not stale

stale[bot] commented 2 years ago

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.

zephyros-dev commented 2 years ago

Not stale

zerok commented 2 months ago

Can still reproduce this with a simple inline environment that is built via function. show is able to generate the output but env list does not list the environment