Remove deprecated libraries, update other libs, add ci v1.23 (#8118)

This commit is contained in:
Ricardo Katz 2022-01-09 21:29:12 -03:00 committed by GitHub
parent c917ffacd2
commit 38c73233f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 97 additions and 311 deletions

View file

@ -24,7 +24,6 @@ import (
"strings"
"github.com/ncabatoff/process-exporter/proc"
"github.com/pkg/errors"
"k8s.io/ingress-nginx/internal/nginx"
)
@ -43,27 +42,27 @@ func (n *NGINXController) Check(_ *http.Request) error {
// check the nginx master process is running
fs, err := proc.NewFS("/proc", false)
if err != nil {
return errors.Wrap(err, "reading /proc directory")
return fmt.Errorf("reading /proc directory: %w", err)
}
f, err := os.ReadFile(nginx.PID)
if err != nil {
return errors.Wrapf(err, "reading %v", nginx.PID)
return fmt.Errorf("reading %v: %w", nginx.PID, err)
}
pid, err := strconv.Atoi(strings.TrimRight(string(f), "\r\n"))
if err != nil {
return errors.Wrapf(err, "reading NGINX PID from file %v", nginx.PID)
return fmt.Errorf("reading NGINX PID from file %v: %w", nginx.PID, err)
}
_, err = fs.Proc(pid)
if err != nil {
return errors.Wrapf(err, "checking for NGINX process with PID %v", pid)
return fmt.Errorf("checking for NGINX process with PID %v: %w", pid, err)
}
statusCode, _, err := nginx.NewGetStatusRequest("/is-dynamic-lb-initialized")
if err != nil {
return errors.Wrapf(err, "checking if the dynamic load balancer started")
return fmt.Errorf("checking if the dynamic load balancer started: %w", err)
}
if statusCode != 200 {