-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OCPBUGS-18658: Unify agent install-complete with installer
Removed custom agent wait-for install-complete code. Moved installer WaitForInstallComplete function from cmd/openshift-install/main to cmd/openshift-install/command so that the function can be made public. Modified agent.newWaitForInstallCompleted() to use the common WaitForInstallComplete function. The benefit of moving agent over to the common WaitForInstallComplete function is that the common function has a step to wait for operators to be in a stable state before calling the cluster installation complete.
- Loading branch information
Showing
11 changed files
with
516 additions
and
663 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package command | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/sirupsen/logrus" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/client-go/rest" | ||
|
||
configv1 "github.com/openshift/api/config/v1" | ||
configclient "github.com/openshift/client-go/config/clientset/versioned" | ||
) | ||
|
||
// LogClusterOperatorConditions logs the current status of cluster operators that | ||
// are still becoming Available. | ||
func LogClusterOperatorConditions(ctx context.Context, config *rest.Config) error { | ||
client, err := configclient.NewForConfig(config) | ||
if err != nil { | ||
return fmt.Errorf("creating a config client: %w", err) | ||
} | ||
|
||
operators, err := client.ConfigV1().ClusterOperators().List(ctx, metav1.ListOptions{}) | ||
if err != nil { | ||
return fmt.Errorf("listing ClusterOperator objects: %w", err) | ||
} | ||
|
||
for _, operator := range operators.Items { | ||
for _, condition := range operator.Status.Conditions { | ||
switch { | ||
case condition.Type == configv1.OperatorUpgradeable: | ||
continue | ||
case condition.Type == configv1.OperatorAvailable && condition.Status == configv1.ConditionTrue: | ||
continue | ||
case (condition.Type == configv1.OperatorDegraded || condition.Type == configv1.OperatorProgressing) && condition.Status == configv1.ConditionFalse: | ||
continue | ||
} | ||
if condition.Type == configv1.OperatorAvailable || condition.Type == configv1.OperatorDegraded { | ||
logrus.Errorf("Cluster operator %s %s is %s with %s: %s", operator.ObjectMeta.Name, condition.Type, condition.Status, condition.Reason, condition.Message) | ||
} else { | ||
logrus.Infof("Cluster operator %s %s is %s with %s: %s", operator.ObjectMeta.Name, condition.Type, condition.Status, condition.Reason, condition.Message) | ||
} | ||
} | ||
} | ||
|
||
return nil | ||
} |
Oops, something went wrong.