Skip to content

Commit

Permalink
Change Constraint Template CRD to apiextensions.k8s.io/v1
Browse files Browse the repository at this point in the history
v1beta1 CRDs will not be supported in upcoming k8s versions, so all our
CRDs will have to be v1.  This makes our toolchain output a v1 CRD for
the Constraint Template kind.

Fixes open-policy-agent/gatekeeper#550

Signed-off-by: juliankatz <juliankatz@google.com>
  • Loading branch information
julianKatz committed May 5, 2021
1 parent 3f51770 commit dcddaff
Show file tree
Hide file tree
Showing 3 changed files with 373 additions and 185 deletions.
2 changes: 1 addition & 1 deletion constraint/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ gen-dependencies:
# Generate manifests e.g. CRD, RBAC etc.
manifests:
controller-gen \
crd:crdVersions="v1beta1",allowDangerousTypes="true" \
crd:allowDangerousTypes="true" \
paths="./pkg/..." \
output:crd:artifacts:config=config/crds
cp config/crds/* deploy/crds.yaml
Expand Down
278 changes: 186 additions & 92 deletions constraint/config/crds/templates.gatekeeper.sh_constrainttemplates.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

---
apiVersion: apiextensions.k8s.io/v1beta1
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
Expand All @@ -15,105 +15,199 @@ spec:
plural: constrainttemplates
singular: constrainttemplate
scope: Cluster
subresources:
status: {}
validation:
openAPIV3Schema:
description: ConstraintTemplate is the Schema for the constrainttemplates API
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/sig-architecture/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/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: ConstraintTemplateSpec defines the desired state of ConstraintTemplate
properties:
crd:
properties:
spec:
properties:
names:
properties:
kind:
type: string
shortNames:
items:
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: ConstraintTemplate is the Schema for the constrainttemplates
API
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/sig-architecture/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/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: ConstraintTemplateSpec defines the desired state of ConstraintTemplate
properties:
crd:
properties:
spec:
properties:
names:
properties:
kind:
type: string
type: array
type: object
validation:
properties:
openAPIV3Schema:
type: object
type: object
shortNames:
items:
type: string
type: array
type: object
validation:
properties:
openAPIV3Schema:
type: object
type: object
type: object
type: object
targets:
items:
properties:
libs:
items:
type: string
type: array
rego:
type: string
target:
type: string
type: object
type: object
targets:
items:
properties:
libs:
items:
type: array
type: object
status:
description: ConstraintTemplateStatus defines the observed state of ConstraintTemplate
properties:
byPod:
items:
description: ByPodStatus defines the observed state of ConstraintTemplate
as seen by an individual controller
properties:
errors:
items:
description: CreateCRDError represents a single error caught
during parsing, compiling, etc.
properties:
code:
type: string
location:
type: string
message:
type: string
required:
- code
- message
type: object
type: array
id:
description: a unique identifier for the pod that wrote the
status
type: string
type: array
rego:
type: string
target:
type: string
type: object
type: array
type: object
status:
description: ConstraintTemplateStatus defines the observed state of ConstraintTemplate
properties:
byPod:
items:
description: ByPodStatus defines the observed state of ConstraintTemplate
as seen by an individual controller
properties:
errors:
items:
description: CreateCRDError represents a single error caught
during parsing, compiling, etc.
properties:
code:
type: string
location:
type: string
message:
type: string
required:
- code
- message
type: object
type: array
id:
description: a unique identifier for the pod that wrote the status
type: string
observedGeneration:
format: int64
type: integer
type: object
type: array
created:
type: boolean
type: object
type: object
version: v1alpha1
versions:
- name: v1alpha1
observedGeneration:
format: int64
type: integer
type: object
type: array
created:
type: boolean
type: object
type: object
served: true
storage: false
subresources:
status: {}
- name: v1beta1
schema:
openAPIV3Schema:
description: ConstraintTemplate is the Schema for the constrainttemplates
API
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/sig-architecture/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/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: ConstraintTemplateSpec defines the desired state of ConstraintTemplate
properties:
crd:
properties:
spec:
properties:
names:
properties:
kind:
type: string
shortNames:
items:
type: string
type: array
type: object
validation:
properties:
openAPIV3Schema:
type: object
type: object
type: object
type: object
targets:
items:
properties:
libs:
items:
type: string
type: array
rego:
type: string
target:
type: string
type: object
type: array
type: object
status:
description: ConstraintTemplateStatus defines the observed state of ConstraintTemplate
properties:
byPod:
items:
description: ByPodStatus defines the observed state of ConstraintTemplate
as seen by an individual controller
properties:
errors:
items:
description: CreateCRDError represents a single error caught
during parsing, compiling, etc.
properties:
code:
type: string
location:
type: string
message:
type: string
required:
- code
- message
type: object
type: array
id:
description: a unique identifier for the pod that wrote the
status
type: string
observedGeneration:
format: int64
type: integer
type: object
type: array
created:
type: boolean
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
Expand Down
Loading

0 comments on commit dcddaff

Please sign in to comment.