Skip to content

Commit

Permalink
refine the proposal, mainly based on @guofei's suggestions:
Browse files Browse the repository at this point in the history
- change Operator name to YurtCluster
- redefine the data structures
- CR would be singleton
- clarify CR deletion action

Signed-off-by: nunu <shaoqiang.chen@intel.com>
  • Loading branch information
gnunu committed Jul 25, 2021
1 parent d0cf81e commit 54f227d
Showing 1 changed file with 52 additions and 30 deletions.
82 changes: 52 additions & 30 deletions docs/proposals/20210722-openyurt-convertor-operator.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: OpenYurt Convertor Operator
title: YurtCluster Operator
authors:
- "@gnunu"
- "@lindayu17"
Expand Down Expand Up @@ -32,6 +32,7 @@ status: provisional
* [FR1](#fr1)
* [FR2](#fr2)
* [FR3](#fr3)
* [FR4](#fr4)
* [Non-Functional Requirements](#non-functional-requirements)
* [NFR1](#nfr1)
* [NFR2](#nfr2)
Expand All @@ -49,7 +50,7 @@ Refer to the [Cluster API Book Glossary](https://cluster-api.sigs.k8s.io/referen

## Summary

This OpenYurt Convertor Operator is to translate a vanilla Kubernetes cluster into an OpenYurt cluster, through a simple API (YurtConvetor CRD).
This YurtCluster Operator is to translate a vanilla Kubernetes cluster into an OpenYurt cluster, through a simple API (YurtCluster CRD).

## Motivation

Expand All @@ -70,29 +71,46 @@ This is an operator, with CRD and Controller.

CRD's definition:

// YurtconvertorSpec defines the desired state of Yurtconvertor
type YurtconvertorSpec struct {
CloudNodes []string `json:"cloudnodes,omitempty"`
Convert []string `json:"convert,omitempty"`
Revert []string `json:"revert,omitempty"`
Except []string `json:"except,omitempty"`
EnableYurtTunnel bool `json:"enable-yurt-tunnel,omitempty"`
EnableYurtAppManager bool `json:"enable-yurt-app-manager,omitempty"`
YurtTunnelVersion string `json:"yurt-tunnel-version,omitempty"`
YurtAppManagerVersion string `json:"yurt-app-manager-version,omitempty"`
type ComponentConfig struct {
Enabled bool `json:"enebled,omitempty"`
Version string `json:"version,omitempty"`
}

// YurtconvertorStatus defines the observed state of Yurtconvertor
type YurtconvertorStatus struct {
Converted []string `json:"converted,omitempty"`
Reverted []string `json:"reverted,omitempty"`
Excepted []string `json:"excepted,omitempty"`
Failed []string `json:"failed,omitempty"`
type NodeSpec struct {
Names []string `json:"names,omitempty"`
Pattern string `json:"pattern,omitempty"`
ExcludedNames []string `json:"excluded-names,omitempty"`
ExcludedPattern string `json:"excluded-pattern,omitempty"`
}

The controller would listen incomming CRs, and analyze the requirements to figure out user's intention, that is, what nodes to convert, and what nodes to revert.
type FailedNode struct {
Name string `json:"name,omitempty"`
Info string `json:"info,omitempty"`
}

// YurtClusterSpec defines the desired state of YurtCluster
type YurtClusterSpec struct {
CloudNodes NodeSpec `json:"cloud-nodes,omitempty"`
EdgeNodes NodeSpec `json:"edge-nodes,omitempty"`
TunnelServiceVersion ComponentConfig `json:"yurt-tunnel-version,omitempty"`
AppManagerVersion ComponentConfig `json:"app-manger-version,omitempty"`
}

The controller would maintain a ConfigMap to record conversion/reversion rules, for esay recovery from issues and maintaining idempotence.
// YurtClusterStatus defines the observed state of YurtCluster
type YurtClusterStatus struct {
ConvertedCloudNodes []string `json:"converted-cloud-nodes,omitempty"`
ConvertedEdgeNodes []string `json:"converted-edge-nodes,omitempty"`
TunnelServiceVersion ComponentConfig `json:"yurt-tunnel-version,omitempty"`
AppManagerVersion ComponentConfig `json:"app-manger-version,omitempty"`
ExcludedCloudNodes []string `json:"excluded-cloud-nodes,omitempty"`
ExcludedEdgeNodes []string `json:"excluded-edge-nodes,omitempty"`
FailedCloudNodes []FailedNode `json:"failed-cloud-nodes,omitempty"`
FailedEdgeNodes []FailedNode `json:"failed-edge-nodes,omitempty"`
}

The CRD would be enforced to have a cluster singleton CR semantics, through patched name validation for CRD definition. (for kubebuilder, under config/crd/patches)

The controller would listen incomming CR, and analyze the requirements to figure out user's intention, that is, what nodes to convert, and what nodes to revert.

The controller would update status to record converted, reverted, and failed nodes.

Expand All @@ -113,23 +131,27 @@ User should have a Kubernetes cluster setup.

#### Functional Requirements

The Operator would do three things:
1) Merge requests
2) do node conversion
3) do node reversion
The Operator would do these things:
1) Analyze requests
2) Do nodes conversion
3) Do nodes reversion
4) Act on CR deletion

##### FR1
Merge requests:
Through CR, the controller would figure out what nodes to convert, what nodes to revert, and maintain a ConfigMap.
Analyze requests:
Through the YurtCluster CR, the controller would figure out what nodes to convert, what nodes to revert, and if enabling addons like YurtTunel and AppManger.
Th nodes to be converted or reverted can be specified using Regular expressions, the controller would process the nodes set, including those coming in the future.

##### FR2
Convert:
User can issue requests to do conversion. Controller should do conversion automatically.
From the analysis, the controller would know which nodes should be converted and do conversion automatically.

##### FR3
Revet:
User can issue requests to do reversion. Controller should do reversion automatically.
Revert:
From the analysis, the controller would know which nodes should be reverted and do reversion automatically.

##### FR4
On CR deletion, the controller should undo anything done to the original K8S cluster, that is, recover back to the origin point.

#### Non-Functional Requirements

Expand Down Expand Up @@ -159,7 +181,7 @@ manual: user should convert/revert nodes manually.

The Operator supports OpenYurt components upgrade, such as YuntTunnel and AppManager.

For Operator itself, upgrade would have no side effects, idempotent semantics would be kept through the internal ConfigMap.
For Operator itself, upgrade would have no side effects, idempotent semantics would be kept.

## Additional Details

Expand Down

0 comments on commit 54f227d

Please sign in to comment.