Skip to content
Merged
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
6 changes: 3 additions & 3 deletions cmd/apiserver-mock/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ func main() {
globalModel.AddProject(model.NewProject("project1", "Project One", []string{"group1", "group3"}, "small"))
globalModel.AddProject(model.NewProject("project2", "Project Two", []string{}, "medium"))
globalModel.AddProject(model.NewProject("project3", "Project Three", []string{"group2", "group3"}, "large"))
globalModel.CreateEnvironment("dev", 1)
globalModel.CreateEnvironment("stg", 2)
globalModel.CreateEnvironment("prod", 4)
globalModel.CreateEnvironment("dev", 1, true)
globalModel.CreateEnvironment("stg", 2, true)
globalModel.CreateEnvironment("prod", 4, false)

cmd := &cobra.Command{
Use: "apiserver-mock",
Expand Down
8 changes: 8 additions & 0 deletions environment.proto
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ message Environment {
EnvironmentDashboard Dashboard = 18; // Link to dashboard
repeated Daemon Daemon = 19; // Daemon configuration for an environment
EnvironmentResources Resources = 20; // Resources utilised by this environment
EnvironmentMetrics Metrics = 21; // Metrics configuration for this environment
}

/**
Expand Down Expand Up @@ -477,3 +478,10 @@ message VolumeBackupSanitizeRules {
message EnvironmentDashboard {
string URL = 1; // Link to dashboard
}

/**
* Environment metrics configuration
*/
message EnvironmentMetrics {
bool Enabled = 1; // Application metrics are enabled
}
5 changes: 4 additions & 1 deletion internal/model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (s *Model) GetEnvironments() []*Environment {
return response
}

func (s *Model) CreateEnvironment(name string, size int) {
func (s *Model) CreateEnvironment(name string, size int, metrics bool) {
environment := &pb.Environment{
Name: name,
Version: "v0.0.1",
Expand Down Expand Up @@ -89,6 +89,9 @@ func (s *Model) CreateEnvironment(name string, size int) {
Schedule: "*/30 * * * *",
},
},
Metrics: &pb.EnvironmentMetrics{
Enabled: metrics,
},
}
if name == "prod" {
environment.Ingress.Routes = append(environment.Ingress.Routes, "example.com", "www.example.com")
Expand Down
Loading