ovrclk / akash

@@ -11,6 +11,8 @@
Loading
11 11
	"sync"
12 12
	"time"
13 13
14 +
	"github.com/cosmos/cosmos-sdk/version"
15 +
14 16
	"github.com/golang-jwt/jwt/v4"
15 17
16 18
	"k8s.io/client-go/tools/remotecommand"
@@ -27,6 +29,7 @@
Loading
27 29
	"github.com/gorilla/mux"
28 30
29 31
	kubeErrors "k8s.io/apimachinery/pkg/api/errors"
32 +
	kubeVersion "k8s.io/apimachinery/pkg/version"
30 33
31 34
	"github.com/ovrclk/akash/manifest"
32 35
	"github.com/ovrclk/akash/provider"
@@ -84,6 +87,12 @@
Loading
84 87
		})
85 88
	})
86 89
90 +
	// GET /version
91 +
	// provider version endpoint does not require authentication
92 +
	router.HandleFunc("/version",
93 +
		createVersionHandler(log, pclient)).
94 +
		Methods(http.MethodGet)
95 +
87 96
	// GET /status
88 97
	// provider status endpoint does not require authentication
89 98
	router.HandleFunc("/status",
@@ -391,6 +400,25 @@
Loading
391 400
	}
392 401
}
393 402
403 +
type versionInfo struct {
404 +
	Akash string            `json:"akash"`
405 +
	Kube  *kubeVersion.Info `json:"kube"`
406 +
}
407 +
408 +
func createVersionHandler(log log.Logger, pclient provider.Client) http.HandlerFunc {
409 +
	return func(w http.ResponseWriter, r *http.Request) {
410 +
		kube, err := pclient.Cluster().KubeVersion()
411 +
		if err != nil {
412 +
			http.Error(w, err.Error(), http.StatusInternalServerError)
413 +
			return
414 +
		}
415 +
		writeJSON(log, w, versionInfo{
416 +
			Akash: version.Version,
417 +
			Kube:  kube,
418 +
		})
419 +
	}
420 +
}
421 +
394 422
func createStatusHandler(log log.Logger, sclient provider.StatusClient) http.HandlerFunc {
395 423
	return func(w http.ResponseWriter, req *http.Request) {
396 424
		status, err := sclient.Status(req.Context())

@@ -13,6 +13,10 @@
Loading
13 13
	migratePathPrefix    = "/migrate"
14 14
)
15 15
16 +
func versionPath() string {
17 +
	return "version"
18 +
}
19 +
16 20
func statusPath() string {
17 21
	return "status"
18 22
}

@@ -20,6 +20,7 @@
Loading
20 20
21 21
	eventsv1 "k8s.io/api/events/v1"
22 22
	v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
23 +
	"k8s.io/apimachinery/pkg/version"
23 24
24 25
	"github.com/ovrclk/akash/manifest"
25 26
	ctypes "github.com/ovrclk/akash/provider/cluster/types"
@@ -88,6 +89,9 @@
Loading
88 89
	PurgeDeclaredHostnames(ctx context.Context, lID mtypes.LeaseID) error
89 90
90 91
	PurgeDeclaredHostname(ctx context.Context, lID mtypes.LeaseID, hostname string) error
92 +
93 +
	// KubeVersion returns the version information of kubernetes running in the cluster
94 +
	KubeVersion() (*version.Info, error)
91 95
}
92 96
93 97
func ErrorIsOkToSendToClient(err error) bool {
@@ -566,3 +570,7 @@
Loading
566 570
func (c *nullClient) AllHostnames(context.Context) ([]ctypes.ActiveHostname, error) {
567 571
	return nil, nil
568 572
}
573 +
574 +
func (c *nullClient) KubeVersion() (*version.Info, error) {
575 +
	return nil, nil
576 +
}

@@ -15,6 +15,7 @@
Loading
15 15
	eventsv1 "k8s.io/api/events/v1"
16 16
	kubeErrors "k8s.io/apimachinery/pkg/api/errors"
17 17
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
18 +
	"k8s.io/apimachinery/pkg/version"
18 19
	"k8s.io/apimachinery/pkg/watch"
19 20
	"k8s.io/client-go/kubernetes"
20 21
	"k8s.io/client-go/rest"
@@ -786,3 +787,7 @@
Loading
786 787
787 788
	return serviceStatus, nil
788 789
}
790 +
791 +
func (c *client) KubeVersion() (*version.Info, error) {
792 +
	return c.kc.(*kubernetes.Clientset).ServerVersion()
793 +
}
Files Coverage
app 77.28%
client 2.84%
cmd 8.67%
deploy/cmd 0.00%
events 7.36%
manifest 80.95%
provider 33.56%
pubsub 89.18%
sdkutil 38.33%
sdl 70.27%
testutil 90.67%
types 28.34%
util 43.11%
x 37.73%
docgen/main.go 0.00%
integration/test_helpers.go 5.40%
validation/manifest.go 94.78%
Project Totals (357 files) 38.23%

No yaml found.

Create your codecov.yml to customize your Codecov experience

Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading