Skip to content

Update of sigs.k8s.io/controller-runtime from v0.11.2 -> v0.12.0 makes envtest fails on applying CRD configs #1899

Closed
@IoanaIvanova

Description

@IoanaIvanova

After updating k8s operator dependency sigs.k8s.io/controller-runtime from version v0.11.2 to v0.12.0 the setup of envtest started failing to apply CRDs which are different that the one that the k8s operator describes.

I would like to apply a different CRD (an argo workflow CRD) since the operator operates on changes of argo workflows and I would like to test this without installing a whole argo server but rather simulate changes of workflow CR. So I need to have a workflow CRD in order to have a workflow CR and I managed to do this by adding the argo CRD in a testdata dir in the operator's repo and passing this dir to the suite_test.go with the following code:

	testEnv := &envtest.Environment{
		CRDDirectoryPaths: []string{
			filepath.Join("..", "..", "config", "crd", "bases"),
			filepath.Join("testdata", "workflows", "definition"),
		},
		ErrorIfCRDPathMissing:    true,
		AttachControlPlaneOutput: true,
	}

This works pretty fine before changing sigs.k8s.io/controller-runtime to version v0.12.0 when the envtest started to search in both described directories the name of the CRD that the k8s operator describe rather then applying the CRD which is in the describe directory.

Could you please tell me if this change is a desired one and if yes how I could change the envtest implementation in order to fulfil the need to apply CRD which is not defined in the testing operator?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions