Skip to content

Commit fa91428

Browse files
authored
fix repeate set chassis (#3083)
* fix repeate set chassis * fail fast * fix go gmt
1 parent 68a798f commit fa91428

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

pkg/controller/controller.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -782,6 +782,10 @@ func (c *Controller) Run(ctx context.Context) {
782782
util.LogFatalAndExit(err, "failed to initialize ovn resources")
783783
}
784784

785+
if err := c.initNodeChassis(); err != nil {
786+
util.LogFatalAndExit(err, "failed to initialize node chassis")
787+
}
788+
785789
// sync ip crd before initIPAM since ip crd will be used to restore vm and statefulset pod in initIPAM
786790
if err := c.initSyncCrdIPs(); err != nil {
787791
util.LogFatalAndExit(err, "failed to sync crd ips")
@@ -791,10 +795,6 @@ func (c *Controller) Run(ctx context.Context) {
791795
util.LogFatalAndExit(err, "failed to initialize ipam")
792796
}
793797

794-
if err := c.initNodeChassis(); err != nil {
795-
util.LogFatalAndExit(err, "failed to initialize node chassis")
796-
}
797-
798798
if err := c.initNodeRoutes(); err != nil {
799799
util.LogFatalAndExit(err, "failed to initialize node routes")
800800
}

pkg/controller/init.go

+8
Original file line numberDiff line numberDiff line change
@@ -853,6 +853,14 @@ func (c *Controller) initNodeChassis() error {
853853
for _, node := range nodes {
854854
chassisName := node.Annotations[util.ChassisAnnotation]
855855
if chassisName != "" {
856+
existChasisId, err := c.ovnLegacyClient.GetChassis(node.Name)
857+
if err != nil {
858+
klog.Errorf("failed to get chassis id: %v", err)
859+
return err
860+
}
861+
if existChasisId == chassisName {
862+
continue
863+
}
856864
exist, err := c.ovnLegacyClient.ChassisExist(chassisName)
857865
if err != nil {
858866
klog.Errorf("failed to check chassis exist: %v", err)

pkg/speaker/subnet.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ func (c *Controller) syncSubnetRoutes() {
9696
}
9797
}
9898

99-
klog.V(5).Infof("expected announce ipv4 routes %v\n,ipv6 route %v", bgpExpected[kubeovnv1.ProtocolIPv4], bgpExpected[kubeovnv1.ProtocolIPv6])
99+
klog.V(5).Infof("expected announce ipv4 routes: %v, ipv6 routes: %v", bgpExpected[kubeovnv1.ProtocolIPv4], bgpExpected[kubeovnv1.ProtocolIPv6])
100100

101101
fn := func(d *bgpapi.Destination) {
102102
for _, path := range d.Paths {

0 commit comments

Comments
 (0)