actions-runner-controller icon indicating copy to clipboard operation
actions-runner-controller copied to clipboard

ERROR: ```flag provided but not defined: -log-format``` when deploying with Helm Chart

Open a-a-ron-stone opened this issue 3 years ago • 8 comments

Checks

  • [X] I've already read https://github.com/actions/actions-runner-controller/blob/master/TROUBLESHOOTING.md and I'm sure my issue is not covered in the troubleshooting guide.
  • [X] I'm not using a custom entrypoint in my runner image

Controller Version

0.26.0

Helm Chart Version

0.21.1

CertManager Version

1.10.1

Deployment Method

Helm

cert-manager installation

we used Bitnami charts to install cert-manager

Checks

  • [X] This isn't a question or user support case (For Q&A and community support, go to Discussions. It might also be a good idea to contract with any of contributors and maintainers if your business is so critical and therefore you need priority support
  • [X] I've read releasenotes before submitting this issue and I'm sure it's not due to any recently-introduced backward-incompatible changes
  • [X] My actions-runner-controller version (v0.x.y) does support the feature
  • [X] I've already upgraded ARC (including the CRDs, see charts/actions-runner-controller/docs/UPGRADING.md for details) to the latest and it didn't fix the issue
  • [X] I've migrated to the workflow job webhook event (if you using webhook driven scaling)

Resource Definitions

apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    deployment.kubernetes.io/revision: "1"
    meta.helm.sh/release-name: actions-runner-controller
    meta.helm.sh/release-namespace: platform
  creationTimestamp: "2023-01-06T16:16:05Z"
  generation: 1
  labels:
    app.kubernetes.io/instance: actions-runner-controller
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: actions-runner-controller
    app.kubernetes.io/version: 0.26.0
    helm.sh/chart: actions-runner-controller-0.21.2
  name: actions-runner-controller
  namespace: platform
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app.kubernetes.io/instance: actions-runner-controller
      app.kubernetes.io/name: actions-runner-controller
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      creationTimestamp: null
      labels:
        app.kubernetes.io/instance: actions-runner-controller
        app.kubernetes.io/name: actions-runner-controller
    spec:
      containers:
      - args:
        - --metrics-addr=127.0.0.1:8080
        - --enable-leader-election
        - --port=9443
        - --sync-period=1m
        - --default-scale-down-delay=10m
        - --docker-image=docker:dind
        - --runner-image=summerwind/actions-runner:latest
	- --log-format=text
        command:
        - /manager
        env:
        - name: GITHUB_TOKEN
          valueFrom:
            secretKeyRef:
              key: github_token
              name: controller-manager
              optional: true
        - name: GITHUB_APP_ID
          valueFrom:
            secretKeyRef:
              key: github_app_id
              name: controller-manager
              optional: true
        - name: GITHUB_APP_INSTALLATION_ID
          valueFrom:
            secretKeyRef:
              key: github_app_installation_id
              name: controller-manager
              optional: true
        - name: GITHUB_APP_PRIVATE_KEY
          valueFrom:
            secretKeyRef:
              key: github_app_private_key
              name: controller-manager
              optional: true
        - name: GITHUB_BASICAUTH_PASSWORD
          valueFrom:
            secretKeyRef:
              key: github_basicauth_password
              name: controller-manager
              optional: true
        image: summerwind/actions-runner-controller:v0.26.0
        imagePullPolicy: IfNotPresent
        name: manager
        ports:
        - containerPort: 9443
          name: webhook-server
          protocol: TCP
        resources: {}
        securityContext: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /etc/actions-runner-controller
          name: secret
          readOnly: true
        - mountPath: /tmp
          name: tmp
        - mountPath: /tmp/k8s-webhook-server/serving-certs
          name: cert
          readOnly: true
      - args:
        - --secure-listen-address=0.0.0.0:8443
        - --upstream=http://127.0.0.1:8080/
        - --logtostderr=true
        - --v=10
        image: quay.io/brancz/kube-rbac-proxy:v0.13.1
        imagePullPolicy: IfNotPresent
        name: kube-rbac-proxy
        ports:
        - containerPort: 8443
          name: metrics-port
          protocol: TCP
        resources: {}
        securityContext: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      serviceAccount: actions-runner-controller
      serviceAccountName: actions-runner-controller
      terminationGracePeriodSeconds: 10
      volumes:
      - name: secret
        secret:
          defaultMode: 420
          secretName: controller-manager
      - name: cert
        secret:
          defaultMode: 420
          secretName: actions-runner-controller-serving-cert
      - emptyDir: {}
        name: tmp

To Reproduce

1. Use the Helm chart to deploy default values with addition of .create and ```authSecret.github_token```

Describe the bug

When the container starts in K8s, it returns an error straight away with the below message image and the pod never successfully starts.

Describe the expected behavior

Expected the pod to successfully start up without error.

Whole Controller Logs

please refer to the image in "Describe the bug"

Whole Runner Pod Logs

N/A - not got to the runner deployment yet

Additional Context

As a workaround, we have removed logformat default value from values.yaml so the if condition doesnt apply the log-format args into the deployment. This successfully deploys the controller into K8s.

a-a-ron-stone avatar Jan 09 '23 11:01 a-a-ron-stone

Hello! Thank you for filing an issue.

The maintainers will triage your issue shortly.

In the meantime, please take a look at the troubleshooting guide for bug reports.

If this is a feature request, please review our contribution guidelines.

github-actions[bot] avatar Jan 09 '23 11:01 github-actions[bot]

I had the same problem and was not able to deploy this version (with helm/argocd). https://github.com/actions/actions-runner-controller/tree/v0.27.0

The new log-format var has a default value of 'text', so even though I didn't set this value initially, it still was set by default. Next I tried setting it to 'text' intentionally (in the values section of the helm/argo app).

Then I scanned the code, and saw this if statement:

charts/actions-runner-controller/templates/githubwebhook.deployment.yaml
        {{- if .Values.githubWebhookServer.logFormat  }}
        - "--log-format={{ .Values.githubWebhookServer.logFormat }}"
        {{- end }}

Next I set log-format to empty string in one test, and null in another test, and both worked to disable the flag, and I was able to deploy.

It seems perhaps a new var was introduced in this version, but not implemented.

as you can see in the following logs, its not an option.

kubectl -n ${ns} logs pod/...github-webhook-serv4zss9 -c github-webhook-server
flag provided but not defined: -log-format
Usage of /github-webhook-server:
  -github-app-id int
        The application ID of GitHub App.
  -github-app-installation-id int
        The installation ID of GitHub App.
  -github-app-private-key string
        The path of a private key file to authenticate as a GitHub App
  -github-basicauth-password string
        Password for GitHub basic auth to use instead of PAT or GitHub APP in case it's running behind a proxy API
  -github-basicauth-username string
        Username for GitHub basic auth to use instead of PAT or GitHub APP in case it's running behind a proxy API
  -github-token string
        The personal access token of GitHub.
  -github-upload-url string
        GitHub Upload URL to be used for GitHub API calls
  -github-url string
        GitHub URL to be used for GitHub API calls
  -github-webhook-secret-token string
        The personal access token of GitHub.
  -kubeconfig string
        Paths to a kubeconfig. Only required if out-of-cluster.
  -log-level string
        The verbosity of the logging. Valid values are "debug", "info", "warn", "error". Defaults to "debug". (default "debug")
  -metrics-addr string
        The address the metric endpoint binds to. (default ":8080")
  -queue-limit int
        The maximum length of the scale operation queue. The scale opration is enqueued per every matching webhook event, and the server returns a 500 HTTP status when the queue was already full on enqueue attempt. (default 100)
  -runner-github-url string
        GitHub URL to be used by runners during registration
  -watch-namespace string
        The namespace to watch for HorizontalRunnerAutoscaler's to scale on Webhook. Set to empty for letting it watch for all namespaces.
  -webhook-addr string
        The address the metric endpoint binds to. (default ":8000")

Argo app was deleted and created fresh, including deployments and CRDs, for the tests.

Hope this helps.

racker7 avatar Jan 18 '23 18:01 racker7

