-
Notifications
You must be signed in to change notification settings - Fork 226
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
Declerative targeting of packages to clusters #3542
Conversation
} | ||
|
||
type ClusterTargetSelector struct { | ||
ClusterType ClusterType `json:"clusterType,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this should be a GVK or GK? We can see how it goes though...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, we could make this a GK/GVK. That will help with discovery for clusters that are represented as resources in the local cluster, but we still need logic to know how to work with those clusters, i.e. connecting to them. Also, there might be situations where we want to discover clusters through some other mean that listing resources, although we could argue that all APIs must reflect clusters as resources.
) | ||
|
||
type PackageSelector struct { | ||
Namespace string `json:"namespace,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we need to go cross-namespace on either packages or targets, and I agree that packages is less dangerous!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to allow for cross-namespace. I added this partly as a way to allow for restricting the controller to target a subset of packages, given that package revisions do not yet support labels.
} | ||
|
||
if apierrors.IsNotFound(err) { | ||
klog.Infof("Creating rootsyncset %s", rootSyncSetName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we can express this as creating a set of "child objects", and then use applylib or similar. Should be less code and take care of pruning. Not a blocker though!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I did consider that approach, but in the end decided on the more standard controller approach.
} | ||
|
||
newReconcile := time.Now().Add(30 * time.Second) | ||
r.NextScheduledReconcile[req.NamespacedName] = newReconcile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to cache this information? I've always seen it just returning RequeueAfter...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I follow. Are you saying there is a way to query the workqueue to check when the next reconcile is scheduled for? This solution is just temporary until we have support for watches on packagerevisions and I've figured out how to set up watches correctly with labelselectors. That is the next steps here.
A few questions / thoughts, but looks good. Merge and iterate :-) |
I agree with the merge and iterate approach, but I think we should come up with an approach where all the "very alpha" controllers doesn't run by default for users trying out Porch. We had some users reporting issues due to our renaming of some of the CRDs in the latest release. We could disable them in the regular porch release and just ask users who want to try them out to build from source. Or even better, publish porch as a kpt package an allow users to opt-in to these controllers if they want to. |
I also think controllers with GCP-specific functionality need to be separated from the rest of the controllers and optionally deployed. Preferably in a single controller-manager. Alternatively they can be part of KCC, especially if they depend on KCC CRDs. |
f589bd5
to
05ede1e
Compare
12c1dd7
to
c4dfd89
Compare
c3debe8
to
17068fd
Compare
31ff51e
to
0cd7023
Compare
} | ||
|
||
func (r *RootSyncRolloutReconciler) findRolloutsForPackageRevision(pkgRev client.Object) []reconcile.Request { | ||
// There is not support for reverse lookup by label: https://github.com/kubernetes/kubernetes/issues/1348 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think controller-runtime has some ability to build our own indexes, but I agree this is a pain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, there is support for building indexes based on fields in controller-runtime, but I couldn't find support for indexes on labels.
0cd7023
to
3a32040
Compare
This adds the RootSyncRollout controller that provides declarative cluster targeting of packages built upon the RootSyncDeployment controller.