Kubewrap - kubewrap is an kubernetes command line utility with a focus to explore the kubernetes REST API's leveraging the go libraries available along with golang and cobra packages.

Kubewrap

kubewrap is an kubernetes cli wrapper with a focus to explore the kubernetes REST API's leveraging the go libraries available along with golang and cobra package.

Install the cobra library:

 go get -u github.com/spf13/cobra/cobra

Next, create your CLI skeleton

cobra init --package-name kubewrap

It will initialize the “kubewrap” project with cobra the library. You can observe that it created a few files in the project.

Folder structure after cobra

root.go → is the file created for the root command. In this CLI utility, there would be a root command followed by some set of sub-commands and flags. Therefore, root.go will take care of all logic required for the main/root command. main.go → as the name says, its the main entry point for your CLI utility. Simply, requirement is just a call to a function present in the root.go

So to recall the flow main.go -> root.go At this point, you could test it by executing below commands inside kubewrap folder. Note Minikube must be installed as it'll need to check for default server to connect to in process.

 go install
 
 kubewrap

kubewrap is a root command and dig is a sub command to that In the future, you could have a set of subcommands such as below

 kubewrap dig1

will list out all the pods

 kubewrap dig2

will list out all the deployments…vice versa. So, to extend our existing skeleton to have subcommand, just execute the below

For you, it should be "kubewrap” folder. Again ignore here testkube Now your flow would be → main.go -> root.go → dig.go Now you could also see the dig.go file created in your existing file structure. That's it. Done. Jump to code now…

Step 3:

a. Connect to your cluster using “kubeconfig” REST API call → root.go The changes required in “step a” needs to be implemented in the root.go wherein you just need to provide the path of your own config file

find config in root.go and change the config file path above when required. In root.go you just need to have above function which takes care of connecting to the minkube cluster using a REST call.
b. Once connected, you would simply make a call to rest API to

“list pods available” → dig.go

Simple, go to dig.go and follow the changes required to make a call to the REST API to list all the pods available in the cluster.

Similar Resources

It is POC to create web apis using golang

Web API using golang It is POC to create web apis using golang. It is not using a good architecture like hexagonal archicture. But, it contains a CRUD

Aug 16, 2021

⚓️ Golang RESTful APIs

Golang RESTful Golang RESTful API started on January 23rd, 2022. 环境配置相关解决办法

Jan 23, 2022

REST api using fiber framework written in golang and using firebase ecosystem to authentication, storage and firestore as a db and use clean architecture as base

REST api using fiber framework written in golang and using firebase ecosystem to authentication, storage and firestore as a db and use clean architecture as base

Backend API Example FiberGo Framework Docs : https://github.com/gofiber Info This application using firebase ecosystem Firebase Auth Cloud Storage Fir

May 31, 2022

GoPrisma - A Go wrapper for prisma to turn databases into GraphQL APIs using Go.

GoPrisma - a Go wrapper for the Prisma Engines What's this? Introspect a database and use it as a GraphQL API using Go. Supported Databases: SQLite Po

Dec 20, 2022

A REST web-service sample project written in Golang using go-fiber, GORM and PostgreSQL

backend A REST web-service sample project written in Golang using go-fiber, GORM and PostgreSQL How to run Make sure you have Go installed (download).

Jan 1, 2023

Example Golang API backend rest implementation mini project Point Of Sale using Gin Framework and Gorm ORM Database.

Example Golang API backend rest implementation mini project Point Of Sale using Gin Framework and Gorm ORM Database.

Dec 23, 2022

A REST framework for quickly writing resource based services in Golang.

What is Resoursea? A high productivity web framework for quickly writing resource based services fully implementing the REST architectural style. This

Sep 27, 2022

🍐 Elegant Golang REST API Framework

🍐 Elegant Golang REST API Framework

An Elegant Golang Web Framework Goyave is a progressive and accessible web application framework focused on REST APIs, aimed at making backend develop

Jan 9, 2023

A rest api with the crud methods made it in golang

A rest api with the crud methods made it in golang

go-API-REST A rest api made it in golang that connects to a mongodb database This API is compatible with the Angular frontend from https://github.com/

Apr 26, 2022
REST API made using native Golang libraries. This API resembles the basic working of Instagram.
REST API made using native Golang libraries. This API resembles the basic working of Instagram.

Golang RESTful API for Instagram A Go based REST API built using native libraries. The API has been thoroughly worked through with Postman. Routes inc

Mar 16, 2022
Generate boilerplate + endpoints for Fiber REST APIs.

gomakeme Generate boilerplate + endpoints for Fiber REST APIs. Never spend 6 minutes doing something by hand when you can spend 1 week to automate it

Dec 30, 2022
Gearbox :gear: is a web framework written in Go with a focus on high performance
Gearbox :gear: is a web framework written in Go with a focus on high performance

gearbox ⚙️ is a web framework for building micro services written in Go with a focus on high performance. It's built on fasthttp which is up to 10x fa

Jan 3, 2023
Microservice framework following best cloud practices with a focus on productivity.

patron Patron is a framework for creating microservices, originally created by Sotiris Mantzaris (https://github.com/mantzas). This fork is maintained

Dec 22, 2022
Gearbox :gear: is a web framework written in Go with a focus on high performance
Gearbox :gear: is a web framework written in Go with a focus on high performance

gearbox ⚙️ is a web framework for building micro services written in Go with a focus on high performance. It's built on fasthttp which is up to 10x fa

Dec 29, 2022
REST Layer, Go (golang) REST API framework
REST Layer, Go (golang) REST API framework

REST Layer REST APIs made easy. REST Layer is an API framework heavily inspired by the excellent Python Eve. It helps you create a comprehensive, cust

Dec 16, 2022
QOR is a set of libraries written in Go that abstracts common features needed for business applications, CMSs, and E-commerce systems.

QOR English Chat Room: 中文聊天室: For security issues, please send us an email to [email protected] and give us time to respond BEFORE posting as an iss

Jan 2, 2023
Boilerplate API template includes all the common packages and setup used for API development in this Company

Boilerplate API Boilerplate API template includes all the common packages and setup used for API development in this Company. Development Copy .env.ex

Feb 19, 2022
Httpserver go - Server using only the go's libraries

API Rest Server This server use only the standard library of go (http, fmt and j

Jun 21, 2022
SendGrid's Golang HTTP Client for calling APIs
SendGrid's Golang HTTP Client for calling APIs

Quickly and easily access any RESTful or RESTful-like API. If you are looking for the SendGrid API client library, please see this repo. Announcements

Dec 29, 2022