apiVersion: v1
policies:
  - name: Default
    isDefault: true
    rules:
      - identifier: REVISION_HISTORY_LIMIT
        messageOnFailure: Set Revision History Limit for getting Previous Version History
      - identifier: ROLLING_UPDATE_DEPLOYMENT
        messageOnFailure: Error in Defining Rolling Update Strategy
customRules:
  - identifier: REVISION_HISTORY_LIMIT
    name: Ensure revisionHistoryLimit was Set
    defaultMessageOnFailure: Set Revision History Limit for getting Previous Version History
    schema:
      properties:
        kind:
         enum:
          - Deployment
        spec:
          type: object
          properties:
            revisionHistoryLimit:
              type: integer
          required:
          - revisionHistoryLimit
      required:
      - spec
  - identifier: ROLLING_UPDATE_DEPLOYMENT
    name: Define Rolling Update Strategy
    defaultMessageOnFailure: Error in Defining Rolling Update Strategy
    schema:
      properties:
        kind:
         enum:
          - Deployment
        spec:
          type: object
          properties:
            strategy:
              type: object
              properties:
                type:
                  enum:
                  - RollingUpdate
                RollingUpdate:
                  type: object
                  properties:
                    maxSurge:
                      type: integer
                    maxUnavailable:
                      type: integer
                  required:
                  - maxSurge
                  - maxUnavailable
              required:
              - type
              - rollingUpdate
          required:
          - strategy
      required:
      - spec
