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

ArgoCD "custom health check" #1693

Open
MPV opened this issue Nov 18, 2021 · 4 comments
Open

ArgoCD "custom health check" #1693

MPV opened this issue Nov 18, 2021 · 4 comments

Comments

@MPV
Copy link

MPV commented Nov 18, 2021

Anyone else using ArgoCD to deploy this operator?

I'd like to suggest we create an ArgoCD "Custom Health Check" for this operator.

Read more about what that is here:
https://argo-cd.readthedocs.io/en/stable/operator-manual/health/

And here's how to add one:
https://argo-cd.readthedocs.io/en/stable/operator-manual/health/#way-2-contribute-a-custom-health-check

Essentially something like this:

$ cd github.com/argoproj/argo-cd
$ cat resource_customizations/acid.zalan.do/postgresql/health.lua
hs = {}
if obj.status == nil or obj.status.PostgresClusterStatus == nil then
  hs.status = "Progressing"
  hs.message = "Waiting for postgres cluster status..."
  return hs
end

if obj.status.PostgresClusterStatus == "Running" then
  hs.status = "Healthy"
  hs.message = obj.status.PostgresClusterStatus
  return hs
end

if obj.status.PostgresClusterStatus == "Creating" or obj.status.PostgresClusterStatus == "Updating" then
  hs.status = "Progressing"
  hs.message = obj.status.PostgresClusterStatus
  return hs
end

-- CreateFailed/UpdateFailed/SyncFailed/Invalid/etc
-- See: https://github.com/zalando/postgres-operator/blob/0745ce7cce63ab6431103d27eb08e54ec47d2b15/pkg/apis/acid.zalan.do/v1/const.go#L4-L13
hs.status = "Degraded"
hs.message = obj.status.PostgresClusterStatus
return hs
@marcellodesales
Copy link

How to show the resources created by the operator?

  • @MPV, how can I show the StatefulSets and Services associated with the Database?
    • ArgoCD is just showing the postgres crd...

Screen Shot 2022-01-31 at 4 26 22 PM

@MPV
Copy link
Author

MPV commented Feb 6, 2022

How to show the resources created by the operator?

  • how can I show the StatefulSets and Services associated with the Database?

    • ArgoCD is just showing the postgres crd...

@marcellodesales #498 is required for those resources to show up (as they’re not created by ArgoCD but by the operator — ArgoCD requires this owner reference link to understand that they are related).

@marcellodesales
Copy link

marcellodesales commented Feb 6, 2022

@MPV

According to #1766 (comment), we just need to add labels... (See Argo's latest discussion on the thread)... thank you!

@alfsch
Copy link
Contributor

alfsch commented Oct 6, 2022

Anyone else using ArgoCD to deploy this operator?

I'd like to suggest we create an ArgoCD "Custom Health Check" for this operator.

Read more about what that is here: https://argo-cd.readthedocs.io/en/stable/operator-manual/health/

And here's how to add one: https://argo-cd.readthedocs.io/en/stable/operator-manual/health/#way-2-contribute-a-custom-health-check

Essentially something like this:

$ cd github.com/argoproj/argo-cd
$ cat resource_customizations/acid.zalan.do/postgresql/health.lua
hs = {}
if obj.status == nil or obj.status.PostgresClusterStatus == nil then
  hs.status = "Progressing"
  hs.message = "Waiting for postgres cluster status..."
  return hs
end

if obj.status.PostgresClusterStatus == "Running" then
  hs.status = "Healthy"
  hs.message = obj.status.PostgresClusterStatus
  return hs
end

if obj.status.PostgresClusterStatus == "Creating" or obj.status.PostgresClusterStatus == "Updating" then
  hs.status = "Progressing"
  hs.message = obj.status.PostgresClusterStatus
  return hs
end

-- CreateFailed/UpdateFailed/SyncFailed/Invalid/etc
-- See: https://github.com/zalando/postgres-operator/blob/0745ce7cce63ab6431103d27eb08e54ec47d2b15/pkg/apis/acid.zalan.do/v1/const.go#L4-L13
hs.status = "Degraded"
hs.message = obj.status.PostgresClusterStatus
return hs

Are there any plans to provide this health check to argo-cd?

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

No branches or pull requests

3 participants