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

support passing raw toml config for tiflash #3355

Merged
merged 9 commits into from Oct 14, 2020

Conversation

july2993
Copy link
Contributor

@july2993 july2993 commented Oct 12, 2020

What problem does this PR solve?

support passing raw toml config for tiflash

follow up #3327

What is changed and how does it work?

origin way to set config:

    tiflash:
      baseImage: pingcap/tiflash
      maxFailoverCount: 3
      replicas: 1
      storageClaims:
        - resources:
            requests:
              storage: 1Gi
--        # storageClassName: local-storage
      # requests:
      #   storage: "1Gi"
      config:
        config:
          logger:
            level: "warn"
            count: 9
        proxy:
          log-level: "warn"
          gc:
            batch-keys: 501

after this pr, support pass config like this:

    tiflash:
      baseImage: pingcap/tiflash
      maxFailoverCount: 3
      replicas: 1
      storageClaims:
        - resources:
            requests:
              storage: 1Gi
--        # storageClassName: local-storage
      # requests:
      #   storage: "1Gi"
      config:
        config: |
          [logger]
            level = "warn"
            count = 9
        proxy: |
          log-level = "warn"
          [gc]
            batch-keys = 501

Check List

Tests

  • Unit test
  • Manual test (add detailed scripts or steps below)

Deploy cluster using the flowing yaml(one use raw, one use origin way),
Check pos normal and config in configmaps as expect

tidb-cluster.yaml CLICK ME

apiVersion: pingcap.com/v1alpha1
kind: TidbCluster
metadata:
  name: basic
spec:
  version: v4.0.6
  timezone: UTC
  pvReclaimPolicy: Delete
  discovery: {}
  configUpdateStrategy: RollingUpdate
  pd:
    baseImage: pingcap/pd
    replicas: 1
    # if storageClassName is not set, the default Storage Class of the Kubernetes cluster will be used
    # storageClassName: local-storage
    requests:
      storage: "1Gi"
    config: |
      [schedule]
        max-merge-region-keys = 22222
        max-merge-region-size = 22
  tikv:
    baseImage: pingcap/tikv
    replicas: 1
    # if storageClassName is not set, the default Storage Class of the Kubernetes cluster will be used
    # storageClassName: local-storage
    requests:
      storage: "1Gi"
    config: |
      [storage]
        # In basic examples, we set this to avoid using too much storage.
        reserve-space = "2MB"
  tidb:
    baseImage: pingcap/tidb
    replicas: 1
    service:
      type: ClusterIP
    config:
      token-limit: 203
      max-server-connections: 51
  pump:
    baseImage: pingcap/tidb-binlog
    replicas: 1
    # storageClassName: local-storage
    requests:
      storage: 20Gi
    # schedulerName: default-scheduler
    # config:
    #   gc: 7
    #   storage:
    #     kv:
    #       compaction-total-size-multiplier: 8.0
    config: |
      gc = 6
      [storage]
        [storage.kv]
          compaction-total-size-multiplier = 8.0


  tiflash:
    baseImage: pingcap/tiflash
    maxFailoverCount: 3
    replicas: 1
    storageClaims:
      - resources:
          requests:
            storage: 1Gi
        # storageClassName: local-storage
    # requests:
    #   storage: "1Gi"
    config:
      config: |
        [logger]
          level = "warn"
          count = 9
      proxy: |
        log-level = "warn"
        [gc]
          batch-keys = 501

tidb-cluster-ym.yamlCLICK ME

apiVersion: pingcap.com/v1alpha1
kind: TidbCluster
metadata:
  name: basic-ym
spec:
  version: v4.0.6
  timezone: UTC
  pvReclaimPolicy: Delete
  discovery: {}
  configUpdateStrategy: RollingUpdate
  pd:
    baseImage: pingcap/pd
    replicas: 1
    # if storageClassName is not set, the default Storage Class of the Kubernetes cluster will be used
    # storageClassName: local-storage
    requests:
      storage: "1Gi"
    config:
      schedule:
        max-merge-region-keys: 22222
        max-merge-region-size: 22
  tikv:
    baseImage: pingcap/tikv
    replicas: 1
    # if storageClassName is not set, the default Storage Class of the Kubernetes cluster will be used
    # storageClassName: local-storage
    requests:
      storage: "1Gi"
    config:
      storage:
        # In basic examples, we set this to avoid using too much storage.
        reserve-space: "2MB"
  tidb:
    baseImage: pingcap/tidb
    replicas: 1
    service:
      type: ClusterIP
    config:
      token-limit: 203
      max-server-connections: 51
  pump:
    baseImage: pingcap/tidb-binlog
    replicas: 1
    # storageClassName: local-storage
    requests:
      storage: 20Gi
    # schedulerName: default-scheduler
    config:
      gc: 6

  tiflash:
    baseImage: pingcap/tiflash
    maxFailoverCount: 3
    replicas: 1
    storageClaims:
      - resources:
          requests:
            storage: 1Gi
        # storageClassName: local-storage
    # requests:
    #   storage: "1Gi"
    config:
      config:
        logger:
          level: "warn"
          count: 9
      proxy:
        log-level: "warn"
        gc:
          batch-keys: 501

Related changes

  • Need to cherry-pick to the release branch
  • Need to update the documentation

Does this PR introduce a user-facing change?:

support passing raw toml config for tiflash

@codecov-io
Copy link

codecov-io commented Oct 12, 2020

Codecov Report

Merging #3355 into master will decrease coverage by 0.38%.
The diff coverage is 66.66%.

@@            Coverage Diff             @@
##           master    #3355      +/-   ##
==========================================
- Coverage   50.28%   49.90%   -0.39%     
==========================================
  Files         163      163              
  Lines       16517    16408     -109     
==========================================
- Hits         8306     8188     -118     
+ Misses       7411     7410       -1     
- Partials      800      810      +10     
Flag Coverage Δ
#unittest 49.90% <66.66%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.


for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
setTiFlashConfigDefault(&test.config, "", "test", "test")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note the previous code for custom config case
config and expect both setted as customTiFlashLogConfig
and no deep copy(CommonConfing and ProxyConfig is the same object for config and expect)

so config will always equal expect after calling this.

@july2993 july2993 force-pushed the toml_config_flash branch 2 times, most recently from 73b672d to 26eca0a Compare October 12, 2020 08:02
@july2993 july2993 marked this pull request as ready for review October 12, 2020 08:02
@july2993 july2993 added the status/PTAL PR needs to be reviewed label Oct 12, 2020
DanielZhangQD
DanielZhangQD previously approved these changes Oct 12, 2020
Copy link
Contributor

@DanielZhangQD DanielZhangQD left a comment

Choose a reason for hiding this comment

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

LGTM

@july2993
Copy link
Contributor Author

@DanielZhangQD @lonng PTAL
recheck&test and align code about update configmap in dff61e7

Copy link
Contributor

@DanielZhangQD DanielZhangQD left a comment

Choose a reason for hiding this comment

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

LGTM

@july2993
Copy link
Contributor Author

@lonng PTAL

Copy link
Contributor

@lonng lonng left a comment

Choose a reason for hiding this comment

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

LGTM

@lonng
Copy link
Contributor

lonng commented Oct 13, 2020

/merge

@ti-srebot
Copy link
Contributor

@lonng Oops! This PR requires at least 2 LGTMs to merge. The current number of LGTM is 1

@lonng
Copy link
Contributor

lonng commented Oct 14, 2020

/test pull-e2e-kind

1 similar comment
@DanielZhangQD
Copy link
Contributor

/test pull-e2e-kind

@july2993 july2993 merged commit 6aa94f7 into pingcap:master Oct 14, 2020
@july2993 july2993 deleted the toml_config_flash branch October 14, 2020 02:41
ti-srebot pushed a commit to ti-srebot/tidb-operator that referenced this pull request Oct 14, 2020
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor

cherry pick to release-1.1 in PR #3368

july2993 added a commit to ti-srebot/tidb-operator that referenced this pull request Oct 14, 2020
follow up pingcap#3327

origin way to set config:
```yaml
    tiflash:
      baseImage: pingcap/tiflash
      maxFailoverCount: 3
      replicas: 1
      storageClaims:
        - resources:
            requests:
              storage: 1Gi
--        # storageClassName: local-storage
      # requests:
      #   storage: "1Gi"
      config:
        config:
          logger:
            level: "warn"
            count: 9
        proxy:
          log-level: "warn"
          gc:
            batch-keys: 501
```
after this pr, support pass config like this:
```yaml
    tiflash:
      baseImage: pingcap/tiflash
      maxFailoverCount: 3
      replicas: 1
      storageClaims:
        - resources:
            requests:
              storage: 1Gi
--        # storageClassName: local-storage
      # requests:
      #   storage: "1Gi"
      config:
        config: |
          [logger]
            level = "warn"
            count = 9
        proxy: |
          log-level = "warn"
          [gc]
            batch-keys = 501
```
DanielZhangQD added a commit that referenced this pull request Oct 14, 2020
support passing raw toml config for tiflash

Co-authored-by: july2993 <july2993@gmail.com>
Co-authored-by: DanielZhangQD <36026334+DanielZhangQD@users.noreply.github.com>
cvvz pushed a commit to cvvz/tidb-operator that referenced this pull request Oct 18, 2020
follow up pingcap#3327

origin way to set config:
```yaml
    tiflash:
      baseImage: pingcap/tiflash
      maxFailoverCount: 3
      replicas: 1
      storageClaims:
        - resources:
            requests:
              storage: 1Gi
--        # storageClassName: local-storage
      # requests:
      #   storage: "1Gi"
      config:
        config:
          logger:
            level: "warn"
            count: 9
        proxy:
          log-level: "warn"
          gc:
            batch-keys: 501
```
after this pr, support pass config like this:
```yaml
    tiflash:
      baseImage: pingcap/tiflash
      maxFailoverCount: 3
      replicas: 1
      storageClaims:
        - resources:
            requests:
              storage: 1Gi
--        # storageClassName: local-storage
      # requests:
      #   storage: "1Gi"
      config:
        config: |
          [logger]
            level = "warn"
            count = 9
        proxy: |
          log-level = "warn"
          [gc]
            batch-keys = 501
```
howardlau1999 pushed a commit to howardlau1999/tidb-operator that referenced this pull request Oct 20, 2020
follow up pingcap#3327

origin way to set config:
```yaml
    tiflash:
      baseImage: pingcap/tiflash
      maxFailoverCount: 3
      replicas: 1
      storageClaims:
        - resources:
            requests:
              storage: 1Gi
--        # storageClassName: local-storage
      # requests:
      #   storage: "1Gi"
      config:
        config:
          logger:
            level: "warn"
            count: 9
        proxy:
          log-level: "warn"
          gc:
            batch-keys: 501
```
after this pr, support pass config like this:
```yaml
    tiflash:
      baseImage: pingcap/tiflash
      maxFailoverCount: 3
      replicas: 1
      storageClaims:
        - resources:
            requests:
              storage: 1Gi
--        # storageClassName: local-storage
      # requests:
      #   storage: "1Gi"
      config:
        config: |
          [logger]
            level = "warn"
            count = 9
        proxy: |
          log-level = "warn"
          [gc]
            batch-keys = 501
```
howardlau1999 pushed a commit to howardlau1999/tidb-operator that referenced this pull request Oct 20, 2020
follow up pingcap#3327

origin way to set config:
```yaml
    tiflash:
      baseImage: pingcap/tiflash
      maxFailoverCount: 3
      replicas: 1
      storageClaims:
        - resources:
            requests:
              storage: 1Gi
--        # storageClassName: local-storage
      # requests:
      #   storage: "1Gi"
      config:
        config:
          logger:
            level: "warn"
            count: 9
        proxy:
          log-level: "warn"
          gc:
            batch-keys: 501
```
after this pr, support pass config like this:
```yaml
    tiflash:
      baseImage: pingcap/tiflash
      maxFailoverCount: 3
      replicas: 1
      storageClaims:
        - resources:
            requests:
              storage: 1Gi
--        # storageClassName: local-storage
      # requests:
      #   storage: "1Gi"
      config:
        config: |
          [logger]
            level = "warn"
            count = 9
        proxy: |
          log-level = "warn"
          [gc]
            batch-keys = 501
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants