Skip to content

Commit 3b9b475

Browse files
committed
chore: remove legacy kube-init and default to CNI state
Signed-off-by: Evan Baker <[email protected]>
1 parent 1594ec2 commit 3b9b475

File tree

3 files changed

+5
-154
lines changed

3 files changed

+5
-154
lines changed

cns/cnireconciler/version.go

Lines changed: 0 additions & 42 deletions
This file was deleted.

cns/cnireconciler/version_test.go

Lines changed: 0 additions & 76 deletions
This file was deleted.

cns/service/main.go

Lines changed: 5 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -838,25 +838,10 @@ func main() {
838838
return
839839
}
840840

841-
// We might be configured to reinitialize state from the CNI instead of the apiserver.
842-
// If so, we should check that the CNI is new enough to support the state commands,
843-
// otherwise we fall back to the existing behavior.
844-
if cnsconfig.InitializeFromCNI {
845-
var isGoodVer bool
846-
isGoodVer, err = cnireconciler.IsDumpStateVer()
847-
if err != nil {
848-
logger.Errorf("error checking CNI ver: %v", err)
849-
}
850-
851-
// override the prior config flag with the result of the ver check.
852-
cnsconfig.InitializeFromCNI = isGoodVer
853-
854-
if cnsconfig.InitializeFromCNI {
855-
// Set the PodInfoVersion by initialization type, so that the
856-
// PodInfo maps use the correct key schema
857-
cns.GlobalPodInfoScheme = cns.InterfaceIDPodInfoScheme
858-
}
859-
}
841+
// By default reinitialize state from the CNI.
842+
// Set the PodInfoVersion by initialization type, so that the
843+
// PodInfo maps use the correct key schema
844+
cns.GlobalPodInfoScheme = cns.InterfaceIDPodInfoScheme
860845
// If cns manageendpointstate is true, then cns maintains its own state and reconciles from it.
861846
// in this case, cns maintains state with containerid as key and so in-memory cache can lookup
862847
// and update based on container id.
@@ -1677,29 +1662,13 @@ func getPodInfoByIPProvider(
16771662
return podInfoByIPProvider, errors.Wrap(err, "failed to create CNS PodInfoProvider")
16781663
}
16791664
}
1680-
case cnsconfig.InitializeFromCNI:
1665+
default:
16811666
logger.Printf("Initializing from CNI")
16821667
podInfoByIPProvider, err = cnireconciler.NewCNIPodInfoProvider()
16831668
if err != nil {
16841669
return podInfoByIPProvider, errors.Wrap(err, "failed to create CNI PodInfoProvider")
16851670
}
1686-
default:
1687-
logger.Printf("Initializing from Kubernetes")
1688-
podInfoByIPProvider = cns.PodInfoByIPProviderFunc(func() (map[string]cns.PodInfo, error) {
1689-
pods, err := clientset.CoreV1().Pods("").List(ctx, metav1.ListOptions{ //nolint:govet // ignore err shadow
1690-
FieldSelector: "spec.nodeName=" + nodeName,
1691-
})
1692-
if err != nil {
1693-
return nil, errors.Wrap(err, "failed to list Pods for PodInfoProvider")
1694-
}
1695-
podInfo, err := cns.KubePodsToPodInfoByIP(pods.Items)
1696-
if err != nil {
1697-
return nil, errors.Wrap(err, "failed to convert Pods to PodInfoByIP")
1698-
}
1699-
return podInfo, nil
1700-
})
17011671
}
1702-
17031672
return podInfoByIPProvider, nil
17041673
}
17051674

0 commit comments

Comments
 (0)