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

controller: add support for global persistent configuration #364

Merged
merged 1 commit into from
Jun 12, 2023

Conversation

Rakshith-R
Copy link
Member

@Rakshith-R Rakshith-R commented Jun 7, 2023

This commits adds support for configuration options consumed through a optional configmap. This will enable users to create a configmap to supply options that are persisted throughout upgrades.
Current support parameters are "reclaim-space-timeout" and "max-concurrent-reconciles".

Closes: #347

@Rakshith-R Rakshith-R requested review from nixpanic and Madhu-1 June 7, 2023 10:16
@mergify mergify bot requested a review from yati1998 June 7, 2023 10:16
@Rakshith-R Rakshith-R force-pushed the global-persistent-config branch from 9cc7642 to 926b09b Compare June 7, 2023 10:23
@@ -49,6 +50,7 @@ var (

const (
defaultTimeout = time.Minute * 3
configFile = "/run/config/csi-addons-config.json"
Copy link
Collaborator

Choose a reason for hiding this comment

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

why use a file, and not the Kubernetes API to access the ConfigMap directly? Users can then place keys directly in the ConfigMap, and do not need to worry about weird indirect json syntax.

@Rakshith-R Rakshith-R force-pushed the global-persistent-config branch 3 times, most recently from a64b409 to 0f3737f Compare June 9, 2023 07:09
@Rakshith-R Rakshith-R requested a review from nixpanic June 9, 2023 07:12
@Rakshith-R Rakshith-R force-pushed the global-persistent-config branch from 0f3737f to 6348d42 Compare June 9, 2023 07:12
Copy link
Collaborator

@nixpanic nixpanic left a comment

Choose a reason for hiding this comment

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

lgtm, a little more cleaning up is possible now. It would be nice to have a single place to configure default values.

docs/csi-addons-config.md Show resolved Hide resolved
cmd/manager/main.go Outdated Show resolved Hide resolved
@Rakshith-R Rakshith-R force-pushed the global-persistent-config branch from 6348d42 to 9bf0fcf Compare June 9, 2023 09:47
@Rakshith-R Rakshith-R requested a review from nixpanic June 9, 2023 09:50
nixpanic
nixpanic previously approved these changes Jun 9, 2023
@@ -39,6 +39,8 @@ import (
controllers "github.com/csi-addons/kubernetes-csi-addons/controllers/csiaddons"
replicationController "github.com/csi-addons/kubernetes-csi-addons/controllers/replication.storage"
"github.com/csi-addons/kubernetes-csi-addons/internal/connection"
"github.com/csi-addons/kubernetes-csi-addons/internal/util"
"k8s.io/client-go/kubernetes"
Copy link
Member

Choose a reason for hiding this comment

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

add a new line

Comment on lines 8 to 9
"reclaim-space-timeout": "5m"
"max-concurrent-reconciles": "50"
Copy link
Member

Choose a reason for hiding this comment

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

match the values for what we have in default , if the user just creates this configmap should not have any impact unless he/she modifies the values

| `reclaim-space-timeout` | `"3m"` | Timeout for reclaimspace operation |
| `max-concurrent-reconciles` | `"100"` | Maximum number of concurrent reconciles |

## Example
Copy link
Member

Choose a reason for hiding this comment

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

let's not duplicate the configmap here as it adds a burden to maintain at 2 places, just add a reference to the configmap here.

Comment on lines 66 to 67
cm, err := kubeClient.CoreV1().ConfigMaps(cfg.Namespace).
Get(context.Background(), csiAddonsConfigMapName, metav1.GetOptions{})
Copy link
Member

Choose a reason for hiding this comment

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

Instead of creating a new context here, create one context in the main and use it.

@Rakshith-R Rakshith-R force-pushed the global-persistent-config branch from 9bf0fcf to 1e9e762 Compare June 12, 2023 09:20
@mergify mergify bot dismissed nixpanic’s stale review June 12, 2023 09:20

Pull request has been modified.

@Rakshith-R Rakshith-R requested review from nixpanic and Madhu-1 June 12, 2023 09:21
@Rakshith-R
Copy link
Member Author

@Mergifyio rebase

This commits adds support for configuration options consumed
through a optional configmap.
This will enable users to create a configmap to supply options
that are persisted throughout upgrades.
Current support parameters are `"reclaim-space-timeout"`
and `"max-concurrent-reconciles"`.

Signed-off-by: Rakshith R <[email protected]>
@mergify
Copy link

mergify bot commented Jun 12, 2023

rebase

✅ Branch has been successfully rebased

@Rakshith-R Rakshith-R force-pushed the global-persistent-config branch from 1e9e762 to fcaf757 Compare June 12, 2023 09:36
@@ -31,6 +31,7 @@ spec:
memory: 64Mi
- name: manager
args:
- "--namespace=$(POD_NAMESPACE)"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the env section is missing here?

Copy link
Member Author

@Rakshith-R Rakshith-R Jun 12, 2023

Choose a reason for hiding this comment

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

I think the env section is missing here?

its added above in manager.yaml . https://github.com/csi-addons/kubernetes-csi-addons/pull/364/files/fcaf7571fe7ee850410e6f2da6fb853daa0a023f#diff-ce0d597a9e5f20a8fe61c3ba5e6185a6b90cfef2c00bb5b5ef3e97b15b79f480

This yaml patches & overrides the manager container args, so I added the namespace arg here.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah, right!

@Rakshith-R Rakshith-R requested a review from nixpanic June 12, 2023 10:22
@@ -31,6 +31,7 @@ spec:
memory: 64Mi
- name: manager
args:
- "--namespace=$(POD_NAMESPACE)"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah, right!

@mergify mergify bot merged commit c927efa into csi-addons:main Jun 12, 2023
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.

Add support for CSI-Addons-config cm for persistent settings
3 participants