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

Fix configMap key value template #110

Merged
merged 2 commits into from
Jan 4, 2022

Conversation

nuriel77
Copy link
Contributor

@nuriel77 nuriel77 commented Dec 23, 2021

Overview

In this commit, based on issue 103 I suggested to omit the toYaml and instead use key value iteration to produce the configMap configData.

This should solve the issue of duplicated keys in the configMap and also keep backward compatibility with values provided with two sets of double quotes.

@michaeljmarshall I wasn't sure if I have to bump the Chart's version or is that something your automation takes care of.

Tested Values

I have tested using helm template . while testing different ways of configuring the values for configData:

Option 1:

zookeeper:
  configData:
    PULSAR_MEM: >
      -Xms1g
      -Xmx1g
      -Dcom.sun.management.jmxremote
      -Djute.maxbuffer=10485760
    PULSAR_GC: >
      -XX:+UseG1GC
    PULSAR_LOG_LEVEL: "info"
    PULSAR_LOG_ROOT_LEVEL: "info"
    PULSAR_EXTRA_OPTS: "-Dzookeeper.tcpKeepAlive=true -Dzookeeper.clientTcpKeepAlive=true -Dpulsar.log.root.level=info"

Option 2:

zookeeper:
  configData:
    PULSAR_MEM: "\"-Xms1g -Xmx1g -Dcom.sun.management.jmxremote -Djute.maxbuffer=10485760\""
    PULSAR_GC: "\"-XX:+UseG1GC\""
    PULSAR_LOG_LEVEL: "info"
    PULSAR_LOG_ROOT_LEVEL: "info"
    PULSAR_EXTRA_OPTS: "-Dzookeeper.tcpKeepAlive=true -Dzookeeper.clientTcpKeepAlive=true -Dpulsar.log.root.level=info"

Option 3 (should be the same for single-quotes):

zookeeper:
  configData:
    PULSAR_MEM: "-Xms1g -Xmx1g -Dcom.sun.management.jmxremote -Djute.maxbuffer=10485760"
    PULSAR_GC: "-XX:+UseG1GC"
    PULSAR_LOG_LEVEL: "info"
    PULSAR_LOG_ROOT_LEVEL: "info"
    PULSAR_EXTRA_OPTS: "-Dzookeeper.tcpKeepAlive=true -Dzookeeper.clientTcpKeepAlive=true -Dpulsar.log.root.level=info"

Option 4:

zookeeper:
  configData:
    PULSAR_MEM: -Xms1g -Xmx1g -Dcom.sun.management.jmxremote -Djute.maxbuffer=10485760
    PULSAR_GC: -XX:+UseG1GC
    PULSAR_LOG_LEVEL: "info"
    PULSAR_LOG_ROOT_LEVEL: "info"
    PULSAR_EXTRA_OPTS: "-Dzookeeper.tcpKeepAlive=true -Dzookeeper.clientTcpKeepAlive=true -Dpulsar.log.root.level=info"

Outputs

I have tested the output of the configMaps that could be produced by the chart:

pulsar-bastion:

apiVersion: v1
kind: ConfigMap
metadata:
  name: "pulsar-bastion"
  namespace: monitoring
  labels:
    app: pulsar
    chart: pulsar-2.0.10
    release: RELEASE-NAME
    heritage: Helm
    component: bastion
    cluster: pulsar
data:
  tlsTrustCertsFilePath: "/etc/ssl/certs/ca-certificates.crt"
  PULSAR_EXTRA_OPTS: "-Dpulsar.log.root.level=info"
  PULSAR_GC: "-XX:+UseG1GC"
  PULSAR_LOG_LEVEL: "info"
  PULSAR_LOG_ROOT_LEVEL: "info"
  PULSAR_MEM: "-XX:+ExitOnOutOfMemoryError"

pulsar-broker:

apiVersion: v1
kind: ConfigMap
metadata:
  name: "pulsar-broker"
  namespace: monitoring
  labels:
    app: pulsar
    chart: pulsar-2.0.10
    release: RELEASE-NAME
    heritage: Helm
    component: broker
    cluster: pulsar
data:
  zookeeperServers:
    pulsar-zookeeper-ca:2181
  configurationStoreServers:
    pulsar-zookeeper-ca:2181
  clusterName: pulsar
  allowAutoTopicCreationType: "non-partitioned"
  PULSAR_EXTRA_OPTS: "-Dpulsar.log.root.level=info"
  PULSAR_GC: "-XX:+UseG1GC"
  PULSAR_LOG_LEVEL: "info"
  PULSAR_LOG_ROOT_LEVEL: "info"
  PULSAR_MEM: "-Xms2g -Xmx2g -XX:MaxDirectMemorySize=2g -Dio.netty.leakDetectionLevel=disabled -Dio.netty.recycler.linkCapacity=1024 -XX:+ExitOnOutOfMemoryError"
  backlogQuotaDefaultRetentionPolicy: "producer_exception"
  brokerDeduplicationEnabled: "false"
  exposeConsumerLevelMetricsInPrometheus: "false"
  exposeTopicLevelMetricsInPrometheus: "true"

pulsar-brokerSts:

apiVersion: v1
kind: ConfigMap
metadata:
  name: "pulsar-brokersts"
  namespace: monitoring
  labels:
    app: pulsar
    chart: pulsar-2.0.10
    release: RELEASE-NAME
    heritage: Helm
    component: brokersts
    cluster: pulsar
data:
  zookeeperServers:
    pulsar-zookeeper-ca:2181
  configurationStoreServers:
    pulsar-zookeeper-ca:2181
  clusterName: pulsar
  allowAutoTopicCreationType: "non-partitioned"
  PULSAR_EXTRA_OPTS: "-Dpulsar.log.root.level=info"
  PULSAR_GC: "-XX:+UseG1GC"
  PULSAR_LOG_LEVEL: "info"
  PULSAR_LOG_ROOT_LEVEL: "info"
  PULSAR_MEM: "-Xms2g -Xmx2g -XX:MaxDirectMemorySize=2g -Dio.netty.leakDetectionLevel=disabled -Dio.netty.recycler.linkCapacity=1024 -XX:+ExitOnOutOfMemoryError"
  backlogQuotaDefaultRetentionPolicy: "producer_exception"
  brokerDeduplicationEnabled: "false"
  exposeConsumerLevelMetricsInPrometheus: "false"
  exposeTopicLevelMetricsInPrometheus: "true"

pulsar-function-extra:

apiVersion: v1
kind: ConfigMap
metadata:
  name: "pulsar-function-extra"
  namespace: monitoring
  labels:
    app: pulsar
    chart: pulsar-2.0.10
    release: RELEASE-NAME
    heritage: Helm
    component: function
    cluster: pulsar
data:
  PULSAR_EXTRA_OPTS: "-Dpulsar.log.root.level=info"
  PULSAR_GC: "-XX:+UseG1GC"
  PULSAR_LOG_LEVEL: "info"
  PULSAR_LOG_ROOT_LEVEL: "info"
  PULSAR_MEM: "-Xms2g -Xmx2g -XX:MaxDirectMemorySize=2g -XX:+ExitOnOutOfMemoryError"

pulsar-proxy:

apiVersion: v1
kind: ConfigMap
metadata:
  name: "pulsar-proxy"
  namespace: monitoring
  labels:
    app: pulsar
    chart: pulsar-2.0.10
    release: RELEASE-NAME
    heritage: Helm
    component: proxy
    cluster: pulsar
data:
  brokerServiceURL: "pulsar://pulsar-broker:6650"
  brokerServiceURLTLS: "pulsar+ssl://pulsar-broker:6651"
  brokerWebServiceURL: "http://pulsar-broker:8080"
  brokerWebServiceURLTLS: "https://pulsar-broker:8443"
  zookeeperServers:
    pulsar-zookeeper-ca:2181
  configurationStoreServers:
    pulsar-zookeeper-ca:2181
  PULSAR_EXTRA_OPTS: "-Dpulsar.log.root.level=info"
  PULSAR_GC: "-XX:+UseG1GC"
  PULSAR_LOG_LEVEL: "info"
  PULSAR_LOG_ROOT_LEVEL: "info"
  PULSAR_MEM: "-Xms1g -Xmx1g -XX:MaxDirectMemorySize=1g"
  numHttpServerThreads: "10"

pulsar-proxy-ws

apiVersion: v1
kind: ConfigMap
metadata:
  name: "pulsar-proxy-ws"
  namespace: monitoring
  labels:
    app: pulsar
    chart: pulsar-2.0.10
    release: RELEASE-NAME
    heritage: Helm
    component: proxy
    cluster: pulsar
data:
  brokerServiceUrl: "pulsar://pulsar-broker:6650"
  brokerServiceUrlTls: "pulsar+ssl://pulsar-broker:6651"
  serviceUrl: "http://pulsar-broker:8080"
  serviceUrlTls: "https://pulsar-broker:8443"
  zookeeperServers:
    "pulsar-zookeeper-ca:2181"
  configurationStoreServers:
    "pulsar-zookeeper-ca:2181"
  clusterName: pulsar
  webServicePort: "8000"
  PULSAR_EXTRA_OPTS: "-Dpulsar.log.root.level=info"
  PULSAR_GC: "-XX:+UseG1GC"
  PULSAR_LOG_LEVEL: "info"
  PULSAR_LOG_ROOT_LEVEL: "info"
  PULSAR_MEM: "-Xms1g -Xmx1g -XX:MaxDirectMemorySize=1g"
  numHttpServerThreads: "10"

pulsar-zookeepernp

apiVersion: v1
kind: ConfigMap
metadata:
  name: "pulsar-zookeepernp"
  namespace: monitoring
  labels:
    app: pulsar
    chart: pulsar-2.0.10
    release: RELEASE-NAME
    heritage: Helm
    component: zookeepernp
    cluster: pulsar
data:
  PULSAR_EXTRA_OPTS: "-Dzookeeper.tcpKeepAlive=true -Dzookeeper.clientTcpKeepAlive=true -Dpulsar.log.root.level=info"
  PULSAR_GC: "-XX:+UseG1GC"
  PULSAR_LOG_LEVEL: "info"
  PULSAR_LOG_ROOT_LEVEL: "info"
  PULSAR_MEM: "-Xms1g -Xmx1g -Dcom.sun.management.jmxremote -Djute.maxbuffer=10485760"

pulsar-zookeeper:

apiVersion: v1
kind: ConfigMap
metadata:
  name: "pulsar-zookeeper"
  namespace: monitoring
  labels:
    app: pulsar
    chart: pulsar-2.0.10
    release: RELEASE-NAME
    heritage: Helm
    component: zookeeper
    cluster: pulsar
data:
  PULSAR_EXTRA_OPTS: "-Dzookeeper.tcpKeepAlive=true -Dzookeeper.clientTcpKeepAlive=true -Dpulsar.log.root.level=info"
  PULSAR_GC: "-XX:+UseG1GC"
  PULSAR_LOG_LEVEL: "info"
  PULSAR_LOG_ROOT_LEVEL: "info"
  PULSAR_MEM: "-Xms1g -Xmx1g -Dcom.sun.management.jmxremote -Djute.maxbuffer=10485760"

Copy link
Member

@michaeljmarshall michaeljmarshall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nuriel77 - thank you for your contribution. I verified these changes locally on my machine, as well. The changes look good, except for one more place that needs to be updated. Can you also update this template too? Thanks.

{{ toYaml .Values.bookkeeper.configData | indent 2 }}
# Workaround for double-quoted values in old values files
BOOKIE_MEM: {{ .Values.bookkeeper.configData.BOOKIE_MEM }}
BOOKIE_GC: {{ .Values.bookkeeper.configData.BOOKIE_GC }}

@nuriel77
Copy link
Contributor Author

@michaeljmarshall you're right. I missed those because I only searched for PULSAR_(GC|MEM) :)
Fixed (found autorecovery as well)

@michaeljmarshall
Copy link
Member

@michaeljmarshall I wasn't sure if I have to bump the Chart's version or is that something your automation takes care of.

I'll take care of bumping the version.

@michaeljmarshall you're right. I missed those because I only searched for PULSAR_(GC|MEM) :) Fixed (found autorecovery as well)

Thanks for finding that other reference.

Copy link
Member

@michaeljmarshall michaeljmarshall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@michaeljmarshall
Copy link
Member

It looks like our Circle CI tests didn't run. I think that is likely because this is from a new fork of our helm chart. I'll need to look into this before we can merge the PR.

@michaeljmarshall
Copy link
Member

@nuriel77 - based on reading through this doc https://circleci.com/docs/2.0/oss/#build-pull-requests-from-forked-repositories, I am wondering if the following applies to your fork:

Note: If a user submits a pull request to your repository from a fork, but no pipeline is triggered, then the user most likely is following a project fork on their personal account rather than the project itself of CircleCi, causing the jobs to trigger under the user’s personal account and not the organization account. To resolve this issue, have the user unfollow their fork of the project on CircleCI and instead follow the source project. This will trigger their jobs to run under the organization when they submit pull requests.

We have Build forked pull requests set to true or enabled in our Circle CI account. If that's not the case, I'll need to keep debugging. Thanks!

@nuriel77
Copy link
Contributor Author

I am wondering if the following applies to your fork:

I guess it is. Never worked with CircleCI.

In any case, I don't think I could have pushed a PR directly to the repository, but only via a fork, right?

@michaeljmarshall
Copy link
Member

I guess it is. Never worked with CircleCI.

That's helpful. I assumed that the documentation meant something specific for CircleCI. Since you've never worked with it before, maybe this line (then the user most likely is following a project fork on their personal account rather than the project itself of CircleCi) means something GitHub specific.

In any case, I don't think I could have pushed a PR directly to the repository, but only via a fork, right?

That is correct. I have definitely seen tests run for PRs opened in forks, so it should work. I'll take a closer look in about 12 hours.

@michaeljmarshall
Copy link
Member

I am going to close and reopen this PR to see if it triggers the CI. It's possible that my initial "Request Changes" prevented CI from running.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Key duplication in configMaps causing errors on some deployment tools
3 participants