Move api, http, healthz, pages to cmd/internal

This commit is contained in:
Jordan Liggitt 2020-03-23 13:26:48 +00:00
parent 9b7fcb5801
commit c22edbcc7d
30 changed files with 796 additions and 788 deletions

View File

@ -18,12 +18,12 @@ set -e
GIT_ROOT=$(dirname "${BASH_SOURCE}")/..
ASSETS_INPUT_DIRS="$GIT_ROOT/pages/assets/js/... $GIT_ROOT/pages/assets/styles/..."
ASSETS_OUTPUT_PATH="$GIT_ROOT/pages/static/assets.go"
ASSETS_INPUT_DIRS="$GIT_ROOT/cmd/internal/pages/assets/js/... $GIT_ROOT/cmd/internal/pages/assets/styles/..."
ASSETS_OUTPUT_PATH="$GIT_ROOT/cmd/internal/pages/static/assets.go"
ASSETS_PACKAGE="static"
TEMPLATES_INPUT_DIRS="$GIT_ROOT/pages/assets/html/..."
TEMPLATES_OUTPUT_PATH="$GIT_ROOT/pages/templates.go"
TEMPLATES_INPUT_DIRS="$GIT_ROOT/cmd/internal/pages/assets/html/..."
TEMPLATES_OUTPUT_PATH="$GIT_ROOT/cmd/internal/pages/templates.go"
TEMPLATES_PACKAGE="pages"
FORCE="${FORCE:-}" # Force assets to be rebuilt if FORCE=true
@ -48,14 +48,14 @@ build_asset () {
mv "${tmp_output}" "${output_path}"
}
for f in $GIT_ROOT/pages/assets/js/* $GIT_ROOT/pages/assets/styles/*; do
for f in $GIT_ROOT/cmd/internal/pages/assets/js/* $GIT_ROOT/cmd/internal/pages/assets/styles/*; do
if [ "$FORCE" == "true" ] || [ "$f" -nt $ASSETS_OUTPUT_PATH -o ! -e $ASSETS_OUTPUT_PATH ]; then
build_asset "$ASSETS_PACKAGE" "$ASSETS_OUTPUT_PATH" "$ASSETS_INPUT_DIRS"
break;
fi
done
for f in $GIT_ROOT/pages/assets/html/*; do
for f in $GIT_ROOT/cmd/internal/pages/assets/html/*; do
if [ "$FORCE" == "true" ] || [ "$f" -nt $TEMPLATES_OUTPUT_PATH -o ! -e $TEMPLATES_OUTPUT_PATH ]; then
build_asset "$TEMPLATES_PACKAGE" "$TEMPLATES_OUTPUT_PATH" "$TEMPLATES_INPUT_DIRS"
break;

View File

@ -27,8 +27,8 @@ import (
"syscall"
"time"
cadvisorhttp "github.com/google/cadvisor/cmd/internal/http"
"github.com/google/cadvisor/container"
cadvisorhttp "github.com/google/cadvisor/http"
"github.com/google/cadvisor/manager"
"github.com/google/cadvisor/metrics"
"github.com/google/cadvisor/utils/sysfs"

View File

@ -16,6 +16,7 @@ require (
github.com/SeanDolphin/bqschema v0.0.0-20150424181127-f92a08f515e1
github.com/Shopify/sarama v1.8.0
github.com/Shopify/toxiproxy v2.1.4+incompatible // indirect
github.com/abbot/go-http-auth v0.0.0-20140618235127-c0ef4539dfab
github.com/eapache/go-resiliency v1.0.1-0.20160104191539-b86b1ec0dd42 // indirect
github.com/eapache/queue v1.0.2 // indirect
github.com/garyburd/redigo v0.0.0-20150301180006-535138d7bcd7
@ -27,6 +28,7 @@ require (
github.com/onsi/gomega v1.7.1 // indirect
github.com/opencontainers/runc v1.0.0-rc10
github.com/pquerna/ffjson v0.0.0-20171002144729-d49c2bc1aa13 // indirect
github.com/prometheus/client_golang v1.0.0
github.com/stretchr/testify v1.4.0
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be
google.golang.org/api v0.0.0-20150730141719-0c2979aeaa5b

View File

@ -198,6 +198,7 @@ github.com/vishvananda/netlink v0.0.0-20150820014904-1e2e08e8a2dc/go.mod h1:+SR5
github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df h1:OviZH7qLw/7ZovXvuNyL3XQl8UFofeikI1NW1Gypu7k=
github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df/go.mod h1:JP3t17pCcGlemwknint6hfoeCVQrEMVwxRLRjXpq+BU=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=

View File

@ -28,8 +28,8 @@ import (
"strings"
"time"
httpmux "github.com/google/cadvisor/cmd/internal/http/mux"
"github.com/google/cadvisor/events"
httpmux "github.com/google/cadvisor/http/mux"
info "github.com/google/cadvisor/info/v1"
"github.com/google/cadvisor/manager"

View File

@ -17,7 +17,7 @@ package healthz
import (
"net/http"
httpmux "github.com/google/cadvisor/http/mux"
httpmux "github.com/google/cadvisor/cmd/internal/http/mux"
)
func handleHealthz(w http.ResponseWriter, r *http.Request) {

View File

@ -19,14 +19,14 @@ import (
"net/http"
auth "github.com/abbot/go-http-auth"
"github.com/google/cadvisor/api"
"github.com/google/cadvisor/cmd/internal/api"
"github.com/google/cadvisor/cmd/internal/healthz"
httpmux "github.com/google/cadvisor/cmd/internal/http/mux"
"github.com/google/cadvisor/cmd/internal/pages"
"github.com/google/cadvisor/cmd/internal/pages/static"
"github.com/google/cadvisor/container"
"github.com/google/cadvisor/healthz"
httpmux "github.com/google/cadvisor/http/mux"
"github.com/google/cadvisor/manager"
"github.com/google/cadvisor/metrics"
"github.com/google/cadvisor/pages"
"github.com/google/cadvisor/pages/static"
"github.com/google/cadvisor/validate"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"

View File

@ -21,7 +21,7 @@ import (
"net/url"
"strings"
httpmux "github.com/google/cadvisor/http/mux"
httpmux "github.com/google/cadvisor/cmd/internal/http/mux"
info "github.com/google/cadvisor/info/v1"
"github.com/google/cadvisor/manager"

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

1
go.mod
View File

@ -6,7 +6,6 @@ require (
cloud.google.com/go v0.26.0
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 // indirect
github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5 // indirect
github.com/abbot/go-http-auth v0.0.0-20140618235127-c0ef4539dfab
github.com/aws/aws-sdk-go v1.6.10
github.com/blang/semver v3.1.0+incompatible
github.com/checkpoint-restore/go-criu v0.0.0-20190109184317-bdb7599cd87b // indirect

2
go.sum
View File

@ -5,8 +5,6 @@ github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5 h1:ygIc8M6trr62pF5DucadTWGdEB4mEyvzi0e2nbcmcyA=
github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw=
github.com/abbot/go-http-auth v0.0.0-20140618235127-c0ef4539dfab h1:/CCup82s4yOdPAC2kijHUejVUNgpWHUmyVY0lek8PIM=
github.com/abbot/go-http-auth v0.0.0-20140618235127-c0ef4539dfab/go.mod h1:Cz6ARTIzApMJDzh5bRMSUou6UMSp0IEXg9km/ci7TJM=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/aws/aws-sdk-go v1.6.10 h1:CVUS2yoWO3h14JctzBlGheGrEtAfvfjzyQT15+BPqNI=

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long