mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
vendor files
This commit is contained in:
33
vendor/k8s.io/kubernetes/pkg/routes/BUILD
generated
vendored
Normal file
33
vendor/k8s.io/kubernetes/pkg/routes/BUILD
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load(
|
||||
"@io_bazel_rules_go//go:def.bzl",
|
||||
"go_library",
|
||||
)
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = [
|
||||
"doc.go",
|
||||
"logs.go",
|
||||
"ui.go",
|
||||
],
|
||||
importpath = "k8s.io/kubernetes/pkg/routes",
|
||||
deps = [
|
||||
"//vendor/github.com/emicklei/go-restful:go_default_library",
|
||||
"//vendor/k8s.io/apiserver/pkg/server/mux:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "package-srcs",
|
||||
srcs = glob(["**"]),
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "all-srcs",
|
||||
srcs = [":package-srcs"],
|
||||
tags = ["automanaged"],
|
||||
)
|
9
vendor/k8s.io/kubernetes/pkg/routes/OWNERS
generated
vendored
Normal file
9
vendor/k8s.io/kubernetes/pkg/routes/OWNERS
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
reviewers:
|
||||
- deads2k
|
||||
- lavalamp
|
||||
- sttts
|
||||
- caesarxuchao
|
||||
approvers:
|
||||
- deads2k
|
||||
- lavalamp
|
||||
- sttts
|
18
vendor/k8s.io/kubernetes/pkg/routes/doc.go
generated
vendored
Normal file
18
vendor/k8s.io/kubernetes/pkg/routes/doc.go
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
Copyright 2015 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Package routes holds a collection of optional master http handlers.
|
||||
package routes
|
50
vendor/k8s.io/kubernetes/pkg/routes/logs.go
generated
vendored
Normal file
50
vendor/k8s.io/kubernetes/pkg/routes/logs.go
generated
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
/*
|
||||
Copyright 2014 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package routes
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"path"
|
||||
|
||||
"github.com/emicklei/go-restful"
|
||||
)
|
||||
|
||||
// Logs adds handlers for the /logs path serving log files from /var/log.
|
||||
type Logs struct{}
|
||||
|
||||
func (l Logs) Install(c *restful.Container) {
|
||||
// use restful: ws.Route(ws.GET("/logs/{logpath:*}").To(fileHandler))
|
||||
// See github.com/emicklei/go-restful/blob/master/examples/restful-serve-static.go
|
||||
ws := new(restful.WebService)
|
||||
ws.Path("/logs")
|
||||
ws.Doc("get log files")
|
||||
ws.Route(ws.GET("/{logpath:*}").To(logFileHandler).Param(ws.PathParameter("logpath", "path to the log").DataType("string")))
|
||||
ws.Route(ws.GET("/").To(logFileListHandler))
|
||||
|
||||
c.Add(ws)
|
||||
}
|
||||
|
||||
func logFileHandler(req *restful.Request, resp *restful.Response) {
|
||||
logdir := "/var/log"
|
||||
actual := path.Join(logdir, req.PathParameter("logpath"))
|
||||
http.ServeFile(resp.ResponseWriter, req.Request, actual)
|
||||
}
|
||||
|
||||
func logFileListHandler(req *restful.Request, resp *restful.Response) {
|
||||
logdir := "/var/log"
|
||||
http.ServeFile(resp.ResponseWriter, req.Request, logdir)
|
||||
}
|
36
vendor/k8s.io/kubernetes/pkg/routes/ui.go
generated
vendored
Normal file
36
vendor/k8s.io/kubernetes/pkg/routes/ui.go
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
/*
|
||||
Copyright 2014 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package routes
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"k8s.io/apiserver/pkg/server/mux"
|
||||
)
|
||||
|
||||
const dashboardPath = "/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/"
|
||||
|
||||
// UIRedirect redirects /ui to the kube-ui proxy path.
|
||||
type UIRedirect struct{}
|
||||
|
||||
func (r UIRedirect) Install(c *mux.PathRecorderMux) {
|
||||
handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
http.Redirect(w, r, dashboardPath, http.StatusTemporaryRedirect)
|
||||
})
|
||||
c.Handle("/ui", handler)
|
||||
c.HandlePrefix("/ui/", handler)
|
||||
}
|
Reference in New Issue
Block a user