Skip to content
Open
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
48 changes: 17 additions & 31 deletions internal/bootstrap/gcp/gcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,13 @@ type VMDef struct {
// Example VM definitions (expand as needed)
var vmDefs = []VMDef{
{"jumpbox", "e2-medium", []string{"jumpbox", "ssh"}, []int64{}, true},
{"postgres", "e2-standard-8", []string{"postgres"}, []int64{}, true},
{"ceph-1", "e2-standard-8", []string{"ceph"}, []int64{20, 200}, false},
{"ceph-2", "e2-standard-8", []string{"ceph"}, []int64{20, 200}, false},
{"ceph-3", "e2-standard-8", []string{"ceph"}, []int64{20, 200}, false},
{"ceph-4", "e2-standard-8", []string{"ceph"}, []int64{20, 200}, false},
{"k0s-1", "e2-standard-16", []string{"k0s"}, []int64{}, false},
{"k0s-2", "e2-standard-16", []string{"k0s"}, []int64{}, false},
{"k0s-3", "e2-standard-16", []string{"k0s"}, []int64{}, false},
{"postgres", "e2-standard-4", []string{"postgres"}, []int64{}, true},
{"ceph-1", "e2-standard-4", []string{"ceph"}, []int64{10, 100}, false},
{"ceph-2", "e2-standard-4", []string{"ceph"}, []int64{10, 100}, false},
{"ceph-3", "e2-standard-4", []string{"ceph"}, []int64{10, 100}, false},
{"k0s-1", "e2-standard-8", []string{"k0s"}, []int64{}, false},
{"k0s-2", "e2-standard-8", []string{"k0s"}, []int64{}, false},
{"k0s-3", "e2-standard-8", []string{"k0s"}, []int64{}, false},
}

var DefaultExperiments []string = []string{
Expand Down Expand Up @@ -1177,11 +1176,11 @@ func (b *GCPBootstrapper) UpdateInstallConfig() error {
HostPattern: "*",
},
DataDevices: files.CephDataDevices{
Size: "100G:",
Size: "50G:",
Limit: 1,
},
DBDevices: files.CephDBDevices{
Size: "10G:500G",
Size: "10G:50G",
Limit: 1,
},
},
Expand All @@ -1208,26 +1207,13 @@ func (b *GCPBootstrapper) UpdateInstallConfig() error {
},
},
}
b.Env.InstallConfig.Cluster.Monitoring = &files.MonitoringConfig{
Prometheus: &files.PrometheusConfig{
RemoteWrite: &files.RemoteWriteConfig{
Enabled: false,
ClusterName: "GCP-test",
},
},
b.Env.InstallConfig.Cluster.Gateway.ServiceType = "LoadBalancer"
b.Env.InstallConfig.Cluster.Gateway.Annotations = map[string]string{
"cloud.google.com/load-balancer-ipv4": b.Env.GatewayIP,
}
b.Env.InstallConfig.Cluster.Gateway = files.GatewayConfig{
ServiceType: "LoadBalancer",
//IPAddresses: []string{b.Env.ControlPlaneNodes[0].ExternalIP},
Annotations: map[string]string{
"cloud.google.com/load-balancer-ipv4": b.Env.GatewayIP,
},
}
b.Env.InstallConfig.Cluster.PublicGateway = files.GatewayConfig{
ServiceType: "LoadBalancer",
Annotations: map[string]string{
"cloud.google.com/load-balancer-ipv4": b.Env.PublicGatewayIP,
},
b.Env.InstallConfig.Cluster.PublicGateway.ServiceType = "LoadBalancer"
b.Env.InstallConfig.Cluster.PublicGateway.Annotations = map[string]string{
"cloud.google.com/load-balancer-ipv4": b.Env.PublicGatewayIP,
}

dnsProject := b.Env.DNSProjectID
Expand Down Expand Up @@ -1276,8 +1262,8 @@ func (b *GCPBootstrapper) UpdateInstallConfig() error {
BomRef: "workspace-agent-24.04",
},
Pool: map[int]int{
1: 1,
2: 1,
1: 0,
2: 0,
3: 0,
},
},
Expand Down
25 changes: 18 additions & 7 deletions internal/installer/config_manager_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,20 +142,20 @@ func (g *InstallConfig) ApplyProfile(profile string) error {
switch profile {
case PROFILE_DEV, PROFILE_DEVELOPMENT:
g.Config.Datacenter.Name = "dev"
if err := ApplyResourceProfile(g.Config, ResourceProfileNoRequests); err != nil {
return fmt.Errorf("applying resource profile: %w", err)
}
g.Config.Cluster.Monitoring = &files.MonitoringConfig{
Prometheus: &files.PrometheusConfig{
RemoteWrite: &files.RemoteWriteConfig{
Enabled: false,
ClusterName: "local-test",
ClusterName: "dev",
},
},
Loki: &files.LokiConfig{Enabled: false},
Grafana: &files.GrafanaConfig{Enabled: false},
GrafanaAlloy: &files.GrafanaAlloyConfig{Enabled: false},
}
if err := ApplyResourceProfile(g.Config, ResourceProfileNoRequests); err != nil {
return fmt.Errorf("applying resource profile: %w", err)
}

case PROFILE_PROD, PROFILE_PRODUCTION:
g.Config.Datacenter.Name = "production"
Expand All @@ -169,9 +169,17 @@ func (g *InstallConfig) ApplyProfile(profile string) error {
}

case PROFILE_MINIMAL:
g.Config.Datacenter.Name = "minimal"
if err := ApplyResourceProfile(g.Config, ResourceProfileNoRequests); err != nil {
return fmt.Errorf("applying resource profile: %w", err)
g.Config.Datacenter.Name = "dev"
g.Config.Cluster.Monitoring = &files.MonitoringConfig{
Prometheus: &files.PrometheusConfig{
RemoteWrite: &files.RemoteWriteConfig{
Enabled: false,
ClusterName: "dev",
},
},
Loki: &files.LokiConfig{Enabled: true},
Grafana: &files.GrafanaConfig{Enabled: true},
GrafanaAlloy: &files.GrafanaAlloyConfig{Enabled: true},
}
g.Config.Codesphere.Plans.WorkspacePlans = map[int]files.WorkspacePlan{
1: {
Expand All @@ -181,6 +189,9 @@ func (g *InstallConfig) ApplyProfile(profile string) error {
OnDemand: true,
},
}
if err := ApplyResourceProfile(g.Config, ResourceProfileNoRequests); err != nil {
return fmt.Errorf("applying resource profile: %w", err)
}

default:
return fmt.Errorf("unknown profile: %s, available profiles: dev, prod, minimal", profile)
Expand Down
24 changes: 24 additions & 0 deletions internal/installer/resource_profiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,21 @@ func applyNoRequestsProfile(config *files.RootConfig) {
},
})

if config.Cluster.Monitoring.Loki == nil {
config.Cluster.Monitoring.Loki = &files.LokiConfig{}
}
config.Cluster.Monitoring.Loki.Override = util.DeepMergeMaps(config.Cluster.Monitoring.Loki.Override, map[string]any{
"loki": map[string]any{
"read": minimalResourceValues(),
"write": minimalResourceValues(),
"backend": minimalResourceValues(),
"resultsCache": minimalResourceValues(),
"chunksCache": minimalResourceValues(),
"canary": minimalResourceValues(),
"gateway": minimalResourceValues(),
},
})

if config.Cluster.Monitoring.PushGateway == nil {
config.Cluster.Monitoring.PushGateway = &files.PushGatewayConfig{}
}
Expand Down Expand Up @@ -180,3 +195,12 @@ func zeroRequests() map[string]int {
"memory": 0,
}
}

func minimalResourceValues() map[string]any {
return map[string]any{
"replicas": 1,
"resources": map[string]any{
"requests": zeroRequests(),
},
}
}
Loading