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
32 changes: 16 additions & 16 deletions NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ License URL: https://github.com/cloudflare/circl/blob/v1.6.3/LICENSE

----------
Module: github.com/codesphere-cloud/cs-go
Version: v0.21.1
Version: v0.22.0
License: Apache-2.0
License URL: https://github.com/codesphere-cloud/cs-go/blob/v0.21.1/LICENSE
License URL: https://github.com/codesphere-cloud/cs-go/blob/v0.22.0/LICENSE

----------
Module: github.com/codesphere-cloud/oms/internal/tmpl
Expand Down Expand Up @@ -797,9 +797,9 @@ License URL: https://github.com/open-telemetry/opentelemetry-proto-go/blob/otlp/

----------
Module: go.yaml.in/yaml/v2
Version: v2.4.3
Version: v2.4.4
License: Apache-2.0
License URL: https://github.com/yaml/go-yaml/blob/v2.4.3/LICENSE
License URL: https://github.com/yaml/go-yaml/blob/v2.4.4/LICENSE

----------
Module: go.yaml.in/yaml/v3
Expand Down Expand Up @@ -929,9 +929,9 @@ License URL: https://github.com/helm/helm/blob/v4.1.3/LICENSE

----------
Module: k8s.io/api
Version: v0.35.2
Version: v0.35.3
License: Apache-2.0
License URL: https://github.com/kubernetes/api/blob/v0.35.2/LICENSE
License URL: https://github.com/kubernetes/api/blob/v0.35.3/LICENSE

----------
Module: k8s.io/apiextensions-apiserver/pkg/apis/apiextensions
Expand All @@ -941,15 +941,15 @@ License URL: https://github.com/kubernetes/apiextensions-apiserver/blob/v0.35.1/

----------
Module: k8s.io/apimachinery/pkg
Version: v0.35.2
Version: v0.35.3
License: Apache-2.0
License URL: https://github.com/kubernetes/apimachinery/blob/v0.35.2/LICENSE
License URL: https://github.com/kubernetes/apimachinery/blob/v0.35.3/LICENSE

----------
Module: k8s.io/apimachinery/third_party/forked/golang
Version: v0.35.2
Version: v0.35.3
License: BSD-3-Clause
License URL: https://github.com/kubernetes/apimachinery/blob/v0.35.2/third_party/forked/golang/LICENSE
License URL: https://github.com/kubernetes/apimachinery/blob/v0.35.3/third_party/forked/golang/LICENSE

----------
Module: k8s.io/apiserver/pkg/endpoints/deprecation
Expand All @@ -959,21 +959,21 @@ License URL: https://github.com/kubernetes/apiserver/blob/v0.35.1/LICENSE

----------
Module: k8s.io/cli-runtime/pkg
Version: v0.35.2
Version: v0.35.3
License: Apache-2.0
License URL: https://github.com/kubernetes/cli-runtime/blob/v0.35.2/LICENSE
License URL: https://github.com/kubernetes/cli-runtime/blob/v0.35.3/LICENSE

----------
Module: k8s.io/client-go
Version: v0.35.2
Version: v0.35.3
License: Apache-2.0
License URL: https://github.com/kubernetes/client-go/blob/v0.35.2/LICENSE
License URL: https://github.com/kubernetes/client-go/blob/v0.35.3/LICENSE

----------
Module: k8s.io/client-go/third_party/forked/golang/template
Version: v0.35.2
Version: v0.35.3
License: BSD-3-Clause
License URL: https://github.com/kubernetes/client-go/blob/v0.35.2/third_party/forked/golang/LICENSE
License URL: https://github.com/kubernetes/client-go/blob/v0.35.3/third_party/forked/golang/LICENSE

----------
Module: k8s.io/component-base/version
Expand Down
2 changes: 1 addition & 1 deletion cli/cmd/init_install_config_interactive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ var _ = Describe("Interactive profile usage", func() {

// Verify production-specific values
Expect(config.Datacenter.Name).To(Equal("production"))
Expect(config.Cluster.Monitoring).To(BeNil())
Expect(config.Cluster.Monitoring.Loki.Enabled).To(BeTrue())
})
})
})
2 changes: 1 addition & 1 deletion cli/cmd/init_install_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var _ = Describe("ApplyProfile", func() {
Entry("development profile", "development", false, "dev"),
Entry("prod profile", "prod", false, "production"),
Entry("production profile", "production", false, "production"),
Entry("minimal profile", "minimal", false, "minimal"),
Entry("minimal profile", "minimal", false, "dev"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we call the dc of minimal dev?

Entry("invalid profile", "invalid", true, ""),
)

Expand Down
52 changes: 17 additions & 35 deletions internal/bootstrap/gcp/gcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,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-2", []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 @@ -1192,10 +1191,6 @@ func (b *GCPBootstrapper) UpdateInstallConfig() error {
Hostname: b.Env.CephNodes[2].GetName(),
IPAddress: b.Env.CephNodes[2].GetInternalIP(),
},
{
Hostname: b.Env.CephNodes[3].GetName(),
IPAddress: b.Env.CephNodes[3].GetInternalIP(),
},
}
b.Env.InstallConfig.Ceph.OSDs = []files.CephOSD{
{
Expand All @@ -1204,11 +1199,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 @@ -1235,26 +1230,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 @@ -1303,8 +1285,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
32 changes: 16 additions & 16 deletions internal/bootstrap/gcp/gcp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ var _ = Describe("GCP Bootstrapper", func() {
Jumpbox: fakeNode("jumpbox", nodeClient),
PostgreSQLNode: fakeNode("postgres", nodeClient),
ControlPlaneNodes: []*node.Node{fakeNode("k0s-1", nodeClient), fakeNode("k0s-2", nodeClient), fakeNode("k0s-3", nodeClient)},
CephNodes: []*node.Node{fakeNode("ceph-1", nodeClient), fakeNode("ceph-2", nodeClient), fakeNode("ceph-3", nodeClient), fakeNode("ceph-4", nodeClient)},
CephNodes: []*node.Node{fakeNode("ceph-1", nodeClient), fakeNode("ceph-2", nodeClient), fakeNode("ceph-3", nodeClient)},
}
})
Describe("NewGCPBootstrapper", func() {
Expand Down Expand Up @@ -187,7 +187,7 @@ var _ = Describe("GCP Bootstrapper", func() {
gc.EXPECT().CreateFirewallRule(projectId, mock.Anything).Return(nil).Times(5)

// 11. EnsureComputeInstances
gc.EXPECT().CreateInstance(projectId, "us-central1-a", mock.Anything).Return(nil).Times(9)
gc.EXPECT().CreateInstance(projectId, "us-central1-a", mock.Anything).Return(nil).Times(8)
// GetInstance calls to retrieve IPs
ipResp := &computepb.Instance{
NetworkInterfaces: []*computepb.NetworkInterface{
Expand All @@ -200,7 +200,7 @@ var _ = Describe("GCP Bootstrapper", func() {
},
}

gc.EXPECT().GetInstance(projectId, "us-central1-a", mock.Anything).Return(ipResp, nil).Times(9)
gc.EXPECT().GetInstance(projectId, "us-central1-a", mock.Anything).Return(ipResp, nil).Times(8)
fw.EXPECT().ReadFile(mock.Anything).Return([]byte("fake-key"), nil).Times(1)

// 12. EnsureGatewayIPAddresses
Expand Down Expand Up @@ -249,10 +249,10 @@ var _ = Describe("GCP Bootstrapper", func() {
Expect(bs.Env.ProjectID).To(HavePrefix("test-project-"))

// Verify nodes are properly set in the environment
Expect(bs.Env.Jumpbox).NotTo(BeNil(), "Jumpbox should be created")
Expect(bs.Env.PostgreSQLNode).NotTo(BeNil(), "PostgreSQL node should be created")
Expect(bs.Env.CephNodes).To(HaveLen(4), "Should have 4 Ceph nodes")
Expect(bs.Env.ControlPlaneNodes).To(HaveLen(3), "Should have 3 K0s control plane nodes")
Expect(bs.Env.Jumpbox).NotTo(BeNil())
Expect(bs.Env.PostgreSQLNode).NotTo(BeNil())
Expect(bs.Env.CephNodes).To(HaveLen(3))
Expect(bs.Env.ControlPlaneNodes).To(HaveLen(3))

// Verify mock returns expected values
Expect(bs.Env.Jumpbox.GetName()).To(Equal("jumpbox"))
Expand Down Expand Up @@ -1003,10 +1003,10 @@ var _ = Describe("GCP Bootstrapper", func() {
// Mock ReadFile for SSH key
fw.EXPECT().ReadFile(csEnv.SSHPublicKeyPath).Return([]byte("ssh-rsa AAA..."), nil).Times(1)

// Mock CreateInstance (9 times)
gc.EXPECT().CreateInstance(csEnv.ProjectID, csEnv.Zone, mock.Anything).Return(nil).Times(9)
// Mock CreateInstance (8 times)
gc.EXPECT().CreateInstance(csEnv.ProjectID, csEnv.Zone, mock.Anything).Return(nil).Times(8)

// Mock GetInstance (9 times)
// Mock GetInstance (8 times)
ipResp := &computepb.Instance{
NetworkInterfaces: []*computepb.NetworkInterface{
{
Expand All @@ -1017,12 +1017,12 @@ var _ = Describe("GCP Bootstrapper", func() {
},
},
}
gc.EXPECT().GetInstance(csEnv.ProjectID, csEnv.Zone, mock.Anything).Return(ipResp, nil).Times(9)
gc.EXPECT().GetInstance(csEnv.ProjectID, csEnv.Zone, mock.Anything).Return(ipResp, nil).Times(8)

err := bs.EnsureComputeInstances()
Expect(err).NotTo(HaveOccurred())
Expect(len(bs.Env.ControlPlaneNodes)).To(Equal(3))
Expect(len(bs.Env.CephNodes)).To(Equal(4))
Expect(len(bs.Env.CephNodes)).To(Equal(3))
Expect(bs.Env.PostgreSQLNode).NotTo(BeNil())
Expect(bs.Env.Jumpbox).NotTo(BeNil())
})
Expand All @@ -1035,14 +1035,14 @@ var _ = Describe("GCP Bootstrapper", func() {
})
It("does not fetch GitHub org keys when GitHub team org is set without slug", func() {
fw.EXPECT().ReadFile(csEnv.SSHPublicKeyPath).Return([]byte("ssh-rsa AAA..."), nil).Times(1)
gc.EXPECT().CreateInstance(csEnv.ProjectID, csEnv.Zone, mock.Anything).Return(nil).Times(9)
gc.EXPECT().CreateInstance(csEnv.ProjectID, csEnv.Zone, mock.Anything).Return(nil).Times(8)
ipResp := &computepb.Instance{
NetworkInterfaces: []*computepb.NetworkInterface{{
NetworkIP: protoString("10.0.0.x"),
AccessConfigs: []*computepb.AccessConfig{{NatIP: protoString("1.2.3.x")}},
}},
}
gc.EXPECT().GetInstance(csEnv.ProjectID, csEnv.Zone, mock.Anything).Return(ipResp, nil).Times(9)
gc.EXPECT().GetInstance(csEnv.ProjectID, csEnv.Zone, mock.Anything).Return(ipResp, nil).Times(8)

err := bs.EnsureComputeInstances()
Expect(err).NotTo(HaveOccurred())
Expand All @@ -1067,15 +1067,15 @@ var _ = Describe("GCP Bootstrapper", func() {
return fmt.Errorf("expected ssh metadata to include team user key")
}
return nil
}).Times(9)
}).Times(8)

ipResp := &computepb.Instance{
NetworkInterfaces: []*computepb.NetworkInterface{{
NetworkIP: protoString("10.0.0.x"),
AccessConfigs: []*computepb.AccessConfig{{NatIP: protoString("1.2.3.x")}},
}},
}
gc.EXPECT().GetInstance(csEnv.ProjectID, csEnv.Zone, mock.Anything).Return(ipResp, nil).Times(9)
gc.EXPECT().GetInstance(csEnv.ProjectID, csEnv.Zone, mock.Anything).Return(ipResp, nil).Times(8)

err := bs.EnsureComputeInstances()
Expect(err).NotTo(HaveOccurred())
Expand Down
36 changes: 29 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 @@ -167,11 +167,30 @@ func (g *InstallConfig) ApplyProfile(profile string) error {
OnDemand: true,
},
}
g.Config.Cluster.Monitoring = &files.MonitoringConfig{
Prometheus: &files.PrometheusConfig{
RemoteWrite: &files.RemoteWriteConfig{
Enabled: false,
ClusterName: "production",
},
},
Loki: &files.LokiConfig{Enabled: true},
Grafana: &files.GrafanaConfig{Enabled: true},
GrafanaAlloy: &files.GrafanaAlloyConfig{Enabled: true},
}

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 +200,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
Loading
Loading