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

add app installer to sealer run #1764

Merged
merged 4 commits into from
Oct 11, 2022

Conversation

kakaZhou719
Copy link
Member

@kakaZhou719 kakaZhou719 commented Oct 9, 2022

Describe what this PR does / why we need it

  1. add app installer to sealer run after runtime reconstructing
  2. rename package name from guest to application .
  3. bugfix for kubeadm config vendor files

Does this pull request fix one issue?

Describe how you did it

Describe how to verify it

Special notes for reviews

@codecov-commenter
Copy link

codecov-commenter commented Oct 9, 2022

Codecov Report

Base: 19.89% // Head: 19.77% // Decreases project coverage by -0.12% ⚠️

Coverage data is based on head (29820b4) compared to base (a20019a).
Patch coverage: 3.94% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1764      +/-   ##
==========================================
- Coverage   19.89%   19.77%   -0.13%     
==========================================
  Files          69       69              
  Lines        6478     6524      +46     
==========================================
+ Hits         1289     1290       +1     
- Misses       5012     5057      +45     
  Partials      177      177              
Impacted Files Coverage Δ
pkg/cluster-runtime/installer.go 0.00% <0.00%> (ø)
pkg/clusterfile/decoder.go 43.24% <ø> (ø)
pkg/runtime/kubernetes/kubeadm/kubeadm_config.go 15.78% <0.00%> (ø)
utils/decode.go 0.00% <ø> (ø)
pkg/infradriver/ssh_infradriver.go 37.50% <60.00%> (-0.08%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@@ -19,6 +19,9 @@ import (
"io/ioutil"
"path/filepath"

imagecommon "github.com/sealerio/sealer/pkg/define/options"
Copy link
Collaborator

Choose a reason for hiding this comment

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

usually, there should be three groups separated by blank for go-imports

  1. the golang official package
  2. the package for the current project
  3. the others

func (i *Installer) Install() error {
var (
masters = i.infraDriver.GetHostIPListByRole(common.MASTER)
master0 = masters[0]
Copy link
Collaborator

Choose a reason for hiding this comment

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

what if the length of masters is equal with zero?

Copy link
Member Author

Choose a reason for hiding this comment

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

the length of masters will not equal to zero during the installation process, that's because we set default master role in the beginning which was got from user input.

workers = getWorkerIPList(i.infraDriver)
all = append(masters, workers...)
image = i.infraDriver.GetClusterImageName()
launchCmds = i.infraDriver.GetClusterLaunchCmds()
Copy link
Collaborator

@starnop starnop Oct 10, 2022

Choose a reason for hiding this comment

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

if these codes not only for install cluster, it's prefer to use clusterLaunchCmds instead of launchCmds

if err := i.runClusterHook(master0, PostInstallCluster); err != nil {
return nil, nil, err
}
func (i *Installer) installApp(master0 net.IP, cmds []string) error {
Copy link
Collaborator

Choose a reason for hiding this comment

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

what's the reason for the master0 IP is needed here for install application

In fact, we should allow the application image to be deployed on either node

Copy link
Member Author

Choose a reason for hiding this comment

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

agree with you, application image should to be deployed on any master node. here i just chose master0 to execute launch cmds. Do we have some scenarios that require this execute node?

if err != nil {
return fmt.Errorf("failed to install application: %s", err)
}
} else {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Where will the CMDS defined in the old image be executed?

Copy link
Member Author

Choose a reason for hiding this comment

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

got it from image extension.Launch.Cmds

if err != nil {
return nil, err
}
func NewImageMounter(imageEngine imageengine.Interface, hostsPlatform map[v1.Platform][]net.IP) (*ImagerMounter, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nice job 👍

Make each method as atomized as possible, and we can use unit-test availability as a measure

@@ -81,7 +82,8 @@ func NewInfraDriver(cluster *v2.Cluster) (InfraDriver, error) {
var err error
ret := &SSHInfraDriver{
clusterName: cluster.Name,
clusterImagerName: cluster.Spec.Image,
clusterImageName: cluster.Spec.Image,
Copy link
Collaborator

Choose a reason for hiding this comment

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

It's confusing here, what's the meaning of clusterImageName and will there be appImageName in the future?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, its a string value that just represent the name of this clusterimage to launch.

@kakaZhou719 kakaZhou719 force-pushed the add-app-installer-to-run branch from 2db3152 to 29820b4 Compare October 10, 2022 13:27
Copy link
Collaborator

@VinceCui VinceCui left a comment

Choose a reason for hiding this comment

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

LGTM

kakzhou719 added 2 commits October 11, 2022 17:04
@kakaZhou719 kakaZhou719 force-pushed the add-app-installer-to-run branch from 29820b4 to 7f3ac7f Compare October 11, 2022 09:04
@kakaZhou719 kakaZhou719 merged commit 5da0546 into sealerio:main Oct 11, 2022
@kakaZhou719 kakaZhou719 deleted the add-app-installer-to-run branch October 11, 2022 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants