How can I set the "Enabled" property to false on a plugin in Kubernetes?

I’m trying to add a plugin to Kong in Kubernetes.

I want my plugin configuration to always be part of my yaml file. But the file will be tokenized so that I can set a variable at deployment time to decide whether the plugin will be enabled .

It would look like this.
Except in this case the Enabled label makes no difference. Is there any way to achieve this?

kind: KongPlugin
  name: global-prometheus
    global: "true"
    enabled: ${Some_tokenized_value_replaced_at_deployment_time}
  namespace: kong
  annotations: XXXXXX
plugin: prometheus

I have tried this, but setting disabled to true didn’t seem to disable my plugin:

kind: KongPlugin
  name: global-prometheus
    global: "true"
  namespace: kong
  annotations: XXXXXX
plugin: prometheus
disabled: ${Some_tokenized_value_replaced_at_deployment_time}

Can you share the complete KongPlugin after it was rendered (what you get from kubectl get kongplugin global-prometheus) for us to try and replicate? Setting disabled in the KongPlugin manifest should control the disabled setting on the plugin within Kong.

NAME                PLUGIN-TYPE   AGE
global-prometheus   prometheus    3h59m

Describe command returns this:

Name:         global-prometheus
Namespace:    kong
Labels:       global=true
API Version:
Disabled:     true
Kind:         KongPlugin
  Creation Timestamp:  2020-05-14T14:23:08Z
  Generation:          9
  Resource Version:    37235502
  Self Link:           /apis/
  UID:                 1ad6cf5b-012f-409e-9a94-a254cc962f1c
Plugin:                prometheus

The log of the kong ingress-controller shows:
I0514 18:32:52.251742 1 kong.go:71] successfully synced configuration to Kong

After that, I navigate to the Kong metrics URL generated by the plugin and it shows the list of available metrics.
I would expect it to not return nothing.

Sorry, should have been kubectl get kongplugin global-prometheus -o yaml. That said, I think this is normal–disabling the plugin ignores it during request processing, but doesn’t disable any admin API endpoints it provides–those exist even if there are no instances of the plugin configured at all. You’ll still see the metrics endpoint, but it won’t start providing actual request data until the plugin is enabled.

Thanks for the reply.
I have tried disabling the plugin with “disabled: true”.
I can confirm it was taken into account when check with kublectl.

However, I’m still receiving new metrics on Prometheus.

Actually after more testing I see that when disabled=true, I’m still receiving metrics bit they are at 0.
Whereas when disabled=false, I’m receiving the actual metrics.

It`s very confusing to still be receiving metrics when the plugin is supposed to be disabled.

© 2019 Kong Inc.    Terms  •  Privacy  •  FAQ