Skip to content

Conversation

@imcsk8
Copy link
Contributor

@imcsk8 imcsk8 commented Sep 27, 2018

Since the operator sdk does not natively handles update
events we have to check for differences in the ClusterIngress
structure by getting its md5 signatureits

This commit is work in progress does not handle updates on the
deployment and service elements of the ClusterIngress.

Code cleanup

Since the operator sdk does not natively handles update
events we have to check for differences in the ClusterIngress
structure by getting its md5 signatureits

This commit is work in progress does not handle updates on the
deployment and service elements of the ClusterIngress.

Code cleanup
@imcsk8
Copy link
Contributor Author

imcsk8 commented Sep 27, 2018

PTAL @openshift/sig-network-edge @ironcladlou @Miciah @pravisankar @knobunc

@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 27, 2018
@openshift-ci-robot openshift-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Sep 27, 2018
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: imcsk8
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approver: knobunc

If they are not already assigned, you can assign the PR to them by writing /assign @knobunc in a comment when ready.

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

The pull request process is described here

Details 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

@ironcladlou
Copy link
Contributor

See topic 7 for some discussion on this, as well as the upstream controller guidelines on managing resources with Generation. Might be worth having a quick call with @deads2k or somebody in @openshift/sig-master for some concrete advice.

For now, I'd be happy if we just unconditionally re-built the resource and issued a PATCH which may no-op. Diffing is going to be a more complex issue.

@Miciah
Copy link
Contributor

Miciah commented Sep 28, 2018

Yeah, I believe we want to use the following pattern:

if ci.Generation > ci.Status.ObservedGeneration {
  // ci.spec was changed; synchronize stuff.
}
ci.Status.ObservedGeneration = ci.Generation

#38 adds ci.Status.ObservedGeneration, and it also adds a SetStatusSyncCondition function that might be a reasonable place to update ci.Status.ObservedGeneration.

@soltysh
Copy link

soltysh commented Sep 28, 2018

@ironcladlou @tnozicka will know the most about generations.


func (h *Handler) Handle(ctx context.Context, event sdk.Event) error {
if ci_md5 == nil {
ci_md5 = make(map[string][16]byte)

Choose a reason for hiding this comment

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

Where is this used? probably stale code

Choose a reason for hiding this comment

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

Difference in MD5 checksum of the object to denote change in custom resource may not be useful in our case.
Once we populate status field, status is updated periodically and md5 checksum on the object will change even though there is no change in CR spec.
I think we should store old spec (as annotation or something mechanism) and then compare with new spec to determine if update is needed. This mechanism will also provide what exactly has changed and can react accordingly.
We could get more pointers from oc apply implementation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sorry this coude slipped the patch, should not be here

logrus.Infof("created router daemonset %s/%s", ds.Namespace, ds.Name)
} else if !errors.IsAlreadyExists(err) {
} else if errors.IsAlreadyExists(err) {
err = sdk.Update(ds)

Choose a reason for hiding this comment

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

How do we know this is an update event and not resync event? (may be we want to update anyway during resync?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When @Miciah PR gets merged we will know when there's an update. I think this pattern is good for now.

logrus.Infof("created router service %s/%s", service.Namespace, service.Name)
} else if !errors.IsAlreadyExists(err) {
} else if errors.IsAlreadyExists(err) {
err = sdk.Update(service)

Choose a reason for hiding this comment

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

I don't think we need to update service, none of the spec changes in CR will change service object.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you're right, removing this code

@openshift-ci-robot openshift-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Oct 4, 2018
@openshift-bot openshift-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 11, 2018
@openshift-bot
Copy link
Contributor

@imcsk8: PR needs rebase.

Details

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/test-infra repository.

@ironcladlou
Copy link
Contributor

Needs redesigned per #49; should probably close this one

@ironcladlou
Copy link
Contributor

/close

@openshift-ci-robot
Copy link
Contributor

@ironcladlou: Closing this PR.

Details

In response to this:

/close

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/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants