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

Proposal: OpenYurt Convertor Operator for converting K8S to OpenYurt #389

Merged
merged 1 commit into from
Jul 29, 2021

Conversation

gnunu
Copy link
Member

@gnunu gnunu commented Jul 22, 2021

Signed-off-by: nunu shaoqiang.chen@intel.com

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespace from that line:
/kind bug
/kind documentation
/kind enhancement
/kind good-first-issue
/kind feature
/kind question
/kind design
/sig ai
/sig iot
/sig network
/sig storage
/sig storage

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?


other Note

@openyurt-bot
Copy link
Collaborator

@gnunu: GitHub didn't allow me to assign the following users: your_reviewer.

Note that only openyurtio members, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time.
For more information please see the contributor guide

In response to this:

Signed-off-by: nunu shaoqiang.chen@intel.com

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespace from that line:
/kind bug
/kind documentation
/kind enhancement
/kind good-first-issue
/kind feature
/kind question
/kind design
/sig ai
/sig iot
/sig network
/sig storage
/sig storage

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?


other Note

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.

@openyurt-bot openyurt-bot added the size/L size/L: 100-499 label Jul 22, 2021
@gnunu
Copy link
Member Author

gnunu commented Jul 22, 2021

/assign @yixingjia

@gnunu
Copy link
Member Author

gnunu commented Jul 22, 2021

/kind feature

@openyurt-bot openyurt-bot added the kind/feature kind/feature label Jul 22, 2021
@gnunu
Copy link
Member Author

gnunu commented Jul 22, 2021

/assign @rambohe-ch


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.

The controller would maintain a ConfigMap to record conversion/reversion rules, for esay recovery from issues and maintaining idempotence.
Copy link
Member

Choose a reason for hiding this comment

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

Can you explain the details about the rules saved in the ConfigMap?

CRD's definition:

// YurtconvertorSpec defines the desired state of Yurtconvertor
type YurtconvertorSpec struct {
Copy link
Member

@Fei-Guo Fei-Guo Jul 22, 2021

Choose a reason for hiding this comment

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

The "YurtConvertor" does not sound like a CRD name for declaring a "state". How about "YurtCluster"?

The CRD SPEC should include CloudNodes[] and EdgeNodes[]. Convert and Revert are actions, not states. The controller should figure out the nodes that need to be reverted, hence we don't need the Revert array in the Spec.

To describe the Cloud/Edge Node lists, we can try the following struct

type YurtClusterSpec struct{
       // optional
       CloudNodes ItemList
       // optional
       EdgeNodes ItemList

       TunnelService    ComponentConfig    
       AppManager  ComponentConfig
}

// You may consider different configs for Tunnel and AppManager separately to 
// allow customization for each component
type ComponentConfig{
    Enable bool 
    Version string
}


type ItemList {
     //optional
     Names []string
     //optional
     Pattern string // For regular expression
     //optional
     ExcludedNames []string
     //optional
     ExcludedPattern string 
} 

It seems that user only needs to specify either CloudNodes or EdgeNodes, not both.
Please clarify this point in the Spec comment if it is true.

Reverted []string `json:"reverted,omitempty"`
Excepted []string `json:"excepted,omitempty"`
Failed []string `json:"failed,omitempty"`
}
Copy link
Member

Choose a reason for hiding this comment

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

Please update the Status based on the SPEC modifications suggested above accordingly.
For failed nodes, the names are not enough. We need to expose the error msgs in the Status as well.

@Fei-Guo
Copy link
Member

Fei-Guo commented Jul 22, 2021

Also,please think about the following questions:

  • Should YurtCluster CR be a singleton in each Cluster?
  • What are the controller behaviors when the YurtCluster CR is deleted?

@gnunu
Copy link
Member Author

gnunu commented Jul 23, 2021

Hi Fei,
Very heuristic suggestions. Thanks!
I am going to refine the proposal on data struct and implementaion details such as CR addition (if singleton) and deleteion response.

@liangyuanpeng
Copy link
Member

If the cluster nodes have multiple different deployment methods, what will happen at this time? E.g. kubeadm binary.

And does it mean that there will be two sets of code for convert/revert?

@gnunu
Copy link
Member Author

gnunu commented Jul 23, 2021

If the cluster nodes have multiple different deployment methods, what will happen at this time? E.g. kubeadm binary.

And does it mean that there will be two sets of code for convert/revert?

I think the converted effect is added necessary changes to the node to be an OpenYurt node. If nodes are added through different methods, maybe there would be specific code for each case. This should be transparent to user. The Operator needs do all dirty works necessary. :)

@gnunu
Copy link
Member Author

gnunu commented Jul 25, 2021

Hi @Fei-Guo,
I refined the proposal based on your suggestions. Two points worth mentioning:

  1. Now that CR would be a singleton, the ConfigMap mentioned in the original proposal for merging CRs' requests is not necessary any more.
  2. On CR deletion, the whole cluster would be recovered back to K8S.

Please see if anything is missing.

Thanks!

@gnunu
Copy link
Member Author

gnunu commented Jul 25, 2021

/assign @rambohe-ch

@gnunu
Copy link
Member Author

gnunu commented Jul 26, 2021

the refinement link is here:
54f227d

@gnunu
Copy link
Member Author

gnunu commented Jul 26, 2021

sorry, one more refinement: use camelCase for json tags:
f84094e

@Fei-Guo
Copy link
Member

Fei-Guo commented Jul 26, 2021

Please fix markdownlint error. Overall, LG.

I don't worry the performance too much since the node components installation can be done in parallel. You probably need to maintain an internal state machine to track the covert progress for each node to deal with frequent switches between edge mode and cloud mode for any reason.

@rambohe-ch Please take a look as well.

@gnunu
Copy link
Member Author

gnunu commented Jul 27, 2021

Please fix markdownlint error. Overall, LG.

I don't worry the performance too much since the node components installation can be done in parallel. You probably need to maintain an internal state machine to track the covert progress for each node to deal with frequent switches between edge mode and cloud mode for any reason.

@rambohe-ch Please take a look as well.

Thanks Fei!
markdownlint errors fixed.
Really nice mention about cloud-edge transition. It's necessary to design for such corner cases for overall right function and performance.

  • Shaoqiang

### Goals
* Convert nodes automatically
* Revert nodes automatically
* Translated OpenYurt cluster should be the same as through Yurtcutl or doing manually
Copy link
Member

Choose a reason for hiding this comment

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

Yurtcutl --> yurtctl


CRD's definition:

type ComponentConfig struct {
Copy link
Member

@rambohe-ch rambohe-ch Jul 27, 2021

Choose a reason for hiding this comment

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

please define all of structs in code block(please use ```), so definition will be more readable

YurtTunnelVersion ComponentConfig `json:"yurtTunnelVersion,omitempty"`
AppManagerVersion ComponentConfig `json:"appMangerVersion,omitempty"`
ExcludedCloudNodes []string `json:"excludedCloudNodes,omitempty"`
ExcludedEdgeNodes []string `json:"excludedEdgeNodes,omitempty"`
Copy link
Member

@rambohe-ch rambohe-ch Jul 27, 2021

Choose a reason for hiding this comment

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

How about merge ExcludedCloudNodes and ExcludedEdgeNodes as ExcludedNodes filed? because both fields maybe contain same excluded nodes.

}

// YurtClusterSpec defines the desired state of YurtCluster
type YurtClusterSpec struct {
Copy link
Member

Choose a reason for hiding this comment

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

User maybe want to define the version of yurthub and yurt-controller-manager component, how about add fields to define yurthub and yurt-controller-manager?

@rambohe-ch
Copy link
Member

@gnunu please merge all of six commits into one commit.

@gnunu
Copy link
Member Author

gnunu commented Jul 28, 2021

@gnunu please merge all of six commits into one commit.

Hi @rambohe-ch, thanks, have made revision on your suggestions.

will merge all the commits nto one.

@gnunu
Copy link
Member Author

gnunu commented Jul 28, 2021

@Fei-Guo @rambohe-ch,

I created a new pull request, for my bad not created a branch in the first place, sorry!
#395

Signed-off-by: nunu <shaoqiang.chen@intel.com>
@gnunu
Copy link
Member Author

gnunu commented Jul 28, 2021

just pushed the merged proposal.

thanks @rambohe-ch for guide to do this!

@rambohe-ch
Copy link
Member

/lgtm

@openyurt-bot openyurt-bot added the lgtm lgtm label Jul 28, 2021
@rambohe-ch
Copy link
Member

/approve

@openyurt-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gnunu, rambohe-ch

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

The pull request process is described here

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

@openyurt-bot openyurt-bot added the approved approved label Jul 29, 2021
@openyurt-bot openyurt-bot merged commit ee5a032 into openyurtio:master Jul 29, 2021
MrGirl pushed a commit to MrGirl/openyurt that referenced this pull request Mar 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved approved kind/feature kind/feature lgtm lgtm size/L size/L: 100-499
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants