elastic / cloud-on-k8s

Elastic Cloud on Kubernetes
Other
2.57k stars 697 forks source link

Creation of StackConfigPolicy - Cluster Settings #6696

Open knechtionscoding opened 1 year ago

knechtionscoding commented 1 year ago

Bug Report

What did you do?

Tried to configure cluster settings via a StackConfigPolicy:

apiVersion: stackconfigpolicy.k8s.elastic.co/v1alpha1
kind: StackConfigPolicy
metadata:
  name: test
spec:
  elasticsearch:
    clusterSettings:
      persistent:
        cluster:
          routing:
            rebalance:
              enable: all
            allocation:
              enable: all
        xpack:
          monitoring:
            collection:
              enabled: 'true'

you'll get:

        message: >-
          Error processing cluster_settings state change:
          java.lang.IllegalArgumentException: persistent setting
          [persistent.xpack.monitoring.collection.enabled], not recognized

And if you try any transient settings:

apiVersion: stackconfigpolicy.k8s.elastic.co/v1alpha1
kind: StackConfigPolicy
metadata:
  name: test
spec:
  elasticsearch:
    clusterSettings:
      transient:
        cluster:
          routing:
            allocation:
              node_concurrent_recoveries: '8'

you'll see:

        message: >-
          Error processing cluster_settings state change:
          java.lang.IllegalArgumentException: persistent setting
          [transient.cluster.routing.allocation.node_concurrent_recoveries], not
          recognized

Possibly related to #6495 and #6694

What did you expect to see?

Cluster settings configured

What did you see instead? Under which circumstances?

Errors:

        message: >-
          Error processing cluster_settings state change:
          java.lang.IllegalArgumentException: persistent setting
          [persistent.xpack.monitoring.collection.enabled], not recognized

and

        message: >-
          Error processing cluster_settings state change:
          java.lang.IllegalArgumentException: persistent setting
          [transient.cluster.routing.allocation.node_concurrent_recoveries], not
          recognized

Environment

thbkrkr commented 1 year ago

When you configure cluster settings through a StackConfigPolicy, you are declaring persistent settings, so persistent or transient fields don't make sense in this context.

apiVersion: stackconfigpolicy.k8s.elastic.co/v1alpha1
kind: StackConfigPolicy
metadata:
  name: test
spec:
  elasticsearch:
    clusterSettings:
      cluster.routing.rebalance.enable: all
      cluster.routing.allocation.enable: all
      cluster.routing.allocation.node_concurrent_recoveries: '8'
      xpack.monitoring.collection.enabled: 'true'

Note that you can choose between the indentation notation (in your example) or the dot notation (in the example above).

I will try to improve the documentation.

knechtionscoding commented 1 year ago

Ah, makes sense. Confirmed that works