Skip to content

api: Introduce & expose endpoint controller statuses#2720

Merged
tgraf merged 3 commits intomasterfrom
controller-status
Feb 6, 2018
Merged

api: Introduce & expose endpoint controller statuses#2720
tgraf merged 3 commits intomasterfrom
controller-status

Conversation

@tgraf
Copy link
Copy Markdown
Contributor

@tgraf tgraf commented Feb 5, 2018

$ cilium status --all-controllers
[...]
Controller Status (0/2 failing)
  Name                               Last success   Last error   Count   Message
  sync-identity-to-k8s-pod (56326)   36s ago        never        0       no error
  sync-identity-to-k8s-pod (29898)   32s ago        never        0       no error
    $ cilium status -o json
      "controllers": [
        {
          "configuration": {
            "error-retry": true,
            "interval": "1m0s"
          },
          "name": "sync-identity-to-k8s-pod (56326)",
          "status": {
            "last-failure-timestamp": "0001-01-01T00:00:00.000Z",
            "last-success-timestamp": "2018-02-05T17:43:34.099-08:00",
            "success-count": 1
          },
          "uuid": "247d5d37-0adf-11e8-aa78-080027559fd9"
        },
        {
          "configuration": {
            "error-retry": true,
            "interval": "1m0s"
          },
          "name": "sync-identity-to-k8s-pod (29898)",
          "status": {
            "last-failure-timestamp": "0001-01-01T00:00:00.000Z",
            "last-success-timestamp": "2018-02-05T17:43:37.997-08:00",
            "success-count": 1
          },
          "uuid": "26d05710-0adf-11e8-aa78-080027559fd9"
        }

@tgraf tgraf added kind/enhancement This would improve or streamline existing functionality. area/daemon Impacts operation of the Cilium daemon. release-note/minor This PR changes functionality that users may find relevant to operating Cilium. labels Feb 5, 2018
@tgraf tgraf requested review from a team as code owners February 5, 2018 23:29
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported type ControllerStatuses should have comment or be unexported

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported type ControllerStatusStatus should have comment or be unexported

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported type ControllerStatusConfiguration should have comment or be unexported

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported type ControllerStatus should have comment or be unexported

@tgraf
Copy link
Copy Markdown
Contributor Author

tgraf commented Feb 5, 2018

test-me-please

Copy link
Copy Markdown
Member

@ianvernon ianvernon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM apart from some minor nitpicks.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: timestamp

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In other structures we have put the mutex above all of the resources which should be accessed under that lock - can you do that here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@tgraf tgraf force-pushed the controller-status branch from 66944a6 to 65481f1 Compare February 6, 2018 01:45
@tgraf tgraf requested a review from a team February 6, 2018 01:45
@tgraf tgraf requested review from a team as code owners February 6, 2018 01:45
@tgraf tgraf added release-note/major This PR introduces major new functionality to Cilium. and removed release-note/minor This PR changes functionality that users may find relevant to operating Cilium. labels Feb 6, 2018
@tgraf
Copy link
Copy Markdown
Contributor Author

tgraf commented Feb 6, 2018

test-me-please

@tgraf tgraf requested a review from ianvernon February 6, 2018 01:47
@ianvernon
Copy link
Copy Markdown
Member

test-me-please

@ianvernon
Copy link
Copy Markdown
Member

ianvernon commented Feb 6, 2018

Error from previous build is odd:

02:28:04 pkg/client/client.go:218: time.Since(t).Truncate undefined (type time.Duration has no field or method Truncate)
02:28:04 Makefile:71: recipe for target 'tests-consul-ginkgo' failed

EDIT: never mind, there were new changes to the PR. I will review when the above error has been resolved.

@tgraf tgraf force-pushed the controller-status branch from 65481f1 to 88753d8 Compare February 6, 2018 10:09
@tgraf
Copy link
Copy Markdown
Contributor Author

tgraf commented Feb 6, 2018

test-me-please

@tgraf tgraf force-pushed the controller-status branch from 88753d8 to c9b5480 Compare February 6, 2018 10:33
@tgraf
Copy link
Copy Markdown
Contributor Author

tgraf commented Feb 6, 2018

test-me-please

@tgraf
Copy link
Copy Markdown
Contributor Author

tgraf commented Feb 6, 2018

02:28:04 pkg/client/client.go:218: time.Since(t).Truncate undefined (type time.Duration has no field or method Truncate)

Truncate() is not available in go 1.8. I've worked around it.

@tgraf
Copy link
Copy Markdown
Contributor Author

tgraf commented Feb 6, 2018

test-me-please

Copy link
Copy Markdown
Contributor

@raybejjani raybejjani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you docuement what allControllers does?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we only do something when status != nil, we can continue when status == nil and avoid the indent.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found this logic a bit difficult. Why not:

if status.ConsecutiveFailureCount > 0 {
	nFailing++
} else if !allControllers {
	continue
}

or a switch on the same clauses.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

The global controller health will become the standard health overview of the
agent as it will show the status of all async operations:

$ cilium status --all-controllers
[...]
Controller Status (0/2 failing)
  Name                               Last success   Last error   Count   Message
  sync-identity-to-k8s-pod (56326)   36s ago        never        0       no error
  sync-identity-to-k8s-pod (29898)   32s ago        never        0       no error

$ cilium status -o json
  "controllers": [
    {
      "configuration": {
        "error-retry": true,
        "interval": "1m0s"
      },
      "name": "sync-identity-to-k8s-pod (56326)",
      "status": {
        "last-failure-timestamp": "0001-01-01T00:00:00.000Z",
        "last-success-timestamp": "2018-02-05T17:43:34.099-08:00",
        "success-count": 1
      },
      "uuid": "247d5d37-0adf-11e8-aa78-080027559fd9"
    },
    {
      "configuration": {
        "error-retry": true,
        "interval": "1m0s"
      },
      "name": "sync-identity-to-k8s-pod (29898)",
      "status": {
        "last-failure-timestamp": "0001-01-01T00:00:00.000Z",
        "last-success-timestamp": "2018-02-05T17:43:37.997-08:00",
        "success-count": 1
      },
      "uuid": "26d05710-0adf-11e8-aa78-080027559fd9"
    }

Signed-off-by: Thomas Graf <[email protected]>
@tgraf tgraf force-pushed the controller-status branch from c9b5480 to 5b57b4d Compare February 6, 2018 12:20
@tgraf
Copy link
Copy Markdown
Contributor Author

tgraf commented Feb 6, 2018

test-me-please

@tgraf tgraf merged commit cb6890e into master Feb 6, 2018
@tgraf tgraf deleted the controller-status branch February 6, 2018 14:01
michi-covalent added a commit that referenced this pull request Aug 5, 2024
[ cherry-picked from cilium/cilium-cli repository ]

Also update kubeadm.k8s.io API version from v1beta2 to v1beta3.

Ref: #2720

Suggested-by: Joe Stringer <[email protected]>
Signed-off-by: Michi Mutsuzaki <[email protected]>
github-merge-queue bot pushed a commit that referenced this pull request Aug 16, 2024
[ cherry-picked from cilium/cilium-cli repository ]

Also update kubeadm.k8s.io API version from v1beta2 to v1beta3.

Ref: #2720

Suggested-by: Joe Stringer <[email protected]>
Signed-off-by: Michi Mutsuzaki <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/daemon Impacts operation of the Cilium daemon. kind/enhancement This would improve or streamline existing functionality. release-note/major This PR introduces major new functionality to Cilium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants