Skip to content

Commit

Permalink
get latest
Browse files Browse the repository at this point in the history
  • Loading branch information
skonto committed Feb 15, 2023
1 parent 0affadb commit c1b15ad
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 37 deletions.
16 changes: 0 additions & 16 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -556,14 +556,8 @@ github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/sivchari/tenv v1.4.7/go.mod h1:5nF+bITvkebQVanjU6IuMbvIot/7ReNsUV7I5NbprB0=
github.com/skonto/pkg v0.0.0-20230215113428-d296136e0174 h1:Txp0ufRLr7/VbV2KIx9NaTau6foHEppbJb9va07Of8g=
github.com/skonto/pkg v0.0.0-20230215113428-d296136e0174/go.mod h1:VO/fcEsq43seuONRQxZyftWHjpMabYzRHDtpSEQ/eoQ=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
github.com/sonatard/noctx v0.0.1/go.mod h1:9D2D/EoULe8Yy2joDHJj7bv3sZoq9AaSb8B4lqBjiZI=
github.com/sourcegraph/go-diff v0.6.1/go.mod h1:iBszgVvyxdc8SFZ7gm69go2KDdt3ag071iBaWPF6cjs=
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
Expand Down Expand Up @@ -1205,16 +1199,6 @@ knative.dev/hack v0.0.0-20230210215449-d71d569c4308 h1:zH5OedRfo9SB22o25VNQ+vygc
knative.dev/hack v0.0.0-20230210215449-d71d569c4308/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q=
knative.dev/networking v0.0.0-20230210015049-195809a6b766 h1:MR5gV19dx9rz2e3UjSKHj/Re7mynysdi/iSnOcBkuiA=
knative.dev/networking v0.0.0-20230210015049-195809a6b766/go.mod h1:Axl8raFlsUR/LiUYt387LpiRfE/zgQULog6BL6rfKM0=
knative.dev/pkg v0.0.0-20230210013552-fb44e94cccb1 h1:VUjBhCMWbugVNWkGIbgW6yfjvAuEPCN7UE1xzMeHJvE=
knative.dev/pkg v0.0.0-20230210013552-fb44e94cccb1/go.mod h1:VO/fcEsq43seuONRQxZyftWHjpMabYzRHDtpSEQ/eoQ=
knative.dev/hack v0.0.0-20230207150947-549c3605c670 h1:1+DsejqC6ex9vq8kS9blFqsr/FEpSTR1hRdtFAm/iEA=
knative.dev/hack v0.0.0-20230207150947-549c3605c670/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q=
knative.dev/networking v0.0.0-20230207014849-2473e65d6920 h1:NN7Fr0MVyYhAbGntBXcwLNc4nCAfg3I4pn1FXc5CLiQ=
knative.dev/networking v0.0.0-20230207014849-2473e65d6920/go.mod h1:rn1yRurhkxmSFkpqs/YdG7b9DiYj0VlmLFzBdOQjpOo=
mvdan.cc/gofumpt v0.1.1/go.mod h1:yXG1r1WqZVKWbVRtBWKWX9+CxGYfA51nSomhM0woR48=
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc=
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4=
mvdan.cc/unparam v0.0.0-20210104141923-aac4ce9116a7/go.mod h1:hBpJkZE8H/sb+VRFvw2+rBpHNsTBcvSpk61hr8mzXZE=
pgregory.net/rapid v0.3.3 h1:jCjBsY4ln4Atz78QoBWxUEvAHaFyNDQg9+WU62aCn1U=
pgregory.net/rapid v0.3.3/go.mod h1:UYpPVyjFHzYBGHIxLFoupi8vwk6rXNzRY9OMvVxFIOU=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
Expand Down
35 changes: 15 additions & 20 deletions vendor/knative.dev/pkg/injection/health_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,36 +20,31 @@ import (
"context"
"errors"
"net/http"
"os"
"strconv"
"time"

"knative.dev/pkg/logging"
)

// HealthCheckDefaultPort defines the default port number for health probes
const HealthCheckDefaultPort = 8080

// ServeHealthProbes sets up liveness and readiness probes.
// If user sets no probes explicitly via the context then defaults are added.
func ServeHealthProbes(ctx context.Context) {
func ServeHealthProbes(ctx context.Context, port int) error {
logger := logging.FromContext(ctx)
port := os.Getenv("KNATIVE_HEALTH_PROBES_PORT")
if port == "" {
port = "8080"
}

server := http.Server{ReadHeaderTimeout: time.Minute, Handler: muxWithHandles(ctx), Addr: ":" + port}

server := http.Server{ReadHeaderTimeout: time.Minute, Handler: muxWithHandles(ctx), Addr: ":" + strconv.Itoa(port)}
go func() {
go func() {
<-ctx.Done()
_ = server.Shutdown(ctx)
}()

// start the web server on port and accept requests
logger.Infof("Probes server listening on port %s", port)

if err := server.ListenAndServe(); err != nil && !errors.Is(err, http.ErrServerClosed) {
logger.Fatal(err)
}
<-ctx.Done()
_ = server.Shutdown(ctx)
}()

// start the web server on port and accept requests
logger.Infof("Probes server listening on port %s", port)
if err := server.ListenAndServe(); err != nil && !errors.Is(err, http.ErrServerClosed) {
return err
}
return nil
}

func muxWithHandles(ctx context.Context) *http.ServeMux {
Expand Down
2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1293,7 +1293,7 @@ knative.dev/networking/pkg/http/stats
knative.dev/networking/pkg/ingress
knative.dev/networking/pkg/k8s
knative.dev/networking/pkg/prober
# knative.dev/pkg v0.0.0-20230207013346-decc1cc0acad => github.com/skonto/pkg v0.0.0-20230215113428-d296136e0174
# knative.dev/pkg v0.0.0-20230210013552-fb44e94cccb1 => github.com/skonto/pkg v0.0.0-20230215113428-d296136e0174
## explicit; go 1.18
knative.dev/pkg/apiextensions/storageversion
knative.dev/pkg/apiextensions/storageversion/cmd/migrate
Expand Down

0 comments on commit c1b15ad

Please sign in to comment.