Skip to content

Instantly share code, notes, and snippets.

@eyarz
Created August 28, 2022 15:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eyarz/9f918858110f7ded2a1bef080296ced7 to your computer and use it in GitHub Desktop.
Save eyarz/9f918858110f7ded2a1bef080296ced7 to your computer and use it in GitHub Desktop.
crossplane_policy
apiVersion: v1
policies:
- name: crossplane
isDefault: true
rules:
- identifier: CUSTOM_RULE_MANDATORY_PATCHSET
# This message will override the rule's `defaultMessageOnFailure` property
messageOnFailure: ''
- identifier: CUSTOM_RULE_MANDATORY_NAME
# This message will override the rule's `defaultMessageOnFailure` property
messageOnFailure: ''
- identifier: CUSTOM_RULE_MANDATORY_PROVIDERCONFIGREF_NAME
# This message will override the rule's `defaultMessageOnFailure` property
messageOnFailure: ''
customRules:
- identifier: CUSTOM_RULE_MANDATORY_PATCHSET
name: Ensure a patchSet exist [CUSTOM RULE]
defaultMessageOnFailure: Add `patchSet` to the `spec` section like so https://gist.github.com/Piotr1215/33b3c07787de601393c2b06adc165b51#file-composition-yaml-L7-L15
schema:
if:
properties:
kind:
enum:
- Composition
then:
properties:
spec:
required:
- patchSets
required:
- spec
- identifier: CUSTOM_RULE_MANDATORY_NAME
name: Ensure a name exist for each base [CUSTOM RULE]
defaultMessageOnFailure: Add `name` to the `base` section like so https://gist.github.com/Piotr1215/33b3c07787de601393c2b06adc165b51#file-composition-yaml-L47
schema:
if:
properties:
kind:
enum:
- Composition
then:
properties:
spec:
properties:
resources:
items:
properties:
name:
type: string
required:
- name
- identifier: CUSTOM_RULE_MANDATORY_PROVIDERCONFIGREF_NAME
name: Ensure a name exist for each providerConfigRef base [CUSTOM RULE]
defaultMessageOnFailure: Add `name` to the `providerConfigRef` in each section like so https://gist.github.com/Piotr1215/33b3c07787de601393c2b06adc165b51#file-composition-yaml-L79
schema:
if:
properties:
kind:
enum:
- Composition
then:
properties:
spec:
properties:
resources:
items:
properties:
base:
properties:
spec:
properties:
providerConfigRef:
properties:
name:
type: string
required:
- name
required:
- providerConfigRef
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment