Skip to content

Supporting values files for helm charts #591

@LucasRoesler

Description

@LucasRoesler

Expected Behaviour

If an app is packaged via a helm chart, then arkade should support passing a values file, for example

arkade install openfaas --values=custom.yaml

Current Behaviour

Value file support is not indicated in the CLI help text

$ arkade install openfaas -h
Install openfaas

Usage:
  arkade install openfaas [flags]

Examples:
  arkade install openfaas --load-balancer

Flags:
  -a, --basic-auth                    Enable authentication (default true)
      --basic-auth-password string    Overide the default random basic-auth-password if this is set
      --clusterrole                   Create a ClusterRole for OpenFaaS instead of a limited scope Role
      --direct-functions              Invoke functions directly from the gateway, or load-balance via endpoint IPs when set to false
      --function-pull-policy string   Pull policy for functions (default "Always")
      --gateways int                  Replicas of gateway (default 1)
  -h, --help                          help for openfaas
      --ingress-operator              Get custom domains and Ingress records via the ingress-operator component
      --license-file string           Path to OpenFaaS Pro license file
  -l, --load-balancer                 Add a loadbalancer
      --log-provider-url string       Set a log provider url for OpenFaaS
      --max-inflight int              Max tasks for queue-worker to process in parallel (default 1)
  -n, --namespace string              The namespace for the core services (default "openfaas")
      --operator                      Create OpenFaaS Operator
      --pull-policy string            Pull policy for OpenFaaS core services (default "IfNotPresent")
      --queue-workers int             Replicas of queue-worker for HA (default 1)
      --set stringArray               Use custom flags or override existing flags 
                                      (example --set gateway.replicas=2)
      --update-repo                   Update the helm repo (default true)

Global Flags:
      --kubeconfig string   Local path for your kubeconfig file
      --wait                If we should wait for the resource to be ready before returning (helm3 only, default false)

Further, the README even suggests that this is a desirable feature https://github.com/alexellis/arkade#say-goodbye-to-valuesyaml-and-hello-to-flags

Are you a GitHub Sponsor (Yes/No?)

Check at https://github.com/sponsors/alexellis

  • Yes
  • No

Possible Solution

Add a --values flag that is then passed to the helm internally.

Context

I am trying to create a walkthrough about using Loke, Tempo, and OpenFaaS together. But, there are just configurations I need to pass that are just too complex to want to parse and then pass as CLI flags via --set, for example, passing this configuration to Grafana

env:
  GF_AUTH_ANONYMOUS_ENABLED: true
  GF_AUTH_ANONYMOUS_ORG_ROLE: "Admin"
  GF_AUTH_DISABLE_LOGIN_FORM: true

grafana.ini:
  server:
    domain: monitoring.openfaas.local
    root_url: "%(protocol)s://%(domain)s/grafana"
    serve_from_sub_path: true

datasources:
  datasources.yaml:
    apiVersion: 1

    datasources:
      - name: Tempo
        type: tempo
        access: proxy
        orgId: 1
        url: http://tempo:3100
        isDefault: false
        version: 1
        editable: false
        uid: tempo
      - name: Loki
        type: loki
        access: proxy
        url: http://loki:3100
        isDefault: true
        version: 1
        editable: false
        uid: loki
        jsonData:
          derivedFields:
            - datasourceUid: tempo
              matcherRegex: (?:traceID|trace_id|traceId|traceid=(\w+))
              url: "$${__value.raw}"
              name: TraceID

Additionally, there are sometimes a need to pass in special characters which are then captured and parsed incorrectly by arkade, preventing the installation of the app. For example, i wanted to setup the nginx log format to use the logfmt style, ie key=value style. The command i tried to use with arkade looks like this

arkade install ingress-nginx \
           --set controller.config.enable-opentracing='true' \
           --set controller.config.jaeger-collector-host=tempo.default.svc.cluster.local \
           --set controller.hostPort.enabled='true' \
           --set controller.service.type=NodePort \
           --set controller.service.nodePorts.http=30080 \
           --set controller.publishService.enabled='false' \
           --set controller.extraArgs.publish-status-address=localhost \
           --set controller.updateStrategy.rollingUpdate.maxSurge=0 \
           --set controller.updateStrategy.rollingUpdate.maxUnavailable=1 \
           --set controller.config.log-format-upstream='remote_addr=$remote_addr user=$remote_user ts=$time_local request="$request" status=$status body_bytes=$body_bytes_sent referer="$http_referer" user_agent="$http_user_agent" request_length=$request_length duration=$request_time upstream=$proxy_upstream_name upstream_addr=$upstream_addr upstream_resp_length=$upstream_response_length upstream_duration=$upstream_response_time upstream_status=$upstream_status traceId=$opentracing_context_uber_trace_id'

But this simply produces an error Error: incorrect format for custom flag. It is failing because of the equal signs in the log format string. This can be verified because this command succeeds

arkade install ingress-nginx \
           --set controller.config.enable-opentracing='true' \
           --set controller.config.jaeger-collector-host=tempo.default.svc.cluster.local \
           --set controller.hostPort.enabled='true' \
           --set controller.service.type=NodePort \
           --set controller.service.nodePorts.http=30080 \
           --set controller.publishService.enabled='false' \
           --set controller.extraArgs.publish-status-address=localhost \
           --set controller.updateStrategy.rollingUpdate.maxSurge=0 \
           --set controller.updateStrategy.rollingUpdate.maxUnavailable=1 \
           --set controller.config.log-format-upstream='$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" $request_length $request_time [$proxy_upstream_name] [$proxy_alternative_upstream_name] $upstream_addr $upstream_response_length $upstream_response_time $upstream_status $req_id traceId $opentracing_context_uber_trace_id'

Your Environment

  • What Kubernetes distribution are you using?
$ kubectl version
Client Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.2", GitCommit:"092fbfbf53427de67cac1e9fa54aaa09a28371d7", GitTreeState:"clean", BuildDate:"2021-06-16T12:59:11Z", GoVersion:"go1.16.5", Compiler:"gc", Platform:"linux/amd64"}
  • Operating System and version (e.g. Linux, Windows, MacOS):
$ uname -a
Linux io-xps 5.13.0-21-generic #21-Ubuntu SMP Tue Oct 19 08:59:28 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

$ cat /etc/os-release
PRETTY_NAME="Ubuntu 21.10"
NAME="Ubuntu"
VERSION_ID="21.10"
VERSION="21.10 (Impish Indri)"
VERSION_CODENAME=impish
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=impish
  • What arkade version is this?
$ arkade version
            _             _      
  __ _ _ __| | ____ _  __| | ___ 
 / _` | '__| |/ / _` |/ _` |/ _ \
| (_| | |  |   < (_| | (_| |  __/
 \__,_|_|  |_|\_\__,_|\__,_|\___|

Get Kubernetes apps the easy way

Version: 0.8.8
Git Commit: 10f4f5e0b2f5012b85a7a2b4b45a0aecdb4d8ea6

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions