Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Origin/cherry pick fixes to 0.8.4 from master branch #2617

Draft
wants to merge 5 commits into
base: release-0.8
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ spec:
- --runtime-workers={{ .Values.runtime.goosefs.runtimeWorkers }}
- --pprof-addr=:6060
- --enable-leader-election
- --port-allocate-policy={{ .Values.runtime.goosefs.portAllocatePolicy }}
env:
{{- if .Values.workdir }}
- name: FLUID_WORKDIR
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ spec:
- --runtime-workers={{ .Values.runtime.jindo.runtimeWorkers }}
- --pprof-addr=:6060
- --enable-leader-election
- --port-allocate-policy={{ .Values.runtime.jindo.portAllocatePolicy }}
env:
{{- if .Values.workdir }}
- name: FLUID_WORKDIR
Expand Down
4 changes: 3 additions & 1 deletion charts/fluid/fluid/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ runtime:
replicas: 1
runtimeWorkers: 3
portRange: 20000-26000
portAllocatePolicy: bitmap
portAllocatePolicy: random
enabled: false
init:
image: fluidcloudnative/init-users:v0.8.3-336791f
Expand All @@ -50,6 +50,7 @@ runtime:
replicas: 1
runtimeWorkers: 3
portRange: 18000-19999
portAllocatePolicy: random
enabled: false
engine: jindofsx
queryUfsTotal: true
Expand All @@ -67,6 +68,7 @@ runtime:
replicas: 1
runtimeWorkers: 3
portRange: 26000-32000
portAllocatePolicy: random
enabled: false
init:
image: fluidcloudnative/init-users:v0.8.3-336791f
Expand Down
9 changes: 9 additions & 0 deletions charts/juicefs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,12 @@ Support configurable tieredstore's volume type

0.2.9
- Add updateStrategy for fuse

0.2.10
- Set root user in worker & fuse pod

0.2.11
- Support credential key in secret

0.2.12
- Set cache dir in volumes & volumeMounts for worker & fuse
2 changes: 1 addition & 1 deletion charts/juicefs/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: juicefs
apiVersion: v1
description: FileSystem aimed for data analytics and machine learning in any cloud.
version: 0.2.9
version: 0.2.12
appVersion: v1.0.0
home: https://juicefs.com/
maintainers:
Expand Down
37 changes: 11 additions & 26 deletions charts/juicefs/templates/fuse/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,28 +83,28 @@ spec:
valueFrom:
secretKeyRef:
name: {{ .Values.configs.metaurlSecret }}
key: metaurl
key: {{ .Values.configs.metaurlSecretKey }}
{{- end }}
{{- if .Values.configs.accesskeySecret }}
- name: ACCESS_KEY
valueFrom:
secretKeyRef:
name: {{ .Values.configs.accesskeySecret }}
key: access-key
key: {{ .Values.configs.accesskeySecretKey }}
{{- end }}
{{- if .Values.configs.secretkeySecret }}
- name: SECRET_KEY
valueFrom:
secretKeyRef:
name: {{ .Values.configs.secretkeySecret }}
key: secret-key
key: {{ .Values.configs.secretkeySecretKey }}
{{- end }}
{{- if .Values.configs.tokenSecret }}
- name: TOKEN
valueFrom:
secretKeyRef:
name: {{ .Values.configs.tokenSecret }}
key: token
key: {{ .Values.configs.tokenSecretKey }}
{{- end }}
- name: FLUID_RUNTIME_TYPE
value: "juicefs"
Expand All @@ -127,24 +127,21 @@ spec:
- containerPort: 9567
name: metrics
protocol: TCP
{{- if .Values.fuse.privileged }}
securityContext:
runAsUser: 0
{{- if .Values.fuse.privileged }}
privileged: true
{{- end }}
lifecycle:
preStop:
exec:
command: ["sh", "-c", "umount {{ .Values.fuse.mountPath }}"]
volumeMounts:
- name: juicefs-fuse-mount
mountPath: {{ .Values.fuse.hostMountPath }}
mountPropagation: Bidirectional
- mountPath: /root/script
name: script
{{- range $name, $mount := .Values.cacheDirs }}
- name: cache-dir-{{ $name }}
mountPath: "{{ $mount.path }}"
{{- end }}
- name: juicefs-fuse-mount
mountPath: {{ .Values.fuse.hostMountPath }}
mountPropagation: Bidirectional
- mountPath: /root/script
name: script
{{- if .Values.fuse.volumeMounts }}
{{ toYaml .Values.fuse.volumeMounts | indent 12 }}
{{- end }}
Expand All @@ -154,18 +151,6 @@ spec:
hostPath:
path: {{ .Values.fuse.hostMountPath }}
type: DirectoryOrCreate
{{- range $name, $mount := .Values.cacheDirs }}
{{- if eq $mount.type "hostPath" }}
- hostPath:
path: "{{ $mount.path }}"
type: DirectoryOrCreate
name: cache-dir-{{ $name }}
{{- else if eq $mount.type "emptyDir" }}
- emptyDir: {}
name: cache-dir-{{ $name }}
{{- /* todo: support volume template */}}
{{- end }}
{{- end }}
- name: script
configMap:
name: {{ template "juicefs.fullname" . }}-fuse-script
Expand Down
27 changes: 6 additions & 21 deletions charts/juicefs/templates/worker/statefuleset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@ spec:
{{ toYaml .Values.worker.resources | trim | indent 12 }}
{{- end }}
command: ["sh", "/root/script/script.sh"]
{{- if .Values.worker.privileged }}
securityContext:
runAsUser: 0
{{- if .Values.worker.privileged }}
privileged: true
{{- end }}
{{- if .Values.worker.ports }}
Expand All @@ -95,28 +96,28 @@ spec:
valueFrom:
secretKeyRef:
name: {{ .Values.configs.metaurlSecret }}
key: metaurl
key: {{ .Values.configs.metaurlSecretKey }}
{{- end }}
{{- if .Values.configs.accesskeySecret }}
- name: ACCESS_KEY
valueFrom:
secretKeyRef:
name: {{ .Values.configs.accesskeySecret }}
key: access-key
key: {{ .Values.configs.accesskeySecretKey }}
{{- end }}
{{- if .Values.configs.secretkeySecret }}
- name: SECRET_KEY
valueFrom:
secretKeyRef:
name: {{ .Values.configs.secretkeySecret }}
key: secret-key
key: {{ .Values.configs.secretkeySecretKey }}
{{- end }}
{{- if .Values.configs.tokenSecret }}
- name: TOKEN
valueFrom:
secretKeyRef:
name: {{ .Values.configs.tokenSecret }}
key: token
key: {{ .Values.configs.tokenSecretKey }}
{{- end }}
lifecycle:
preStop:
Expand All @@ -125,27 +126,11 @@ spec:
volumeMounts:
- mountPath: /root/script
name: script
{{- range $name, $mount := .Values.cacheDirs }}
- name: cache-dir-{{ $name }}
mountPath: "{{ $mount.path }}"
{{- end }}
{{- if .Values.worker.volumeMounts }}
{{ toYaml .Values.worker.volumeMounts | indent 12 }}
{{- end }}
restartPolicy: Always
volumes:
{{- range $name, $mount := .Values.cacheDirs }}
{{- if eq $mount.type "hostPath" }}
- hostPath:
path: "{{ $mount.path }}"
type: DirectoryOrCreate
name: cache-dir-{{ $name }}
{{- else if eq $mount.type "emptyDir" }}
- emptyDir: {}
name: cache-dir-{{ $name }}
{{- /* todo: support volume template */}}
{{- end }}
{{- end }}
- name: script
configMap:
name: {{ template "juicefs.fullname" . }}-worker-script
Expand Down
4 changes: 4 additions & 0 deletions charts/juicefs/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,15 @@ worker:
configs:
name: ""
accesskeySecret: ""
accesskeySecretKey: ""
secretkeySecret: ""
secretkeySecretKey: ""
bucket: ""
metaurlSecret: ""
metaurlSecretKey: ""
storage: ""
tokenSecret: ""
tokenSecretKey: ""
formatCmd : ""

