Skip to content

Instantly share code, notes, and snippets.

@liberlanco
Last active August 12, 2020 14:05
Show Gist options
  • Save liberlanco/7a8c62f3973ce07a3b5a207770cd17fe to your computer and use it in GitHub Desktop.
Save liberlanco/7a8c62f3973ce07a3b5a207770cd17fe to your computer and use it in GitHub Desktop.
# Prototype for new worker.json enabled: flag.
# https://jira.tegile.com/browse/FIR-698
# Currently it's simple: true/false
# With this implementation it will be something complex.
# It could be old true/false value
# But also some list of complex rules
# Rules is an array. They are processed one by one:
# - [true|false]
# - [disable|enable]
# - [disable|enable]_if: { ... conditions ... }
# Conditions are object properties,
# they all AND-ed logically in one rule:
#
# Check zone: Values are: global, non-global, NAME
# zone_[eq|ne]: <string>
# zone_[in]: [<string>, <string>, ...]
# zone_not_in: [<string>, <string>, ...]
#
# Check appliance type. Values are: sds, if-appliance
# appliance_type_[OP]: .... same operations as in zone
#
# Check project. Values are: nef/nef-core/fusion/etc ...
# project_[OP]: .... same for project name (nef/nef-core/fusion/etc...)
---
# To enable everywhere
---
enabled: true
---
enabled: [true]
---
enabled: ['enable']
# To disable everywhere
---
enabled: false
---
enabled: ['disable']
---
enabled: [false]
---
enabled: [] # false by default
---
# Disable in any non-global zone
enabled:
- disable_if:
zone_eq: non-global
- true
---
# Same but with _ne
enabled:
- disable_if:
zone_ne: global
- true
---
# Disable in non-global zone in if-appliance
# OR in any other project
enabled:
- disable_if:
zone_eq: non-global
- disable_if:
appliance_type_ne: if-appliance
- true
---
# Disable in non-global zone in if-appliance:
enabled:
- disable_if:
appliance_type_eq: if-appliance
zone_ne: global
# Same in JSON syntax:
#
# "enabled": [
# "disable_if": {
# "appliance_type_eq": "if-appliance",
# "zone_ne": "global"
# }
# ]
---
# Enable only in specific environment
enabled:
- enable_if:
appliance_type_eq: sds
zone_eq: global
- false # optional - worker is disabled by default
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment