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

Propagate configuration/route conditions to KFService status object #145

Merged
merged 6 commits into from
Jun 24, 2019
Merged

Propagate configuration/route conditions to KFService status object #145

merged 6 commits into from
Jun 24, 2019

Conversation

yuzisun
Copy link
Member

@yuzisun yuzisun commented Jun 7, 2019

What this PR does / why we need it:
Populate following conditions on status object for

  • DefaultConfigurationReady
  • CanaryConfigurationReady
  • RouteReady
  • KFServiceReady

KFServiceReady condition is depending on DefaultConfiguationReady and RouteReady conditions.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #113

Special notes for your reviewer:

  1. This PR replaced our conditions definition with knative's status duck type(https://github.com/knative/pkg/blob/master/apis/duck/v1beta1/status_types.go#L54), so that we can reuse all the conditions related utility functions and easier to propagate the conditions from knative resources. The conditions definition is mostly same as what we had before, one difference is that knative uses VolatileTime in place of metav1.Time to exclude this from creating equality.Semantic difference when comparing status object, the side effect of this is that when updating status object I'am getting an error status.conditions.lastTransitionTime in body must be of type object: "string" because lastTransitionTime is now of type object. I have chatted with kube builder guys, they suggested using marker +kubebuilder:validation:Type=string which is supported in controller-runtime 2.0, but we are still on 1.9.0 due to knative dep. For now I have walked around the issue by patching the generated crd with string type for lastTransitionTime.

Release note:



This change is Reviewable

@yuzisun
Copy link
Member Author

yuzisun commented Jun 16, 2019

/retest

@yuzisun yuzisun changed the title WIP: populate conditions on status object Populate conditions on KFService status object Jun 16, 2019
@yuzisun yuzisun changed the title Populate conditions on KFService status object Propagate configuration/route conditions to KFService status object Jun 16, 2019
@yuzisun
Copy link
Member Author

yuzisun commented Jun 16, 2019

@ellis-bigelow @cliveseldon @rakelkar This is ready to review.

Copy link
Contributor

@ellistarn ellistarn left a comment

Choose a reason for hiding this comment

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

Really cool Dan.

I was talking to the knative folks about knative/pkg. They were talking about how controller-runtime was not good enough to meet their needs which caused them to invent many of the utilities in knative/pkg. They described it as solving day-2 problems for writing controllers vs controller-runtime solving day-1 problems (i.e. getting something working ASAP). Ideally, this would be in a separate repo someday.

What do you think about holding off on this until the refactor is in. There's a little bit of collide, and I think that PR is probably closer.

config/default/manager/manager.yaml Show resolved Hide resolved
pkg/apis/serving/v1alpha1/kfservice_status.go Outdated Show resolved Hide resolved
// default configuration have reported readiness.
ServiceConditionDefaultConfigurationsReady duckv1alpha1.ConditionType = "DefaultConfigurationReady"
KFServiceConditionDefaultConfigurationsReady apis.ConditionType = "DefaultConfigurationReady"
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should just be "DefaultReady" for the same reason about exposing knative configurations through our api.

How do you feel about two for now:
"DefaultReady"
"DefaultPredictorReady"

Each of the components will need to ready up and they can rollup.

// ServiceConditionCanaryConfigurationsReady is set when the service's underlying
// canary configuration have reported readiness.
ServiceConditionCanaryConfigurationsReady duckv1alpha1.ConditionType = "CanaryConfigurationReady"
KFServiceConditionCanaryConfigurationsReady apis.ConditionType = "CanaryConfigurationReady"
Copy link
Contributor

Choose a reason for hiding this comment

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

likewise.

pkg/apis/serving/v1alpha1/kfservice_status.go Outdated Show resolved Hide resolved
@@ -155,10 +155,12 @@ func (r *ReconcileService) Reconcile(request reconcile.Request) (reconcile.Resul
configurationReconciler := knative.NewConfigurationReconciler(r.Client)
routeReconciler := knative.NewRouteReconciler(r.Client)

// Initialize conditions
kfsvc.Status.InitializeConditions()
Copy link
Contributor

Choose a reason for hiding this comment

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

What exactly is this doing? Setting them all to unknown? Why is this necessary to setup?

pkg/controller/kfservice/kfservice_controller.go Outdated Show resolved Hide resolved
pkg/testing/be_sematic_equal_matcher.go Show resolved Hide resolved
pkg/testing/be_sematic_equal_matcher.go Show resolved Hide resolved
@yuzisun
Copy link
Member Author

yuzisun commented Jun 17, 2019

Really cool Dan.

I was talking to the knative folks about knative/pkg. They were talking about how controller-runtime was not good enough to meet their needs which caused them to invent many of the utilities in knative/pkg. They described it as solving day-2 problems for writing controllers vs controller-runtime solving day-1 problems (i.e. getting something working ASAP). Ideally, this would be in a separate repo someday.

What do you think about holding off on this until the refactor is in. There's a little bit of collide, and I think that PR is probably closer.

hmm, can you point me to the PR ? I was expecting these utilities exist in controller-runtime and later I found them in knative pkg, here I am mostly using the condition utils in knative pkg and I think should be fairly easy to migrate later, but I'd like to take a look at their PR first to determine what should we do here.

@yuzisun
Copy link
Member Author

yuzisun commented Jun 19, 2019

/retest

Copy link
Contributor

@ellistarn ellistarn left a comment

Choose a reason for hiding this comment

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

Awesome. LGTM, couple of tiny nits to simplify the code. Ready to LGTM/Approve right afterwards.

func (ss *KFServiceStatus) PropagateDefaultConfigurationStatus(defaultConfigurationStatus *knservingv1alpha1.ConfigurationStatus) {
ss.Default.Name = defaultConfigurationStatus.LatestCreatedRevisionName
configurationCondition := defaultConfigurationStatus.GetCondition(knservingv1alpha1.ConfigurationConditionReady)
if configurationCondition == nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this go in the switch?

func (ss *KFServiceStatus) PropagateCanaryConfigurationStatus(canaryConfigurationStatus *knservingv1alpha1.ConfigurationStatus) {
ss.Canary.Name = canaryConfigurationStatus.LatestCreatedRevisionName
configurationCondition := canaryConfigurationStatus.GetCondition(knservingv1alpha1.ConfigurationConditionReady)
if configurationCondition == nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Likewise.

@@ -65,5 +103,16 @@ func (ss *KFServiceStatus) PropagateRouteStatus(rs *knservingv1alpha1.RouteStatu
}
}

//TODO @yuzisun populate route status conditions
rc := rs.GetCondition(knservingv1alpha1.RouteConditionReady)
Copy link
Contributor

Choose a reason for hiding this comment

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

And here

@ellistarn
Copy link
Contributor

/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ellis-bigelow

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

The pull request process is described 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

@k8s-ci-robot k8s-ci-robot merged commit cbcd49f into kserve:master Jun 24, 2019
@yuzisun yuzisun deleted the conditions branch August 19, 2019 06:06
ellistarn pushed a commit to ellistarn/kfserving that referenced this pull request Jul 28, 2020
…serve#145)

* Populate conditions on status object

* Fix memory limit

* Add conditions test

* Address review comments

* Fix test

* Move nil check to switch statement
rafvasq pushed a commit to rafvasq/kserve that referenced this pull request Jul 21, 2023
Includes resolution of etcd client vulnerability CVE-2018-1099

Note that we are keeping the Kubernetes libraries at 22.x level since there's now a transitive dependency on knative via the main kserve libraries and that's incompatible with Kube >= 23.0.

Signed-off-by: Nick Hill <nickhill@us.ibm.com>

Signed-off-by: Nick Hill <nickhill@us.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Propagate configuration/route conditions to KFService
3 participants