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

Create a new version of odf-operator #498

Open
wants to merge 13 commits into
base: main-v2
Choose a base branch
from

Conversation

iamniting
Copy link
Member

@iamniting iamniting commented Oct 11, 2024

Signed-off-by: Nitin Goyal [email protected]

operator-sdk init --domain openshift.io \
    --repo github.com/red-hat-storage/odf-operator \
    --license apache2 --owner "Red Hat OpenShift Data Foundation"

Signed-off-by: Nitin Goyal <[email protected]>
operator-sdk create api --group odf \
    --version v1alpha1 --kind StorageSystem --resource --controller

Signed-off-by: Nitin Goyal <[email protected]>
Signed-off-by: Nitin Goyal <[email protected]>
Copy link
Contributor

openshift-ci bot commented Oct 11, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: iamniting

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link
Contributor

openshift-ci bot commented Oct 22, 2024

@iamniting: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/images f467467 link true /test images
ci/prow/odf-operator-e2e-aws f467467 link true /test odf-operator-e2e-aws

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Scheme: mgr.GetScheme(),
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
OperatorNamespace: "openshift-storage",
Copy link
Contributor

Choose a reason for hiding this comment

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

pls get the namespace via downward-api.

if err = (&odfwebhook.ClusterServiceVersionDefaulter{
Client: mgr.GetClient(),
Decoder: admission.NewDecoder(mgr.GetScheme()),
OperatorNamespace: "openshift-storage",
Copy link
Contributor

Choose a reason for hiding this comment

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

pls get the namespace via downward-api.

}

//+kubebuilder:rbac:groups=odf.openshift.io,resources=storagesystems,verbs=get;list;watch;create;update;patch;delete
//+kubebuilder:rbac:groups=odf.openshift.io,resources=storagesystems/status,verbs=get;update;patch
//+kubebuilder:rbac:groups=odf.openshift.io,resources=storagesystems/finalizers,verbs=update
//+kubebuilder:rbac:groups="",resources=services,verbs=get;list;watch;create;update;patch;delete
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think patch verb for svc is required here.

}

//+kubebuilder:rbac:groups=odf.openshift.io,resources=storagesystems,verbs=get;list;watch;create;update;patch;delete
//+kubebuilder:rbac:groups=odf.openshift.io,resources=storagesystems/status,verbs=get;update;patch
//+kubebuilder:rbac:groups=odf.openshift.io,resources=storagesystems/finalizers,verbs=update
//+kubebuilder:rbac:groups="",resources=services,verbs=get;list;watch;create;update;patch;delete
//+kubebuilder:rbac:groups=admissionregistration.k8s.io,resources=mutatingwebhookconfigurations,verbs=get;list;watch;create;update;patch;delete
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think patch verb for webhook is required here.

// the user.
//
// For more details, check Reconcile and its Result here:
// - https://pkg.go.dev/sigs.k8s.io/[email protected]/pkg/reconcile
func (r *StorageSystemReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

will the reconcile for odf-console be added in another PR?

Copy link
Member Author

Choose a reason for hiding this comment

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

We need to copy-paste the whole reconcile, I will do that as part of the other PR.

)

const (
WebhookPath = "/mutate-operators-coreos-com-v1alpha1-clusterserviceversion"
Copy link
Contributor

Choose a reason for hiding this comment

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

this doesn't need to be GVK identifiable by any means, not user facing, longer names are prone to typos and short name would suffice, how about '/mutate-csv' or can expand csv.

)

var (
ManagedPkgNames = []string{
Copy link
Contributor

Choose a reason for hiding this comment

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

is this required outside of the package?

Comment on lines +26 to +39
// base csvs
"ocs-operator",
"rook-ceph-operator",
"ocs-client-operator",
"mcg-operator",
"noobaa-operator",
"odf-csi-addons-operator",
"csi-addons",
"cephcsi-operator",
"odf-prometheus-operator",
"recipe",

// extended csvs
"ibm-storage-odf-operator",
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we need it here? you can scale down any csv which isn't odf-operator (can be queried from OLM set env easily) in the namespace since we are managing the ns

the edge case is only operators installed in all namespaces and maybe we need to look at how to filter those out.

(or)

we might want to get this info during build time about all the csvs that we going to manage, wdyt?

r.logger = log.FromContext(r.context)
r.logger.Info("Request received for ClusterServiceVersion review")

instance := &opv1a1.ClusterServiceVersion{}
Copy link
Contributor

Choose a reason for hiding this comment

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

pls use the shortname, instance doesn't say anything. same in remaining places.

Suggested change
instance := &opv1a1.ClusterServiceVersion{}
csv := &opv1a1.ClusterServiceVersion{}

Comment on lines +52 to +60
if err := r.reconcileWebhookService(); err != nil {
r.logger.Error(err, "unable to reconcile webhook service")
return ctrl.Result{}, err
}

if err := r.reconcileSubscriptionValidatingWebhook(); err != nil {
r.logger.Error(err, "unable to register subscription validating webhook")
return ctrl.Result{}, err
}
Copy link
Contributor

Choose a reason for hiding this comment

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

may I know what else be part of another PR? to name a few as below seems to be related to this PR only

  1. watches on webhook and service is missing
  2. addition and removal of finalizer on storagesystem is missing
  3. removal of webhook and service during uninstallation is missing

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