Unverified Commit ff05cbb5 authored by xieydd's avatar xieydd Committed by GitHub
Browse files

Make Alluxio master can be scheduled via nodeSelector (#755)

* Make Alluxio master can be scheduled via nodeSelector

* fix boundary condition
Showing with 39 additions and 2 deletions
+39 -2
......@@ -72,6 +72,10 @@ type AlluxioCompTemplateSpec struct {
// Enabled or Disabled for the components. For now, only API Gateway is enabled or disabled.
// +optional
Enabled bool `json:"enabled,omitempty"`
// NodeSelector is a selector which must be true for the master to fit on a node
// +optional
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
}
// AlluxioFuseSpec is a description of the Alluxio Fuse
......
......@@ -70,6 +70,13 @@ func (in *AlluxioCompTemplateSpec) DeepCopyInto(out *AlluxioCompTemplateSpec) {
(*out)[key] = val
}
}
if in.NodeSelector != nil {
in, out := &in.NodeSelector, &out.NodeSelector
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlluxioCompTemplateSpec.
......
......@@ -1046,6 +1046,18 @@ bool
<p>Enabled or Disabled for the components. For now, only API Gateway is enabled or disabled.</p>
</td>
</tr>
<tr>
<td>
<code>nodeSelector</code></br>
<em>
map[string]string
</em>
</td>
<td>
<em>(Optional)</em>
<p>NodeSelector is a selector which must be true for the master to fit on a node</p>
</td>
</tr>
</tbody>
</table>
<h3 id="data.fluid.io/v1alpha1.AlluxioFuseSpec">AlluxioFuseSpec
......@@ -3798,5 +3810,5 @@ string
<hr/>
<p><em>
Generated with <code>gen-crd-api-reference-docs</code>
on git commit <code>01c0b49</code>.
on git commit <code>7d8b02e</code>.
</em></p>
......@@ -18,10 +18,11 @@ package alluxio
import (
"errors"
"fmt"
"github.com/fluid-cloudnative/fluid/pkg/ddc/base/portallocator"
"os"
"strings"
"github.com/fluid-cloudnative/fluid/pkg/ddc/base/portallocator"
datav1alpha1 "github.com/fluid-cloudnative/fluid/api/v1alpha1"
"github.com/fluid-cloudnative/fluid/pkg/common"
"github.com/fluid-cloudnative/fluid/pkg/utils"
......@@ -275,6 +276,11 @@ func (e *AlluxioEngine) transformMasters(runtime *datav1alpha1.AlluxioRuntime,
value.Master.HostNetwork = true
nodeSelector := e.transformMasterSelector(runtime)
if len(nodeSelector) != 0 {
value.Master.NodeSelector = nodeSelector
}
// // check the run as
// if runtime.Spec.RunAs != nil {
// value.Master.Env["ALLUXIO_USERNAME"] = alluxioUser
......@@ -482,3 +488,11 @@ func (e *AlluxioEngine) allocatePorts(value *Alluxio) error {
// value.JobMaster.Ports.Embedded = 20003
// }
// }
func (e *AlluxioEngine) transformMasterSelector(runtime *datav1alpha1.AlluxioRuntime) map[string]string {
properties := map[string]string{}
if runtime.Spec.Master.NodeSelector != nil {
properties = runtime.Spec.Master.NodeSelector
}
return properties
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment