Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kuma injector overrides annotation configuration with default values #4458

Closed
rejmond opened this issue Jun 10, 2022 · 3 comments · Fixed by #4660
Closed

Kuma injector overrides annotation configuration with default values #4458

rejmond opened this issue Jun 10, 2022 · 3 comments · Fixed by #4660
Assignees
Labels
kind/bug A bug triage/accepted The issue was reviewed and is complete enough to start working on it

Comments

@rejmond
Copy link

rejmond commented Jun 10, 2022

What happened?

I am trying to configure a pod with annotations, using this documentation.
The Kuma injector don't apply them and use default configuration.

How to reproduce?

I use Kind cluster for development.

Create a cluster.

cat > cluster-config.yaml <<EOF
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
 - role: control-plane
 - role: worker
EOF

kind create cluster --config ./cluster-config.yaml

Install Kuma control plane.

kumactl install control-plane | kubectl apply -f -

Create Kuma meshed pod.

cat > pod.yaml <<EOF
apiVersion: v1
kind: Pod
metadata:
  name: hello-world
  labels:
    kuma.io/sidecar-injection: enabled
  annotations:
    kuma.io/builtindns: enabled
    kuma.io/builtindnsport: "15058"
spec:
  restartPolicy: Never
  containers:
    - name: hello-world
      image: strm/helloworld-http
      imagePullPolicy: IfNotPresent
      stdin: true
      tty: true
EOF

kubectl apply -f pod.yaml

Check pod annotations.

kubectl describe pod hello-world

Expected output:

Name:         hello-world
Namespace:    default
Priority:     0
Node:         kind-worker/172.18.0.3
Start Time:   Fri, 10 Jun 2022 14:41:35 +0700
Labels:       kuma.io/sidecar-injection=enabled
Annotations:  kuma.io/builtindns: enabled
              kuma.io/builtindnsport: 15058
              ...

Real output:

Name:         hello-world
Namespace:    default
Priority:     0
Node:         kind-worker/172.18.0.3
Start Time:   Fri, 10 Jun 2022 14:41:35 +0700
Labels:       kuma.io/sidecar-injection=enabled
Annotations:  kuma.io/builtindns: enabled
              kuma.io/builtindnsport: 15053
              ...

Pod annotation kuma.io/builtindnsport has a default value 15053, not 15058 as I set in pod's configuration.

Kuma version
Kuma: 1.6.0

Kuma configuration
Default configuration file without changes.

kuma-cp.conf.txt

@rejmond rejmond added kind/bug A bug triage/pending This issue will be looked at on the next triage meeting labels Jun 10, 2022
@lahabana lahabana added triage/accepted The issue was reviewed and is complete enough to start working on it and removed triage/pending This issue will be looked at on the next triage meeting labels Jun 13, 2022
@github-actions github-actions bot added the triage/stale Inactive for some time. It will be triaged again label Jul 14, 2022
@github-actions
Copy link
Contributor

This issue was inactive for 30 days it will be reviewed in the next triage meeting and might be closed.
If you think this issue is still relevant please comment on it promptly or attend the next triage meeting.

@tharun208
Copy link
Contributor

@lahabana I tested it with the master and injector is able to override the default values with the user specified one..

@lahabana
Copy link
Contributor

I've just tried and I see @rejmond 's problem on master (the port doesn't take the annotation):

➜  kuma git:(master) ✗ kubectl describe pod hello-world | grep kuma.io
Labels:       kuma.io/sidecar-injection=enabled
Annotations:  kuma.io/builtindns: enabled
              kuma.io/builtindnsport: 15053
              kuma.io/envoy-admin-port: 9901
              kuma.io/mesh: default
              kuma.io/sidecar-injected: true
              kuma.io/sidecar-uid: 5678
              kuma.io/transparent-proxying: enabled
              kuma.io/transparent-proxying-inbound-port: 15006
              kuma.io/transparent-proxying-inbound-v6-port: 15010
              kuma.io/transparent-proxying-outbound-port: 15001
              kuma.io/virtual-probes: enabled
              kuma.io/virtual-probes-port: 9000
  Normal  CreatedKumaDataplane  97s                k8s.kuma.io/dataplane-generator  Created Kuma Dataplane: hello-world
  Normal  UpdatedKumaDataplane  67s (x4 over 97s)  k8s.kuma.io/dataplane-generator  Updated Kuma Dataplane: hello-world

@lahabana lahabana removed the triage/stale Inactive for some time. It will be triaged again label Jul 18, 2022
lahabana added a commit to lahabana/kuma that referenced this issue Jul 22, 2022
- Make override of the port work
- Fix from `kuma.io/builtindnsport` to `kuma.io/builtin-dns-port`
- Fix from `kuma.io/builtindns` to `kuma.io/builtin-dns`
- Rewrite `annotations.go` to make it easier to use defaults
- Provide a standard way to mark pod annotations as deprecated and to log about them

Fix kumahq#4458
Fix kumahq#2347

Signed-off-by: Charly Molter <charly.molter@konghq.com>
@lahabana lahabana self-assigned this Jul 25, 2022
lahabana added a commit that referenced this issue Jul 26, 2022
- Make override of the port work
- Fix from `kuma.io/builtindnsport` to `kuma.io/builtin-dns-port`
- Fix from `kuma.io/builtindns` to `kuma.io/builtin-dns`
- Rewrite `annotations.go` to make it easier to use defaults
- Provide a standard way to mark pod annotations as deprecated and to log about them

Fix #4458
Fix #2347

Signed-off-by: Charly Molter <charly.molter@konghq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug A bug triage/accepted The issue was reviewed and is complete enough to start working on it
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants