Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use the ToolchainCluster.Spec fields #1054

Merged
merged 4 commits into from
Oct 4, 2024

Conversation

metlos
Copy link
Contributor

@metlos metlos commented Oct 2, 2024

Instead, use their replacements in the ToolchainCluster status. This will enable us to remove the fields from the spec and only rely on the kubeconfig (and the status fields that project the values out of the kubeconfig).

Copy link
Collaborator

@MatousJobanek MatousJobanek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@openshift-ci openshift-ci bot added the approved label Oct 2, 2024
@metlos
Copy link
Contributor Author

metlos commented Oct 2, 2024

/test publish-operators-for-e2e-tests

Copy link

openshift-ci bot commented Oct 2, 2024

@metlos: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test e2e

Use /test all to run all jobs.

In response to this:

/test publish-operators-for-e2e-tests

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@MatousJobanek
Copy link
Collaborator

/test publish-operators-for-e2e-tests

this is a GH action workflow. If you want to restart it, then go to the GH Actions UI and click on "re-run".

However, the workflow is configured to automatically run also when you leave any of the following comments: /retest, /test all, /test e2e, or /test

if: ${{ github.event.comment == '' || contains(github.event.comment.body, '/retest') || contains(github.event.comment.body, '/test all') || contains(github.event.comment.body, '/test e2e') }}

Copy link
Contributor

@mfrancisc mfrancisc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link

openshift-ci bot commented Oct 2, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: MatousJobanek, metlos, mfrancisc, ranakan19

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [MatousJobanek,mfrancisc,ranakan19]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@metlos
Copy link
Contributor Author

metlos commented Oct 3, 2024

/retest

Copy link

sonarcloud bot commented Oct 3, 2024

@metlos metlos merged commit 9ece59f into codeready-toolchain:master Oct 4, 2024
7 of 8 checks passed
Comment on lines 174 to 186
clusters := &toolchainv1alpha1.ToolchainClusterList{}
if err := a.Client.List(context.TODO(), clusters, client.InNamespace(a.Namespace), client.MatchingLabels{
"namespace": namespace,
}); err != nil {
if err := a.Client.List(context.TODO(), clusters, client.InNamespace(a.Namespace)); err != nil {
return toolchainv1alpha1.ToolchainCluster{}, false, err
}
if len(clusters.Items) == 0 {
t.Logf("no toolchaincluster resource with expected labels: namespace='%s'", namespace)
}
// assume there is zero or 1 match only
for _, cl := range clusters.Items {
if cd.IsTrue(cl.Status.Conditions, cdtype) {
if cl.Status.OperatorNamespace == namespace && cd.IsTrue(cl.Status.Conditions, cdtype) {
return cl, true, nil
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw, the message in the middle is not up-to-date anymore. Could be modified to:

func (a *Awaitility) GetToolchainCluster(t *testing.T, namespace string, cdtype toolchainv1alpha1.ConditionType) (toolchainv1alpha1.ToolchainCluster, bool, error) {
	clusters := &toolchainv1alpha1.ToolchainClusterList{}
	if err := a.Client.List(context.TODO(), clusters, client.InNamespace(a.Namespace)); err != nil {
		return toolchainv1alpha1.ToolchainCluster{}, false, err
	}
	// assume there is zero or 1 match only
	for _, tCluster := range clusters.Items {
		if tCluster.Status.OperatorNamespace == namespace && cd.IsTrue(tCluster.Status.Conditions, cdtype) {
			return tCluster, true, nil
		}
	}
	t.Logf("no ToolchainCluster resource that would be ready and would contain Status.OperatorNamespace: '%s'", namespace)
	return toolchainv1alpha1.ToolchainCluster{}, false, nil

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants