Skip to content

Commit

Permalink
Fixes to CRD v1 compatibility in tests.
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Luddy <bluddy@redhat.com>
  • Loading branch information
benluddy committed Jul 12, 2021
1 parent 455e603 commit b7febc1
Show file tree
Hide file tree
Showing 22 changed files with 200 additions and 102 deletions.
15 changes: 11 additions & 4 deletions test/e2e/crd_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ var _ = Describe("CRD Versions", func() {
Name: crdName,
},
Spec: apiextensionsv1.CustomResourceDefinitionSpec{
Scope: apiextensionsv1.NamespaceScoped,
Group: "cluster.com",
Versions: []apiextensionsv1.CustomResourceDefinitionVersion{
{
Expand Down Expand Up @@ -141,7 +142,7 @@ var _ = Describe("CRD Versions", func() {
Kind: crdPlural,
ListKind: "list" + crdPlural,
},
Scope: "Namespaced",
Scope: apiextensions.NamespaceScoped,
},
}

Expand Down Expand Up @@ -183,6 +184,7 @@ var _ = Describe("CRD Versions", func() {
Kind: crdPlural,
ListKind: "list" + crdPlural,
},
Scope: apiextensions.NamespaceScoped,
},
}

Expand Down Expand Up @@ -307,7 +309,7 @@ var _ = Describe("CRD Versions", func() {
Kind: crdPlural,
ListKind: "list" + crdPlural,
},
Scope: "Namespaced",
Scope: apiextensionsv1.NamespaceScoped,
},
}
_, err := c.ApiextensionsInterface().ApiextensionsV1().CustomResourceDefinitions().Create(context.TODO(), oldCRD, metav1.CreateOptions{})
Expand All @@ -321,13 +323,18 @@ var _ = Describe("CRD Versions", func() {
}
GinkgoT().Logf("old crd status stored versions: %#v", oldCRD.Status.StoredVersions)

// set v1alpha1 to no longer served
// set v1alpha1 to no longer stored
oldCRD.Spec.Versions[0].Storage = false
// update CRD on-cluster with a new version
oldCRD.Spec.Versions = append(oldCRD.Spec.Versions, apiextensionsv1.CustomResourceDefinitionVersion{
Name: "v1alpha2",
Served: true,
Storage: true,
Schema: &apiextensionsv1.CustomResourceValidation{
OpenAPIV3Schema: &apiextensionsv1.JSONSchemaProps{
Type: "object",
},
},
})

updatedCRD, err := c.ApiextensionsInterface().ApiextensionsV1().CustomResourceDefinitions().Update(context.TODO(), oldCRD, metav1.UpdateOptions{})
Expand Down Expand Up @@ -364,7 +371,7 @@ var _ = Describe("CRD Versions", func() {
Kind: crdPlural,
ListKind: "list" + crdPlural,
},
Scope: "Namespaced",
Scope: apiextensions.NamespaceScoped,
},
}

Expand Down
23 changes: 11 additions & 12 deletions test/e2e/csv_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,7 @@ var _ = Describe("ClusterServiceVersion", func() {
Kind: crdPlural,
ListKind: "list" + crdPlural,
},
Scope: "Namespaced",
Scope: apiextensions.NamespaceScoped,
},
})
Expect(err).ShouldNot(HaveOccurred())
Expand Down Expand Up @@ -1238,7 +1238,7 @@ var _ = Describe("ClusterServiceVersion", func() {
Kind: crdPlural,
ListKind: "list" + crdPlural,
},
Scope: "Namespaced",
Scope: apiextensions.NamespaceScoped,
},
}
crd.SetOwnerReferences([]metav1.OwnerReference{{
Expand Down Expand Up @@ -2381,8 +2381,7 @@ var _ = Describe("ClusterServiceVersion", func() {
Kind: crdPlural,
ListKind: "list" + crdPlural,
},

Scope: "Namespaced",
Scope: apiextensions.NamespaceScoped,
},
})

Expand Down Expand Up @@ -2574,7 +2573,7 @@ var _ = Describe("ClusterServiceVersion", func() {
Kind: crdPlural,
ListKind: "list" + crdPlural,
},
Scope: "Namespaced",
Scope: apiextensions.NamespaceScoped,
},
})
Expect(err).ShouldNot(HaveOccurred())
Expand Down Expand Up @@ -2764,7 +2763,7 @@ var _ = Describe("ClusterServiceVersion", func() {
Kind: crdPlural,
ListKind: "list" + crdPlural,
},
Scope: "Namespaced",
Scope: apiextensions.NamespaceScoped,
},
})
Expect(err).ShouldNot(HaveOccurred())
Expand Down Expand Up @@ -2954,7 +2953,7 @@ var _ = Describe("ClusterServiceVersion", func() {
Kind: crdPlural,
ListKind: "list" + crdPlural,
},
Scope: "Namespaced",
Scope: apiextensions.NamespaceScoped,
},
})

Expand Down Expand Up @@ -3125,7 +3124,7 @@ var _ = Describe("ClusterServiceVersion", func() {
Kind: crdPlural,
ListKind: "list" + crdPlural,
},
Scope: "Namespaced",
Scope: apiextensions.NamespaceScoped,
},
})
Expect(err).ShouldNot(HaveOccurred())
Expand Down Expand Up @@ -3403,7 +3402,7 @@ var _ = Describe("ClusterServiceVersion", func() {
Kind: crdPlural,
ListKind: "list" + crdPlural,
},
Scope: "Namespaced",
Scope: apiextensions.NamespaceScoped,
},
})
Expect(err).ShouldNot(HaveOccurred())
Expand Down Expand Up @@ -3567,7 +3566,7 @@ var _ = Describe("ClusterServiceVersion", func() {
Kind: crdPlural,
ListKind: "list" + crdPlural,
},
Scope: "Namespaced",
Scope: apiextensions.NamespaceScoped,
},
})
defer cleanupCRD()
Expand Down Expand Up @@ -3797,7 +3796,7 @@ var _ = Describe("ClusterServiceVersion", func() {
Kind: crdPlural,
ListKind: "list" + crdPlural,
},
Scope: "Namespaced",
Scope: apiextensions.NamespaceScoped,
},
})
Expect(err).ShouldNot(HaveOccurred())
Expand Down Expand Up @@ -4346,7 +4345,7 @@ func newMockExtServerDeployment(labelName string, mGVKs []mockGroupVersionKind)
for _, mGVK := range mGVKs {
containers = append(containers, corev1.Container{
Name: genName(mGVK.Name),
Image: "quay.io/coreos/mock-extension-apiserver:master",
Image: "quay.io/operator-framework/mock-extension-apiserver:master",
Command: []string{"/bin/mock-extension-apiserver"},
Args: []string{
"-v=4",
Expand Down
20 changes: 16 additions & 4 deletions test/e2e/data/catalog.new.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,38 @@ metadata:
namespace: tectonic-system
data:
customResourceDefinitions: |-
- apiVersion: apiextensions.k8s.io/v1beta1
- apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: testcs.example.com
spec:
group: example.com
version: v1alpha1
versions:
- name: v1alpha1
served: true
storage: true
schema:
openAPIV3Schema:
type: object
scope: Namespaced
names:
plural: testcs
singular: testc
kind: TestC
listKind: TestCList
- apiVersion: apiextensions.k8s.io/v1beta1
- apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: testbs.example.com
spec:
group: example.com
version: v1alpha1
versions:
- name: v1alpha1
served: true
storage: true
schema:
openAPIV3Schema:
type: object
scope: Namespaced
names:
plural: testbs
Expand Down
20 changes: 16 additions & 4 deletions test/e2e/data/catalog.old.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,38 @@ metadata:
namespace: tectonic-system
data:
customResourceDefinitions: |-
- apiVersion: apiextensions.k8s.io/v1beta1
- apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: testas.example.com
spec:
group: example.com
version: v1alpha1
versions:
- name: v1alpha1
served: true
storage: true
schema:
openAPIV3Schema:
type: object
scope: Namespaced
names:
plural: testas
singular: testa
kind: TestA
listKind: TestAList
- apiVersion: apiextensions.k8s.io/v1beta1
- apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: testbs.example.com
spec:
group: example.com
version: v1alpha1
versions:
- name: v1alpha1
served: true
storage: true
schema:
openAPIV3Schema:
type: object
scope: Namespaced
names:
plural: testbs
Expand Down
10 changes: 6 additions & 4 deletions test/e2e/data/kiali-image-bundle/manifests/kiali.crd.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: apiextensions.k8s.io/v1beta1
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: kialis.kiali.io
Expand All @@ -12,10 +12,12 @@ spec:
plural: kialis
singular: kiali
scope: Namespaced
subresources:
status: {}
version: v1alpha1
versions:
- name: v1alpha1
served: true
storage: true
subresources:
status: {}
schema:
openAPIV3Schema:
type: object
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: apiextensions.k8s.io/v1beta1
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: monitoringdashboards.monitoring.kiali.io
Expand All @@ -12,4 +12,10 @@ spec:
plural: monitoringdashboards
singular: monitoringdashboard
scope: Namespaced
version: v1alpha1
versions:
- name: v1alpha1
served: true
storage: true
schema:
openAPIV3Schema:
type: object
10 changes: 6 additions & 4 deletions test/e2e/data/kiali-manifests/0.18.1/kiali.crd.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: apiextensions.k8s.io/v1beta1
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: kialis.kiali.io
Expand All @@ -12,10 +12,12 @@ spec:
plural: kialis
singular: kiali
scope: Namespaced
subresources:
status: {}
version: v1alpha1
versions:
- name: v1alpha1
served: true
storage: true
schema:
openAPIV3Schema:
type: object
subresources:
status: {}
10 changes: 6 additions & 4 deletions test/e2e/data/kiali-manifests/1.1.0/kiali.crd.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: apiextensions.k8s.io/v1beta1
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: kialis.kiali.io
Expand All @@ -12,10 +12,12 @@ spec:
plural: kialis
singular: kiali
scope: Namespaced
subresources:
status: {}
version: v1alpha1
versions:
- name: v1alpha1
served: true
storage: true
schema:
openAPIV3Schema:
type: object
subresources:
status: {}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: apiextensions.k8s.io/v1beta1
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: monitoringdashboards.monitoring.kiali.io
Expand All @@ -12,4 +12,10 @@ spec:
plural: monitoringdashboards
singular: monitoringdashboard
scope: Namespaced
version: v1alpha1
versions:
- name: v1alpha1
served: true
storage: true
schema:
openAPIV3Schema:
type: object
10 changes: 6 additions & 4 deletions test/e2e/data/kiali-manifests/1.3.1/kiali.crd.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: apiextensions.k8s.io/v1beta1
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: kialis.kiali.io
Expand All @@ -12,10 +12,12 @@ spec:
plural: kialis
singular: kiali
scope: Namespaced
subresources:
status: {}
version: v1alpha1
versions:
- name: v1alpha1
served: true
storage: true
subresources:
status: {}
schema:
openAPIV3Schema:
type: object
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: apiextensions.k8s.io/v1beta1
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: monitoringdashboards.monitoring.kiali.io
Expand All @@ -12,4 +12,10 @@ spec:
plural: monitoringdashboards
singular: monitoringdashboard
scope: Namespaced
version: v1alpha1
versions:
- name: v1alpha1
served: true
storage: true
schema:
openAPIV3Schema:
type: object
Loading

0 comments on commit b7febc1

Please sign in to comment.