Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hooks configuration API refactoring #37

Closed
dmgtn opened this issue Aug 16, 2019 · 0 comments · Fixed by #45
Closed

Hooks configuration API refactoring #37

dmgtn opened this issue Aug 16, 2019 · 0 comments · Fixed by #45
Assignees
Milestone

Comments

@dmgtn
Copy link
Member

dmgtn commented Aug 16, 2019

We have a few problems in API that should be fixed:

  1. First of all – we mistakenly use operation instead of operator in matchExpressions clause. This is a real bug and should be fixed.
  2. We use selector, containing matchLabels and matchExpressions fields. But the more Kubernetes-compatible name will be labelSelector. Rename selector to labelSelector.
  3. In Add support of matchLabels and matchExpressions for namespaceSelector  #32 we are going to add matchLabels and matchExpressions to namespace. Instead of just adding them to namespaceSelector, we better introduce new field namespace, and then add there labelSelector.
  4. Fully abandon namespaceSelector, and instead of it namespace.labelSelector (as already suggested above), namespace.nameSelector (having matchNames).
  5. Add support for field selector for onKubernetesEvent hooks #35 and Replace objectName with nameSelector.matchNames #33 also implement in better way.
  6. Introduce v1 (Introduce versioning for hooks configuration API #36)

Full example:

{
  "configVersion": "v1",
  "onKubernetesEvent": [
    {
      "name": "Monitor labeled pods in cache tier",
      "kind": "Pod",
      "event": [ "add", "update", "delete" ],
      "nameSelector": {
        "matchNames": ["pod-xxx", "pod-yyy", "pod-zzz"],
      },
      "labelSelector": {
        "matchLabels": {
          "myLabel": "myLabelValue",
          "someKey": "someValue",
          ...
        },
        "matchExpressions": [
          {
            "key": "tier",
            "operator": "In",
            "values": ["cache"],
          },
          ...
        ],
      },
      "fieldSelector": { 
        "matchExpressions": [
          {
            "field": "status.phase",
            "operator": "Equal",
            "value": "Pending",
          },
          ...
        ],
      },
      "namespace": {
        "nameSelector": {
          "matchNames": ["somenamespace", "proj-production", "proj-stage"],
        },
        "labelSelector": {
          "matchLabels": {
            "myLabel": "myLabelValue",
            "someKey": "someValue",
            ...
          },
          "matchExpressions": [
            {
              "key": "tier",
              "operator": "In",
              "values": ["cache"],
            },
            ...
          ]
        }
      },
      "jqFilter": ".metadata.labels",
      "allowFailure": true|false,
    },
  ]
}
@dmgtn dmgtn closed this as completed in #45 Sep 2, 2019
dmgtn pushed a commit that referenced this issue Sep 2, 2019
* Introduce versioning for hooks configuration API #36
* Hooks configuration API refactoring #37
* Add support for field selector for onKubernetesEvent hooks #35
@diafour diafour modified the milestones: 1.0.0, 1.0.0-beta.6 Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants