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

external: create a configmap for the command line args #14354

Merged
merged 1 commit into from
Jun 25, 2024

Conversation

parth-gr
Copy link
Member

user can look back to there configurations by
looking at the configmap created with command
line arguments
This will be useful for them during upgrades when they need to re run the python script with the same flags

Checklist:

  • Commit Message Formatting: Commit titles and messages follow guidelines in the developer guide.
  • Reviewed the developer guide on Submitting a Pull Request
  • Pending release notes updated with breaking and/or notable changes for the next minor release.
  • Documentation has been updated, if necessary.
  • Unit tests have been added, if necessary.
  • Integration tests have been added, if necessary.

@BlaineEXE BlaineEXE marked this pull request as draft June 18, 2024 15:52
@parth-gr
Copy link
Member Author

parth-gr commented Jun 19, 2024

I have only added the arguments that has some value

[{"name": "external-cluster-user-command", "kind": "ConfigMap", "data": {"data": ["verbose: False", "ceph-conf: None", "keyring: None", "rgw-pool-prefix: default", "restricted-auth-permission: False", "v2-port-enable: False", "format: json", "cephfs-filesystem-name: myfs", "cephfs-metadata-pool-name: myfs-metadata", "cephfs-data-pool-name: myfs-replicated", "rbd-data-pool-name: replicapool", "rgw-skip-tls: False", "skip-monitoring-endpoint: False", "dry-run: False", "upgrade: False"]}}, {"name": "rook-ceph-mon-endpoints", "kind": "ConfigMap", "data": {"data": "a=10.97.22.211:6789", "maxMonId": "0", "mapping": "{}"}}, {"name": "rook-ceph-mon", "kind": "Secret", "data": {"admin-secret": "admin-secret", "fsid": "cacf16f1-a616-4fa7-abed-e0b373739a12", "mon-secret": "mon-secret"}}, {"name": "rook-ceph-operator-creds", "kind": "Secret", "data": {"userID": "client.healthchecker", "userKey": "AQAgf3Jmrz0SGBAAdRNMCORxP6tvQA80QX9jUQ=="}}, {"name": "monitoring-endpoint", "kind": "CephCluster", "data": {"MonitoringEndpoint": "10.244.239.85", "MonitoringPort": "9283"}}, {"name": "rook-csi-rbd-node", "kind": "Secret", "data": {"userID": "csi-rbd-node", "userKey": "AQBDcnJmycs5ExAAWK+bf6EQ5mjOhNUHo6cjOQ=="}}, {"name": "rook-csi-rbd-provisioner", "kind": "Secret", "data": {"userID": "csi-rbd-provisioner", "userKey": "AQBDcnJml+NaBBAAynhQU44b416JvlgRla5Bpw=="}}, {"name": "rook-csi-cephfs-provisioner", "kind": "Secret", "data": {"adminID": "csi-cephfs-provisioner", "adminKey": "AQBDcnJmp8xFJRAA07NNBroRhS9zsSwT/Nw7vA=="}}, {"name": "rook-csi-cephfs-node", "kind": "Secret", "data": {"adminID": "csi-cephfs-node", "adminKey": "AQBDcnJmKaAyNRAAX9u7L0DT2htQjKTwygOHhA=="}}, {"name": "rook-ceph-dashboard-link", "kind": "Secret", "data": {"userID": "ceph-dashboard-link", "userKey": "http://10.244.239.85:7000/"}}, {"name": "ceph-rbd", "kind": "StorageClass", "data": {"pool": "replicapool", "csi.storage.k8s.io/provisioner-secret-name": "rook-csi-rbd-provisioner", "csi.storage.k8s.io/controller-expand-secret-name": "rook-csi-rbd-provisioner", "csi.storage.k8s.io/node-stage-secret-name": "rook-csi-rbd-node"}}, {"name": "cephfs", "kind": "StorageClass", "data": {"fsName": "myfs", "pool": "myfs-replicated", "csi.storage.k8s.io/provisioner-secret-name": "rook-csi-cephfs-provisioner", "csi.storage.k8s.io/controller-expand-secret-name": "rook-csi-cephfs-provisioner", "csi.storage.k8s.io/node-stage-secret-name": "rook-csi-cephfs-node"}}]

@parth-gr parth-gr marked this pull request as ready for review June 19, 2024 06:55
@parth-gr
Copy link
Member Author

@BlaineEXE For the command output in config map,

Which way we should output:

Lets say command is: python3 a.py --abc 123 --pqr 456

  1. The exact command
    "cmd": "python3 a.py --abc 123 --pqr 456"

  2. Or individual flags,

"abc": 123
"pqr": 456

@BlaineEXE
Copy link
Member

In order to facilitate user ease of use, I think it makes most sense to store things in a format that is immediately usable without users having to do anything. For storing configs based on CLI flags, I think it makes the most sense to store them in flag form like --abc 123 --pqr 456. I think that it probably makes the most sense to record only the flags themselves and not the command.

Assuming work is completed to implement config file support, we can instead output a generated config file, which might be more legible like your second example but still easily usable.

@parth-gr parth-gr force-pushed the external-seamless-upgrade2 branch 3 times, most recently from 8b59879 to 9560cdf Compare June 20, 2024 13:27
@parth-gr
Copy link
Member Author

Output: {"name": "external-cluster-user-command", "kind": "ConfigMap", "data": {"data": "--rbd-data-pool-name replicapool"}}

@BlaineEXE
Copy link
Member

Do we need any upstream doc updates for this?

@parth-gr
Copy link
Member Author

Do we need any upstream doc updates for this?

@BlaineEXE that was a good reminder,

So I even created the configmap in the import script that upstream uses.

And then I realised we haven't document on, if we need to upgrade and utilise new feature we need to re-run the script, so I need to draw a attention first on how to utilise new flag on a brow field cluster, so I am creating a new issue in which I will document the same and also add about the command line args configmap

"$EXTERNAL_COMMAND_CONFIGMAP_NAME" \
--from-literal=command="$EXTERNAL_CLUSTER_USER_COMMAND" \
else
echo "configmap $EXTERNAL_COMMAND_CONFIGMAP_NAME already exists"
Copy link
Member

Choose a reason for hiding this comment

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

If it already exists, should we assume that this is a re-run with an update? In that case I think the tool should update the existing cm

Copy link
Member Author

@parth-gr parth-gr Jun 24, 2024

Choose a reason for hiding this comment

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

That correct we need to patch it, thanks

deploy/examples/import-external-cluster.sh Outdated Show resolved Hide resolved
deploy/examples/create-external-cluster-resources.py Outdated Show resolved Hide resolved
"$EXTERNAL_COMMAND_CONFIGMAP_NAME" \
--from-literal=command="$EXTERNAL_CLUSTER_USER_COMMAND"
else
echo "configmap $EXTERNAL_COMMAND_CONFIGMAP_NAME already exists, update it"
Copy link
Member

Choose a reason for hiding this comment

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

Users may interpret "update it" to mean that they need to take action.

Suggested change
echo "configmap $EXTERNAL_COMMAND_CONFIGMAP_NAME already exists, update it"
echo "configmap $EXTERNAL_COMMAND_CONFIGMAP_NAME already exists, updating it"

Comment on lines 180 to 184
$KUBECTL -n "$NAMESPACE" patch configmap "$EXTERNAL_COMMAND_CONFIGMAP_NAME" \
-p "{'data':{'command':$EXTERNAL_COMMAND_CONFIGMAP_NAME}}"
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 try to be consistent with formatting. The $KUBECTL create X Y --vals commands elsewhere all use the format below. Let's do the same for this patch command to keep consistency.

$KUBECTL -n "$NAMESPACE" \
  create \
  X \
  Y \
  --vals

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

user can look back to there configurations by
looking at the configmap created with command
line arguments
This will be useful for them during upgrades when they
need to re run the python script with the same flags

Signed-off-by: parth-gr <partharora1010@gmail.com>
@BlaineEXE BlaineEXE merged commit c85ce7c into rook:master Jun 25, 2024
52 of 53 checks passed
@travisn
Copy link
Member

travisn commented Jul 1, 2024

@parth-gr What upstream documentation can we update so users will be aware of this new feature?

@travisn
Copy link
Member

travisn commented Jul 1, 2024

@parth-gr What upstream documentation can we update so users will be aware of this new feature?

Or maybe it's already covered by #14353?

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.

None yet

3 participants