Skip to content

Commit

Permalink
stash
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCqk committed May 30, 2024
1 parent e381e49 commit bae0ce3
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,13 @@ csi-build:
CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} GO111MODULE=${GO_MODULE} go build ${GC_FLAGS} -a -o bin/fluid-csi -ldflags '${LDFLAGS}' cmd/csi/main.go

dataset-controller-build:
CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} GO111MODULE=${GO_MODULE} go build ${GC_FLAGS} -a -o bin/dataset-controller -ldflags '${LDFLAGS}' cmd/dataset/main.go
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=${GO_MODULE} go build ${GC_FLAGS} -a -o bin/dataset-controller -ldflags '${LDFLAGS}' cmd/dataset/main.go

alluxioruntime-controller-build:
CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} GO111MODULE=${GO_MODULE} go build ${GC_FLAGS} -a -o bin/alluxioruntime-controller -ldflags '${LDFLAGS}' cmd/alluxio/main.go

jindoruntime-controller-build:
CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} GO111MODULE=${GO_MODULE} go build ${GC_FLAGS} -a -o bin/jindoruntime-controller -ldflags '${LDFLAGS}' cmd/jindo/main.go
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=${GO_MODULE} go build ${GC_FLAGS} -a -o bin/jindoruntime-controller -ldflags '${LDFLAGS}' cmd/jindo/main.go

goosefsruntime-controller-build:
CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} GO111MODULE=${GO_MODULE} go build ${GC_FLAGS} -a -o bin/goosefsruntime-controller -ldflags '${LDFLAGS}' cmd/goosefs/main.go
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile.dataset
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ RUN apk add --update curl tzdata iproute2 bash libc6-compat vim && \
echo "Asia/Shanghai" > /etc/timezone

ARG TARGETARCH
RUN curl -o helm-v3.11.3-linux-${TARGETARCH}.tar.gz https://get.helm.sh/helm-v3.11.3-linux-${TARGETARCH}.tar.gz && \
RUN export HTTPS_PROXY=socks5://host.docker.internal:13659 && curl -o helm-v3.11.3-linux-${TARGETARCH}.tar.gz https://get.helm.sh/helm-v3.11.3-linux-${TARGETARCH}.tar.gz && \
tar -xvf helm-v3.11.3-linux-${TARGETARCH}.tar.gz && \
mv linux-${TARGETARCH}/helm /usr/local/bin/ddc-helm && \
chmod u+x /usr/local/bin/ddc-helm && \
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile.jindoruntime
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ RUN apk add --update curl tzdata iproute2 bash libc6-compat vim && \
echo "Asia/Shanghai" > /etc/timezone

ARG TARGETARCH
RUN curl -o helm-v3.11.3-linux-${TARGETARCH}.tar.gz https://get.helm.sh/helm-v3.11.3-linux-${TARGETARCH}.tar.gz && \
RUN export HTTPS_PROXY=socks5://host.docker.internal:13659 && curl -o helm-v3.11.3-linux-${TARGETARCH}.tar.gz https://get.helm.sh/helm-v3.11.3-linux-${TARGETARCH}.tar.gz && \
tar -xvf helm-v3.11.3-linux-${TARGETARCH}.tar.gz && \
mv linux-${TARGETARCH}/helm /usr/local/bin/ddc-helm && \
chmod u+x /usr/local/bin/ddc-helm && \
Expand Down
48 changes: 48 additions & 0 deletions pkg/ddc/jindocache/ufs.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ limitations under the License.
package jindocache

import (
"fmt"

"github.com/fluid-cloudnative/fluid/pkg/ddc/jindocache/operations"
"github.com/fluid-cloudnative/fluid/pkg/utils"
)
Expand Down Expand Up @@ -110,3 +112,49 @@ func (e *JindoCacheEngine) ShouldUpdateUFS() (ufsToUpdate *utils.UFSToUpdate) {
func (e *JindoCacheEngine) UpdateOnUFSChange(*utils.UFSToUpdate) (updateReady bool, err error) {
return
}

func (e *JindoCacheEngine) shouldRemountMountpoint() {
runtime, err := e.getRuntime()
if err != nil {
e.Log.Error(err, "failed to execute shouldRemountMountpoint", "runtime", e.name)
return
}

masterPodName, masterContainerName := e.getMasterPodInfo()
masterPod, err := e.getMasterPod(masterPodName, e.namespace)

Check failure on line 124 in pkg/ddc/jindocache/ufs.go

View workflow job for this annotation

GitHub Actions / lint

too many arguments in call to e.getMasterPod

Check failure on line 124 in pkg/ddc/jindocache/ufs.go

View workflow job for this annotation

GitHub Actions / staticcheck

too many arguments in call to e.getMasterPod

Check failure on line 124 in pkg/ddc/jindocache/ufs.go

View workflow job for this annotation

GitHub Actions / staticcheck

too many arguments in call to e.getMasterPod
if err != nil {
e.Log.Error(err, "checkIfRemountRequired", "master pod", e.name)
return
}

var startedAt *metav1.Time

Check failure on line 130 in pkg/ddc/jindocache/ufs.go

View workflow job for this annotation

GitHub Actions / lint

undefined: metav1

Check failure on line 130 in pkg/ddc/jindocache/ufs.go

View workflow job for this annotation

GitHub Actions / staticcheck

undefined: metav1
for _, containerStatus := range masterPod.Status.ContainerStatuses {
if containerStatus.Name == masterContainerName {
if containerStatus.State.Running == nil {
e.Log.Error(fmt.Errorf("container is not running"), "checkIfRemountRequired", "master pod", masterPodName)
return
} else {
startedAt = &containerStatus.State.Running.StartedAt
break
}
}
}

// If mounttime is earlier than master container starttime, remount is necessary
if startedAt != nil && runtime.Status.MountTime != nil && runtime.Status.MountTime.Before(startedAt) {
e.Log.Info("remount on master restart", "jindocache", e.name)

unmountedPaths, err := e.FindUnmountedUFS()

Check failure on line 147 in pkg/ddc/jindocache/ufs.go

View workflow job for this annotation

GitHub Actions / lint

e.FindUnmountedUFS undefined (type *JindoCacheEngine has no field or method FindUnmountedUFS)

Check failure on line 147 in pkg/ddc/jindocache/ufs.go

View workflow job for this annotation

GitHub Actions / staticcheck

e.FindUnmountedUFS undefined (type *JindoCacheEngine has no field or method FindUnmountedUFS)
if err != nil {
e.Log.Error(err, "Failed in finding unmounted ufs")
return
}

if len(unmountedPaths) != 0 {
ufsToUpdate.AddMountPaths(unmountedPaths)

Check failure on line 154 in pkg/ddc/jindocache/ufs.go

View workflow job for this annotation

GitHub Actions / lint

undefined: ufsToUpdate

Check failure on line 154 in pkg/ddc/jindocache/ufs.go

View workflow job for this annotation

GitHub Actions / staticcheck

undefined: ufsToUpdate
} else {
// if no path can be mounted, set mountTime to be now
e.updateMountTime()

Check failure on line 157 in pkg/ddc/jindocache/ufs.go

View workflow job for this annotation

GitHub Actions / lint

e.updateMountTime undefined (type *JindoCacheEngine has no field or method updateMountTime)) (typecheck)

Check failure on line 157 in pkg/ddc/jindocache/ufs.go

View workflow job for this annotation

GitHub Actions / staticcheck

e.updateMountTime undefined (type *JindoCacheEngine has no field or method updateMountTime) (compile)
}
}
}
5 changes: 5 additions & 0 deletions pkg/ddc/jindocache/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"github.com/fluid-cloudnative/fluid/pkg/utils"
appsv1 "k8s.io/api/apps/v1"
"k8s.io/apimachinery/pkg/types"
v1 "k8s.io/client-go/applyconfigurations/core/v1"
)

func (e *JindoCacheEngine) getTieredStoreType(runtime *datav1alpha1.JindoRuntime) int {
Expand Down Expand Up @@ -109,6 +110,10 @@ func (e *JindoCacheEngine) getMasterPodInfo() (podName string, containerName str
return
}

func (e *JindoCacheEngine) getMasterPod() (*v1.Pod, error) {

Check failure on line 113 in pkg/ddc/jindocache/utils.go

View workflow job for this annotation

GitHub Actions / lint

v1.Pod (value of type func(name string, namespace string) *"github.com/fluid-cloudnative/fluid/vendor/k8s.io/client-go/applyconfigurations/core/v1".PodApplyConfiguration) is not a type

Check failure on line 113 in pkg/ddc/jindocache/utils.go

View workflow job for this annotation

GitHub Actions / lint

v1.Pod (value of type func(name string, namespace string) *"github.com/fluid-cloudnative/fluid/vendor/k8s.io/client-go/applyconfigurations/core/v1".PodApplyConfiguration) is not a type

Check failure on line 113 in pkg/ddc/jindocache/utils.go

View workflow job for this annotation

GitHub Actions / staticcheck

v1.Pod (value of type func(name string, namespace string) *"k8s.io/client-go/applyconfigurations/core/v1".PodApplyConfiguration) is not a type

Check failure on line 113 in pkg/ddc/jindocache/utils.go

View workflow job for this annotation

GitHub Actions / staticcheck

v1.Pod (value of type func(name string, namespace string) *"k8s.io/client-go/applyconfigurations/core/v1".PodApplyConfiguration) is not a type

}

Check failure on line 115 in pkg/ddc/jindocache/utils.go

View workflow job for this annotation

GitHub Actions / lint

missing return

Check failure on line 115 in pkg/ddc/jindocache/utils.go

View workflow job for this annotation

GitHub Actions / staticcheck

missing return

Check failure on line 115 in pkg/ddc/jindocache/utils.go

View workflow job for this annotation

GitHub Actions / staticcheck

missing return

// return total storage size of Jindo in bytes
func (e *JindoCacheEngine) TotalJindoStorageBytes() (value int64, err error) {
podName, containerName := e.getMasterPodInfo()
Expand Down

0 comments on commit bae0ce3

Please sign in to comment.