cleanup the command line arguments and other PR feedback
This commit is contained in:
1 parent
a6b4430d8a
commit
37d85a374b
23 files changed
+70
-128
No files matched your search
@@ -1,4 +1,4 @@
|
||||
FROM alpine:3.4
|
||||
FROM scratch
|
||||
|
||||
COPY rook-operator /opt/rook/bin/
|
||||
|
||||
|
||||
+7
-5
@@ -47,6 +47,7 @@ Tool for bootstrapping and running the rook storage daemon.
|
||||
https://github.com/rook/rook`,
|
||||
}
|
||||
var cfg = &config{}
|
||||
var clusterInfo mon.ClusterInfo
|
||||
|
||||
var logLevelRaw string
|
||||
var logger = capnslog.NewPackageLogger("github.com/rook/rook", "rookd")
|
||||
@@ -65,7 +66,6 @@ type config struct {
|
||||
cephConfigOverride string
|
||||
bluestoreConfig partition.BluestoreConfig
|
||||
networkInfo clusterd.NetworkInfo
|
||||
clusterName string
|
||||
monEndpoints string
|
||||
}
|
||||
|
||||
@@ -82,11 +82,8 @@ func main() {
|
||||
// 2) environment variables (upper case, replace - with _, and rook prefix. For example, discovery-url is ROOKD_DISCOVERY_URL)
|
||||
// 3) command line parameter
|
||||
func init() {
|
||||
rootCmd.Flags().StringVar(&cfg.adminSecret, "admin-secret", "", "secret for the admin user (random if not specified)")
|
||||
rootCmd.Flags().StringVar(&cfg.discoveryURL, "discovery-url", "", "etcd discovery URL. Example: http://discovery.rook.com/26bd83c92e7145e6b103f623263f61df")
|
||||
rootCmd.Flags().StringVar(&cfg.etcdMembers, "etcd-members", "", "etcd members to connect to. Overrides the discovery URL. Example: http://10.23.45.56:2379")
|
||||
rootCmd.Flags().StringVar(&cfg.networkInfo.PublicAddrIPv4, "public-ipv4", "127.0.0.1", "public IPv4 address for this machine")
|
||||
rootCmd.Flags().StringVar(&cfg.networkInfo.ClusterAddrIPv4, "private-ipv4", "127.0.0.1", "private IPv4 address for this machine")
|
||||
rootCmd.Flags().StringVar(&cfg.networkInfo.PublicNetwork, "public-network", "", "public (front-side) network and subnet mask for the cluster, using CIDR notation (e.g., 192.168.0.0/24)")
|
||||
rootCmd.Flags().StringVar(&cfg.networkInfo.ClusterNetwork, "private-network", "", "private (back-side) network and subnet mask for the cluster, using CIDR notation (e.g., 10.0.0.0/24)")
|
||||
rootCmd.Flags().StringVar(&cfg.devices, "data-devices", "", "comma separated list of devices to use for storage")
|
||||
@@ -99,8 +96,13 @@ func init() {
|
||||
rootCmd.Flags().IntVar(&cfg.bluestoreConfig.WalSizeMB, "osd-wal-size", partition.WalDefaultSizeMB, "default size (MB) for OSD write ahead log (WAL)")
|
||||
rootCmd.Flags().IntVar(&cfg.bluestoreConfig.DatabaseSizeMB, "osd-database-size", partition.DBDefaultSizeMB, "default size (MB) for OSD database")
|
||||
|
||||
rootCmd.PersistentFlags().StringVar(&cfg.clusterName, "cluster-name", "rookcluster", "ceph cluster name")
|
||||
rootCmd.PersistentFlags().StringVar(&cfg.networkInfo.PublicAddrIPv4, "public-ipv4", "127.0.0.1", "public IPv4 address for this machine")
|
||||
rootCmd.PersistentFlags().StringVar(&cfg.networkInfo.ClusterAddrIPv4, "private-ipv4", "127.0.0.1", "private IPv4 address for this machine")
|
||||
rootCmd.PersistentFlags().StringVar(&clusterInfo.Name, "cluster-name", "rookcluster", "ceph cluster name")
|
||||
rootCmd.PersistentFlags().StringVar(&cfg.monEndpoints, "mon-endpoints", "", "ceph mon endpoints")
|
||||
rootCmd.PersistentFlags().StringVar(&clusterInfo.FSID, "fsid", "", "the cluster uuid")
|
||||
rootCmd.PersistentFlags().StringVar(&clusterInfo.MonitorSecret, "mon-secret", "", "the cephx keyring for monitors")
|
||||
rootCmd.PersistentFlags().StringVar(&clusterInfo.AdminSecret, "admin-secret", "", "secret for the admin user (random if not specified)")
|
||||
rootCmd.PersistentFlags().StringVar(&cfg.dataDir, "data-dir", "/var/lib/rook", "directory for storing configuration")
|
||||
rootCmd.PersistentFlags().StringVar(&logLevelRaw, "log-level", "INFO", "logging level for logging/tracing output (valid values: CRITICAL,ERROR,WARNING,NOTICE,INFO,DEBUG,TRACE)")
|
||||
rootCmd.PersistentFlags().StringVar(&cfg.cephConfigOverride, "ceph-config-override", "", "optional path to a ceph config file that will be appended to the config files that rook generates")
|
||||
|
||||
+7
-28
@@ -19,14 +19,11 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/rook/rook/pkg/cephmgr/cephd"
|
||||
"github.com/rook/rook/pkg/cephmgr/mon"
|
||||
"github.com/rook/rook/pkg/clusterd"
|
||||
"github.com/rook/rook/pkg/util/exec"
|
||||
"github.com/rook/rook/pkg/util/flags"
|
||||
"github.com/rook/rook/pkg/util/proc"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
@@ -37,53 +34,35 @@ var monCmd = &cobra.Command{
|
||||
}
|
||||
|
||||
var (
|
||||
cluster mon.ClusterInfo
|
||||
monName string
|
||||
monPort int
|
||||
)
|
||||
|
||||
func init() {
|
||||
monCmd.Flags().StringVar(&monName, "name", "", "name of the monitor")
|
||||
monCmd.Flags().StringVar(&cluster.FSID, "fsid", "", "keyring for secure monitors")
|
||||
monCmd.Flags().StringVar(&cluster.MonitorSecret, "mon-secret", "", "keyring for secure monitors")
|
||||
monCmd.Flags().StringVar(&cluster.AdminSecret, "admin-secret", "", "keyring for secure monitors")
|
||||
monCmd.Flags().IntVar(&monPort, "port", 0, "port of the monitor")
|
||||
|
||||
flags.SetFlagsFromEnv(monCmd.Flags(), "ROOKD")
|
||||
|
||||
monCmd.RunE = startMon
|
||||
}
|
||||
|
||||
func startMon(cmd *cobra.Command, args []string) error {
|
||||
if err := flags.VerifyRequiredFlags(monCmd, []string{"name", "fsid", "mon-secret", "admin-secret", "data-dir", "cluster-name"}); err != nil {
|
||||
if err := flags.VerifyRequiredFlags(monCmd, []string{"name", "fsid", "mon-secret", "admin-secret", "data-dir", "cluster-name", "private-ipv4"}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
setLogLevel()
|
||||
|
||||
ipaddress := os.Getenv(mon.IPAddressEnvVar)
|
||||
if ipaddress == "" {
|
||||
return fmt.Errorf("missing pod ip address for the monitor")
|
||||
}
|
||||
|
||||
if monPort == 0 {
|
||||
return fmt.Errorf("missing mon port")
|
||||
}
|
||||
|
||||
cluster.Name = cfg.clusterName
|
||||
|
||||
// at first start the local monitor needs to be added to the list of mons
|
||||
cluster.Monitors = mon.ParseMonEndpoints(cfg.monEndpoints)
|
||||
cluster.Monitors[monName] = mon.ToCephMon(monName, ipaddress)
|
||||
|
||||
monCfg := &mon.Config{Name: monName, Cluster: &cluster, CephLauncher: cephd.New()}
|
||||
|
||||
executor := &exec.CommandExecutor{}
|
||||
context := &clusterd.DaemonContext{
|
||||
ProcMan: proc.New(executor),
|
||||
Executor: executor,
|
||||
ConfigDir: cfg.dataDir,
|
||||
ConfigFileOverride: cfg.cephConfigOverride,
|
||||
LogLevel: cfg.logLevel,
|
||||
}
|
||||
clusterInfo.Monitors = mon.ParseMonEndpoints(cfg.monEndpoints)
|
||||
clusterInfo.Monitors[monName] = mon.ToCephMon(monName, cfg.networkInfo.ClusterAddrIPv4)
|
||||
|
||||
monCfg := &mon.Config{Name: monName, Cluster: &clusterInfo, CephLauncher: cephd.New()}
|
||||
context := clusterd.NewDaemonContext(cfg.dataDir, cfg.cephConfigOverride, cfg.logLevel)
|
||||
return mon.Run(context, monCfg)
|
||||
}
|
||||
+5
-19
@@ -23,9 +23,7 @@ import (
|
||||
"github.com/rook/rook/pkg/cephmgr/osd"
|
||||
"github.com/rook/rook/pkg/cephmgr/osd/partition"
|
||||
"github.com/rook/rook/pkg/clusterd"
|
||||
"github.com/rook/rook/pkg/util/exec"
|
||||
"github.com/rook/rook/pkg/util/flags"
|
||||
"github.com/rook/rook/pkg/util/proc"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
@@ -39,14 +37,11 @@ var (
|
||||
)
|
||||
|
||||
func init() {
|
||||
osdCmd.Flags().StringVar(&osdCluster.MonitorSecret, "osd-mon-secret", "", "keyring for secure monitors")
|
||||
osdCmd.Flags().StringVar(&osdCluster.AdminSecret, "osd-admin-secret", "", "keyring for secure monitors")
|
||||
|
||||
osdCmd.RunE = startOSD
|
||||
}
|
||||
|
||||
func startOSD(cmd *cobra.Command, args []string) error {
|
||||
if err := flags.VerifyRequiredFlags(osdCmd, []string{"cluster-name", "mon-endpoints", "osd-mon-secret", "osd-admin-secret"}); err != nil {
|
||||
if err := flags.VerifyRequiredFlags(osdCmd, []string{"cluster-name", "mon-endpoints", "mon-secret", "admin-secret"}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -56,19 +51,10 @@ func startOSD(cmd *cobra.Command, args []string) error {
|
||||
metadataDevice := ""
|
||||
forceFormat := false
|
||||
location := ""
|
||||
bluestoreConfig := partition.BluestoreConfig{DatabaseSizeMB: 512} //FIX
|
||||
osdCluster.Monitors = mon.ParseMonEndpoints(cfg.monEndpoints)
|
||||
osdCluster.Name = cfg.clusterName
|
||||
agent := osd.NewAgent(cephd.New(), devices, metadataDevice, forceFormat, location, bluestoreConfig, &osdCluster)
|
||||
|
||||
executor := &exec.CommandExecutor{}
|
||||
context := &clusterd.DaemonContext{
|
||||
ProcMan: proc.New(executor),
|
||||
Executor: executor,
|
||||
ConfigDir: cfg.dataDir,
|
||||
ConfigFileOverride: cfg.cephConfigOverride,
|
||||
LogLevel: cfg.logLevel,
|
||||
}
|
||||
bluestoreConfig := partition.BluestoreConfig{DatabaseSizeMB: 512} // FIX
|
||||
clusterInfo.Monitors = mon.ParseMonEndpoints(cfg.monEndpoints)
|
||||
agent := osd.NewAgent(cephd.New(), devices, metadataDevice, forceFormat, location, bluestoreConfig, &clusterInfo)
|
||||
context := clusterd.NewDaemonContext(cfg.dataDir, cfg.cephConfigOverride, cfg.logLevel)
|
||||
|
||||
return osd.Run(context, agent)
|
||||
}
|
||||
+6
-15
@@ -24,7 +24,6 @@ import (
|
||||
"github.com/rook/rook/pkg/cephmgr/mon"
|
||||
"github.com/rook/rook/pkg/cephmgr/rgw"
|
||||
"github.com/rook/rook/pkg/clusterd"
|
||||
"github.com/rook/rook/pkg/util/exec"
|
||||
"github.com/rook/rook/pkg/util/flags"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
@@ -36,7 +35,6 @@ var rgwCmd = &cobra.Command{
|
||||
}
|
||||
|
||||
var (
|
||||
rgwCluster mon.ClusterInfo
|
||||
rgwKeyring string
|
||||
rgwHost string
|
||||
rgwPort int
|
||||
@@ -44,16 +42,16 @@ var (
|
||||
|
||||
func init() {
|
||||
rgwCmd.Flags().StringVar(&rgwKeyring, "rgw-keyring", "", "the rgw keyring")
|
||||
rgwCmd.Flags().StringVar(&osdCluster.MonitorSecret, "rgw-mon-secret", "", "the monitor secret")
|
||||
rgwCmd.Flags().StringVar(&osdCluster.AdminSecret, "rgw-admin-secret", "", "the admin secret")
|
||||
rgwCmd.Flags().StringVar(&rgwHost, "rgw-host", "", "dns host name")
|
||||
rgwCmd.Flags().IntVar(&rgwPort, "rgw-port", 0, "rgw port number")
|
||||
|
||||
flags.SetFlagsFromEnv(rgwCmd.Flags(), "ROOKD")
|
||||
|
||||
rgwCmd.RunE = startRGW
|
||||
}
|
||||
|
||||
func startRGW(cmd *cobra.Command, args []string) error {
|
||||
if err := flags.VerifyRequiredFlags(rgwCmd, []string{"mon-endpoints", "cluster-name", "rgw-host", "rgw-mon-secret", "rgw-admin-secret", "rgw-keyring"}); err != nil {
|
||||
if err := flags.VerifyRequiredFlags(rgwCmd, []string{"mon-endpoints", "cluster-name", "mon-secret", "admin-secret", "rgw-host", "rgw-keyring"}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -63,10 +61,9 @@ func startRGW(cmd *cobra.Command, args []string) error {
|
||||
|
||||
setLogLevel()
|
||||
|
||||
rgwCluster.Monitors = mon.ParseMonEndpoints(cfg.monEndpoints)
|
||||
rgwCluster.Name = cfg.clusterName
|
||||
clusterInfo.Monitors = mon.ParseMonEndpoints(cfg.monEndpoints)
|
||||
config := &rgw.Config{
|
||||
ClusterInfo: &rgwCluster,
|
||||
ClusterInfo: &clusterInfo,
|
||||
CephLauncher: cephd.New(),
|
||||
Keyring: rgwKeyring,
|
||||
Host: rgwHost,
|
||||
@@ -74,13 +71,7 @@ func startRGW(cmd *cobra.Command, args []string) error {
|
||||
InProc: true,
|
||||
}
|
||||
|
||||
executor := &exec.CommandExecutor{}
|
||||
context := &clusterd.DaemonContext{
|
||||
Executor: executor,
|
||||
ConfigDir: cfg.dataDir,
|
||||
ConfigFileOverride: cfg.cephConfigOverride,
|
||||
LogLevel: cfg.logLevel,
|
||||
}
|
||||
context := clusterd.NewDaemonContext(cfg.dataDir, cfg.cephConfigOverride, cfg.logLevel)
|
||||
|
||||
return rgw.Run(context, config)
|
||||
}
|
||||
@@ -38,6 +38,8 @@ func init() {
|
||||
toolCmd.Flags().StringVar(&toolType, "type", "", "type of tool [rgw-admin|mon --mkfs|osd --mkfs]")
|
||||
toolCmd.MarkFlagRequired("type")
|
||||
|
||||
flags.SetFlagsFromEnv(toolCmd.Flags(), "ROOKD")
|
||||
|
||||
toolCmd.RunE = runTool
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,6 @@ spec:
|
||||
spec:
|
||||
containers:
|
||||
- name: rook-operator
|
||||
image: quay.io/rook/rook-operator:dev-2017-01-27-b
|
||||
image: quay.io/rook/rook-operator:dev-2017-02-01-c
|
||||
command: ["/opt/rook/bin/rook-operator"]
|
||||
args: ["--container-version=dev-2017-01-27-k8s-a"]
|
||||
args: ["--container-version=dev-2017-02-01-k8s-b"]
|
||||
@@ -25,8 +25,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
Port = 6790
|
||||
IPAddressEnvVar = "MON_POD_IP"
|
||||
Port = 6790
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
@@ -86,7 +85,7 @@ func generateConfigFiles(context *clusterd.DaemonContext, config *Config) (strin
|
||||
}
|
||||
|
||||
// write the config file to disk
|
||||
confFilePath, err := GenerateConnectionConfigFile(ToContext(context), config.Cluster, getMonRunDirPath(context.ConfigDir, config.Name),
|
||||
confFilePath, err := GenerateConnectionConfigFile(clusterd.ToContext(context), config.Cluster, getMonRunDirPath(context.ConfigDir, config.Name),
|
||||
"admin", getMonKeyringPath(context.ConfigDir, config.Name))
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
@@ -106,11 +105,6 @@ func generateConfigFiles(context *clusterd.DaemonContext, config *Config) (strin
|
||||
return confFilePath, monDataDir, nil
|
||||
}
|
||||
|
||||
// TEMP: Convert a context to a daemon context. This should go away after all daemons convert
|
||||
func ToContext(context *clusterd.DaemonContext) *clusterd.Context {
|
||||
return &clusterd.Context{Executor: context.Executor, ProcMan: context.ProcMan, ConfigDir: context.ConfigDir, LogLevel: context.LogLevel, ConfigFileOverride: context.ConfigFileOverride}
|
||||
}
|
||||
|
||||
func startMon(context *clusterd.DaemonContext, config *Config, confFilePath, monDataDir string) error {
|
||||
// call mon --mkfs in a child process
|
||||
logger.Infof("initializing mon")
|
||||
@@ -143,7 +137,7 @@ func startMon(context *clusterd.DaemonContext, config *Config, confFilePath, mon
|
||||
fmt.Sprintf("--conf=%s", confFilePath),
|
||||
fmt.Sprintf("--keyring=%s", keyringPath))
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to start rgw: %+v", err)
|
||||
return fmt.Errorf("failed to start mon: %+v", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
@@ -29,7 +29,7 @@ import (
|
||||
func Run(dcontext *clusterd.DaemonContext, agent *OsdAgent) error {
|
||||
|
||||
logger.Infof("discovering hardware")
|
||||
context := mon.ToContext(dcontext)
|
||||
context := clusterd.ToContext(dcontext)
|
||||
hardware, err := inventory.DiscoverHardware(context.Executor)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed initial hardware discovery. %+v", err)
|
||||
|
||||
@@ -110,7 +110,7 @@ func (a *rgwAgent) startRGW(context *clusterd.Context, cluster *mon.ClusterInfo)
|
||||
keyring := val.Node.Value
|
||||
|
||||
config := &Config{Keyring: keyring, ClusterInfo: cluster, Host: DNSName, Port: RGWPort}
|
||||
dcontext := toDaemonContext(context)
|
||||
dcontext := clusterd.ToDaemonContext(context)
|
||||
err = generateConfigFiles(dcontext, config)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to generate rgw config files. %+v", err)
|
||||
|
||||
@@ -70,7 +70,7 @@ func generateConfigFiles(context *clusterd.DaemonContext, config *Config) error
|
||||
"rgw intent log object name utc": "true",
|
||||
"rgw enable usage log": "true",
|
||||
}
|
||||
_, err := mon.GenerateConfigFile(mon.ToContext(context), config.ClusterInfo, getRGWConfDir(context.ConfigDir),
|
||||
_, err := mon.GenerateConfigFile(clusterd.ToContext(context), config.ClusterInfo, getRGWConfDir(context.ConfigDir),
|
||||
"client.radosgw.gateway", getRGWKeyringPath(context.ConfigDir), false, nil, settings)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create config file. %+v", err)
|
||||
@@ -96,10 +96,6 @@ func generateConfigFiles(context *clusterd.DaemonContext, config *Config) error
|
||||
return nil
|
||||
}
|
||||
|
||||
func toDaemonContext(context *clusterd.Context) *clusterd.DaemonContext {
|
||||
return &clusterd.DaemonContext{ProcMan: context.ProcMan, Executor: context.Executor, ConfigDir: context.ConfigDir, LogLevel: context.LogLevel, ConfigFileOverride: context.ConfigFileOverride}
|
||||
}
|
||||
|
||||
func startRGW(context *clusterd.DaemonContext, config *Config) (rgwProc *proc.MonitoredProc, err error) {
|
||||
|
||||
// start the monitor daemon in the foreground with the given config
|
||||
|
||||
@@ -122,6 +122,26 @@ func copyContext(c *Context) *Context {
|
||||
}
|
||||
}
|
||||
|
||||
func NewDaemonContext(dataDir, cephConfigOverride string, logLevel capnslog.LogLevel) *DaemonContext {
|
||||
executor := &exec.CommandExecutor{}
|
||||
return &DaemonContext{
|
||||
ProcMan: proc.New(executor),
|
||||
Executor: executor,
|
||||
ConfigDir: dataDir,
|
||||
ConfigFileOverride: cephConfigOverride,
|
||||
LogLevel: logLevel,
|
||||
}
|
||||
}
|
||||
|
||||
// Convert a context to a daemon context
|
||||
func ToContext(context *DaemonContext) *Context {
|
||||
return &Context{Executor: context.Executor, ProcMan: context.ProcMan, ConfigDir: context.ConfigDir, LogLevel: context.LogLevel, ConfigFileOverride: context.ConfigFileOverride}
|
||||
}
|
||||
|
||||
func ToDaemonContext(context *Context) *DaemonContext {
|
||||
return &DaemonContext{ProcMan: context.ProcMan, Executor: context.Executor, ConfigDir: context.ConfigDir, LogLevel: context.LogLevel, ConfigFileOverride: context.ConfigFileOverride}
|
||||
}
|
||||
|
||||
func (c *Context) GetExecutor() exec.Executor {
|
||||
if c.Executor == nil {
|
||||
return &exec.CommandExecutor{}
|
||||
|
||||
@@ -52,7 +52,6 @@ func DiscoverHardwareAndStore(etcdClient etcd.KeysAPI, executor exec.Executor, n
|
||||
}
|
||||
|
||||
// Discover all the hardware properties for this node.
|
||||
// Store the important properties in etcd and more detailed info for the local node in the context.
|
||||
func DiscoverHardware(executor exec.Executor) (*Hardware, error) {
|
||||
devices, err := discoverDevices(executor)
|
||||
if err != nil {
|
||||
@@ -61,8 +60,6 @@ func DiscoverHardware(executor exec.Executor) (*Hardware, error) {
|
||||
|
||||
mem := getSystemMemory()
|
||||
|
||||
// TODO: Discover network adapters, processors, ...
|
||||
|
||||
return &Hardware{Disks: devices, Memory: mem}, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -13,22 +13,8 @@ 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.
|
||||
|
||||
Some of the code below came from https://github.com/ceph/go-ceph
|
||||
which has the following license:
|
||||
|
||||
Copyright 2016 The etcd-operator 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.
|
||||
Some of the code below came from https://github.com/coreos/etcd-operator
|
||||
which also has the apache 2.0 license.
|
||||
*/
|
||||
package k8sutil
|
||||
|
||||
|
||||
@@ -19,4 +19,4 @@ import (
|
||||
"github.com/coreos/pkg/capnslog"
|
||||
)
|
||||
|
||||
var logger = capnslog.NewPackageLogger("github.com/rook/rook-operator", "k8sutil")
|
||||
var logger = capnslog.NewPackageLogger("github.com/rook/rook-operator", "op-k8sutil")
|
||||
@@ -13,22 +13,8 @@ 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.
|
||||
|
||||
Some of the code below came from https://github.com/ceph/go-ceph
|
||||
which has the following license:
|
||||
|
||||
Copyright 2016 The etcd-operator 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.
|
||||
Some of the code below came from https://github.com/coreos/etcd-operator
|
||||
which also has the apache 2.0 license.
|
||||
*/
|
||||
package k8sutil
|
||||
|
||||
@@ -45,6 +31,7 @@ const (
|
||||
AppAttr = "app"
|
||||
ClusterAttr = "rook_cluster"
|
||||
VersionAttr = "rook_version"
|
||||
PodIPEnvVar = "ROOKD_PRIVATE_IPV4"
|
||||
)
|
||||
|
||||
func MakeRookImage(version string) string {
|
||||
|
||||
@@ -19,4 +19,4 @@ import (
|
||||
"github.com/coreos/pkg/capnslog"
|
||||
)
|
||||
|
||||
var logger = capnslog.NewPackageLogger("github.com/rook/rook-operator", "mon")
|
||||
var logger = capnslog.NewPackageLogger("github.com/rook/rook-operator", "op-mon")
|
||||
@@ -163,6 +163,8 @@ func (c *Cluster) waitForPodToStart(clientset *kubernetes.Clientset, pod *v1.Pod
|
||||
return "", fmt.Errorf("timed out waiting for pod %s to start", pod.Name)
|
||||
}
|
||||
|
||||
// detect whether we have a big enough cluster to run services on different nodes.
|
||||
// the anti-affinity will prevent pods of the same type of running on the same node.
|
||||
func (c *Cluster) getAntiAffinity(clientset *kubernetes.Clientset) (bool, error) {
|
||||
nodeOptions := api.ListOptions{}
|
||||
nodeOptions.TypeMeta.Kind = "Node"
|
||||
|
||||
@@ -81,7 +81,7 @@ func (c *Cluster) monContainer(config *MonConfig, clusterInfo *mon.ClusterInfo)
|
||||
{Name: k8sutil.DataDirVolume, MountPath: k8sutil.DataDir},
|
||||
},
|
||||
Env: []v1.EnvVar{
|
||||
{Name: mon.IPAddressEnvVar, ValueFrom: &v1.EnvVarSource{FieldRef: &v1.ObjectFieldSelector{FieldPath: "status.podIP"}}},
|
||||
{Name: k8sutil.PodIPEnvVar, ValueFrom: &v1.EnvVarSource{FieldRef: &v1.ObjectFieldSelector{FieldPath: "status.podIP"}}},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,4 +19,4 @@ import (
|
||||
"github.com/coreos/pkg/capnslog"
|
||||
)
|
||||
|
||||
var logger = capnslog.NewPackageLogger("github.com/rook/rook-operator", "osd")
|
||||
var logger = capnslog.NewPackageLogger("github.com/rook/rook-operator", "op-osd")
|
||||
@@ -95,7 +95,7 @@ func (c *Cluster) makeDaemonSet(cluster *mon.ClusterInfo) (*extensions.DaemonSet
|
||||
|
||||
func (c *Cluster) osdContainer(cluster *mon.ClusterInfo) api.Container {
|
||||
|
||||
command := fmt.Sprintf("/usr/bin/rookd osd --data-dir=%s --mon-endpoints=%s --cluster-name=%s --osd-mon-secret=%s --osd-admin-secret=%s ",
|
||||
command := fmt.Sprintf("/usr/bin/rookd osd --data-dir=%s --mon-endpoints=%s --cluster-name=%s --mon-secret=%s --admin-secret=%s ",
|
||||
k8sutil.DataDir, mon.FlattenMonEndpoints(cluster.Monitors), cluster.Name, cluster.MonitorSecret, cluster.AdminSecret)
|
||||
privileged := true
|
||||
return api.Container{
|
||||
|
||||
@@ -19,4 +19,4 @@ import (
|
||||
"github.com/coreos/pkg/capnslog"
|
||||
)
|
||||
|
||||
var logger = capnslog.NewPackageLogger("github.com/rook/rook-operator", "rgw")
|
||||
var logger = capnslog.NewPackageLogger("github.com/rook/rook-operator", "op-rgw")
|
||||
@@ -130,7 +130,7 @@ func (c *Cluster) makeDeployment(cluster *mon.ClusterInfo, keyring string) (*ext
|
||||
|
||||
func (c *Cluster) rgwContainer(cluster *mon.ClusterInfo, keyring string) api.Container {
|
||||
|
||||
command := fmt.Sprintf("/usr/bin/rookd rgw --data-dir=%s --mon-endpoints=%s --cluster-name=%s --rgw-mon-secret=%s --rgw-admin-secret=%s --rgw-port=%d --rgw-host=%s --rgw-keyring=%s",
|
||||
command := fmt.Sprintf("/usr/bin/rookd rgw --data-dir=%s --mon-endpoints=%s --cluster-name=%s --mon-secret=%s --admin-secret=%s --rgw-port=%d --rgw-host=%s --rgw-keyring=%s",
|
||||
k8sutil.DataDir, mon.FlattenMonEndpoints(cluster.Monitors), cluster.Name, cluster.MonitorSecret, cluster.AdminSecret, cephrgw.RGWPort, cephrgw.DNSName, keyring)
|
||||
return api.Container{
|
||||
// TODO: fix "sleep 5".
|
||||
|
||||
Reference in new issue
Block a user