Hey @a-a-ron-stone! The log-format flag for the ARC's controller-manager is added via https://github.com/actions/actions-runner-controller/commit/fbdfe0df8cb0cdc65fa8cf846fc48a6e0ec1e449 and it's available since ARC v0.27.0. I presume the error happened to you because you (perhaps accidentally?) used a legacy ARC image with a newer chart. Could you upgrade your image to v0.27.0 or greater?

@racker7's issue seems to be about github-webhook-server which is a different command than the controller-manager you're seeing the issue with. I'll follow up on it shortly...

mumoshu avatar Apr 02 '23 23:04 mumoshu

Hey @racker7! Thanks for reporting. I just checked https://github.com/actions/actions-runner-controller/commit/fbdfe0df8cb0cdc65fa8cf846fc48a6e0ec1e449#diff-2fa1f5f187b67a02c2d17ea86330e7112f71aec54a37128f0f845e1e13f17a24 and I can definitely see the log-format flag is there... Could you give me the exact helm command or ArgoCD Application custom resource you used to install ARC v0.27.0? This shouldn't happen if you really installed v0.27.0 or greater.

mumoshu avatar Apr 02 '23 23:04 mumoshu

@mumoshu Thanks for checking in. I did not deploy this directly with helm but via ArgoCD app by pushing git updates. Another person had set it all up with Helm originally. Since we are still in testing phase, in order to make sure I had a clean slate, I deleted the CRDs, app, pods, etc and then created again. I could try to test again in the next couple weeks. I dont know how all the code works but I could guess the default image.pullPolicy IfNotPresent maybe didn't grab the latest image.

racker7 avatar Apr 04 '23 15:04 racker7

If it helps, this is my Application resource after removing the logFormat: null values:

project: ci-cd
source:
  repoURL: 'https://github.com/actions-runner-controller/actions-runner-controller.git'
  path: charts/actions-runner-controller
  targetRevision: v0.27.0
  helm:
    parameters:
      - name: authSecret.name
        value: auth
      - name: scope.singleNamespace
        value: 'true'
      - name: githubWebhookServer.enabled
        value: 'true'
      - name: githubWebhookServer.secret.name
        value: auth
      - name: metrics.serviceMonitor
        value: 'true'
      - name: resources.requests.memory
        value: 60Mi
      - name: resources.limits.memory
        value: 150Mi
      - name: githubWebhookServer.resources.requests.memory
        value: 65Mi
      - name: githubWebhookServer.resources.limits.memory
        value: 100Mi
    skipCrds: true
destination:
  server: 'https://kubernetes.default.svc'
  namespace: github-runner
syncPolicy:
  automated:
    prune: true
  syncOptions:
    - CreateNamespace=false
    - PrunePropagationPolicy=foreground
    - PruneLast=true
    - SkipDryRunOnMissingResource=false

This produces the error:

flag provided but not defined: -log-format

In both the github-runner-actions-runner-controller Deployment and the github-runner-actions-runner-controller-github-webhook-server Deployment.

shivjm avatar Apr 05 '23 07:04 shivjm

Sorry for delayed reply. Coming back to this I realize that this Argo spec:

apiVersion: argoproj.io/v1alpha1
kind: Application
spec:
  source:
    repoURL: https://github.com/actions/actions-runner-controller.git
    path: charts/actions-runner-controller
    targetRevision: v0.27.0
...

Results in this Webhook Deployment spec:

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app.kubernetes.io/instance: ghrunner-stg
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: actions-runner-controller
    app.kubernetes.io/version: 0.26.0
    argocd.argoproj.io/instance: ghrunner-stg
    helm.sh/chart: actions-runner-controller-0.21.1
...
spec:
  template:
    spec:
      containers:
        - command:
            - /github-webhook-server
          image: 'summerwind/actions-runner-controller:v0.26.0'
          imagePullPolicy: IfNotPresent
          name: github-webhook-server
...

perhaps the image 0.26.0 is not the image we want? I see newer versions are out, so I'll give that a try.

  • update: installed targetRevision: v0.27.4 which pulled app.kubernetes.io/version: 0.27.3 and the issue appears resolved. ty for your help.

racker7 avatar May 22 '23 17:05 racker7

any news ?

didlawowo avatar Dec 06 '24 13:12 didlawowo