/
githubmirror
/
origin
Обзор
Документация
Войти
/
githubmirror
/
origin
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
pkg/clioptions/clusterinfo/write_job_run_data.go
49 строк
2 KB
Devan Goodwin
Rename temp Go fields to locator/message and serialize to match
19 апр 2024, 15:33
19 апр 2024, 15:33
12fe22e
Код
Авторство
О чём код?
package clusterinfo import ( "context" "strings" "github.com/openshift/origin/pkg/monitortestlibrary/platformidentification" "k8s.io/client-go/rest" e2e "k8s.io/kubernetes/test/e2e/framework" "github.com/openshift/origin/pkg/monitor/monitorapi" ) func WasMasterNodeUpdated(events monitorapi.Intervals) string { nodeUpdates := events.Filter(monitorapi.NodeUpdate) for _, i := range nodeUpdates { // "locator": "node/ip-10-0-240-32.us-west-1.compute.internal", // "message": "reason/NodeUpdate phase/Update config/rendered-master-757d729d8565a6f9f4e59913d4731db1 roles/control-plane,master reached desired config roles/control-plane,master", // vs // "locator": "node/ip-10-0-228-209.us-west-1.compute.internal", // "message": "reason/NodeUpdate phase/Update config/rendered-worker-722803a00bad408ee94572ab244ad3bc roles/worker reached desired config roles/worker", if strings.Contains(i.Message.Annotations[monitorapi.AnnotationRoles], "master") { return "Y" } } return "N" } // TODO this should be taking a client, not a kubeconfig. Can't test a kubeconfig. func CollectClusterData(adminKubeConfig *rest.Config, masterNodeUpdated string) platformidentification.ClusterData { clusterData := platformidentification.ClusterData{} var errs *[]error clusterData, errs = platformidentification.BuildClusterData(context.TODO(), adminKubeConfig) if errs != nil { for _, err := range *errs { e2e.Logf("Error building cluster data: %s", err.Error()) } e2e.Logf("Ignoring cluster data due to previous errors: %v", clusterData) return platformidentification.ClusterData{} } clusterData.MasterNodesUpdated = masterNodeUpdated return clusterData }