mirror of
https://github.com/labring/sealos.git
synced 2026-10-29 17:25:58 +08:00
feat(apply): conditionally append components based on distribution type (#5909)
* feat(apply): conditionally append components based on distribution type Signed-off-by: cuisongliu <cuisongliu@qq.com> * fix(cluster): return nil for rootfs image if image spec is empty Signed-off-by: cuisongliu <cuisongliu@qq.com> --------- Signed-off-by: cuisongliu <cuisongliu@qq.com>
This commit is contained in:
@@ -21,6 +21,8 @@ import (
|
||||
"os"
|
||||
"strconv"
|
||||
|
||||
"github.com/labring/sealos/pkg/runtime/k3s"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"golang.org/x/sync/errgroup"
|
||||
@@ -123,9 +125,12 @@ func (c *Applier) Apply() error {
|
||||
|
||||
func (c *Applier) getWriteBackObjects() []interface{} {
|
||||
obj := []interface{}{c.ClusterDesired}
|
||||
distribution := c.ClusterFile.GetCluster().GetDistribution()
|
||||
if runtimeConfig := c.ClusterFile.GetRuntimeConfig(); runtimeConfig != nil {
|
||||
if components := runtimeConfig.GetComponents(); len(components) > 0 {
|
||||
obj = append(obj, components...)
|
||||
if distribution == k3s.Distribution {
|
||||
obj = append(obj, components...)
|
||||
}
|
||||
}
|
||||
}
|
||||
if configs := c.ClusterFile.GetConfigs(); len(configs) > 0 {
|
||||
|
||||
@@ -109,6 +109,9 @@ func (c *Cluster) GetAllIPS() []string {
|
||||
}
|
||||
|
||||
func (c *Cluster) GetRootfsImage() *MountImage {
|
||||
if c == nil || len(c.Status.Mounts) == 0 {
|
||||
return nil
|
||||
}
|
||||
for _, img := range c.Status.Mounts {
|
||||
if img.IsRootFs() {
|
||||
return &img
|
||||
|
||||
Reference in New Issue
Block a user