mirror of https://github.com/k3s-io/k3s
Expose v1beta2 API group
parent
c90d62d512
commit
ca5355908f
|
@ -40,7 +40,7 @@ import (
|
|||
var (
|
||||
port = flag.Uint("port", 8080, "The port to listen on. Default 8080.")
|
||||
address = flag.String("address", "127.0.0.1", "The address on the local server to listen to. Default 127.0.0.1")
|
||||
apiPrefix = flag.String("api_prefix", "/api/v1beta1", "The prefix for API requests on the server. Default '/api/v1beta1'")
|
||||
apiPrefix = flag.String("api_prefix", "/api", "The prefix for API requests on the server. Default '/api'")
|
||||
cloudProvider = flag.String("cloud_provider", "", "The provider for cloud services. Empty string for no provider.")
|
||||
cloudConfigFile = flag.String("cloud_config", "", "The path to the cloud provider configuration file. Empty string for no configuration file.")
|
||||
minionRegexp = flag.String("minion_regexp", "", "If non empty, and -cloud_provider is specified, a regular expression for matching minion VMs")
|
||||
|
@ -141,9 +141,12 @@ func main() {
|
|||
PodInfoGetter: podInfoGetter,
|
||||
})
|
||||
|
||||
storage, codec := m.API_v1beta1()
|
||||
mux := http.NewServeMux()
|
||||
apiserver.NewAPIGroup(m.API_v1beta1()).InstallREST(mux, *apiPrefix+"/v1beta1")
|
||||
apiserver.NewAPIGroup(m.API_v1beta2()).InstallREST(mux, *apiPrefix+"/v1beta2")
|
||||
apiserver.InstallSupport(mux)
|
||||
|
||||
handler := apiserver.Handle(storage, codec, *apiPrefix)
|
||||
handler := http.Handler(mux)
|
||||
if len(corsAllowedOriginList) > 0 {
|
||||
allowedOriginRegexps, err := util.CompileRegexps(corsAllowedOriginList)
|
||||
if err != nil {
|
||||
|
@ -151,10 +154,11 @@ func main() {
|
|||
}
|
||||
handler = apiserver.CORS(handler, allowedOriginRegexps, nil, nil, "true")
|
||||
}
|
||||
handler = apiserver.RecoverPanics(handler)
|
||||
|
||||
s := &http.Server{
|
||||
Addr: net.JoinHostPort(*address, strconv.Itoa(int(*port))),
|
||||
Handler: apiserver.RecoverPanics(handler),
|
||||
Handler: handler,
|
||||
ReadTimeout: 5 * time.Minute,
|
||||
WriteTimeout: 5 * time.Minute,
|
||||
MaxHeaderBytes: 1 << 20,
|
||||
|
|
|
@ -21,6 +21,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/v1beta1"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/v1beta2"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/apiserver"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/cloudprovider"
|
||||
|
@ -139,3 +140,12 @@ func (m *Master) API_v1beta1() (map[string]apiserver.RESTStorage, runtime.Codec)
|
|||
}
|
||||
return storage, v1beta1.Codec
|
||||
}
|
||||
|
||||
// API_v1beta2 returns the resources and codec for API version v1beta2.
|
||||
func (m *Master) API_v1beta2() (map[string]apiserver.RESTStorage, runtime.Codec) {
|
||||
storage := make(map[string]apiserver.RESTStorage)
|
||||
for k, v := range m.storage {
|
||||
storage[k] = v
|
||||
}
|
||||
return storage, v1beta2.Codec
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue