Skip to content

Commit 21263bd

Browse files
geroplroboquat
authored andcommitted
[installer] Introduce metadata.shortname
1 parent 448a47e commit 21263bd

File tree

6 files changed

+11
-7
lines changed

6 files changed

+11
-7
lines changed

install/installer/example-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ domain: ""
1515
kind: Full
1616
metadata:
1717
region: local
18+
shortname: default
1819
objectStorage:
1920
inCluster: true
2021
observability:

install/installer/pkg/components/server/configmap.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) {
2929
scfg := ConfigSerialized{
3030
Version: ctx.VersionManifest.Version,
3131
HostURL: fmt.Sprintf("https://%s", ctx.Config.Domain),
32-
InstallationShortname: ctx.Namespace, // todo(sje): is this needed?
33-
Stage: "production", // todo(sje): is this needed?
32+
InstallationShortname: ctx.Config.Metadata.InstallationShortname,
33+
Stage: "production", // todo(sje): is this needed?
3434
LicenseFile: license,
3535
WorkspaceHeartbeat: WorkspaceHeartbeat{
3636
IntervalSeconds: 60,

install/installer/pkg/components/server/deployment.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func deployment(ctx *common.RenderContext) ([]runtime.Object, error) {
6363
}
6464

6565
// Convert to a JSON string
66-
fc, err := common.ToJSONString(wsmanagerbridge.WSManagerList())
66+
fc, err := common.ToJSONString(wsmanagerbridge.WSManagerList(ctx))
6767
if err != nil {
6868
return nil, fmt.Errorf("failed to marshal server.WorkspaceManagerList config: %w", err)
6969
}

install/installer/pkg/components/ws-manager-bridge/configmap.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616

1717
func configmap(ctx *common.RenderContext) ([]runtime.Object, error) {
1818
wsmbcfg := Configuration{
19-
Installation: "",
19+
Installation: ctx.Config.Metadata.InstallationShortname,
2020
WSClusterDBReconcileIntervalSeconds: 60,
2121
ControllerIntervalSeconds: 60,
2222
ControllerMaxDisconnectSeconds: 150,
@@ -31,7 +31,7 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) {
3131
UnknownPhaseSeconds: 600,
3232
},
3333
EmulatePreparingIntervalSeconds: 10,
34-
StaticBridges: WSManagerList(),
34+
StaticBridges: WSManagerList(ctx),
3535
}
3636

3737
fc, err := common.ToJSONString(wsmbcfg)

install/installer/pkg/components/ws-manager-bridge/objects.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ var Objects = common.CompositeRenderFunc(
1818
common.DefaultServiceAccount(Component),
1919
)
2020

21-
func WSManagerList() []WorkspaceCluster {
21+
func WSManagerList(ctx *common.RenderContext) []WorkspaceCluster {
2222
return []WorkspaceCluster{{
23-
Name: "default",
23+
Name: ctx.Config.Metadata.InstallationShortname,
2424
URL: fmt.Sprintf("dns:///%s:%d", wsmanager.Component, wsmanager.RPCPort),
2525
TLS: WorkspaceClusterTLS{
2626
Authority: "/ws-manager-client-tls-certs/ca.crt",

install/installer/pkg/config/v1/config.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ func (v version) Defaults(in interface{}) error {
4747
cfg.Certificate.Name = "https-certificates"
4848
cfg.Database.InCluster = pointer.Bool(true)
4949
cfg.Metadata.Region = "local"
50+
cfg.Metadata.InstallationShortname = "default" // TODO(gpl): we're tied to "default" here because that's what we put into static bridges in the past
5051
cfg.ObjectStorage.InCluster = pointer.Bool(true)
5152
cfg.ContainerRegistry.InCluster = pointer.Bool(true)
5253
cfg.Workspace.Resources.Requests = corev1.ResourceList{
@@ -99,6 +100,8 @@ type Config struct {
99100

100101
type Metadata struct {
101102
Region string `json:"region" validate:"required"`
103+
// InstallationShortname establishes the "identity" of the (application) cluster.
104+
InstallationShortname string `json:"shortname" validate:"required"`
102105
}
103106

104107
type Observability struct {

0 commit comments

Comments
 (0)