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

re-enable PVC support #12014

Merged
merged 2 commits into from
Aug 22, 2022
Merged
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
14 changes: 10 additions & 4 deletions components/content-service/pkg/layer/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func (s *Provider) GetContentLayer(ctx context.Context, owner, workspaceID strin
return s.getSnapshotContentLayer(ctx, gis)
}
if pis := initializer.GetPrebuild(); pis != nil {
l, manifest, err = s.getPrebuildContentLayer(ctx, pis)
l, manifest, err = s.getPrebuildContentLayer(ctx, pis, false)
if err != nil {
log.WithError(err).WithFields(log.OWI(owner, workspaceID, "")).Warn("cannot initialize from prebuild - falling back to Git")
span.LogKV("fallback-to-git", err.Error())
Expand Down Expand Up @@ -303,7 +303,7 @@ func (s *Provider) GetContentLayerPVC(ctx context.Context, owner, workspaceID st
l = []Layer{*layer}
return l, manifest, nil
}
l, manifest, err = s.getPrebuildContentLayer(ctx, pis)
l, manifest, err = s.getPrebuildContentLayer(ctx, pis, true)
if err != nil {
log.WithError(err).WithFields(log.OWI(owner, workspaceID, "")).Warn("cannot initialize from prebuild - falling back to Git")
span.LogKV("fallback-to-git", err.Error())
Expand Down Expand Up @@ -394,9 +394,10 @@ func (s *Provider) getSnapshotContentLayer(ctx context.Context, sp *csapi.Snapsh
return l, manifest, nil
}

func (s *Provider) getPrebuildContentLayer(ctx context.Context, pb *csapi.PrebuildInitializer) (l []Layer, manifest *csapi.WorkspaceContentManifest, err error) {
func (s *Provider) getPrebuildContentLayer(ctx context.Context, pb *csapi.PrebuildInitializer, isPVC bool) (l []Layer, manifest *csapi.WorkspaceContentManifest, err error) {
span, ctx := tracing.FromContext(ctx, "getPrebuildContentLayer")
defer tracing.FinishSpan(span, &err)
span.LogKV("isPVC", isPVC)

segs := strings.Split(pb.Prebuild.Snapshot, "@")
if len(segs) != 2 {
Expand Down Expand Up @@ -447,7 +448,12 @@ func (s *Provider) getPrebuildContentLayer(ctx context.Context, pb *csapi.Prebui
}
}

layer, err := contentDescriptorToLayer(cdesc)
var layer *Layer
if isPVC {
layer, err = contentDescriptorToLayerPVC(cdesc)
} else {
layer, err = contentDescriptorToLayer(cdesc)
}
if err != nil {
return nil, nil, err
}
Expand Down
6 changes: 0 additions & 6 deletions components/ws-manager/pkg/manager/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import (

"github.com/gitpod-io/gitpod/common-go/kubernetes"
wsk8s "github.com/gitpod-io/gitpod/common-go/kubernetes"
"github.com/gitpod-io/gitpod/common-go/log"
"github.com/gitpod-io/gitpod/common-go/tracing"
"github.com/gitpod-io/gitpod/common-go/util"
csapi "github.com/gitpod-io/gitpod/content-service/api"
Expand Down Expand Up @@ -559,11 +558,6 @@ func (m *Manager) createDefiniteWorkspacePod(startContext *startWorkspaceContext
}
ffidx[feature] = struct{}{}

if feature == api.WorkspaceFeatureFlag_PERSISTENT_VOLUME_CLAIM {
log.WithField("request", startContext).Warn("Request with PVC enabled. Skipping feature.")
continue
}

switch feature {
case api.WorkspaceFeatureFlag_FULL_WORKSPACE_BACKUP:
removeVolume(&pod, workspaceVolumeName)
Expand Down