splunk / qbec

configure kubernetes objects on multiple clusters using jsonnet
https://qbec.io
Apache License 2.0
171 stars 37 forks source link

Can not specify name for HELM v3 releases #88

Open kvaps opened 5 years ago

kvaps commented 5 years ago
[helm template] cd /home/kvaps/git/infrastructure/deployments/prometheus-operator/components && helm template ../vendor/helm-charts/stable/prometheus-operator --name monitoring --namespace monitoring --values -
[helm template] cd /home/kvaps/git/infrastructure/deployments/prometheus-operator/components && helm template ../vendor/helm-charts/stable/prometheus-operator --name monitoring --namespace monitoring --values -
Error: unknown flag: --name
Error: unknown flag: --name
✘ evaluate 'cluster-resources': RUNTIME ERROR: run helm template command: exit status 1
        components/cluster-resources.jsonnet:(5:23)-(14:2)      thunk <renderedChart> from <$>
        components/cluster-resources.jsonnet:20:12-25   $

        During evaluation

evaluate 'prometheus-operator': RUNTIME ERROR: run helm template command: exit status 1
        components/prometheus-operator.jsonnet:(5:23)-(14:2)    thunk <renderedChart> from <$>
        components/prometheus-operator.jsonnet:21:12-25 $

        During evaluation
kvaps commented 5 years ago

My bad Release Names were removed from Helm3 https://helm.sh/docs/faq/#release-names-are-now-scoped-to-the-namespace

Not a bug, removing name parameter from std.native('expandHelmTemplate') makes helm templating working again

kvaps commented 4 years ago

Reopen, there is still need an opportunity to specify name for the releases, eg:

# For Helm 2
helm install --namespace <NAMESPACE> --name gitlab-runner -f <CONFIG_VALUES_FILE> gitlab/gitlab-runner

# For Helm 3
helm install --namespace <NAMESPACE> gitlab-runner -f <CONFIG_VALUES_FILE> gitlab/gitlab-runner

from here

kvaps commented 4 years ago

Good workaround is to use --name-template flag, it's working fine with both: Helm2 and Helm3

example component:

local env = { name: std.extVar('qbec.io/env'), namespace: std.extVar('qbec.io/defaultNs') };
local p = import '../params.libsonnet';
local params = p.components.gitlabRunner;

std.native('expandHelmTemplate')(
  '../vendor/gitlab-runner',
  params.values,
  {
    nameTemplate: params.name,
    namespace: env.namespace,
    thisFile: std.thisFile,
    verbose: true,
  }
)

and values:

{
  components: {
    gitlabRunner: {
      name: 'gitlab-runner',
      values: {
        gitlabUrl: 'https://gitlab.exmple.org/',
        runnerRegistrationToken: 'Aim3veFeuQueey6aicee',
        rbac: {
          create: true,
        },
      },
    },
  },
}
harsimranmaan commented 4 years ago

helm 3 moved the name option to the main command as in helm template [NAME] [chart] which makes it harder to support both at the same time. As per https://helm.sh/docs/topics/version_skew/, helm2 would sunset with k8s 1.16. We should move to just supporting helm3 going forward. See https://github.com/splunk/qbec/pull/156/files#diff-89fd933f962458094e145ae8f0975458R76-R80

kvaps commented 4 years ago

@harsimranmaan how about using --name-template? It is supported by both helm2 and helm3

harsimranmaan commented 4 years ago

That might solve problem from both worlds. Maybe we can drop the --name or NAME parameter when we end support for helm2. A note in documentation about this behaviour should be enough in that case.