Remove check for cri-o drop-in files
An upgrade from 4.5 to 4.6 will no longer need the logic
that checks whether we are moving from crio.conf to using
crio.conf.d (drop-in files). 4.5 is already using drop-in
files for configuring cri-o fields.
@@ -481,17 +481,8 @@ func (ctrl *Controller) syncContainerRuntimeConfig(key string) error {
// If we have seen this generation and the sync didn't fail, then skip
if cfg.Status.ObservedGeneration >= cfg.Generation && cfg.Status.Conditions[len(cfg.Status.Conditions)-1].Type == mcfgv1.ContainerRuntimeConfigSuccess {
- // This is the scenario for upgrades where we are moving from crio.conf to crio.conf.d
- // this can be removed in the next release
- fromOldCrio, err := ctrl.isUpdatingFromOldCRIOConf(cfg)
- if err != nil {
- return fmt.Errorf("error checking if we are updating from crio.conf: %v", err)
- }
- // We want to trigger a resync if we are updating from a version where crio.conf.d didn't exist
- if !fromOldCrio {
return nil
}
- }
// Validate the ContainerRuntimeConfig CR
if err := validateUserContainerRuntimeConfig(cfg); err != nil {
@@ -912,39 +903,3 @@ func (ctrl *Controller) getPoolsForContainerRuntimeConfig(config *mcfgv1.Contain
return pools, nil
}
-
-// isUpdatingFromOldCRIOConf returns true if the mc associated with cfg has /etc/crio/crio.conf as
-// its file path.
-func (ctrl *Controller) isUpdatingFromOldCRIOConf(cfg *mcfgv1.ContainerRuntimeConfig) (bool, error) {
- mcpPools, err := ctrl.getPoolsForContainerRuntimeConfig(cfg)
- if err != nil {
- return false, fmt.Errorf("could not get list of machine config pools: %v", err)
- }
- if len(mcpPools) == 0 {
- return false, nil
- }
-
- for _, pool := range mcpPools {
- managedKey, err := getManagedKeyCtrCfg(pool, ctrl.client)
- if err != nil {
- return false, err
- }
- mc, err := ctrl.client.MachineconfigurationV1().MachineConfigs().Get(context.TODO(), managedKey, metav1.GetOptions{})
- if err != nil && !errors.IsNotFound(err) {
- return false, fmt.Errorf("could not get mc with name %q: %v", managedKey, err)
- }
- if mc.Spec.Config.Raw != nil {
- conf, err := ctrlcommon.ParseAndConvertConfig(mc.Spec.Config.Raw)
- if err != nil {
- return false, fmt.Errorf("error parsing ignition: %v", err)
- }
- // If the filepath matches /etc/crio/crio.conf return true
- for _, file := range conf.Storage.Files {
- if file.Path == "/etc/crio/crio.conf" {
- return true, nil
- }
- }
- }
- }
- return false, nil
-}
