mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 06:27:05 +00:00
Add event endpoint to apiserver
This commit is contained in:
parent
3e076e12fe
commit
15680731f7
@ -49,17 +49,18 @@ import (
|
|||||||
var (
|
var (
|
||||||
port = flag.Uint("port", 8080, "The port to listen on. Default 8080")
|
port = flag.Uint("port", 8080, "The port to listen on. Default 8080")
|
||||||
address = util.IP(net.ParseIP("127.0.0.1"))
|
address = util.IP(net.ParseIP("127.0.0.1"))
|
||||||
apiPrefix = flag.String("api_prefix", "/api", "The prefix for API requests on the server. Default '/api'")
|
apiPrefix = flag.String("api_prefix", "/api", "The prefix for API requests on the server. Default '/api'.")
|
||||||
storageVersion = flag.String("storage_version", "", "The version to store resources with. Defaults to server preferred")
|
storageVersion = flag.String("storage_version", "", "The version to store resources with. Defaults to server preferred")
|
||||||
cloudProvider = flag.String("cloud_provider", "", "The provider for cloud services. Empty string for no provider.")
|
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.")
|
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")
|
minionRegexp = flag.String("minion_regexp", "", "If non empty, and -cloud_provider is specified, a regular expression for matching minion VMs.")
|
||||||
minionPort = flag.Uint("minion_port", 10250, "The port at which kubelet will be listening on the minions.")
|
minionPort = flag.Uint("minion_port", 10250, "The port at which kubelet will be listening on the minions.")
|
||||||
healthCheckMinions = flag.Bool("health_check_minions", true, "If true, health check minions and filter unhealthy ones. Default true")
|
healthCheckMinions = flag.Bool("health_check_minions", true, "If true, health check minions and filter unhealthy ones. Default true.")
|
||||||
minionCacheTTL = flag.Duration("minion_cache_ttl", 30*time.Second, "Duration of time to cache minion information. Default 30 seconds")
|
minionCacheTTL = flag.Duration("minion_cache_ttl", 30*time.Second, "Duration of time to cache minion information. Default 30 seconds.")
|
||||||
tokenAuthFile = flag.String("token_auth_file", "", "If set, the file that will be used to secure the API server via token authentication")
|
eventTTL = flag.Duration("event_ttl", 48*time.Hour, "Amount of time to retain events. Default 2 days.")
|
||||||
|
tokenAuthFile = flag.String("token_auth_file", "", "If set, the file that will be used to secure the API server via token authentication.")
|
||||||
etcdServerList util.StringList
|
etcdServerList util.StringList
|
||||||
etcdConfigFile = flag.String("etcd_config", "", "The config file for the etcd client. Mutually exclusive with -etcd_servers")
|
etcdConfigFile = flag.String("etcd_config", "", "The config file for the etcd client. Mutually exclusive with -etcd_servers.")
|
||||||
machineList util.StringList
|
machineList util.StringList
|
||||||
corsAllowedOriginList util.StringList
|
corsAllowedOriginList util.StringList
|
||||||
allowPrivileged = flag.Bool("allow_privileged", false, "If true, allow privileged containers.")
|
allowPrivileged = flag.Bool("allow_privileged", false, "If true, allow privileged containers.")
|
||||||
@ -178,6 +179,7 @@ func main() {
|
|||||||
HealthCheckMinions: *healthCheckMinions,
|
HealthCheckMinions: *healthCheckMinions,
|
||||||
Minions: machineList,
|
Minions: machineList,
|
||||||
MinionCacheTTL: *minionCacheTTL,
|
MinionCacheTTL: *minionCacheTTL,
|
||||||
|
EventTTL: *eventTTL,
|
||||||
MinionRegexp: *minionRegexp,
|
MinionRegexp: *minionRegexp,
|
||||||
PodInfoGetter: podInfoGetter,
|
PodInfoGetter: podInfoGetter,
|
||||||
NodeResources: api.NodeResources{
|
NodeResources: api.NodeResources{
|
||||||
|
@ -31,6 +31,8 @@ import (
|
|||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/registry/controller"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/registry/controller"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/registry/endpoint"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/registry/endpoint"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/registry/etcd"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/registry/etcd"
|
||||||
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/registry/event"
|
||||||
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/registry/generic"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/registry/minion"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/registry/minion"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/registry/pod"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/registry/pod"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/registry/service"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/registry/service"
|
||||||
@ -49,6 +51,7 @@ type Config struct {
|
|||||||
HealthCheckMinions bool
|
HealthCheckMinions bool
|
||||||
Minions []string
|
Minions []string
|
||||||
MinionCacheTTL time.Duration
|
MinionCacheTTL time.Duration
|
||||||
|
EventTTL time.Duration
|
||||||
MinionRegexp string
|
MinionRegexp string
|
||||||
PodInfoGetter client.PodInfoGetter
|
PodInfoGetter client.PodInfoGetter
|
||||||
NodeResources api.NodeResources
|
NodeResources api.NodeResources
|
||||||
@ -62,6 +65,7 @@ type Master struct {
|
|||||||
endpointRegistry endpoint.Registry
|
endpointRegistry endpoint.Registry
|
||||||
minionRegistry minion.Registry
|
minionRegistry minion.Registry
|
||||||
bindingRegistry binding.Registry
|
bindingRegistry binding.Registry
|
||||||
|
eventRegistry generic.Registry
|
||||||
storage map[string]apiserver.RESTStorage
|
storage map[string]apiserver.RESTStorage
|
||||||
client *client.Client
|
client *client.Client
|
||||||
}
|
}
|
||||||
@ -92,6 +96,7 @@ func New(c *Config) *Master {
|
|||||||
serviceRegistry: serviceRegistry,
|
serviceRegistry: serviceRegistry,
|
||||||
endpointRegistry: etcd.NewRegistry(c.EtcdHelper, nil),
|
endpointRegistry: etcd.NewRegistry(c.EtcdHelper, nil),
|
||||||
bindingRegistry: etcd.NewRegistry(c.EtcdHelper, manifestFactory),
|
bindingRegistry: etcd.NewRegistry(c.EtcdHelper, manifestFactory),
|
||||||
|
eventRegistry: event.NewEtcdRegistry(c.EtcdHelper, uint64(c.EventTTL.Seconds())),
|
||||||
minionRegistry: minionRegistry,
|
minionRegistry: minionRegistry,
|
||||||
client: c.Client,
|
client: c.Client,
|
||||||
}
|
}
|
||||||
@ -147,6 +152,7 @@ func (m *Master) init(cloud cloudprovider.Interface, podInfoGetter client.PodInf
|
|||||||
"services": service.NewREST(m.serviceRegistry, cloud, m.minionRegistry),
|
"services": service.NewREST(m.serviceRegistry, cloud, m.minionRegistry),
|
||||||
"endpoints": endpoint.NewREST(m.endpointRegistry),
|
"endpoints": endpoint.NewREST(m.endpointRegistry),
|
||||||
"minions": minion.NewREST(m.minionRegistry),
|
"minions": minion.NewREST(m.minionRegistry),
|
||||||
|
"events": event.NewREST(m.eventRegistry),
|
||||||
|
|
||||||
// TODO: should appear only in scheduler API group.
|
// TODO: should appear only in scheduler API group.
|
||||||
"bindings": binding.NewREST(m.bindingRegistry),
|
"bindings": binding.NewREST(m.bindingRegistry),
|
||||||
|
Loading…
Reference in New Issue
Block a user