Documentation ¶
Overview ¶
Copyright 2016 The Rook Authors. All rights reserved.
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.
Copyright 2016 The Rook Authors. All rights reserved.
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.
Copyright 2016 The Rook Authors. All rights reserved.
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.
Copyright 2016 The Rook Authors. All rights reserved.
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.
Copyright 2016 The Rook Authors. All rights reserved.
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.
Copyright 2016 The Rook Authors. All rights reserved.
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.
Copyright 2016 The Rook Authors. All rights reserved.
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.
Copyright 2016 The Rook Authors. All rights reserved.
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.
Copyright 2016 The Rook Authors. All rights reserved.
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.
Copyright 2016 The Rook Authors. All rights reserved.
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.
Copyright 2016 The Rook Authors. All rights reserved.
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.
Index ¶
- Constants
- func ConfigureServiceIfTriggered(context *Context, agent ServiceAgent) bool
- func GetNodeProgressKey(nodeID string) string
- func GetNodeStatusKey(service, nodeID string) string
- func IsLeader(l Lease, nodeID string) bool
- func IsNodeUnhealthy(node *inventory.NodeConfig) (int, bool)
- func RunConfigureAgent(context *Context, agent ServiceAgent) error
- func SetNodeConfigStatus(etcdClient etcd.KeysAPI, nodeID, taskKey string, nodeStatus NodeConfigStatus) error
- func SetNodeConfigStatusWithPrevIndex(etcdClient etcd.KeysAPI, nodeID string, nodeStatus NodeConfigStatus, ...) (*etcd.Response, error)
- func TriggerAgents(etcdClient etcd.KeysAPI, nodeIDs []string, agentKey string) error
- func TriggerAgentsAndWait(etcdClient etcd.KeysAPI, nodeIDs []string, agentKey string, ...) error
- func TriggerAgentsAndWaitForCompletion(etcdClient etcd.KeysAPI, nodeIDs []string, agentKey string, ...) error
- func VerifyNetworkInfo(networkInfo NetworkInfo) error
- func WaitForNodeConfigCompletion(etcdClient etcd.KeysAPI, taskKey string, nodes []string, timeout int) (int, error)
- type ClusterMember
- type ClusterRefresher
- type ClusterService
- type Context
- type DaemonContext
- type Leader
- type Lease
- type Manager
- type NetworkInfo
- type NodeConfigStatus
- type RefreshEvent
- type RefreshKey
- type ServiceAgent
- type ServiceLeader
- type UnhealthyNode
Constants ¶
const ( EtcdRequestTimeout = time.Second LeaderKey = "/rook/leader" )
const ( DesiredKey = "desired" AppliedKey = "applied" NodeStatusRootKey = "/rook/_notify/%s" NodeStatusServiceKey = "/rook/_notify/%s/%s" // node ID, service name InfiniteTimeout = -1 StatusValue = "status" NodeConfigStatusUnknown = iota NodeConfigStatusNotTriggered NodeConfigStatusTriggered NodeConfigStatusRunning NodeConfigStatusFailed NodeConfigStatusSucceeded NodeConfigStatusTimeout NodeConfigStatusAbort )
const (
LeaderElectionKey = "orchestrator-leader"
)
const (
SystemLogDir = "/var/log/rook"
)
Variables ¶
This section is empty.
Functions ¶
func ConfigureServiceIfTriggered ¶
func ConfigureServiceIfTriggered(context *Context, agent ServiceAgent) bool
func GetNodeProgressKey ¶
Get the general node status key, used for communication between the leader and the agents
func GetNodeStatusKey ¶
Get the status key for the general node or the specific service on the node.
func IsNodeUnhealthy ¶
func IsNodeUnhealthy(node *inventory.NodeConfig) (int, bool)
func RunConfigureAgent ¶
func RunConfigureAgent(context *Context, agent ServiceAgent) error
func SetNodeConfigStatus ¶
func SetNodeConfigStatus(etcdClient etcd.KeysAPI, nodeID, taskKey string, nodeStatus NodeConfigStatus) error
SetNodeConfigStatus sets the node configuration status. If a taskKey is specified, set the status for a specific task. If the taskKey is the empty string, set the status for the node.
func TriggerAgents ¶
Trigger agents that they need to apply new state. The method will not wait for any nodes to respond. Returns success if the etcd trigger keys were set.
func TriggerAgentsAndWait ¶
func TriggerAgentsAndWait(etcdClient etcd.KeysAPI, nodeIDs []string, agentKey string, requiredSuccessCount, waitSeconds int) error
Trigger agents that they need to apply new state. The method will wait for all nodes to respond. Returns success if at least "requiredSuccessCount" of the nodes succeed. Waits at most the designated number of seconds.
func TriggerAgentsAndWaitForCompletion ¶
func TriggerAgentsAndWaitForCompletion(etcdClient etcd.KeysAPI, nodeIDs []string, agentKey string, requiredSuccessCount int) error
Trigger agents that they need to apply new state. The method will wait for all nodes to respond. Returns success if at least "requiredSuccessCount" of the nodes succeed. Waits at most 60s per node.
func VerifyNetworkInfo ¶ added in v0.3.0
func VerifyNetworkInfo(networkInfo NetworkInfo) error
Types ¶
type ClusterMember ¶
type ClusterMember struct {
// contains filtered or unexported fields
}
func (*ClusterMember) ElectLeader ¶
func (r *ClusterMember) ElectLeader() error
type ClusterRefresher ¶
type ClusterRefresher struct {
// contains filtered or unexported fields
}
ClusterRefresher type
func NewClusterRefresher ¶
func NewClusterRefresher() *ClusterRefresher
Create a new cluster refresher
func (*ClusterRefresher) TriggerDevicesChanged ¶
func (c *ClusterRefresher) TriggerDevicesChanged(nodeID string) bool
Trigger an event for a device being added or removed to a node
func (*ClusterRefresher) TriggerRefresh ¶
func (c *ClusterRefresher) TriggerRefresh() bool
Trigger a general refresh of the cluster
type ClusterService ¶
type ClusterService struct { Name string Leader ServiceLeader Agents []ServiceAgent }
type Context ¶
type Context struct { // The registered services for cluster configuration Services []*ClusterService // The latest inventory information Inventory *inventory.Config // The local node ID NodeID string // The etcd client for get/set config values EtcdClient etcd.KeysAPI // The implementation of executing a console command Executor exec.Executor // The process manager for launching a process ProcMan *proc.ProcManager // The root configuration directory used by services ConfigDir string // A value indicating the desired logging/tracing level LogLevel capnslog.LogLevel // The full path to a config file that can be used to override generated settings ConfigFileOverride string // Information about the network for this machine and its cluster NetworkInfo NetworkInfo }
The context for loading or applying the configuration state of a service.
func StartJoinCluster ¶
func StartJoinCluster(services []*ClusterService, configDir, nodeID, discoveryURL, etcdMembers string, networkInfo NetworkInfo, configFileOverride string, logLevel capnslog.LogLevel) (*Context, error)
StartJoinCluster initializes the cluster services to enable joining the cluster and listening for orchestration.
func ToContext ¶ added in v0.3.0
func ToContext(context *DaemonContext) *Context
Convert a context to a daemon context
func (*Context) GetExecutor ¶
type DaemonContext ¶ added in v0.3.0
type DaemonContext struct { // The implementation of executing a console command Executor exec.Executor // The process manager for launching a process ProcMan *proc.ProcManager // The root configuration directory used by services ConfigDir string // A value indicating the desired logging/tracing level LogLevel capnslog.LogLevel // The full path to a config file that can be used to override generated settings ConfigFileOverride string }
The context for running a rook daemon.
func NewDaemonContext ¶ added in v0.3.0
func NewDaemonContext(dataDir, cephConfigOverride string, logLevel capnslog.LogLevel) *DaemonContext
func ToDaemonContext ¶ added in v0.3.0
func ToDaemonContext(context *Context) *DaemonContext
type Leader ¶
type Leader interface { OnLeadershipAcquired() error OnLeadershipLost() error GetLeaseName() string }
Interface defining how a leader reacts to gaining or losing election, new members being added, etc.
type Lease ¶
type Lease interface { Renew(time.Duration) error Release() error MachineID() string Version() int Index() uint64 TimeRemaining() time.Duration }
The interfaces and implementation for leasing found in this source file comes from https://github.com/coreos/fleet/tree/master/pkg/lease We cannot reference the fleet package due to the fleet reference to the etcdclient as part of the antiquated godeps _workspace. With the move to the vendor folder, we were required to break this indirect dependency and move the source code to our own repo.
type NetworkInfo ¶ added in v0.3.0
type NodeConfigStatus ¶
type NodeConfigStatus int
func GetNodeConfigStatus ¶
func ParseNodeConfigStatus ¶
func ParseNodeConfigStatus(status string) NodeConfigStatus
func WatchNodeConfigStatus ¶
func WatchNodeConfigStatus(etcdClient etcd.KeysAPI, taskKey, nodeID string, timeout int, index *uint64) (NodeConfigStatus, error)
WatchNodeConfigStatus watches for changes to the node config status etcd key
func (NodeConfigStatus) String ¶
func (n NodeConfigStatus) String() string
type RefreshEvent ¶
type RefreshEvent struct { Context *Context NodesAdded *util.Set NodesRemoved *util.Set NodesChanged *util.Set NodesUnhealthy map[string]*UnhealthyNode }
RefreshEvent type
type RefreshKey ¶
type RefreshKey struct { Path string Triggered func(response *etcd.Response, refresher *ClusterRefresher) }
RefreshKey type
type ServiceAgent ¶
type ServiceAgent interface { // Get the name of the service agent Name() string // Initialize the agents from the context, allowing them to store desired state in etcd before orchestration starts. Initialize(context *Context) error // Configure the service according to the changes requested by the leader ConfigureLocalService(context *Context) error // Remove a service that is no longer needed DestroyLocalService(context *Context) error }
type ServiceLeader ¶
type ServiceLeader interface { // Get the list of etcd keys that when changed should trigger an orchestration RefreshKeys() []*RefreshKey // Refresh the service HandleRefresh(e *RefreshEvent) }
Interface implemented by a service that has been elected leader