Skip to content

Commit

Permalink
feat(env-check): remove env check condition when host OS is unsupported
Browse files Browse the repository at this point in the history
longhorn/longhorn-10019

Signed-off-by: Raphanus Lo <[email protected]>
(cherry picked from commit a27e0ba)
  • Loading branch information
COLDTURNIP committed Dec 25, 2024
1 parent 87ad1cb commit f1df1d4
Showing 1 changed file with 1 addition and 41 deletions.
42 changes: 1 addition & 41 deletions controller/monitor/environment_check_monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"github.com/jinzhu/copier"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"

"k8s.io/apimachinery/pkg/util/wait"

corev1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -211,9 +210,7 @@ func (m *EnvironmentCheckMonitor) syncPackagesInstalled(kubeNode *corev1.Node, n
packageProbeExecutables["sys-fs/cryptsetup"] = "cryptsetup"
packageProbeExecutables["sys-fs/lvm2"] = "dmsetup"
default:
collectedData.conditions = types.SetCondition(collectedData.conditions, longhorn.NodeConditionTypeRequiredPackages, longhorn.ConditionStatusFalse,
string(longhorn.NodeConditionReasonUnknownOS),
fmt.Sprintf("Unable to verify the required packages because the OS image '%v' is unknown to the Longhorn system. Please ensure the required packages are installed.", osImage))
// unsupported host platform, skip environment check condition
return
}

Expand Down Expand Up @@ -331,8 +328,6 @@ func (m *EnvironmentCheckMonitor) syncMultipathd(namespaces []lhtypes.Namespace,
collectedData.conditions = types.SetCondition(collectedData.conditions, longhorn.NodeConditionTypeMultipathd, longhorn.ConditionStatusTrue, "", "")
}

<<<<<<< HEAD
=======
func (m *EnvironmentCheckMonitor) checkPackageInstalled(packageProbeExecutables map[string]string, namespaces []lhtypes.Namespace) (installed, notInstalled []string, err error) {
nsexec, err := lhns.NewNamespaceExecutor(lhtypes.ProcessNone, lhtypes.HostProcDirectory, namespaces)
if err != nil {
Expand All @@ -351,41 +346,6 @@ func (m *EnvironmentCheckMonitor) checkPackageInstalled(packageProbeExecutables
return installed, notInstalled, nil
}

func (m *EnvironmentCheckMonitor) checkHugePages(kubeNode *corev1.Node, collectedData *CollectedEnvironmentCheckInfo) {
hugePageLimitInMiB, err := m.ds.GetSettingAsInt(types.SettingNameV2DataEngineHugepageLimit)
if err != nil {
m.logger.Debugf("Failed to fetch v2-data-engine-hugepage-limit setting, using default value: %d", 2048)
hugePageLimitInMiB = 2048
}

capacity := kubeNode.Status.Capacity
hugepages2MiCapacity := capacity["hugepages-2Mi"]
if hugepages2MiCapacity.IsZero() {
collectedData.conditions = types.SetCondition(collectedData.conditions, longhorn.NodeConditionTypeHugePagesAvailable, longhorn.ConditionStatusFalse,
string(longhorn.NodeConditionReasonHugePagesNotConfigured),
"HugePages (2Mi) are not configured",
)
return
}

requiredHugePages := resource.NewQuantity(int64(hugePageLimitInMiB*util.MiB), resource.BinarySI)
if hugepages2MiCapacity.Cmp(*requiredHugePages) < 0 {
collectedData.conditions = types.SetCondition(collectedData.conditions, longhorn.NodeConditionTypeHugePagesAvailable, longhorn.ConditionStatusFalse,
string(longhorn.NodeConditionReasonInsufficientHugePages),
fmt.Sprintf("Insufficient HugePages (2Mi): Required %s, Capacity %s", requiredHugePages.String(), hugepages2MiCapacity.String()))
return
}

collectedData.conditions = types.SetCondition(
collectedData.conditions,
longhorn.NodeConditionTypeHugePagesAvailable,
longhorn.ConditionStatusTrue,
"",
"HugePages (2Mi) are properly configured",
)
}

>>>>>>> 1d6fc2c0 (feat(env-check): check package installation without system package manager)
func (m *EnvironmentCheckMonitor) checkKernelModulesLoaded(kubeNode *corev1.Node, isV2DataEngine bool, collectedData *CollectedEnvironmentCheckInfo) {
modulesToCheck := make(map[string]string)
for k, v := range kernelModules {
Expand Down

0 comments on commit f1df1d4

Please sign in to comment.