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

deploy supervisor image via server ide config #6512

Closed
akosyakov opened this issue Nov 2, 2021 · 3 comments · Fixed by #6697 or #6669
Closed

deploy supervisor image via server ide config #6512

akosyakov opened this issue Nov 2, 2021 · 3 comments · Fixed by #6697 or #6669

Comments

@akosyakov
Copy link
Member

akosyakov commented Nov 2, 2021

We should move configuration of the supervisor image to the IDE service in Gitpod Server.

@csweichel
Copy link
Contributor

We need to make this change backwards compatible, i.e. an old server (which does not send the supervisor image ref) needs to work with a new workspace cluster (which might expect the supervisor image ref). To do that, we could just overwrite the static layer we currently add by changing the order of the layer sources in registry facade:

	var layerSources []LayerSource

        // add static layer first, so that they can be overwritten by the layers that come afterwards

	log.Info("preparing static layer")
	staticLayer := NewRevisioningLayerSource(CompositeLayerSource{})
	layerSources = append(layerSources, staticLayer)
	if len(cfg.StaticLayer) > 0 {
		l, err := buildStaticLayer(ctx, cfg.StaticLayer, newResolver)
		if err != nil {
			return nil, err
		}
		staticLayer.Update(l)
	}

	ideRefSource := func(s *api.ImageSpec) (ref string, err error) {
		return s.IdeRef, nil
	}
	ideLayerSource, err := NewSpecMappedImageSource(newResolver, ideRefSource)
	if err != nil {
		return nil, err
	}
	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)

	// introduce new supervisor layer source. It's ok if the ref returned is an empty string, the spec mapped
        // layer source handles this case gracefully.

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

	// content layer source needs to remain where it is and must not be overwritten by the spec mapped stuff

	clsrc, err := NewContentLayerSource()
	if err != nil {
		return nil, xerrors.Errorf("cannot create content layer source: %w", err)
	}
	layerSources = append(layerSources, clsrc)

@corneliusludmann
Copy link
Contributor

/assign

@corneliusludmann
Copy link
Contributor

corneliusludmann commented Nov 8, 2021

One part of this issue is to add the supervisor ref to the ImageSpec of the registry facade. That's obvious.

But the supervisor image ref is also part of the ws-proxy config:

"supervisorImage": "{{ template "gitpod.comp.imageFull" (dict "root" . "gp" $.Values "comp" .Values.components.workspace.supervisor) }}"

This seems to be used to handle supervisor frontend URLs via blobserve.

@csweichel How could we get this dynamic so that we can change the supervisor image in the server-ide-configmap only? Is it possible?

EDIT: I think we could get the supervisor image from the imageSpec annotation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment