US-12625701-B2 - Providing self-managed operators
Abstract
Self-managed operators is provided. A set of sub-operators that a main operator depends on is selected from a plurality of predefined sub-operators based on an analysis of a new version of a custom resource definition in response to determining that a current version of the main operator does match a main operator version identified in the new version of the custom resource definition corresponding to the main operator based on the analysis of the custom resource definition. A sub-custom resource definition is generated for each respective sub-operator of the set of sub-operators that the main operator depends on based on the new version of the custom resource definition corresponding to the main operator. The set of sub-operators that the main operator depends on is launched automatically using the sub-custom resource definition of each respective sub-operator of the set of sub-operators.
Inventors
- Yan Fen Guo
- Chao Feng Wu
- Hui Huang
- Song Bai
- Xiang Cai
- XIAO JIAN LIAN
- Leela Prasad Chitta
Assignees
- INTERNATIONAL BUSINESS MACHINES CORPORATION
Dates
- Publication Date
- 20260512
- Application Date
- 20240423
Claims (20)
- 1 . A computer-implemented method for providing self-managed operators, the computer-implemented method comprising: responsive to a computer, using a management role of a main operator, determining that a current version of the main operator does match a main operator version identified in a new version of a custom resource definition corresponding to the main operator based on an analysis of the custom resource definition, selecting, by the computer, using the management role of the main operator, a set of sub-operators that the main operator depends on from a plurality of predefined sub-operators based on the analysis of the new version of the custom resource definition; generating, by the computer, using a function role of the main operator, a sub-custom resource definition for each respective sub-operator of the set of sub-operators that the main operator depends on based on the new version of the custom resource definition corresponding to the main operator; and launching, by the computer, using the management role of the main operator, the set of sub-operators that the main operator depends on automatically using the sub-custom resource definition of each respective sub-operator of the set of sub-operators.
- 2 . The computer-implemented method of claim 1 , further comprising: detecting, by the computer, using the management role of the main operator, that the custom resource definition corresponding to the main operator was updated to the new version; performing, by the computer, using the management role of the main operator, the analysis of the custom resource definition corresponding to the main operator that was updated to the new version; and determining, by the computer, using the management role of the main operator, whether the current version of the main operator matches the main operator version identified in the new version of the custom resource definition based on the analysis of the custom resource definition.
- 3 . The computer-implemented method of claim 1 , further comprising: responsive to the computer, using the management role of the main operator, determining that the current version of the main operator does not match the main operator version identified in the new version of the custom resource definition based on the analysis of the custom resource definition corresponding to the main operator, applying, by the computer, using the management role of the main operator, a new catalog source file to the main operator to automatically upgrade the main operator to the main operator version identified in the new version of the custom resource definition; and updating, by the computer, using the management role of the main operator, a channel in a subscription of the main operator with the main operator version identified in the new version of the custom resource definition.
- 4 . The computer-implemented method of claim 1 , further comprising: managing, by the computer, using the function role of the main operator, a set of components of an application that provides a set of services corresponding to the main operator and the set of sub-operators that the main operator depends on; and recording, by the computer, using the function role of the main operator, a status of the main operator in an operator status configuration map.
- 5 . The computer-implemented method of claim 1 , further comprising: monitoring, by the computer, using the management role of the main operator, a status of each respective sub-operator of the set of sub-operators that the main operator depends on in an operator status configuration map; and determining, by the computer, using the management role of the main operator, whether a sub-operator of the set of sub-operators that the main operator depends on is in a ready for delete status based on the monitoring of the status of each respective sub-operator in the operator status configuration map.
- 6 . The computer-implemented method of claim 5 , further comprising: responsive to the computer, using the management role of the main operator, determining that the sub-operator of the set of sub-operators that the main operator depends on is in the ready for delete status based on the monitoring of the status of each respective sub-operator in the operator status configuration map, deleting, by the computer, using the management role of the main operator, a sub-custom resource definition corresponding to the sub-operator of the set of sub-operators that is in the ready for delete status; and deleting, by the computer, using the management role of the main operator, the sub-operator of the set of sub-operators that is in the ready for delete status by deleting a sub-subscription and cluster service version corresponding to the sub-operator.
- 7 . The computer-implemented method of claim 1 , wherein the management role automatically launches the set of sub-operators without launching any other sub-operators of the plurality of predefined sub-operators preventing unnecessary resource consumption by any of the other sub-operators.
- 8 . The computer-implemented method of claim 1 , wherein the custom resource definition corresponding to the main operator includes added parameters of subscription and catalog source that contain information needed for the main operator to automatically upgrade to a newer version and launch sub-operator dependencies.
- 9 . A computer system for providing self-managed operators, the computer system comprising: a communication fabric; a set of computer-readable storage media connected to the communication fabric, wherein the set of computer-readable storage media collectively stores program instructions; and a set of processors connected to the communication fabric, wherein the set of processors executes the program instructions to: select, using a management role of a main operator, a set of sub-operators that a main operator depends on from a plurality of predefined sub-operators based on an analysis of a new version of a custom resource definition in response to determining that a current version of the main operator does match a main operator version identified in the new version of the custom resource definition corresponding to the main operator based on the analysis of the custom resource definition; generate, using a function role of the main operator, a sub-custom resource definition for each respective sub-operator of the set of sub-operators that the main operator depends on based on the new version of the custom resource definition corresponding to the main operator; and launch, using the management role of the main operator, the set of sub-operators that the main operator depends on automatically using the sub-custom resource definition of each respective sub-operator of the set of sub-operators.
- 10 . The computer system of claim 9 , wherein the set of processors further executes the program instructions to: detect, using the management role of the main operator, that the custom resource definition corresponding to the main operator was updated to the new version; perform, using the management role of the main operator, the analysis of the custom resource definition corresponding to the main operator that was updated to the new version; and determine, using the management role of the main operator, whether the current version of the main operator matches the main operator version identified in the new version of the custom resource definition based on the analysis of the custom resource definition.
- 11 . The computer system of claim 9 , wherein the set of processors further executes the program instructions to: apply, using the management role of the main operator, a new catalog source file to the main operator to automatically upgrade the main operator to the main operator version identified in the new version of the custom resource definition in response to determining that the current version of the main operator does not match the main operator version identified in the new version of the custom resource definition based on the analysis of the custom resource definition corresponding to the main operator; and update, using the management role of the main operator, a channel in a subscription of the main operator with the main operator version identified in the new version of the custom resource definition.
- 12 . The computer system of claim 9 , wherein the set of processors further executes the program instructions to: manage, using the function role of the main operator, a set of components of an application that provides a set of services corresponding to the main operator and the set of sub-operators that the main operator depends on; and record, using the function role of the main operator, a status of the main operator in an operator status configuration map.
- 13 . The computer system of claim 9 , wherein the set of processors further executes the program instructions to: monitor, using the management role of the main operator, a status of each respective sub-operator of the set of sub-operators that the main operator depends on in an operator status configuration map; and determine, using the management role of the main operator, whether a sub-operator of the set of sub-operators that the main operator depends on is in a ready for delete status based on monitoring the status of each respective sub-operator in the operator status configuration map.
- 14 . The computer system of claim 13 , wherein the set of processors further executes the program instructions to: delete, using the management role of the main operator, a sub-custom resource definition corresponding to the sub-operator of the set of sub-operators that is in the ready for delete status in response to determining that the sub-operator of the set of sub-operators that the main operator depends on is in the ready for delete status based on the monitoring of the status of each respective sub-operator in the operator status configuration map; and delete, using the management role of the main operator, the sub-operator of the set of sub-operators that is in the ready for delete status by deleting a sub-subscription and cluster service version corresponding to the sub-operator.
- 15 . A computer program product for providing self-managed operators, the computer program product comprising a set of computer-readable storage media having program instructions collectively stored therein, the program instructions executable by a computer to cause the computer to: select, using a management role of a main operator, a set of sub-operators that a main operator depends on from a plurality of predefined sub-operators based on an analysis of a new version of a custom resource definition in response to determining that a current version of the main operator does match a main operator version identified in the new version of the custom resource definition corresponding to the main operator based on the analysis of the custom resource definition; generate, using a function role of the main operator, a sub-custom resource definition for each respective sub-operator of the set of sub-operators that the main operator depends on based on the new version of the custom resource definition corresponding to the main operator; and launch, using the management role of the main operator, the set of sub-operators that the main operator depends on automatically using the sub-custom resource definition of each respective sub-operator of the set of sub-operators.
- 16 . The computer program product of claim 15 , wherein the program instructions further cause the computer to: detect, using the management role of the main operator, that the custom resource definition corresponding to the main operator was updated to the new version; perform, using the management role of the main operator, the analysis of the custom resource definition corresponding to the main operator that was updated to the new version; and determine, using the management role of the main operator, whether the current version of the main operator matches the main operator version identified in the new version of the custom resource definition based on the analysis of the custom resource definition.
- 17 . The computer program product of claim 15 , wherein the program instructions further cause the computer to: apply, using the management role of the main operator, a new catalog source file to the main operator to automatically upgrade the main operator to the main operator version identified in the new version of the custom resource definition in response to determining that the current version of the main operator does not match the main operator version identified in the new version of the custom resource definition based on the analysis of the custom resource definition corresponding to the main operator; and update, using the management role of the main operator, a channel in a subscription of the main operator with the main operator version identified in the new version of the custom resource definition.
- 18 . The computer program product of claim 15 , wherein the program instructions further cause the computer to: manage, using the function role of the main operator, a set of components of an application that provides a set of services corresponding to the main operator and the set of sub-operators that the main operator depends on; and record, using the function role of the main operator, a status of the main operator in an operator status configuration map.
- 19 . The computer program product of claim 15 , wherein the program instructions further cause the computer to: monitor, using the management role of the main operator, a status of each respective sub-operator of the set of sub-operators that the main operator depends on in an operator status configuration map; and determine, using the management role of the main operator, whether a sub-operator of the set of sub-operators that the main operator depends on is in a ready for delete status based on monitoring the status of each respective sub-operator in the operator status configuration map.
- 20 . The computer program product of claim 19 , wherein the program instructions further cause the computer to: delete, using the management role of the main operator, a sub-custom resource definition corresponding to the sub-operator of the set of sub-operators that is in the ready for delete status in response to determining that the sub-operator of the set of sub-operators that the main operator depends on is in the ready for delete status based on the monitoring of the status of each respective sub-operator in the operator status configuration map; and delete, using the management role of the main operator, the sub-operator of the set of sub-operators that is in the ready for delete status by deleting a sub-subscription and cluster service version corresponding to the sub-operator.
Description
BACKGROUND The disclosure relates generally to container-based environments and more specifically to managing operators in a container-based environment. A container-based environment, architecture, platform, or the like, such as, for example, Kubernetes® (a registered trademark of the Linux Foundation of San Francisco, CA, USA), provides a structural design for automating deployment, scaling, and operations of containers across host nodes. A host node is a machine, either physical or virtual, where containers (i.e., applications) are deployed. A container is a version of a container image and is ready to run as an application corresponding to a service. The container includes the environment for the application to run (e.g., file systems, environment variables, port mappings, and the like). A resource in a container-based environment stores a set of application programming interface (API) objects of a certain kind (e.g., a built-in pod resource contains a set of pod objects). A custom resource enables a user to create API objects. A custom resource allows the user to extend capabilities of a container-based environment beyond the default installation by adding any kind of API object useful to an application. In other words, a custom resource represents a customization of a particular container-based environment installation. A custom resource definition defines a custom resource. Custom resources can appear and disappear in a running cluster of host nodes through dynamic registration, and cluster administrators can update custom resources independently of the cluster itself. A computer instruction describes an operation. For example, an operator issues a specific instruction to a computer to carry out an operation on one or more operands. An operand is the part of a computer instruction which specifies what data is to be manipulated or operated on, while at the same time representing the data. SUMMARY According to one illustrative embodiment, a computer-implemented method for providing self-managed operators is provided. In response to a computer, using a management role of a main operator, determining that a current version of the main operator does match a main operator version identified in a new version of a custom resource definition corresponding to the main operator based on an analysis of the custom resource definition, the computer, using the management role of the main operator, selects a set of sub-operators that the main operator depends on from a plurality of predefined sub-operators based on the analysis of the new version of the custom resource definition. The computer, using a function role of the main operator, generates a sub-custom resource definition for each respective sub-operator of the set of sub-operators that the main operator depends on based on the new version of the custom resource definition corresponding to the main operator. The computer, using the management role of the main operator, launches the set of sub-operators that the main operator depends on automatically using the sub-custom resource definition of each respective sub-operator of the set of sub-operators. According to other illustrative embodiments, a computer system and computer program product for providing self-managed operators are provided. BRIEF DESCRIPTION OF THE DRAWINGS FIG. 1 is a pictorial representation of a computing environment in which illustrative embodiments may be implemented; FIG. 2 is a diagram illustrating an example of an operator lifecycle management process in accordance with an illustrative embodiment; FIG. 3 is a diagram illustrating an example of a main operator process in accordance with an illustrative embodiment; FIG. 4 is a diagram illustrating an example of an operator status configuration map in accordance with an illustrative embodiment; FIGS. 5A-5B are a diagram illustrating an example of an operator deployment process in accordance with an illustrative embodiment; FIG. 6 is a diagram illustrating an example of a custom resource definition in accordance with an illustrative embodiment; FIG. 7 is a diagram illustrating an example of a main operator permission change in accordance with an illustrative embodiment; FIG. 8 is a diagram illustrating an example of a main operator configuration table in accordance with an illustrative embodiment; FIG. 9 is a diagram illustrating an example of a sub-operator installation process in accordance with an illustrative embodiment; FIGS. 10A-10B are a diagram illustrating an example of a main operator upgrade process in accordance with an illustrative embodiment; FIG. 11 is a diagram illustrating an example of a sub-operator deletion process in accordance with an illustrative embodiment; FIGS. 12A-12B are a flowchart illustrating a process for providing self-managed operators in accordance with an illustrative embodiment; and FIG. 13 is a flowchart illustrating a process for sub-operator deletion in accordance with an illustrative embodiment. DE