1
0
mirror of https://github.com/rancher/os.git synced 2025-09-08 02:01:27 +00:00

Various fixes

This commit is contained in:
Darren Shepherd
2021-10-22 23:22:09 -07:00
parent 06fc7fc32e
commit b00581c2d7
14 changed files with 189 additions and 103 deletions

View File

@@ -2,6 +2,7 @@ package managedos
import (
"context"
"fmt"
"github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1"
provv1 "github.com/rancher/os2/pkg/apis/rancheros.cattle.io/v1"
@@ -71,6 +72,10 @@ func (h *handler) OnChange(mos *provv1.ManagedOSImage, status provv1.ManagedOSIm
return nil, status, err
}
if mos.Namespace == "fleet-local" && len(mos.Spec.Targets) > 0 {
return nil, status, fmt.Errorf("spec.targets should be empty if in the fleet-local namespace")
}
bundle := &v1alpha1.Bundle{
ObjectMeta: metav1.ObjectMeta{
Name: name.SafeConcatName("mos", mos.Name),
@@ -79,12 +84,15 @@ func (h *handler) OnChange(mos *provv1.ManagedOSImage, status provv1.ManagedOSIm
Spec: v1alpha1.BundleSpec{
Resources: resources,
BundleDeploymentOptions: v1alpha1.BundleDeploymentOptions{},
Paused: mos.Spec.Paused,
RolloutStrategy: mos.Spec.ClusterRolloutStrategy,
Targets: mos.Spec.Targets,
},
}
if mos.Namespace == "fleet-local" {
bundle.Spec.Targets = []v1alpha1.BundleTarget{{ClusterName: "local"}}
}
status, err = h.updateStatus(status, bundle)
return []runtime.Object{
bundle,