Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PMM-11670 Set the cluster label if empty #2459

Merged
merged 19 commits into from
Sep 13, 2023
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
7 changes: 2 additions & 5 deletions .github/workflows/managed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,6 @@ jobs:
- name: Run debug commands on failure
if: ${{ failure() }}
run: |
env
go version
go env
pwd
env | sort
go env | sort
git status
kubectl version --short --output json
1 change: 1 addition & 0 deletions api-tests/inventory/nodes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ func TestRemoveNode(t *testing.T) {
Address: "localhost",
Port: 3306,
ServiceName: serviceName,
Cluster: serviceName,
},
},
}, listAgentsOK.Payload)
Expand Down
12 changes: 12 additions & 0 deletions api-tests/inventory/services_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ func TestMySQLService(t *testing.T) {
Address: "localhost",
Port: 3306,
ServiceName: serviceName,
Cluster: serviceName,
},
},
}, res)
Expand All @@ -372,6 +373,7 @@ func TestMySQLService(t *testing.T) {
Address: "localhost",
Port: 3306,
ServiceName: serviceName,
Cluster: serviceName,
},
},
}, serviceRes)
Expand Down Expand Up @@ -553,6 +555,7 @@ func TestMongoDBService(t *testing.T) {
ServiceID: serviceID,
NodeID: genericNodeID,
ServiceName: serviceName,
Cluster: serviceName,
Address: "localhost",
Port: 27017,
},
Expand All @@ -573,6 +576,7 @@ func TestMongoDBService(t *testing.T) {
ServiceID: serviceID,
NodeID: genericNodeID,
ServiceName: serviceName,
Cluster: serviceName,
Address: "localhost",
Port: 27017,
},
Expand Down Expand Up @@ -729,6 +733,7 @@ func TestMongoDBService(t *testing.T) {
ServiceID: serviceID,
NodeID: genericNodeID,
ServiceName: serviceName,
Cluster: serviceName,
Socket: "/tmp/mongodb-27017.sock",
},
},
Expand Down Expand Up @@ -770,6 +775,7 @@ func TestPostgreSQLService(t *testing.T) {
DatabaseName: defaultPostgresDBName,
Port: 5432,
ServiceName: serviceName,
Cluster: serviceName,
},
},
}, res)
Expand All @@ -791,6 +797,7 @@ func TestPostgreSQLService(t *testing.T) {
DatabaseName: defaultPostgresDBName,
Port: 5432,
ServiceName: serviceName,
Cluster: serviceName,
},
},
}, serviceRes)
Expand Down Expand Up @@ -973,6 +980,7 @@ func TestProxySQLService(t *testing.T) {
Address: "localhost",
Port: 5432,
ServiceName: serviceName,
Cluster: serviceName,
},
},
}, res)
Expand All @@ -993,6 +1001,7 @@ func TestProxySQLService(t *testing.T) {
Address: "localhost",
Port: 5432,
ServiceName: serviceName,
Cluster: serviceName,
},
},
}, serviceRes)
Expand Down Expand Up @@ -1184,6 +1193,7 @@ func TestExternalService(t *testing.T) {
ServiceID: serviceID,
NodeID: genericNodeID,
ServiceName: serviceName,
Cluster: serviceName,
Group: "redis",
},
},
Expand All @@ -1203,6 +1213,7 @@ func TestExternalService(t *testing.T) {
ServiceID: serviceID,
NodeID: genericNodeID,
ServiceName: serviceName,
Cluster: serviceName,
Group: "redis",
},
},
Expand Down Expand Up @@ -1334,6 +1345,7 @@ func TestExternalService(t *testing.T) {
ServiceID: serviceID,
NodeID: genericNodeID,
ServiceName: serviceName,
Cluster: serviceName,
Group: "external",
},
},
Expand Down
2 changes: 2 additions & 0 deletions api-tests/management/external_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ func TestAddExternal(t *testing.T) {
ServiceID: serviceID,
NodeID: nodeID,
ServiceName: serviceName,
Cluster: serviceName,
Group: "external",
},
}, *serviceOK.Payload)
Expand Down Expand Up @@ -225,6 +226,7 @@ func TestAddExternal(t *testing.T) {
ServiceID: serviceID,
NodeID: nodeID,
ServiceName: serviceName,
Cluster: serviceName,
Group: "external",
},
}, *serviceOK.Payload)
Expand Down
2 changes: 2 additions & 0 deletions api-tests/management/haproxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ func TestAddHAProxy(t *testing.T) {
ServiceID: serviceID,
NodeID: nodeID,
ServiceName: serviceName,
Cluster: serviceName,
},
}, *serviceOK.Payload)

Expand Down Expand Up @@ -225,6 +226,7 @@ func TestAddHAProxy(t *testing.T) {
ServiceID: serviceID,
NodeID: nodeID,
ServiceName: serviceName,
Cluster: serviceName,
},
}, *serviceOK.Payload)

Expand Down
7 changes: 7 additions & 0 deletions api-tests/management/mongodb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ func TestAddMongoDB(t *testing.T) {
ServiceID: serviceID,
NodeID: nodeID,
ServiceName: serviceName,
Cluster: serviceName,
Address: "10.10.10.10",
Port: 27017,
},
Expand Down Expand Up @@ -154,6 +155,7 @@ func TestAddMongoDB(t *testing.T) {
ServiceID: serviceID,
NodeID: nodeID,
ServiceName: serviceName,
Cluster: serviceName,
Address: "10.10.10.10",
Port: 27017,
},
Expand Down Expand Up @@ -389,6 +391,7 @@ func TestAddMongoDB(t *testing.T) {
ServiceID: serviceID,
NodeID: newNodeID,
ServiceName: serviceName,
Cluster: serviceName,
Address: "10.10.10.10",
Port: 27017,
},
Expand Down Expand Up @@ -607,6 +610,7 @@ func TestAddMongoDB(t *testing.T) {
ServiceID: serviceID,
NodeID: nodeID,
ServiceName: serviceName,
Cluster: serviceName,
Socket: "/tmp/mongodb-27017.sock",
},
}, *serviceOK.Payload)
Expand Down Expand Up @@ -678,6 +682,7 @@ func TestAddMongoDB(t *testing.T) {
ServiceID: serviceID,
NodeID: nodeID,
ServiceName: serviceName,
Cluster: serviceName,
Address: "10.10.10.10",
Port: 27017,
},
Expand Down Expand Up @@ -750,6 +755,7 @@ func TestAddMongoDB(t *testing.T) {
ServiceID: serviceID,
NodeID: nodeID,
ServiceName: serviceName,
Cluster: serviceName,
Address: "10.10.10.10",
Port: 27017,
},
Expand Down Expand Up @@ -821,6 +827,7 @@ func TestAddMongoDB(t *testing.T) {
ServiceID: serviceID,
NodeID: nodeID,
ServiceName: serviceName,
Cluster: serviceName,
Address: "10.10.10.10",
Port: 27017,
},
Expand Down
6 changes: 6 additions & 0 deletions api-tests/management/mysql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ func TestAddMySQL(t *testing.T) {
ServiceID: serviceID,
NodeID: nodeID,
ServiceName: serviceName,
Cluster: serviceName,
Address: "10.10.10.10",
Port: 3306,
},
Expand Down Expand Up @@ -159,6 +160,7 @@ func TestAddMySQL(t *testing.T) {
ServiceID: serviceID,
NodeID: nodeID,
ServiceName: serviceName,
Cluster: serviceName,
Address: "10.10.10.10",
Port: 3306,
},
Expand Down Expand Up @@ -413,6 +415,7 @@ func TestAddMySQL(t *testing.T) {
ServiceID: serviceID,
NodeID: newNodeID,
ServiceName: serviceName,
Cluster: serviceName,
Address: "10.10.10.10",
Port: 27017,
},
Expand Down Expand Up @@ -666,6 +669,7 @@ func TestAddMySQL(t *testing.T) {
ServiceID: serviceID,
NodeID: nodeID,
ServiceName: serviceName,
Cluster: serviceName,
Address: "10.10.10.10",
Port: 3306,
},
Expand Down Expand Up @@ -741,6 +745,7 @@ func TestAddMySQL(t *testing.T) {
ServiceID: serviceID,
NodeID: nodeID,
ServiceName: serviceName,
Cluster: serviceName,
Address: "10.10.10.10",
Port: 3306,
},
Expand Down Expand Up @@ -815,6 +820,7 @@ func TestAddMySQL(t *testing.T) {
ServiceID: serviceID,
NodeID: nodeID,
ServiceName: serviceName,
Cluster: serviceName,
Address: "10.10.10.10",
Port: 3306,
},
Expand Down
7 changes: 7 additions & 0 deletions api-tests/management/postgresql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ func TestAddPostgreSQL(t *testing.T) {
ServiceID: serviceID,
NodeID: nodeID,
ServiceName: serviceName,
Cluster: serviceName,
DatabaseName: defaultPostgresDBName,
Address: "10.10.10.10",
Port: 5432,
Expand Down Expand Up @@ -161,6 +162,7 @@ func TestAddPostgreSQL(t *testing.T) {
ServiceID: serviceID,
NodeID: nodeID,
ServiceName: serviceName,
Cluster: serviceName,
DatabaseName: defaultPostgresDBName,
Address: "10.10.10.10",
Port: 5432,
Expand Down Expand Up @@ -261,6 +263,7 @@ func TestAddPostgreSQL(t *testing.T) {
ServiceID: serviceID,
NodeID: nodeID,
ServiceName: serviceName,
Cluster: serviceName,
DatabaseName: defaultPostgresDBName,
Address: "10.10.10.10",
Port: 5432,
Expand Down Expand Up @@ -410,6 +413,7 @@ func TestAddPostgreSQL(t *testing.T) {
ServiceID: serviceID,
NodeID: newNodeID,
ServiceName: serviceName,
Cluster: serviceName,
DatabaseName: defaultPostgresDBName,
Address: "10.10.10.10",
Port: 27017,
Expand Down Expand Up @@ -636,6 +640,7 @@ func TestAddPostgreSQL(t *testing.T) {
ServiceID: serviceID,
NodeID: nodeID,
ServiceName: serviceName,
Cluster: serviceName,
DatabaseName: defaultPostgresDBName,
Address: "10.10.10.10",
Port: 5432,
Expand Down Expand Up @@ -711,6 +716,7 @@ func TestAddPostgreSQL(t *testing.T) {
ServiceID: serviceID,
NodeID: nodeID,
ServiceName: serviceName,
Cluster: serviceName,
DatabaseName: defaultPostgresDBName,
Address: "10.10.10.10",
Port: 5432,
Expand Down Expand Up @@ -785,6 +791,7 @@ func TestAddPostgreSQL(t *testing.T) {
ServiceID: serviceID,
NodeID: nodeID,
ServiceName: serviceName,
Cluster: serviceName,
DatabaseName: defaultPostgresDBName,
Address: "10.10.10.10",
Port: 5432,
Expand Down
16 changes: 9 additions & 7 deletions api-tests/management/proxysql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ func TestAddProxySQL(t *testing.T) {
ServiceID: serviceID,
NodeID: nodeID,
ServiceName: serviceName,
Cluster: serviceName,
Address: "10.10.10.10",
Port: 3306,
},
Expand Down Expand Up @@ -155,6 +156,7 @@ func TestAddProxySQL(t *testing.T) {
ServiceID: serviceID,
NodeID: nodeID,
ServiceName: serviceName,
Cluster: serviceName,
Address: "10.10.10.10",
Port: 3306,
},
Expand Down Expand Up @@ -260,13 +262,12 @@ func TestAddProxySQL(t *testing.T) {
params := &proxysql.AddProxySQLParams{
Context: pmmapitests.Context,
Body: proxysql.AddProxySQLBody{
NodeID: nodeID,
PMMAgentID: pmmAgentID,
ServiceName: serviceName,
Address: "10.10.10.10",
Port: 3306,
Username: "username",

NodeID: nodeID,
PMMAgentID: pmmAgentID,
ServiceName: serviceName,
Address: "10.10.10.10",
Port: 3306,
Username: "username",
SkipConnectionCheck: true,
},
}
Expand Down Expand Up @@ -386,6 +387,7 @@ func TestAddProxySQL(t *testing.T) {
ServiceID: serviceID,
NodeID: newNodeID,
ServiceName: serviceName,
Cluster: serviceName,
Address: "10.10.10.10",
Port: 27017,
},
Expand Down
3 changes: 3 additions & 0 deletions managed/models/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,9 @@ var databaseSchema = [][]string{
`ALTER TABLE agents
ALTER COLUMN comments_parsing_disabled DROP DEFAULT`,
},
85: {
`UPDATE services SET cluster = service_name WHERE cluster = ''`,
},
}

// ^^^ Avoid default values in schema definition. ^^^
Expand Down
Loading
Loading