forked from rook/rook
rename rook k8s artifacts for consistency
This commit is contained in:
committed by
Bassam Tabbara
parent
ac27d1f590
commit
6177aff963
@@ -68,8 +68,8 @@ func (k8sh *K8sHelper) GetMonitorPods() ([]string, error) {
|
||||
moncount := 0
|
||||
|
||||
for moncount < 3 {
|
||||
m := fmt.Sprintf("mon%d", monIdx)
|
||||
selector := fmt.Sprintf("mon=%s", m)
|
||||
m := fmt.Sprintf("rook-mon%d", monIdx)
|
||||
selector := fmt.Sprintf("rook-mon=%s", m)
|
||||
cmdArgs := []string{"-n", "rook", "get", "pod", "-l", selector}
|
||||
stdout, _, status := ExecuteCmd("kubectl", cmdArgs)
|
||||
if status == 0 {
|
||||
|
||||
@@ -51,7 +51,7 @@ func TestCreateSecrets(t *testing.T) {
|
||||
err := c.createClientAccess(info)
|
||||
assert.Nil(t, err)
|
||||
|
||||
secretName := fmt.Sprintf("%s-rook-user", c.Name)
|
||||
secretName := fmt.Sprintf("%s-rook-user", c.Namespace)
|
||||
secret, err := clientset.CoreV1().Secrets(k8sutil.DefaultNamespace).Get(secretName, metav1.GetOptions{})
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, secretName, secret.Name)
|
||||
|
||||
@@ -50,21 +50,19 @@ func TestStartMDS(t *testing.T) {
|
||||
// start a basic cluster
|
||||
err := c.Start()
|
||||
assert.Nil(t, err)
|
||||
|
||||
validateStart(t, c)
|
||||
|
||||
// starting again should be a no-op
|
||||
err = c.Start()
|
||||
assert.Nil(t, err)
|
||||
|
||||
validateStart(t, c)
|
||||
}
|
||||
|
||||
func validateStart(t *testing.T, c *Cluster) {
|
||||
|
||||
r, err := c.context.Clientset.ExtensionsV1beta1().Deployments(c.Namespace).Get("mds", metav1.GetOptions{})
|
||||
r, err := c.context.Clientset.ExtensionsV1beta1().Deployments(c.Namespace).Get(appName, metav1.GetOptions{})
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, "mds", r.Name)
|
||||
assert.Equal(t, appName, r.Name)
|
||||
}
|
||||
|
||||
func TestPodSpecs(t *testing.T) {
|
||||
@@ -73,13 +71,13 @@ func TestPodSpecs(t *testing.T) {
|
||||
|
||||
d := c.makeDeployment(mdsID)
|
||||
assert.NotNil(t, d)
|
||||
assert.Equal(t, "mds", d.Name)
|
||||
assert.Equal(t, appName, d.Name)
|
||||
assert.Equal(t, v1.RestartPolicyAlways, d.Spec.Template.Spec.RestartPolicy)
|
||||
assert.Equal(t, 2, len(d.Spec.Template.Spec.Volumes))
|
||||
assert.Equal(t, "rook-data", d.Spec.Template.Spec.Volumes[0].Name)
|
||||
|
||||
assert.Equal(t, "mds", d.ObjectMeta.Name)
|
||||
assert.Equal(t, "mds", d.Spec.Template.ObjectMeta.Labels["app"])
|
||||
assert.Equal(t, appName, d.ObjectMeta.Name)
|
||||
assert.Equal(t, appName, d.Spec.Template.ObjectMeta.Labels["app"])
|
||||
assert.Equal(t, c.Namespace, d.Spec.Template.ObjectMeta.Labels["rook_cluster"])
|
||||
assert.Equal(t, 0, len(d.ObjectMeta.Annotations))
|
||||
|
||||
|
||||
@@ -167,7 +167,7 @@ func (c *Cluster) getExpectedMonConfig() []*MonConfig {
|
||||
// initialize mon info if we don't have enough mons (at first startup)
|
||||
for i := len(c.clusterInfo.Monitors); i < c.Size; i++ {
|
||||
c.maxMonID++
|
||||
mons = append(mons, &MonConfig{Name: fmt.Sprintf("mon%d", c.maxMonID), Port: int32(mon.Port)})
|
||||
mons = append(mons, &MonConfig{Name: fmt.Sprintf("%s%d", appName, c.maxMonID), Port: int32(mon.Port)})
|
||||
}
|
||||
|
||||
return mons
|
||||
@@ -506,7 +506,7 @@ func validNode(node v1.Node, placement k8sutil.Placement) bool {
|
||||
}
|
||||
|
||||
func (c *Cluster) getNodesWithMons() (*util.Set, error) {
|
||||
options := metav1.ListOptions{LabelSelector: fmt.Sprintf("app=mon")}
|
||||
options := metav1.ListOptions{LabelSelector: fmt.Sprintf("app=%s", appName)}
|
||||
pods, err := c.context.Clientset.CoreV1().Pods(c.Namespace).List(options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -77,14 +77,13 @@ func validateStart(t *testing.T, c *Cluster) {
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, 1, len(s.StringData))
|
||||
|
||||
s, err = c.context.Clientset.CoreV1().Secrets(c.Namespace).Get("mon", metav1.GetOptions{})
|
||||
s, err = c.context.Clientset.CoreV1().Secrets(c.Namespace).Get(appName, metav1.GetOptions{})
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, 4, len(s.StringData))
|
||||
|
||||
// there is only one pod created. the other two won't be created since the first one doesn't start
|
||||
_, err = c.context.Clientset.Extensions().ReplicaSets(c.Namespace).Get("rook-ceph-mon0", metav1.GetOptions{})
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, "mon0", p.Name)
|
||||
}
|
||||
|
||||
func TestSaveMonEndpoints(t *testing.T) {
|
||||
@@ -210,7 +209,7 @@ func TestAvailableNodesInUse(t *testing.T) {
|
||||
|
||||
// start pods on two of the nodes so that only one node will be available
|
||||
for i := 0; i < 2; i++ {
|
||||
pod := c.makeMonPod(&MonConfig{Name: fmt.Sprintf("mon%d", i)}, nodes[i].Name)
|
||||
pod := c.makeMonPod(&MonConfig{Name: fmt.Sprintf("rook-mon%d", i)}, nodes[i].Name)
|
||||
_, err := clientset.CoreV1().Pods(c.Namespace).Create(pod)
|
||||
assert.Nil(t, err)
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ func testPodSpec(t *testing.T, dataDir string) {
|
||||
}
|
||||
|
||||
assert.Equal(t, "mon0", pod.ObjectMeta.Name)
|
||||
assert.Equal(t, "mon", pod.ObjectMeta.Labels["app"])
|
||||
assert.Equal(t, appName, pod.ObjectMeta.Labels["app"])
|
||||
assert.Equal(t, c.Namespace, pod.ObjectMeta.Labels["mon_cluster"])
|
||||
assert.Equal(t, 1, len(pod.ObjectMeta.Annotations))
|
||||
assert.Equal(t, "myversion", pod.ObjectMeta.Annotations["rook_version"])
|
||||
|
||||
@@ -89,8 +89,8 @@ func testPodDevices(t *testing.T, dataDir, deviceFilter string, allDevices bool)
|
||||
assert.Equal(t, dataDir, replicaSet.Spec.Template.Spec.Volumes[0].HostPath.Path)
|
||||
}
|
||||
|
||||
assert.Equal(t, "osd", replicaSet.Spec.Template.ObjectMeta.Name)
|
||||
assert.Equal(t, "osd", replicaSet.Spec.Template.ObjectMeta.Labels["app"])
|
||||
assert.Equal(t, appName, replicaSet.Spec.Template.ObjectMeta.Name)
|
||||
assert.Equal(t, appName, replicaSet.Spec.Template.ObjectMeta.Labels["app"])
|
||||
assert.Equal(t, c.Namespace, replicaSet.Spec.Template.ObjectMeta.Labels["rook_cluster"])
|
||||
assert.Equal(t, 0, len(replicaSet.Spec.Template.ObjectMeta.Annotations))
|
||||
|
||||
|
||||
@@ -60,17 +60,17 @@ func TestStartRGW(t *testing.T) {
|
||||
|
||||
func validateStart(t *testing.T, c *Cluster, clientset *fake.Clientset) {
|
||||
|
||||
r, err := clientset.ExtensionsV1beta1().Deployments(c.Namespace).Get("rgw", metav1.GetOptions{})
|
||||
r, err := clientset.ExtensionsV1beta1().Deployments(c.Namespace).Get(appName, metav1.GetOptions{})
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, "rgw", r.Name)
|
||||
assert.Equal(t, appName, r.Name)
|
||||
|
||||
s, err := clientset.CoreV1().Services(c.Namespace).Get("rgw", metav1.GetOptions{})
|
||||
s, err := clientset.CoreV1().Services(c.Namespace).Get(appName, metav1.GetOptions{})
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, "rgw", s.Name)
|
||||
assert.Equal(t, appName, s.Name)
|
||||
|
||||
secret, err := clientset.CoreV1().Secrets(c.Namespace).Get("rgw", metav1.GetOptions{})
|
||||
secret, err := clientset.CoreV1().Secrets(c.Namespace).Get(appName, metav1.GetOptions{})
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, "rgw", secret.Name)
|
||||
assert.Equal(t, appName, secret.Name)
|
||||
assert.Equal(t, 1, len(secret.StringData))
|
||||
|
||||
}
|
||||
@@ -80,14 +80,14 @@ func TestPodSpecs(t *testing.T) {
|
||||
|
||||
d := c.makeDeployment()
|
||||
assert.NotNil(t, d)
|
||||
assert.Equal(t, "rgw", d.Name)
|
||||
assert.Equal(t, appName, d.Name)
|
||||
assert.Equal(t, v1.RestartPolicyAlways, d.Spec.Template.Spec.RestartPolicy)
|
||||
assert.Equal(t, 2, len(d.Spec.Template.Spec.Volumes))
|
||||
assert.Equal(t, "rook-data", d.Spec.Template.Spec.Volumes[0].Name)
|
||||
assert.Equal(t, k8sutil.ConfigOverrideName, d.Spec.Template.Spec.Volumes[1].Name)
|
||||
|
||||
assert.Equal(t, "rgw", d.ObjectMeta.Name)
|
||||
assert.Equal(t, "rgw", d.Spec.Template.ObjectMeta.Labels["app"])
|
||||
assert.Equal(t, appName, d.ObjectMeta.Name)
|
||||
assert.Equal(t, appName, d.Spec.Template.ObjectMeta.Labels["app"])
|
||||
assert.Equal(t, c.Namespace, d.Spec.Template.ObjectMeta.Labels["rook_cluster"])
|
||||
assert.Equal(t, 0, len(d.ObjectMeta.Annotations))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user