Skip to content

Commit 372a686

Browse files
Merge pull request #1157 from awgreene/prune-unknown-fields
Bug 1769003: Implement Structural Schema for CRDs
2 parents aeb4692 + 62be3ee commit 372a686

File tree

301 files changed

+69288
-4091
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

301 files changed

+69288
-4091
lines changed

Makefile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ IMAGE_TAG ?= "dev"
2222
SPECIFIC_UNIT_TEST := $(if $(TEST),-run $(TEST),)
2323
LOCAL_NAMESPACE := "olm"
2424
export GO111MODULE=on
25+
CONTROLLER_GEN := go run ./vendor/sigs.k8s.io/controller-tools/cmd/controller-gen
26+
YQ_INTERNAL := go run ./vendor/github.com/mikefarah/yq/v2/
2527

2628
# ART builds are performed in dist-git, with content (but not commits) copied
2729
# from the source repo. Thus at build time if your code is inspecting the local
@@ -156,7 +158,9 @@ codegen:
156158
go run vendor/k8s.io/kube-openapi/cmd/openapi-gen/openapi-gen.go --logtostderr -i ./vendor/k8s.io/apimachinery/pkg/runtime,./vendor/k8s.io/apimachinery/pkg/apis/meta/v1,./vendor/k8s.io/apimachinery/pkg/version,./pkg/package-server/apis/operators/v1,./pkg/package-server/apis/apps/v1alpha1,./pkg/api/apis/operators/v1alpha1,./pkg/lib/version -p $(PKG)/pkg/package-server/apis/openapi -O zz_generated.openapi -h boilerplate.go.txt -r /dev/null
157159
$(CODEGEN_INTERNAL) deepcopy,conversion,client,lister,informer $(PKG)/pkg/api/client $(PKG)/pkg/api/apis $(PKG)/pkg/api/apis "operators:v1alpha1,v1"
158160
$(CODEGEN_INTERNAL) all $(PKG)/pkg/package-server/client $(PKG)/pkg/package-server/apis $(PKG)/pkg/package-server/apis "operators:v1 apps:v1alpha1"
159-
161+
$(CONTROLLER_GEN) schemapatch:manifests=./deploy/chart/templates paths=./pkg/api/apis/operators/v1alpha1/... output:dir=./deploy/chart/templates
162+
$(CONTROLLER_GEN) schemapatch:manifests=./deploy/chart/templates paths=./pkg/api/apis/operators/v1/... output:dir=./deploy/chart/templates
163+
$(YQ_INTERNAL) w --inplace deploy/chart/templates/0000_50_olm_03-clusterserviceversion.crd.yaml spec.validation.openAPIV3Schema.properties.spec.properties.install.properties.spec.properties.deployments.items.properties.spec.properties.template.properties.metadata.x-kubernetes-preserve-unknown-fields true
160164
container-codegen:
161165
docker build -t olm:codegen -f codegen.Dockerfile .
162166
docker run --name temp-codegen olm:codegen /bin/true
@@ -226,9 +230,9 @@ endif
226230
ifndef ver
227231
$(error ver is undefined)
228232
endif
229-
yq w -i deploy/$(target)/values.yaml olm.image.ref $(olmref)
230-
yq w -i deploy/$(target)/values.yaml catalog.image.ref $(olmref)
231-
yq w -i deploy/$(target)/values.yaml package.image.ref $(olmref)
233+
$(YQ_INTERNAL) w -i deploy/$(target)/values.yaml olm.image.ref $(olmref)
234+
$(YQ_INTERNAL) w -i deploy/$(target)/values.yaml catalog.image.ref $(olmref)
235+
$(YQ_INTERNAL) w -i deploy/$(target)/values.yaml package.image.ref $(olmref)
232236
./scripts/package_release.sh $(ver) deploy/$(target)/manifests/$(ver) deploy/$(target)/values.yaml
233237
ln -sfFn ./$(ver) deploy/$(target)/manifests/latest
234238
ifeq ($(quickstart), true)

deploy/chart/templates/0000_50_olm_03-clusterserviceversion.crd.yaml

Lines changed: 8186 additions & 520 deletions
Large diffs are not rendered by default.

deploy/chart/templates/0000_50_olm_04-installplan.crd.yaml

Lines changed: 151 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ metadata:
44
name: installplans.operators.coreos.com
55
annotations:
66
displayName: Install Plan
7-
description: Represents a plan to install and resolve dependencies for Cluster Services
7+
description: Represents a plan to install and resolve dependencies for Cluster
8+
Services
89
spec:
910
group: operators.coreos.com
1011
version: v1alpha1
@@ -39,36 +40,165 @@ spec:
3940
status: {}
4041
validation:
4142
openAPIV3Schema:
42-
description: Represents a plan to install and resolve dependencies for Cluster Services.
43+
description: InstallPlan defines the installation of a set of operators.
44+
type: object
45+
required:
46+
- metadata
47+
- spec
4348
properties:
49+
apiVersion:
50+
description: 'APIVersion defines the versioned schema of this representation
51+
of an object. Servers should convert recognized schemas to the latest
52+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
53+
type: string
54+
kind:
55+
description: 'Kind is a string value representing the REST resource this
56+
object represents. Servers may infer this from the endpoint the client
57+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
58+
type: string
59+
metadata:
60+
type: object
4461
spec:
62+
description: InstallPlanSpec defines a set of Application resources to be
63+
installed
4564
type: object
46-
description: Spec for an InstallPlan
4765
required:
48-
- clusterServiceVersionNames
4966
- approval
67+
- approved
68+
- clusterServiceVersionNames
5069
properties:
70+
approval:
71+
description: Approval is the user approval policy for an InstallPlan.
72+
type: string
73+
approved:
74+
type: boolean
75+
clusterServiceVersionNames:
76+
type: array
77+
items:
78+
type: string
5179
source:
5280
type: string
53-
description: Name of the preferred CatalogSource
5481
sourceNamespace:
5582
type: string
56-
description: Namespace that contains the preffered CatalogSource
57-
clusterServiceVersionNames:
83+
status:
84+
description: "InstallPlanStatus represents the information about the status
85+
of steps required to complete installation. \n Status may trail the actual
86+
state of a system."
87+
type: object
88+
required:
89+
- catalogSources
90+
- phase
91+
properties:
92+
attenuatedServiceAccountRef:
93+
description: AttenuatedServiceAccountRef references the service account
94+
that is used to do scoped operator install.
95+
type: object
96+
properties:
97+
apiVersion:
98+
description: API version of the referent.
99+
type: string
100+
fieldPath:
101+
description: 'If referring to a piece of an object instead of an
102+
entire object, this string should contain a valid JSON/Go field
103+
access statement, such as desiredState.manifest.containers[2].
104+
For example, if the object reference is to a container within
105+
a pod, this would take on a value like: "spec.containers{name}"
106+
(where "name" refers to the name of the container that triggered
107+
the event) or if no container name is specified "spec.containers[2]"
108+
(container with index 2 in this pod). This syntax is chosen only
109+
to have some well-defined way of referencing a part of an object.
110+
TODO: this design is not final and this field is subject to change
111+
in the future.'
112+
type: string
113+
kind:
114+
description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
115+
type: string
116+
name:
117+
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
118+
type: string
119+
namespace:
120+
description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/'
121+
type: string
122+
resourceVersion:
123+
description: 'Specific resourceVersion to which this reference is
124+
made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency'
125+
type: string
126+
uid:
127+
description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids'
128+
type: string
129+
catalogSources:
58130
type: array
59-
description: A list of the names of the Cluster Services
60131
items:
61132
type: string
62-
anyOf:
63-
- properties:
64-
approval:
65-
enum:
66-
- Manual
67-
approved:
68-
type: boolean
69-
required:
70-
- approved
71-
- properties:
72-
approval:
73-
enum:
74-
- Automatic
133+
conditions:
134+
type: array
135+
items:
136+
description: InstallPlanCondition represents the overall status of
137+
the execution of an InstallPlan.
138+
type: object
139+
properties:
140+
lastTransitionTime:
141+
type: string
142+
format: date-time
143+
lastUpdateTime:
144+
type: string
145+
format: date-time
146+
message:
147+
type: string
148+
reason:
149+
description: ConditionReason is a camelcased reason for the state
150+
transition.
151+
type: string
152+
status:
153+
type: string
154+
type:
155+
description: InstallPlanConditionType describes the state of an
156+
InstallPlan at a certain point as a whole.
157+
type: string
158+
phase:
159+
description: InstallPlanPhase is the current status of a InstallPlan
160+
as a whole.
161+
type: string
162+
plan:
163+
type: array
164+
items:
165+
description: Step represents the status of an individual step in an
166+
InstallPlan.
167+
type: object
168+
required:
169+
- resolving
170+
- resource
171+
- status
172+
properties:
173+
resolving:
174+
type: string
175+
resource:
176+
description: StepResource represents the status of a resource
177+
to be tracked by an InstallPlan.
178+
type: object
179+
required:
180+
- group
181+
- kind
182+
- name
183+
- sourceName
184+
- sourceNamespace
185+
- version
186+
properties:
187+
group:
188+
type: string
189+
kind:
190+
type: string
191+
manifest:
192+
type: string
193+
name:
194+
type: string
195+
sourceName:
196+
type: string
197+
sourceNamespace:
198+
type: string
199+
version:
200+
type: string
201+
status:
202+
description: StepStatus is the current status of a particular
203+
resource an in InstallPlan
204+
type: string

0 commit comments

Comments
 (0)