Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions operator/cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,14 @@ func main() {
cont, err := controller.NewSkyhookReconciler(
mgr.GetScheme(),
mgr.GetClient(),
mgr.GetEventRecorder("skyhook-controller"),
mgr.GetEventRecorder("nodewright-controller"),
options.SkyhookOperatorOptions)
if err != nil {
setupLog.Error(err, "unable to create controller", "controller", "Skyhook")
setupLog.Error(err, "unable to create controller", "controller", "NodeWright")
os.Exit(1)
}
if err = cont.SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "Skyhook")
setupLog.Error(err, "unable to create controller", "controller", "NodeWright")
os.Exit(1)
}

Expand Down
12 changes: 6 additions & 6 deletions operator/internal/controller/cluster_state_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -909,9 +909,9 @@ func (s *skyhookNodes) UpdateCondition(logger logr.Logger) bool {
byStatus := wrapper.SkyhookReadyConditionStatusGroups(nodeStatuses, nodeNames)

if wrapper.SkyhookReadyConditionMessageTruncated(byStatus) {
logger.WithName("skyhook-ready-condition").Info(
logger.WithName("nodewright-ready-condition").Info(
"Ready condition message truncated; full per-status node lists",
"skyhook", s.skyhook.Name,
"nodewright", s.skyhook.Name,
"complete", byStatus[v1alpha1.StatusComplete],
"inProgress", byStatus[v1alpha1.StatusInProgress],
"blocked", byStatus[v1alpha1.StatusBlocked],
Expand Down Expand Up @@ -1112,7 +1112,7 @@ func (np *NodePicker) updateTaintToleranceCondition(s SkyhookNodes, nodesWithTai
if len(nodesWithTaintTolerationIssue) > 0 {
message := fmt.Sprintf("Node [%s] has taints that are not tolerable. Skipping.", strings.Join(nodesWithTaintTolerationIssue, ", "))
if len(nodesWithTaintTolerationIssue) > wrapper.ReadyConditionNodeListLimit {
np.logger.Info("Condition message truncated for nodes with taint toleration issues", "skyhook", s.GetSkyhook().Name, "nodes", nodesWithTaintTolerationIssue)
np.logger.Info("Condition message truncated for nodes with taint toleration issues", "nodewright", s.GetSkyhook().Name, "nodes", nodesWithTaintTolerationIssue)
message = fmt.Sprintf("%d nodes have taints that are not tolerable. Skipping.", len(nodesWithTaintTolerationIssue))
}

Expand Down Expand Up @@ -1141,7 +1141,7 @@ func (np *NodePicker) updateIgnoredNodesCondition(s SkyhookNodes, ignoredNodes [
if len(ignoredNodes) > 0 {
message := fmt.Sprintf("Node [%s] has ignore label set. Skipping.", strings.Join(ignoredNodes, ", "))
if len(ignoredNodes) > wrapper.ReadyConditionNodeListLimit {
np.logger.Info("Condition message truncated for ignored nodes", "skyhook", s.GetSkyhook().Name, "nodes", ignoredNodes)
np.logger.Info("Condition message truncated for ignored nodes", "nodewright", s.GetSkyhook().Name, "nodes", ignoredNodes)
message = fmt.Sprintf("%d nodes have ignore label set. Skipping.", len(ignoredNodes))
}

Expand Down Expand Up @@ -1563,7 +1563,7 @@ func (skyhook *skyhookNodes) Migrate(logger logr.Logger) error {
}

if err := skyhook.skyhook.Migrate(logger); err != nil {
return fmt.Errorf("error migrating skyhook [%s]: %w", skyhook.skyhook.Name, err)
return fmt.Errorf("error migrating nodewright [%s]: %w", skyhook.skyhook.Name, err)
}

if from == "" { // before this was a thing v0.4.0 and before
Expand All @@ -1587,7 +1587,7 @@ func (skyhook *skyhookNodes) AddCompartment(name string, compartment *wrapper.Co
func (skyhook *skyhookNodes) AddCompartmentNode(name string, node wrapper.SkyhookNode) error {
compartment, ok := skyhook.compartments[name]
if !ok {
return fmt.Errorf("compartment %q not found for skyhook %q - missing deployment policy", name, skyhook.skyhook.Name)
return fmt.Errorf("compartment %q not found for nodewright %q - missing deployment policy", name, skyhook.skyhook.Name)
}
compartment.AddNode(node)
return nil
Expand Down
2 changes: 1 addition & 1 deletion operator/internal/controller/event_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func (h *globalDelayHandler) relevant(ctx context.Context, object client.Object)
case *corev1.Node:
list, err := h.dal.GetSkyhooks(ctx)
if err != nil {
return false, fmt.Errorf("listing skyhooks for node relevance check: %w", err)
return false, fmt.Errorf("listing nodewrights for node relevance check: %w", err)
}
if list == nil {
return false, nil
Expand Down
36 changes: 18 additions & 18 deletions operator/internal/controller/skyhook_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ func NewSkyhookReconciler(schema *runtime.Scheme, c client.Client, recorder even

err := opts.Validate()
if err != nil {
return nil, fmt.Errorf("invalid skyhook operator options: %w", err)
return nil, fmt.Errorf("invalid nodewright operator options: %w", err)
}

return &SkyhookReconciler{
Expand Down Expand Up @@ -373,7 +373,7 @@ func (r *SkyhookReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct
skyhooks, err := r.dal.GetSkyhooks(ctx)
if err != nil {
// error, going to requeue and backoff
logger.Error(err, "error getting skyhooks")
logger.Error(err, "error getting nodewrights")
return ctrl.Result{}, err
}

Expand Down Expand Up @@ -555,7 +555,7 @@ func (r *SkyhookReconciler) processSkyhooksPerNode(ctx context.Context, clusterS
}
hasWork, err := skyhook.HasUninstallWork()
if err != nil {
errs = append(errs, fmt.Errorf("error checking uninstall work for skyhook %s: %w", skyhook.GetSkyhook().Name, err))
errs = append(errs, fmt.Errorf("error checking uninstall work for nodewright %s: %w", skyhook.GetSkyhook().Name, err))
continue
}
if skyhook.IsComplete() && !hasWork {
Expand All @@ -565,7 +565,7 @@ func (r *SkyhookReconciler) processSkyhooksPerNode(ctx context.Context, clusterS
// Check if any nodes are ready for this skyhook
ready, err := hasReadyNodesForSkyhook(skyhook, clusterState.skyhooks)
if err != nil {
errs = append(errs, fmt.Errorf("error checking ready nodes for skyhook %s: %w", skyhook.GetSkyhook().Name, err))
errs = append(errs, fmt.Errorf("error checking ready nodes for nodewright %s: %w", skyhook.GetSkyhook().Name, err))
continue
}
if !ready {
Expand All @@ -574,7 +574,7 @@ func (r *SkyhookReconciler) processSkyhooksPerNode(ctx context.Context, clusterS

res, err := r.RunSkyhookPackages(ctx, clusterState, nodePicker, skyhook)
if err != nil {
logger.Error(err, "error processing skyhook", "skyhook", skyhook.GetSkyhook().Name)
logger.Error(err, "error processing nodewright", "nodewright", skyhook.GetSkyhook().Name)
errs = append(errs, err)
}
if res != nil {
Expand Down Expand Up @@ -631,11 +631,11 @@ func (r *SkyhookReconciler) HandleMigrations(ctx context.Context, clusterState *

err := skyhook.Migrate(logger)
if err != nil {
return false, fmt.Errorf("error migrating skyhook [%s]: %w", skyhook.GetSkyhook().Name, err)
return false, fmt.Errorf("error migrating nodewright [%s]: %w", skyhook.GetSkyhook().Name, err)
}

if err := skyhook.GetSkyhook().NodeWright.Validate(); err != nil {
return false, fmt.Errorf("error validating skyhook [%s]: %w", skyhook.GetSkyhook().Name, err)
return false, fmt.Errorf("error validating nodewright [%s]: %w", skyhook.GetSkyhook().Name, err)
}

// MIGRATION-SHIM: rollback-safe legacy cleanup. skyhook.Migrate above adopts
Expand Down Expand Up @@ -672,7 +672,7 @@ func (r *SkyhookReconciler) HandleMigrations(ctx context.Context, clusterState *
// the legacy skyhook.nvidia.com labels.
hadLegacyWorkloads, workloadsChanged, err := r.reconcileLegacyLabeledWorkloads(ctx, nw, prune)
if err != nil {
return false, fmt.Errorf("error reconciling legacy-labeled workloads for skyhook [%s]: %w", skyhook.GetSkyhook().Name, err)
return false, fmt.Errorf("error reconciling legacy-labeled workloads for nodewright [%s]: %w", skyhook.GetSkyhook().Name, err)
}
if workloadsChanged {
updates = true
Expand All @@ -683,7 +683,7 @@ func (r *SkyhookReconciler) HandleMigrations(ctx context.Context, clusterState *
// additionally it needs to be an update, a patch nils out the annotations for some reason, which the save function does a patch

if err = r.Status().Update(ctx, skyhook.GetSkyhook().NodeWright); err != nil {
return false, fmt.Errorf("error updating during migration skyhook status [%s]: %w", skyhook.GetSkyhook().Name, err)
return false, fmt.Errorf("error updating during migration nodewright status [%s]: %w", skyhook.GetSkyhook().Name, err)
}

// because of conflict issues (409) we need to do things a bit differently here.
Expand All @@ -695,15 +695,15 @@ func (r *SkyhookReconciler) HandleMigrations(ctx context.Context, clusterState *

newskyhook, err := r.dal.GetSkyhook(ctx, skyhook.GetSkyhook().Name)
if err != nil {
return false, fmt.Errorf("error getting skyhook to migrate [%s]: %w", skyhook.GetSkyhook().Name, err)
return false, fmt.Errorf("error getting nodewright to migrate [%s]: %w", skyhook.GetSkyhook().Name, err)
}
newPatch := client.MergeFrom(newskyhook.DeepCopy())

// set version
wrapper.NewSkyhookWrapper(newskyhook).SetVersion()

if err = r.Patch(ctx, newskyhook, newPatch); err != nil {
return false, fmt.Errorf("error updating during migration skyhook [%s]: %w", skyhook.GetSkyhook().Name, err)
return false, fmt.Errorf("error updating during migration nodewright [%s]: %w", skyhook.GetSkyhook().Name, err)
}

updates = true
Expand Down Expand Up @@ -789,7 +789,7 @@ func (r *SkyhookReconciler) reconcileLegacyLabeledWorkloads(ctx context.Context,
pods := &corev1.PodList{}
if err := r.List(ctx, pods, client.InNamespace(r.opts.Namespace),
client.MatchingLabels{legacyNameLabel: skyhookName}); err != nil {
return false, false, fmt.Errorf("listing legacy-labeled pods for skyhook [%s]: %w", skyhookName, err)
return false, false, fmt.Errorf("listing legacy-labeled pods for nodewright [%s]: %w", skyhookName, err)
}
if len(pods.Items) > 0 {
hadLegacy = true
Expand Down Expand Up @@ -826,7 +826,7 @@ func (r *SkyhookReconciler) reconcileLegacyLabeledWorkloads(ctx context.Context,
cms := &corev1.ConfigMapList{}
if err := r.List(ctx, cms, client.InNamespace(r.opts.Namespace),
client.MatchingLabels{labelKey: skyhookName}); err != nil {
return false, false, fmt.Errorf("listing legacy-labeled configmaps by [%s] for skyhook [%s]: %w", labelKey, skyhookName, err)
return false, false, fmt.Errorf("listing legacy-labeled configmaps by [%s] for nodewright [%s]: %w", labelKey, skyhookName, err)
}
for i := range cms.Items {
cm := &cms.Items[i]
Expand Down Expand Up @@ -1112,7 +1112,7 @@ func (r *SkyhookReconciler) TrackReboots(ctx context.Context, clusterState *clus
updates = true
err := r.Status().Update(ctx, skyhook.GetSkyhook().NodeWright)
if err != nil {
errs = append(errs, fmt.Errorf("error updating skyhook status after reboot [%s]: %w", skyhook.GetSkyhook().Name, err))
errs = append(errs, fmt.Errorf("error updating nodewright status after reboot [%s]: %w", skyhook.GetSkyhook().Name, err))
}
}
}
Expand Down Expand Up @@ -1904,7 +1904,7 @@ func (r *SkyhookReconciler) HandleFinalizer(ctx context.Context, skyhook Skyhook
controllerutil.AddFinalizer(skyhook.GetSkyhook().NodeWright, SkyhookFinalizer)

if err := r.Update(ctx, skyhook.GetSkyhook().NodeWright); err != nil {
return false, fmt.Errorf("error updating skyhook to add finalizer: %w", err)
return false, fmt.Errorf("error updating nodewright to add finalizer: %w", err)
}
}
} else { // being deleted
Expand Down Expand Up @@ -2076,12 +2076,12 @@ func (r *SkyhookReconciler) HandleFinalizer(ctx context.Context, skyhook Skyhook
// re-triggering add-finalizer logic.)
skyhook.GetSkyhook().Status.ObservedGeneration = skyhook.GetSkyhook().Status.ObservedGeneration + 1
if err := r.Status().Update(ctx, skyhook.GetSkyhook().NodeWright); err != nil {
return false, fmt.Errorf("error updating skyhook status: %w", err)
return false, fmt.Errorf("error updating nodewright status: %w", err)
}

controllerutil.RemoveFinalizer(skyhook.GetSkyhook().NodeWright, SkyhookFinalizer)
if err := r.Update(ctx, skyhook.GetSkyhook().NodeWright); err != nil {
return false, fmt.Errorf("error updating skyhook removing finalizer: %w", err)
return false, fmt.Errorf("error updating nodewright removing finalizer: %w", err)
}

return true, nil
Expand Down Expand Up @@ -2409,7 +2409,7 @@ func (r *SkyhookReconciler) ValidateNodeConfigmaps(ctx context.Context, skyhookN
// Ensure packages.json is present and up-to-date for expected configmaps
skyhookCR, err := r.dal.GetSkyhook(ctx, skyhookName)
if err != nil {
return update, fmt.Errorf("error getting skyhook for metadata validation: %w", err)
return update, fmt.Errorf("error getting nodewright for metadata validation: %w", err)
}
skyhookWrapper := wrapper.NewSkyhookWrapper(skyhookCR)
metadata := NewSkyhookMetadata(r.opts, skyhookWrapper)
Expand Down
2 changes: 1 addition & 1 deletion operator/internal/controller/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ var _ = BeforeSuite(func() {
operator, err = NewSkyhookReconciler(
k8sManager.GetScheme(),
k8sManager.GetClient(),
k8sManager.GetEventRecorder("skyhook-controller"),
k8sManager.GetEventRecorder("nodewright-controller"),
opts,
)
Expect(err).ToNot(HaveOccurred())
Expand Down
4 changes: 2 additions & 2 deletions operator/internal/dal/dal.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (e *dal) GetSkyhook(ctx context.Context, name string, opts ...client.ListOp
if apierrors.IsNotFound(err) {
return nil, nil
}
return nil, fmt.Errorf("error getting skyhook [%s]: %w", name, err)
return nil, fmt.Errorf("error getting nodewright [%s]: %w", name, err)
}

return &skyhook, nil
Expand All @@ -72,7 +72,7 @@ func (e *dal) GetSkyhooks(ctx context.Context, opts ...client.ListOption) (*skyh
if apierrors.IsNotFound(err) {
return nil, nil
}
return nil, fmt.Errorf("error getting skyhooks: %w", err)
return nil, fmt.Errorf("error getting nodewrights: %w", err)
}

if len(skyhook.Items) == 0 {
Expand Down
Loading