Skip to content

Commit

Permalink
[installer] Introduce metadata.shortname
Browse files Browse the repository at this point in the history
  • Loading branch information
geropl committed Apr 11, 2022
1 parent 89cc699 commit 9782fdb
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 7 deletions.
1 change: 1 addition & 0 deletions install/installer/example-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ domain: ""
kind: Full
metadata:
region: local
shortname: default
objectStorage:
inCluster: true
observability:
Expand Down
4 changes: 2 additions & 2 deletions install/installer/pkg/components/server/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) {
scfg := ConfigSerialized{
Version: ctx.VersionManifest.Version,
HostURL: fmt.Sprintf("https://%s", ctx.Config.Domain),
InstallationShortname: ctx.Namespace, // todo(sje): is this needed?
Stage: "production", // todo(sje): is this needed?
InstallationShortname: ctx.Config.Metadata.InstallationShortname,
Stage: "production", // todo(sje): is this needed?
LicenseFile: license,
WorkspaceHeartbeat: WorkspaceHeartbeat{
IntervalSeconds: 60,
Expand Down
2 changes: 1 addition & 1 deletion install/installer/pkg/components/server/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func deployment(ctx *common.RenderContext) ([]runtime.Object, error) {
}

// Convert to a JSON string
fc, err := common.ToJSONString(wsmanagerbridge.WSManagerList())
fc, err := common.ToJSONString(wsmanagerbridge.WSManagerList(ctx))
if err != nil {
return nil, fmt.Errorf("failed to marshal server.WorkspaceManagerList config: %w", err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (

func configmap(ctx *common.RenderContext) ([]runtime.Object, error) {
wsmbcfg := Configuration{
Installation: "",
Installation: ctx.Config.Metadata.InstallationShortname,
WSClusterDBReconcileIntervalSeconds: 60,
ControllerIntervalSeconds: 60,
ControllerMaxDisconnectSeconds: 150,
Expand All @@ -31,7 +31,7 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) {
UnknownPhaseSeconds: 600,
},
EmulatePreparingIntervalSeconds: 10,
StaticBridges: WSManagerList(),
StaticBridges: WSManagerList(ctx),
}

fc, err := common.ToJSONString(wsmbcfg)
Expand Down
4 changes: 2 additions & 2 deletions install/installer/pkg/components/ws-manager-bridge/objects.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ var Objects = common.CompositeRenderFunc(
common.DefaultServiceAccount(Component),
)

func WSManagerList() []WorkspaceCluster {
func WSManagerList(ctx *common.RenderContext) []WorkspaceCluster {
return []WorkspaceCluster{{
Name: "default",
Name: ctx.Config.Metadata.InstallationShortname,
URL: fmt.Sprintf("dns:///%s:%d", wsmanager.Component, wsmanager.RPCPort),
TLS: WorkspaceClusterTLS{
Authority: "/ws-manager-client-tls-certs/ca.crt",
Expand Down
3 changes: 3 additions & 0 deletions install/installer/pkg/config/v1/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ func (v version) Defaults(in interface{}) error {
cfg.Certificate.Name = "https-certificates"
cfg.Database.InCluster = pointer.Bool(true)
cfg.Metadata.Region = "local"
cfg.Metadata.InstallationShortname = "default" // TODO(gpl): we're tied to "default" here because that's what we put into static bridges in the past
cfg.ObjectStorage.InCluster = pointer.Bool(true)
cfg.ContainerRegistry.InCluster = pointer.Bool(true)
cfg.Workspace.Resources.Requests = corev1.ResourceList{
Expand Down Expand Up @@ -99,6 +100,8 @@ type Config struct {

type Metadata struct {
Region string `json:"region" validate:"required"`
// InstallationShortname establishes the "identity" of the (application) cluster.
InstallationShortname string `json:"shortname" validate:"required"`
}

type Observability struct {
Expand Down

0 comments on commit 9782fdb

Please sign in to comment.