Beispiel #1
0
// Do is the Periodic interface implementation
func (u *getLatestVersionData) Do() error {
	cluster, err := data.GetCluster(u.installedData, u.clusterID, u.availableComponentVsn)
	if err != nil {
		return err
	}
	if _, err := u.vsns.Refresh(cluster); err != nil {
		return err
	}
	return nil
}
Beispiel #2
0
// ComponentsHandler route handler
func ComponentsHandler(
	workflow data.InstalledData,
	clusterID data.ClusterID,
	availVers data.AvailableComponentVersion,
) http.Handler {
	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		cluster, err := data.GetCluster(workflow, clusterID, availVers)
		if err != nil {
			http.Error(w, err.Error(), http.StatusInternalServerError)
			return
		}
		if err := json.NewEncoder(w).Encode(cluster); err != nil {
			http.Error(w, err.Error(), http.StatusInternalServerError)
		}
	})
}
Beispiel #3
0
//  sendVersions sends cluster version data
func sendVersionsImpl(
	apiClient *apiclient.WorkflowManager,
	clusterID data.ClusterID,
	k8sResources *k8s.ResourceInterfaceNamespaced,
	availableVersions data.AvailableVersions,
) error {
	cluster, err := data.GetCluster(
		data.NewInstalledDeisData(k8sResources),
		clusterID,
		data.NewLatestReleasedComponent(k8sResources, availableVersions),
	)
	if err != nil {
		log.Println("error getting installed components data")
		return err
	}

	_, err = apiClient.Operations.CreateClusterDetails(&operations.CreateClusterDetailsParams{Body: &cluster})
	if err != nil {
		log.Println("error sending diagnostic data")
		return err
	}
	return nil
}