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

NE-1907: Manage OSSM operator subscription manually to ensure a compatible version is installed #1112

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rfredette
Copy link
Contributor

Istio and the Gateway API CRDs need to be in sync to work. The CRDs are baked into a particular openshift release, so this change updates the ingress operator to install a compatible version with the CRDs it already installs.

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 29, 2024
@openshift-ci openshift-ci bot requested review from grzpiotrowski and Miciah July 29, 2024 19:33
@candita
Copy link
Contributor

candita commented Sep 11, 2024

/assign

@rfredette rfredette changed the title WIP: Manage OSSM operator subscription manually to ensure a compatible version is installed NE-1817: Manage OSSM operator subscription manually to ensure a compatible version is installed Sep 16, 2024
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Sep 16, 2024

@rfredette: This pull request references NE-1817 which is a valid jira issue.

In response to this:

Istio and the Gateway API CRDs need to be in sync to work. The CRDs are baked into a particular openshift release, so this change updates the ingress operator to install a compatible version with the CRDs it already installs.

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Sep 16, 2024
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 16, 2024
@rfredette
Copy link
Contributor Author

/retest

Copy link
Contributor

openshift-ci bot commented Sep 16, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from candita. For more information see the Kubernetes Code Review Process.

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

@rfredette
Copy link
Contributor Author

rfredette commented Oct 28, 2024

test failed due to some test infra issue:

error: unable to read image registry.build02.ci.openshift.org/ci-op-hx0k37ig/stable@sha256:e3f1d39aa298ba7049f7d28ecf4ab8d4d49c54918355e8fb37bd94a2050434fa: unable to retrieve source image registry.build02.ci.openshift.org/ci-op-hx0k37ig/stable@sha256:e3f1d39aa298ba7049f7d28ecf4ab8d4d49c54918355e8fb37bd94a2050434fa manifest #1 from manifest list: received unexpected HTTP status: 504 Gateway Time-out 

/retest

…sion is installed

Istio and the Gateway API CRDs need to be in sync to work. The CRDs are
baked into a particular openshift release, so this change updates the
ingress operator to install a compatible version with the CRDs it
already installs.
@rfredette rfredette changed the title NE-1817: Manage OSSM operator subscription manually to ensure a compatible version is installed NE-1907: Manage OSSM operator subscription manually to ensure a compatible version is installed Nov 11, 2024
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Nov 11, 2024

@rfredette: This pull request references NE-1907 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.18.0" version, but no target version was set.

In response to this:

Istio and the Gateway API CRDs need to be in sync to work. The CRDs are baked into a particular openshift release, so this change updates the ingress operator to install a compatible version with the CRDs it already installs.

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 openshift-eng/jira-lifecycle-plugin repository.

@rfredette
Copy link
Contributor Author

/jira refresh

@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Nov 11, 2024

@rfredette: This pull request references NE-1907 which is a valid jira issue.

In response to this:

/jira refresh

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 openshift-eng/jira-lifecycle-plugin repository.

@Miciah Miciah added the priority/backlog Higher priority than priority/awaiting-more-evidence. label Nov 13, 2024
@rfredette
Copy link
Contributor Author

single node test failure is unrelated.
/test e2e-aws-ovn-single-node

Copy link
Contributor

openshift-ci bot commented Nov 18, 2024

@rfredette: all tests passed!

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.

@@ -61,6 +62,22 @@ func NewUnmanaged(mgr manager.Manager, config Config) (controller.Controller, er
if err := c.Watch(source.Kind[client.Object](operatorCache, &gatewayapiv1.GatewayClass{}, &handler.EnqueueRequestForObject{}, isOurGatewayClass, notIstioGatewayClass)); err != nil {
return nil, err
}
isOurInstallPlan := predicate.NewPredicateFuncs(func(o client.Object) bool {
installPlan := o.(*operatorsv1alpha1.InstallPlan)
for _, csv := range installPlan.Spec.ClusterServiceVersionNames {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should you check to make sure len(ClusterServiceVersionNames) > 0 first?

}
}
}
return nil, fmt.Errorf("No InstallPlan with cluster service version %s found", serviceMeshOperatorDesiredVersion)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return nil, fmt.Errorf("No InstallPlan with cluster service version %s found", serviceMeshOperatorDesiredVersion)
return nil, fmt.Errorf("no InstallPlan with cluster service version %s found in namespace %s", serviceMeshOperatorDesiredVersion, serviceMeshOperatorNamespace)

return false, currentInstallPlan, nil
}

func (r *reconciler) getCurrentInstallPlan(ctx context.Context) (*operatorsv1alpha1.InstallPlan, error) {
Copy link
Contributor

@candita candita Dec 18, 2024

Choose a reason for hiding this comment

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

nit: use the function name we normally use.

Suggested change
func (r *reconciler) getCurrentInstallPlan(ctx context.Context) (*operatorsv1alpha1.InstallPlan, error) {
func (r *reconciler) currentInstallPlan(ctx context.Context) (*operatorsv1alpha1.InstallPlan, error) {

} else if currentInstallPlan == nil {
return false, nil, nil
}
if !currentInstallPlan.Spec.Approved {
Copy link
Contributor

Choose a reason for hiding this comment

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

The idiomatic way to write an "ensure" function is to get the current object, get the desired object, compare them, and use the "have" and "want" values to determine whether to create or update. Can you update this to use the idiomatic form?


func (r *reconciler) getCurrentInstallPlan(ctx context.Context) (*operatorsv1alpha1.InstallPlan, error) {
InstallPlans := &operatorsv1alpha1.InstallPlanList{}
if err := r.client.List(ctx, InstallPlans, client.InNamespace(serviceMeshOperatorNamespace)); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

So the installPlan doesn't have a unique name?

@@ -16,6 +17,11 @@ import (
"k8s.io/apimachinery/pkg/types"
)

var (
serviceMeshOperatorDesiredVersion = "servicemeshoperator.v2.6.2"
Copy link
Contributor

@candita candita Dec 18, 2024

Choose a reason for hiding this comment

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

I'm not sure this is going to work. If we change the version in a future release and need to backport a different change in the same file, won't this get overwritten? I think normally version information is recorded in a manifest yaml. Can you find a way to do this without hardcoding the version here?

I'll check with @Miciah because I don't know the answer.

@candita
Copy link
Contributor

candita commented Dec 18, 2024

@rfredette can you add a unit test for the ensure function?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. priority/backlog Higher priority than priority/awaiting-more-evidence.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants