From bc4a09c6b6367a8d7fdbdd9cad31915536af72f8 Mon Sep 17 00:00:00 2001 From: razo7 Date: Sun, 16 Apr 2023 16:55:07 +0300 Subject: [PATCH 1/2] CRDS are namespaced Fix ECOPROJECT-1234 --- api/v1alpha1/fenceagentsremediation_types.go | 2 +- api/v1alpha1/fenceagentsremediationtemplate_types.go | 2 +- ...e-agents-remediation.medik8s.io_fenceagentsremediations.yaml | 2 +- ...-remediation.medik8s.io_fenceagentsremediationtemplates.yaml | 2 +- ...e-agents-remediation.medik8s.io_fenceagentsremediations.yaml | 2 +- ...-remediation.medik8s.io_fenceagentsremediationtemplates.yaml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api/v1alpha1/fenceagentsremediation_types.go b/api/v1alpha1/fenceagentsremediation_types.go index c14d6897..a14d3eea 100644 --- a/api/v1alpha1/fenceagentsremediation_types.go +++ b/api/v1alpha1/fenceagentsremediation_types.go @@ -49,7 +49,7 @@ type FenceAgentsRemediationStatus struct { //+kubebuilder:object:root=true //+kubebuilder:subresource:status -//+kubebuilder:resource:scope=Cluster,shortName=far +//+kubebuilder:resource:shortName=far // +operator-sdk:csv:customresourcedefinitions:resources={{"FenceAgentsRemediation","v1alpha1","fenceagentsremediations"}} // FenceAgentsRemediation is the Schema for the fenceagentsremediations API diff --git a/api/v1alpha1/fenceagentsremediationtemplate_types.go b/api/v1alpha1/fenceagentsremediationtemplate_types.go index 6cd9d520..507952fb 100644 --- a/api/v1alpha1/fenceagentsremediationtemplate_types.go +++ b/api/v1alpha1/fenceagentsremediationtemplate_types.go @@ -45,7 +45,7 @@ type FenceAgentsRemediationTemplateStatus struct { // +kubebuilder:object:root=true // +kubebuilder:subresource:status -//+kubebuilder:resource:scope=Cluster,shortName=fart +//+kubebuilder:resource:shortName=fart // FenceAgentsRemediationTemplate is the Schema for the fenceagentsremediationtemplates API // +operator-sdk:csv:customresourcedefinitions:resources={{"FenceAgentsRemediationTemplate","v1alpha1","fenceagentsremediationtemplates"}} diff --git a/bundle/manifests/fence-agents-remediation.medik8s.io_fenceagentsremediations.yaml b/bundle/manifests/fence-agents-remediation.medik8s.io_fenceagentsremediations.yaml index 6a01ea07..776846e7 100644 --- a/bundle/manifests/fence-agents-remediation.medik8s.io_fenceagentsremediations.yaml +++ b/bundle/manifests/fence-agents-remediation.medik8s.io_fenceagentsremediations.yaml @@ -16,7 +16,7 @@ spec: shortNames: - far singular: fenceagentsremediation - scope: Cluster + scope: Namespaced versions: - name: v1alpha1 schema: diff --git a/bundle/manifests/fence-agents-remediation.medik8s.io_fenceagentsremediationtemplates.yaml b/bundle/manifests/fence-agents-remediation.medik8s.io_fenceagentsremediationtemplates.yaml index 531d2ecb..fb51c73d 100644 --- a/bundle/manifests/fence-agents-remediation.medik8s.io_fenceagentsremediationtemplates.yaml +++ b/bundle/manifests/fence-agents-remediation.medik8s.io_fenceagentsremediationtemplates.yaml @@ -16,7 +16,7 @@ spec: shortNames: - fart singular: fenceagentsremediationtemplate - scope: Cluster + scope: Namespaced versions: - name: v1alpha1 schema: diff --git a/config/crd/bases/fence-agents-remediation.medik8s.io_fenceagentsremediations.yaml b/config/crd/bases/fence-agents-remediation.medik8s.io_fenceagentsremediations.yaml index 953576aa..fa196b11 100644 --- a/config/crd/bases/fence-agents-remediation.medik8s.io_fenceagentsremediations.yaml +++ b/config/crd/bases/fence-agents-remediation.medik8s.io_fenceagentsremediations.yaml @@ -15,7 +15,7 @@ spec: shortNames: - far singular: fenceagentsremediation - scope: Cluster + scope: Namespaced versions: - name: v1alpha1 schema: diff --git a/config/crd/bases/fence-agents-remediation.medik8s.io_fenceagentsremediationtemplates.yaml b/config/crd/bases/fence-agents-remediation.medik8s.io_fenceagentsremediationtemplates.yaml index 68da8e45..d4c8a9b8 100644 --- a/config/crd/bases/fence-agents-remediation.medik8s.io_fenceagentsremediationtemplates.yaml +++ b/config/crd/bases/fence-agents-remediation.medik8s.io_fenceagentsremediationtemplates.yaml @@ -15,7 +15,7 @@ spec: shortNames: - fart singular: fenceagentsremediationtemplate - scope: Cluster + scope: Namespaced versions: - name: v1alpha1 schema: From 9632a6c3ecce17d078df226bc5f3e1b0138cde31 Mon Sep 17 00:00:00 2001 From: razo7 Date: Mon, 17 Apr 2023 17:29:10 +0300 Subject: [PATCH 2/2] Add test namespace We need to set test namespace for CR creation, when FAR CR is no longer cluster scoped --- test/e2e/far_e2e_test.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/e2e/far_e2e_test.go b/test/e2e/far_e2e_test.go index fe7602ce..8a376d7d 100644 --- a/test/e2e/far_e2e_test.go +++ b/test/e2e/far_e2e_test.go @@ -14,7 +14,10 @@ import ( "github.com/medik8s/fence-agents-remediation/api/v1alpha1" ) -const fenceAgentDummyName = "echo" +const ( + fenceAgentDummyName = "echo" + testNamespace = "openshift-operators" +) var _ = Describe("FAR E2e", func() { Context("fence agent - dummy", func() { @@ -41,7 +44,7 @@ var _ = Describe("FAR E2e", func() { // createFAR assigns the input to FenceAgentsRemediation object, creates CR with offset, and returns the CR object func createFAR(nodeName string, agent string, sharedParameters map[v1alpha1.ParameterName]string, nodeParameters map[v1alpha1.ParameterName]map[v1alpha1.NodeName]string) *v1alpha1.FenceAgentsRemediation { far := &v1alpha1.FenceAgentsRemediation{ - ObjectMeta: metav1.ObjectMeta{Name: nodeName}, + ObjectMeta: metav1.ObjectMeta{Name: nodeName, Namespace: testNamespace}, Spec: v1alpha1.FenceAgentsRemediationSpec{ Agent: agent, SharedParameters: sharedParameters,