Drone

DRONE_POLICY_FILE annotations don't seem to work

after learning about policies (Global podAnnotations for runner pods),
we’re using this configmap as drone policy:

apiVersion: v1
kind: ConfigMap
metadata:
  name: drone-cfg
  namespace: {{ drone_runner_target_namespace }}
data:
  runner-policies.yaml: |
    # https://github.com/drone-runners/drone-runner-kube/pull/18#issuecomment-637674508
    ---
    kind: policy
    name: default

    metadata:
      annotations:
        iam.amazonaws.com/role: drone-runner-prod

    node_selector:
      company.com/instancegroup-set: build-runner
    
    tolerations:
    - key: node-purpose
      operator: Equal
      value: build
      effect: NoSchedule

node selector and tolerations work perfectly, builds are spun up on dedicated nodes which is awesome. However, the configured annotations are not applied onto the build pods. Could this be a bug?

I took a look at the source and it looks like annotations are being appended:

I don’t have time to deep dive on this right now, but perhaps you can take a look at the code and see if you notice anything? Also remember that you need to restart the runner if you make changes to the policy file.

I can test a policy including labels to see how that works. I’m not familiar enough with the codebase (or Golang) to understand how the annotation merging happens, and what happens to the annotations struct afterwards.

I found the problem and pushed an update, which is available in the latest docker image.

awesome, thanks! I’ll verify right away.

yup, confirmed. Thanks for fixing!!