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

Enable lifecycle hooks explicitly in the ClusterClass #8211

Open
killianmuldoon opened this issue Mar 1, 2023 · 3 comments
Open

Enable lifecycle hooks explicitly in the ClusterClass #8211

killianmuldoon opened this issue Mar 1, 2023 · 3 comments
Labels
area/clusterclass Issues or PRs related to clusterclass area/runtime-sdk Issues or PRs related to Runtime SDK help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@killianmuldoon
Copy link
Contributor

Runtime SDK Lifecycle hooks are currently linked to Clusters entirely based on a namespace selector defined in an ExtensionConfig. If an ExtensionConfig has a Lifecycle hook enabled and a Cluster matches the namespace selector of the ExtensionConfig the hook is called.

There should be some way for Cluster or ClusterClass authors to opt in to lifecycle hooks explicitly. This is the case for external patches today which are specified in a ClusterClass as below.

  patches:
  - name: test-patch
    external:
      generateExtension: generate-patches.k8s-upgrade-with-runtimesdk
      validateExtension: validate-topology.k8s-upgrade-with-runtimesdk
      discoverVariablesExtension: discover-variables.k8s-upgrade-with-runtimesdk

The namespace selector is still in place for these extension calls, so a ClusterClass can not use an extension when it doesn't match the namespace selector.

This issue is about considering making Lifecycle hook extensions explicitly in the ClusterClass spec - i.e. adding a new struct under ClusterClass .spec which looks like:

  hooks:
      beforeClusterCreate: 
         - before-cluster-create.first-extension
         - before-cluster-create.second-extension
         - before-cluster-create.third-extension
      afterClusterUpgrade:
         - before-cluster-upgrade.first-extension
         - before-cluster-upgrade.second-extension
      beforeClusterDelete:
         - before-cluster-delete.third-extension

In the above example Clusters created using this ClusterClass will have beforeClusterCreate calls to three extensions, afterClusterUpgrade calls to two extensions, and beforeClusterDelete calls to one extension.

This would allow ClusterClass, and depending on implementation Cluster, authors to have some control over the hooks called in the lifecycle of the objects they control.

/kind api-change
/area runtime-sdk
/area topology

@k8s-ci-robot k8s-ci-robot added kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API area/runtime-sdk Issues or PRs related to Runtime SDK area/topology needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Mar 1, 2023
@sbueringer
Copy link
Member

/triage accepted

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Mar 2, 2023
@fabriziopandini
Copy link
Member

+1
this seems a good compromise between what we have today and enabling hooks on each cluster

@killianmuldoon killianmuldoon added the area/clusterclass Issues or PRs related to clusterclass label May 4, 2023
@fabriziopandini
Copy link
Member

/priority important-longterm

@k8s-ci-robot k8s-ci-robot added the priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. label Apr 11, 2024
@fabriziopandini fabriziopandini added the help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. label May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/clusterclass Issues or PRs related to clusterclass area/runtime-sdk Issues or PRs related to Runtime SDK help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

No branches or pull requests

4 participants