Skip to content

Commit

Permalink
[registry-facade] Add desktop_ide_ref
Browse files Browse the repository at this point in the history
  • Loading branch information
corneliusludmann committed Oct 22, 2021
1 parent 1d7c6ca commit 4c8638c
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 31 deletions.
69 changes: 40 additions & 29 deletions components/registry-facade-api/go/imagespec.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions components/registry-facade-api/go/provider.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions components/registry-facade-api/imagespec.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ message ImageSpec {
string ide_ref = 2;
// content_layer describe the last few layers which provide the workspace's content
repeated ContentLayer content_layer = 3;
// desktop_ide_ref point to an image denotign the desktop IDE to use
string desktop_ide_ref = 4;
}

// ContentLayer is a layer that provides a workspace's content
Expand Down
12 changes: 12 additions & 0 deletions components/registry-facade/pkg/registry/layersource.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,9 @@ func (src *SpecMappedImagedSource) Envs(ctx context.Context, spec *api.ImageSpec
if err != nil {
return nil, err
}
if lsrc == nil {
return []EnvModifier{}, nil
}
return lsrc.Envs(ctx, spec)
}

Expand All @@ -403,6 +406,9 @@ func (src *SpecMappedImagedSource) GetLayer(ctx context.Context, spec *api.Image
if err != nil {
return nil, err
}
if lsrc == nil {
return []AddonLayer{}, nil
}
return lsrc.GetLayer(ctx, spec)
}

Expand All @@ -412,6 +418,9 @@ func (src *SpecMappedImagedSource) HasBlob(ctx context.Context, spec *api.ImageS
if err != nil {
return false
}
if lsrc == nil {
return false
}
return lsrc.HasBlob(ctx, spec, dgst)
}

Expand All @@ -431,6 +440,9 @@ func (src *SpecMappedImagedSource) getDelegate(ctx context.Context, spec *api.Im
if err != nil {
return nil, err
}
if ref == "" {
return nil, nil
}

if s, ok := src.cache.Get(ref); ok {
return s.(LayerSource), nil
Expand Down
9 changes: 9 additions & 0 deletions components/registry-facade/pkg/registry/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,15 @@ func NewRegistry(cfg config.Config, newResolver ResolverProvider, reg prometheus
}
layerSources = append(layerSources, ideLayerSource)

desktopIdeRefSource := func(s *api.ImageSpec) (ref string, err error) {
return s.DesktopIdeRef, nil
}
desktopIdeLayerSource, err := NewSpecMappedImageSource(newResolver, desktopIdeRefSource)
if err != nil {
return nil, err
}
layerSources = append(layerSources, desktopIdeLayerSource)

log.Info("preparing static layer")
staticLayer := NewRevisioningLayerSource(CompositeLayerSource{})
layerSources = append(layerSources, staticLayer)
Expand Down

0 comments on commit 4c8638c

Please sign in to comment.