## FUSE ##
Expand Down
9 changes: 7 additions & 2 deletions cmd/alluxio/app/alluxio.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func init() {
alluxioCmd.Flags().StringVar(&portRange, "runtime-node-port-range", "20000-25000", "Set available port range for Alluxio")
alluxioCmd.Flags().IntVar(&maxConcurrentReconciles, "runtime-workers", 3, "Set max concurrent workers for AlluxioRuntime controller")
alluxioCmd.Flags().StringVarP(&pprofAddr, "pprof-addr", "", "", "The address for pprof to use while exporting profiling results")
alluxioCmd.Flags().StringVar(&portAllocatePolicy, "port-allocate-policy", "bitmap", "Set port allocating policy, available choice is bitmap or random(default bitmap).")
alluxioCmd.Flags().StringVar(&portAllocatePolicy, "port-allocate-policy", "random", "Set port allocating policy, available choice is bitmap or random(default random).")
}

func handle() {
Expand Down Expand Up @@ -128,7 +128,12 @@ func handle() {
}
setupLog.Info("port range parsed", "port range", pr.String())

portallocator.SetupRuntimePortAllocatorWithType(mgr.GetClient(), pr, portallocator.AllocatePolicy(portAllocatePolicy), alluxio.GetReservedPorts)
err = portallocator.SetupRuntimePortAllocator(mgr.GetClient(), pr, portAllocatePolicy, alluxio.GetReservedPorts)
if err != nil {
setupLog.Error(err, "failed to setup runtime port allocator")
os.Exit(1)
}
setupLog.Info("Set up runtime port allocator", "policy", portAllocatePolicy)

setupLog.Info("starting alluxioruntime-controller")
if err := mgr.Start(ctrl.SetupSignalHandler()); err != nil {
Expand Down
9 changes: 8 additions & 1 deletion cmd/goosefs/app/goosefs.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ var (
portRange string
maxConcurrentReconciles int
pprofAddr string
portAllocatePolicy string
)

var cmd = &cobra.Command{
Expand All @@ -73,6 +74,7 @@ func init() {
startCmd.Flags().StringVarP(&leaderElectionNamespace, "leader-election-namespace", "", "fluid-system", "The namespace in which the leader election resource will be created.")
startCmd.Flags().BoolVarP(&development, "development", "", true, "Enable development mode for fluid controller.")
startCmd.Flags().StringVar(&portRange, "runtime-node-port-range", "20000-25000", "Set available port range for GooseFS")
startCmd.Flags().StringVar(&portAllocatePolicy, "port-allocate-policy", "random", "Set port allocating policy, available choice is bitmap or random(default random).")
startCmd.Flags().StringVarP(&pprofAddr, "pprof-addr", "", "", "The address for pprof to use while exporting profiling results")
startCmd.Flags().IntVar(&maxConcurrentReconciles, "runtime-workers", 3, "Set max concurrent workers for GooseFSRuntime controller")
cmd.AddCommand(startCmd)
Expand Down Expand Up @@ -129,7 +131,12 @@ func handle() {
}
setupLog.Info("port range parsed", "port range", pr.String())

portallocator.SetupRuntimePortAllocator(mgr.GetClient(), pr, goosefs.GetReservedPorts)
err = portallocator.SetupRuntimePortAllocator(mgr.GetClient(), pr, portAllocatePolicy, goosefs.GetReservedPorts)
if err != nil {
setupLog.Error(err, "failed to setup runtime port allocator")
os.Exit(1)
}
setupLog.Info("Set up runtime port allocator", "policy", portAllocatePolicy)

setupLog.Info("starting goosefsruntime-controller")
if err := mgr.Start(ctrl.SetupSignalHandler()); err != nil {
Expand Down
11 changes: 9 additions & 2 deletions cmd/jindo/app/jindo.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ var (
development bool
// The new mode
eventDriven bool
portRange string
maxConcurrentReconciles int
pprofAddr string
portRange string
portAllocatePolicy string
)

var jindoCmd = &cobra.Command{
Expand All @@ -74,6 +75,7 @@ func init() {
jindoCmd.Flags().StringVarP(&leaderElectionNamespace, "leader-election-namespace", "", "fluid-system", "The namespace in which the leader election resource will be created.")
jindoCmd.Flags().BoolVarP(&development, "development", "", true, "Enable development mode for fluid controller.")
jindoCmd.Flags().StringVar(&portRange, "runtime-node-port-range", "18000-19999", "Set available port range for Jindo")
jindoCmd.Flags().StringVar(&portAllocatePolicy, "port-allocate-policy", "random", "Set port allocating policy, available choice is bitmap or random(default random).")
jindoCmd.Flags().IntVar(&maxConcurrentReconciles, "runtime-workers", 3, "Set max concurrent workers for JindoRuntime controller")
jindoCmd.Flags().BoolVar(&eventDriven, "event-driven", true, "The reconciler's loop strategy. if it's false, it indicates period driven.")
jindoCmd.Flags().StringVarP(&pprofAddr, "pprof-addr", "", "", "The address for pprof to use while exporting profiling results")
Expand Down Expand Up @@ -130,7 +132,12 @@ func handle() {
}
setupLog.Info("port range parsed", "port range", pr.String())

portallocator.SetupRuntimePortAllocator(mgr.GetClient(), pr, jindo.GetReservedPorts)
err = portallocator.SetupRuntimePortAllocator(mgr.GetClient(), pr, portAllocatePolicy, jindo.GetReservedPorts)
if err != nil {
setupLog.Error(err, "failed to setup runtime port allocator")
os.Exit(1)
}
setupLog.Info("Set up runtime port allocator", "policy", portAllocatePolicy)

setupLog.Info("starting jindoruntime-controller")
if err := mgr.Start(ctrl.SetupSignalHandler()); err != nil {
Expand Down
14 changes: 8 additions & 6 deletions pkg/controllers/v1alpha1/fluidapp/fluidapp_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ package fluidapp

import (
"context"
"github.com/fluid-cloudnative/fluid/pkg/common"
"github.com/fluid-cloudnative/fluid/pkg/ctrl/watch"
"github.com/fluid-cloudnative/fluid/pkg/utils"
"github.com/fluid-cloudnative/fluid/pkg/utils/kubeclient"

"github.com/go-logr/logr"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/labels"
Expand All @@ -33,6 +30,11 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/controller"
"sigs.k8s.io/controller-runtime/pkg/reconcile"

"github.com/fluid-cloudnative/fluid/pkg/common"
"github.com/fluid-cloudnative/fluid/pkg/ctrl/watch"
"github.com/fluid-cloudnative/fluid/pkg/utils"
"github.com/fluid-cloudnative/fluid/pkg/utils/kubeclient"
)

const controllerName string = "FluidAppController"
Expand Down Expand Up @@ -98,8 +100,8 @@ func (f *FluidAppReconciler) Reconcile(ctx context.Context, request reconcile.Re
func (f *FluidAppReconciler) internalReconcile(ctx reconcileRequestContext) (ctrl.Result, error) {
pod := ctx.pod

// umount fuse sidecar
err := f.umountFuseSidecar(pod)
// umount fuse sidecars
err := f.umountFuseSidecars(pod)
if err != nil {
ctx.Log.Error(err, "umount fuse sidecar error", "podName", pod.Name, "podNamespace", pod.Namespace)
return utils.RequeueIfError(err)
Expand Down
Loading