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

ocs-client-operator implementation #7

Merged
merged 21 commits into from
Feb 1, 2023

Conversation

Madhu-1
Copy link
Member

@Madhu-1 Madhu-1 commented Jan 24, 2023

This replaces #3, #4, #5, and #6, as this includes all the planned changes.

@Madhu-1 Madhu-1 force-pushed the client-operator branch 6 times, most recently from dc3b646 to f106db1 Compare January 24, 2023 13:10
Copy link
Member

@jarrpa jarrpa left a comment

Choose a reason for hiding this comment

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

Overall this is a great PR, thank you for accommodating my commit requests. 🙏 Apart from the more specific review comments, I have a couple of broad questions:

Regarding the StorageClient CRD:

  • I remember at some point having a conversation (months ago) about naming this StorageClient vs OcsClient. The reasoning for the latter probably make more sense when it was ocsclient.odf.openshift.io, but I can see storageclient.ocs.openshift.io also making sense these days. Is this related to the referenced (though unexplained) conversation about the API group name?
  • Why are we limiting to one per namespace? I can imagine the argument being something about Secret/data isolation, but could I get a concrete example of where this would be an actual problem with the current design?

Regarding the StorageClassClaim implementation, this seems largely similar to the work I did in the previous PRs. If this is the case, could you add a Co-authored-by: [email protected] line to the relevant commit messages? If you feel any of the other commits are significantly based on that same prior work, please do add the line there as well.

Beyond that:

  • Your commits are signed using your personal gmail account. I would think you should be using your @redhat.com account, was this intentional?
  • I like the implementation of the status-report job, but boy does it look weird to have a main.go under pkg. Would it be possible to do as was done for the Provider and create a service/status-reporter directory for that job?

.github/workflows/conf/commitlintrc.json Outdated Show resolved Hide resolved
images.yaml Outdated Show resolved Hide resolved
pkg/csi/csi.go Outdated Show resolved Hide resolved
pkg/csi/csi.go Outdated Show resolved Hide resolved
pkg/csi/csidriver.go Outdated Show resolved Hide resolved
controllers/storageclient_controller.go Outdated Show resolved Hide resolved
controllers/storageclient_controller.go Show resolved Hide resolved
controllers/suite_test.go Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
pkg/csi/monconfigmap.go Outdated Show resolved Hide resolved
@Madhu-1
Copy link
Member Author

Madhu-1 commented Jan 26, 2023

Overall this is a great PR, thank you for accommodating my commit requests. pray Apart from the more specific review comments, I have a couple of broad questions:

Regarding the StorageClient CRD:

  • I remember at some point having a conversation (months ago) about naming this StorageClient vs OcsClient. The reasoning for the latter probably make more sense when it was ocsclient.odf.openshift.io, but I can see storageclient.ocs.openshift.io also making sense these days. Is this related to the referenced (though unexplained) conversation about the API group name?

It was discussed in one of the meetings with @nb-ohad and @oritwas as it's more opt and as the name explains it's just a storageclient we decided on storage client name. it's not documented anywhere.

  • Why are we limiting to one per namespace? I can imagine the argument being something about Secret/data isolation, but could I get a concrete example of where this would be an actual problem with the current design?

To keep it simple for now, we will go with one storageClient per namespace but in future/follow-up PR we will block creating multiple storageclient per provider and allow multiple storageclient connecting to different providers in the same namespace.

Regarding the StorageClassClaim implementation, this seems largely similar to the work I did in the previous PRs. If this is the case, could you add a Co-authored-by: [email protected] line to the relevant commit messages? If you feel any of the other commits are significantly based on that same prior work, please do add the line there as well.

Sorry missed adding it. Done 👍

Beyond that:

  • Your commits are signed using your personal gmail account. I would think you should be using your @redhat.com account, was this intentional?

yes, it's intentional I use my Gmail id for all the projects I work with. Never used redhat.com till now.

  • I like the implementation of the status-report job, but boy does it look weird to have a main.go under pkg. Would it be possible to do as was done for the Provider and create a service/status-reporter directory for that job?

Done 👍

@Madhu-1 Madhu-1 force-pushed the client-operator branch 3 times, most recently from 329de9f to ee3a815 Compare January 26, 2023 07:57
@Madhu-1 Madhu-1 requested a review from jarrpa January 26, 2023 07:58
.github/workflows/conf/commitlintrc.json Outdated Show resolved Hide resolved
pkg/csi/csidriver.go Outdated Show resolved Hide resolved
pkg/csi/csidriver.go Show resolved Hide resolved
pkg/csi/csi.go Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
controllers/suite_test.go Outdated Show resolved Hide resolved
@jarrpa
Copy link
Member

jarrpa commented Jan 26, 2023

  • Your commits are signed using your personal gmail account. I would think you should be using your @redhat.com account, was this intentional?

yes, it's intentional I use my Gmail id for all the projects I work with. Never used redhat.com till now.

I haven't seen this before. Best I knew if you're doing work for redhat you should be signing it as such. But if that's what you've been doing and no one else has said anything about, I'm not gonna care. 😆

added cleanup component to the commitlint
config file. The cleanup can be used when
we are doing any code cleanup.

Signed-off-by: Madhu Rajanna <[email protected]>
Replacing odf with ocs for below reason

* The project is created to the ocs-client-operator
* To keep the CRD group as similar to existing CRD
* The name change is after discussion in a meeting

Signed-off-by: Madhu Rajanna <[email protected]>
its expected to have a new line between the function
comment on the linter comments.
This is also auto suggested from golang linter tools.
Signed-off-by: Madhu Rajanna <[email protected]>
update golang to 1.18 no need to support
v1.17 as its old version and its not
supported by vendor dependencies like
kubernetes

Signed-off-by: Madhu Rajanna <[email protected]>
includes the go.mod, go.sum and vendor
changes for the csi driver.

Signed-off-by: Madhu Rajanna <[email protected]>
added csi to commitlint config.
If there are CSI changes csi component
can be used when creating the git commit.

Signed-off-by: Madhu Rajanna <[email protected]>
@Madhu-1 Madhu-1 force-pushed the client-operator branch 3 times, most recently from 2ab538d to 753d2dc Compare January 26, 2023 15:43
@Madhu-1 Madhu-1 requested a review from jarrpa January 26, 2023 15:44
pkg/csi/csi.go Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
Copy link
Member

@jarrpa jarrpa left a comment

Choose a reason for hiding this comment

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

Excellent work! Just one last typo to fix, I don't entirely want to hold up the entire PR for this, but if not now then who knows when. 😆 If you or someone else has permissions to hit the big green merge button once you update the PR I hereby consent to you doing so ASAP.

@Madhu-1 Madhu-1 force-pushed the client-operator branch 2 times, most recently from 020a8e1 to 8effa23 Compare January 31, 2023 07:47
@Madhu-1
Copy link
Member Author

Madhu-1 commented Jan 31, 2023

@jarrpa Please take a look at it; below are the major changes after discussing with @nb-ohad

  • Remove the OCP check and consider the cluster is always OCP for now. I will open an issue to track the gap to run with standalone kubernetes
  • Move complete CSI logic to ClusterVersion CR.
  • Move CSI RBAC from code to yaml files which help in security audit

@Madhu-1
Copy link
Member Author

Madhu-1 commented Jan 31, 2023

Test results from OCP cluster

[🎩︎]mrajanna@fedora ocs-client-operator $]oc get po -nocs-client-ns
NAME                                                     READY   STATUS    RESTARTS   AGE
csi-addons-controller-manager-7fc65dff49-7mpxs           2/2     Running   0          49m
csi-cephfsplugin-6wtgv                                   2/2     Running   0          2m39s
csi-cephfsplugin-bwn6g                                   2/2     Running   0          2m52s
csi-cephfsplugin-p9f97                                   2/2     Running   0          2m49s
csi-cephfsplugin-provisioner-7bbcd8d9bf-gqgj9            5/5     Running   0          23m
csi-cephfsplugin-provisioner-7bbcd8d9bf-gqrxx            5/5     Running   0          23m
csi-rbdplugin-5k5cp                                      3/3     Running   0          25m
csi-rbdplugin-6mv8w                                      3/3     Running   0          25m
csi-rbdplugin-7bzzl                                      3/3     Running   0          25m
csi-rbdplugin-provisioner-5f8fd786d-65rx5                5/5     Running   0          3m12s
csi-rbdplugin-provisioner-5f8fd786d-hppg9                5/5     Running   0          3m18s
ocs-client-operator-controller-manager-d8df78b86-ls2gs   2/2     Running   0          3m43s

Copy link
Member

@jarrpa jarrpa left a comment

Choose a reason for hiding this comment

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

Just a few small things left. Apart from the code questions, there's a commit description that should be amended:

 csi: install ceph-csi driver

Install ceph-CSI driver based on the
kubernetes version where the ocs-client
operator is running.

This also includes clusterversion controller
which can trigger an upgrade of csi driver
if required when a OCP cluster is upgraded.

There is a if/else check in main.go which helps
to install/test csidriver changes by checking
this is a ocp cluster or kubernetes cluster.

The if/else mentioned has been removed.

controllers/clusterversion_controller.go Outdated Show resolved Hide resolved
// GetOperatorDeployment returns the operator deployment object
func GetOperatorDeployment(ctx context.Context, c client.Client, namespace string) (*appsv1.Deployment, error) {
deployment := &appsv1.Deployment{}
err := c.Get(ctx, types.NamespacedName{Name: "ocs-client-operator-controller-manager", Namespace: namespace}, deployment)
Copy link
Member

Choose a reason for hiding this comment

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

There's not a 100% guarantee that this will always be the name of the Deployment resource... we can probably leave this as-is for the sake of expediency, but I would like to see something that gets the Deployment based on the metadata of the Pod.

Copy link
Member

Choose a reason for hiding this comment

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

PR looks good to merge, please create an issue for this comment when you're back online.

controllers/storageclient_controller.go Outdated Show resolved Hide resolved
@Madhu-1 Madhu-1 force-pushed the client-operator branch 2 times, most recently from e30a4f3 to 27a53cd Compare February 1, 2023 08:21
Madhu-1 and others added 15 commits February 1, 2023 09:24
Install ceph-CSI driver based on the
OCP version where the ocs-client
operator is running.

This also includes clusterversion controller
which can trigger an installation of csi driver
and also upgrade of csi the driver if required
when a OCP cluster is upgraded.

Co-authored-by: Jose A. Rivera <[email protected]>
Signed-off-by: Madhu Rajanna <[email protected]>
dockerfile changes to copy sidecar.yaml
to the operator image

Signed-off-by: Madhu Rajanna <[email protected]>
RBAC changes required to manage the csidriver.

Signed-off-by: Madhu Rajanna <[email protected]>
Use golang 1.18 and 1.19 in the CI
environment.

Signed-off-by: Madhu Rajanna <[email protected]>
Adding storageClient CR which supports
anboarding and offboarding new storageclients
to the provider cluster.

A single storageclient can exists in a single
namespace. If someone tries to create one
more storageclient it will fail.

Co-authored-by: Jose A. Rivera <[email protected]>
Signed-off-by: Madhu Rajanna <[email protected]>
contains the go.mod and vendor changes
required for storageclient

Co-authored-by: Jose A. Rivera <[email protected]>
Signed-off-by: Madhu Rajanna <[email protected]>
these changes are the manifest and bundle
changes for the storageclient.

Co-authored-by: Jose A. Rivera <[email protected]>
Signed-off-by: Madhu Rajanna <[email protected]>
Adding storageClassclaim CR which supports
requesting for cephfs and rbd storageclass

Co-authored-by: Jose A. Rivera <[email protected]>
Signed-off-by: Madhu Rajanna <[email protected]>
storageclient changes for the storageclassclaim
controller

* check no storageclassclaims exists before deleting
the storageclient

Co-authored-by: Jose A. Rivera <[email protected]>
Signed-off-by: Madhu Rajanna <[email protected]>
changes includes the manifest and bundle for
the storageclassclaim

Co-authored-by: Jose A. Rivera <[email protected]>
Signed-off-by: Madhu Rajanna <[email protected]>
Adding the status health of the storageclient
to the provider cluster.

Signed-off-by: Madhu Rajanna <[email protected]>
manifest changes for the status-reporter image

Signed-off-by: Madhu Rajanna <[email protected]>
Deploymemnt is done using a dependencies.yaml file,
to instruct OLM to bring and deploy csiaddons bundle
as part of ocs-client-operator bundle installation

The pakcage name and version is configurable when
running the make bundle command.

Signed-off-by: Madhu Rajanna <[email protected]>
increase the golangci-lint timeout
to higher value.

Signed-off-by: Madhu Rajanna <[email protected]>
setting OwnNamespace to true as the dependent
csi-addons also required it to be true.

Signed-off-by: Madhu Rajanna <[email protected]>
@Madhu-1 Madhu-1 requested a review from jarrpa February 1, 2023 08:25
Copy link
Member

@jarrpa jarrpa left a comment

Choose a reason for hiding this comment

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

LGTM!

@jarrpa jarrpa merged commit 99ca5fb into red-hat-storage:main Feb 1, 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.

2 participants