Skip to content

Commit

Permalink
Make sure config/crds are always up to date for testing (#977)
Browse files Browse the repository at this point in the history
What this PR does / why we need it:
In the past, we generated manifests using /config/manifests. Then we switched to kudo init. Now kudo init should be the ultimate source of truth but at the same time, we still have /config/manifests file with usually obsolete manifests that are causing cryptic test failures.

This PR removes this tech debt. Instead of removing /config/crds, I went the way of generating them from init in tests and then writing test that always ensures that these are up to date with what init provides. The manifests are right now used e.g. when test harness starts - the harness expects folder with CRDs so this was one solution of how to provide it (I find it the easier one).
  • Loading branch information
alenkacz committed Oct 23, 2019
1 parent df22c2c commit 6cde6ed
Show file tree
Hide file tree
Showing 14 changed files with 124 additions and 263 deletions.
37 changes: 8 additions & 29 deletions config/crds/kudo_v1alpha1_instance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,62 +3,41 @@ kind: CustomResourceDefinition
metadata:
creationTimestamp: null
labels:
app: kudo-manager
controller-tools.k8s.io: "1.0"
name: instances.kudo.dev
spec:
group: kudo.dev
names:
kind: Instance
plural: instances
singular: instance
scope: Namespaced
validation:
openAPIV3Schema:
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
properties:
dependencies:
items:
properties:
referenceName:
description: Name specifies the name of the dependency. Referenced
via defaults.config.
type: string
version:
description: 'Version captures the requirements for what versions
of the above object are allowed. Example: ^3.1.4'
type: string
required:
- referenceName
- version
type: object
type: array
operatorVersion:
description: Operator specifies a reference to a specific Operator object.
OperatorVersion:
description: Operator specifies a reference to a specific Operator object
type: object
parameters:
description: 'TODO: this is deprecated and should not be used'
type: object
type: object
status:
properties:
activePlan:
description: TODO turn into struct
aggregatedStatus:
type: object
planStatus:
type: object
status:
type: string
type: object
type: object
version: v1alpha1
status:
acceptedNames:
Expand Down
13 changes: 5 additions & 8 deletions config/crds/kudo_v1alpha1_operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,22 @@ kind: CustomResourceDefinition
metadata:
creationTimestamp: null
labels:
app: kudo-manager
controller-tools.k8s.io: "1.0"
name: operators.kudo.dev
spec:
group: kudo.dev
names:
kind: Operator
plural: operators
singular: operator
scope: Namespaced
validation:
openAPIV3Schema:
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
type: string
metadata:
type: object
Expand All @@ -37,17 +33,18 @@ spec:
maintainers:
items:
properties:
name:
type: string
email:
type: string
name:
type: string
type: object
type: array
url:
type: string
type: object
status:
type: object
type: object
version: v1alpha1
status:
acceptedNames:
Expand Down
20 changes: 2 additions & 18 deletions config/crds/kudo_v1alpha1_operatorversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ spec:
type: string
kind:
type: string
meta:
metadata:
type: object
spec:
properties:
Expand All @@ -30,22 +30,6 @@ spec:
type: string
crdVersion:
type: string
dependencies:
items:
properties:
crdVersion:
description: 'Version captures the requirements for what versions
of the above object are allowed Example: ^3.1.4'
type: string
referenceName:
description: Name specifies the name of the dependency. Referenced
via this in defaults.config
type: string
required:
- referenceName
- crdVersion
type: object
type: array
operator:
type: object
parameters:
Expand Down Expand Up @@ -112,4 +96,4 @@ status:
kind: ""
plural: ""
conditions: []
storedVersions: []
storedVersions: []
112 changes: 0 additions & 112 deletions config/crds/kudo_v1alpha1_planexecution.yaml

This file was deleted.

37 changes: 0 additions & 37 deletions config/kustomization.yaml

This file was deleted.

12 changes: 0 additions & 12 deletions config/manager_image_patch.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion pkg/kudoctl/cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func (initCmd *initCmd) run() error {

var mans []string

crd, err := cmdInit.CRDManifests()
crd, err := cmdInit.CRDs().AsYaml()
if err != nil {
return err
}
Expand Down
Loading

0 comments on commit 6cde6ed

Please sign in to comment.