kubeplus

module
v0.0.0-...-de64a1c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 12, 2020 License: Apache-2.0

README

KubePlus API Add-on

KubePlus API add-on simplifies building workflow automation involving Kubernetes Custom Resoures. It brings uniformity in using disparate Custom Resources to create platform workflows. Towards this it provides kubectl commands for discovery, resource usage monitoring and troubleshooting of Custom Resources.

kubectl commands

KubePlus API add-on offers following kubectl commands:

1. kubectl man : Provides information about how to use a Custom Resource.

2. kubectl composition : Provides information about sub resources created as part of handling a Custom Resource instance.

3. kubectl metrics cr : Provides various metrics for Custom Resource instance (number of sub-resources, number of pods, number of containers, number of nodes on which the pods run, total CPU and Memory).

4. kubectl metrics account : Provides various metrics for an account identity - user / service account. (number of custom resources, number of Deployments/StatefulSets/ReplicaSets/DaemonSets/ReplicationControllers, number of Pods, total CPU and Memory).

5. kubectl crlogs : Provides logs for all the containers of a Custom Resource instance.

6. kubectl cr-relations : (upcoming) Provides information about relationships of a Custom Resource instance with other resources (custom or built-in) via labels / annotations / spec properties / sub-resources.

Example

$ kubectl metrics cr MysqlCluster cluster1 namespace1
---------------------------------------------------------- 
 Creator Account Identity: devdattakulkarni@gmail.com
---------------------------------------------------------- 
 Number of Sub-resources: 7
 Number of Pods: 2
 Number of Containers: 16
 Number of Nodes: 1
Total CPU(cores): 84m
Total MEMORY(bytes): 302Mi
----------------------------------------------------------

$ kubectl metrics account devdattakulkarni@gmail.com
---------------------------------------------------------- 
 Creator Account Identity: devdattakulkarni@gmail.com
---------------------------------------------------------- 
 Number of Custom Resources: 3
 Number of Deployments: 1
 Number of StatefulSets: 0
 Number of ReplicaSets: 0
 Number of DaemonSets: 0
 Number of ReplicationControllers: 0
 Number of Pods: 0
Total CPU(cores): 288m
Total MEMORY(bytes): 524Mi

Details about KubePlus API Add-on can be found here. KubePlus API Add-on is being developed as part of our Platform as Code practice.

How to use?

In order to use KubePlus API add-on all you need to do is enhance Custom Resource Definition (CRD) YAMLs with following two annotations.

platform-as-code/usage

The 'usage' annotation is used to define usage information for a Custom Resource. The value for 'usage' annotation is the name of the ConfigMap that stores the usage information.

platform-as-code/composition

The 'composition' annotation is used to define Kubernetes's built-in resources that are created as part of instantiating a Custom Resource instance.

Here is an example of MysqlCluster Custom Resource Definition (CRD) enhanced with above annotations:

  apiVersion: apiextensions.k8s.io/v1beta1
  kind: CustomResourceDefinition
  metadata:
    name: mysqlclusters.mysql.presslabs.org
    annotations:
      helm.sh/hook: crd-install
      platform-as-code/usage: mysqlcluster-usage.usage
      platform-as-code/composition: StatefulSet, Service, ConfigMap, Secret, PodDisruptionBudget
  spec:
    group: mysql.presslabs.org
    names:
      kind: MysqlCluster
      plural: mysqlclusters
      shortNames:
      - mysql
    scope: Namespaced

Try it:

  • Use Kubernetes cluster with version 1.14.
  • Enable Kubernetes Metrics API Server on your cluster.
    • Hosted Kubernetes solutions like GKE has this already installed.
   $ git clone https://github.com/cloud-ark/kubeplus.git
   $ cd kubeplus
   $ ./deploy-kubeplus.sh
   $ export PATH=`pwd`:$PATH

Check out examples.

Status

Actively under development

Directories

Path Synopsis
cmd/client-gen
client-gen makes the individual typed clients using gengo.
client-gen makes the individual typed clients using gengo.
cmd/client-gen/generators
Package generators has the generators for the client-gen utility.
Package generators has the generators for the client-gen utility.
cmd/conversion-gen
conversion-gen is a tool for auto-generating Conversion functions.
conversion-gen is a tool for auto-generating Conversion functions.
cmd/deepcopy-gen
deepcopy-gen is a tool for auto-generating DeepCopy functions.
deepcopy-gen is a tool for auto-generating DeepCopy functions.
cmd/defaulter-gen
defaulter-gen is a tool for auto-generating Defaulter functions.
defaulter-gen is a tool for auto-generating Defaulter functions.
cmd/go-to-protobuf
go-to-protobuf generates a Protobuf IDL from a Go struct, respecting any existing IDL tags on the Go struct.
go-to-protobuf generates a Protobuf IDL from a Go struct, respecting any existing IDL tags on the Go struct.
cmd/go-to-protobuf/protobuf
go-to-protobuf generates a Protobuf IDL from a Go struct, respecting any existing IDL tags on the Go struct.
go-to-protobuf generates a Protobuf IDL from a Go struct, respecting any existing IDL tags on the Go struct.
cmd/go-to-protobuf/protoc-gen-gogo
Package main defines the protoc-gen-gogo binary we use to generate our proto go files, as well as takes dependencies on the correct gogo/protobuf packages for godeps.
Package main defines the protoc-gen-gogo binary we use to generate our proto go files, as well as takes dependencies on the correct gogo/protobuf packages for godeps.
cmd/import-boss
import-boss enforces import restrictions in a given repository.
import-boss enforces import restrictions in a given repository.
cmd/openapi-gen
This package generates openAPI definition file to be used in open API spec generation on API servers.
This package generates openAPI definition file to be used in open API spec generation on API servers.
cmd/set-gen
set-gen is an example usage of gengo.
set-gen is an example usage of gengo.
pkg/apis/operatorcontroller/v1
Package v1 is the v1 version of the API.
Package v1 is the v1 version of the API.
pkg/client/clientset/versioned
This package has the automatically generated clientset.
This package has the automatically generated clientset.
pkg/client/clientset/versioned/fake
This package has the automatically generated fake clientset.
This package has the automatically generated fake clientset.
pkg/client/clientset/versioned/scheme
This package contains the scheme of the automatically generated clientset.
This package contains the scheme of the automatically generated clientset.
pkg/client/clientset/versioned/typed/operatorcontroller/v1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
pkg/client/clientset/versioned/typed/operatorcontroller/v1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
helm-pod Module
cmd/client-gen
client-gen makes the individual typed clients using gengo.
client-gen makes the individual typed clients using gengo.
cmd/client-gen/generators
Package generators has the generators for the client-gen utility.
Package generators has the generators for the client-gen utility.
cmd/conversion-gen
conversion-gen is a tool for auto-generating Conversion functions.
conversion-gen is a tool for auto-generating Conversion functions.
cmd/deepcopy-gen
deepcopy-gen is a tool for auto-generating DeepCopy functions.
deepcopy-gen is a tool for auto-generating DeepCopy functions.
cmd/defaulter-gen
defaulter-gen is a tool for auto-generating Defaulter functions.
defaulter-gen is a tool for auto-generating Defaulter functions.
cmd/go-to-protobuf
go-to-protobuf generates a Protobuf IDL from a Go struct, respecting any existing IDL tags on the Go struct.
go-to-protobuf generates a Protobuf IDL from a Go struct, respecting any existing IDL tags on the Go struct.
cmd/go-to-protobuf/protobuf
go-to-protobuf generates a Protobuf IDL from a Go struct, respecting any existing IDL tags on the Go struct.
go-to-protobuf generates a Protobuf IDL from a Go struct, respecting any existing IDL tags on the Go struct.
cmd/go-to-protobuf/protoc-gen-gogo
Package main defines the protoc-gen-gogo binary we use to generate our proto go files, as well as takes dependencies on the correct gogo/protobuf packages for godeps.
Package main defines the protoc-gen-gogo binary we use to generate our proto go files, as well as takes dependencies on the correct gogo/protobuf packages for godeps.
cmd/import-boss
import-boss enforces import restrictions in a given repository.
import-boss enforces import restrictions in a given repository.
cmd/openapi-gen
This package generates openAPI definition file to be used in open API spec generation on API servers.
This package generates openAPI definition file to be used in open API spec generation on API servers.
cmd/set-gen
set-gen is an example usage of gengo.
set-gen is an example usage of gengo.
pkg/apis/postgrescontroller/v1
Package v1 is the v1 version of the API.
Package v1 is the v1 version of the API.
pkg/client/clientset/versioned
This package has the automatically generated clientset.
This package has the automatically generated clientset.
pkg/client/clientset/versioned/fake
This package has the automatically generated fake clientset.
This package has the automatically generated fake clientset.
pkg/client/clientset/versioned/scheme
This package contains the scheme of the automatically generated clientset.
This package contains the scheme of the automatically generated clientset.
pkg/client/clientset/versioned/typed/postgrescontroller/v1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
pkg/client/clientset/versioned/typed/postgrescontroller/v1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
cmd/client-gen
client-gen makes the individual typed clients using gengo.
client-gen makes the individual typed clients using gengo.
cmd/client-gen/generators
Package generators has the generators for the client-gen utility.
Package generators has the generators for the client-gen utility.
cmd/conversion-gen
conversion-gen is a tool for auto-generating Conversion functions.
conversion-gen is a tool for auto-generating Conversion functions.
cmd/deepcopy-gen
deepcopy-gen is a tool for auto-generating DeepCopy functions.
deepcopy-gen is a tool for auto-generating DeepCopy functions.
cmd/defaulter-gen
defaulter-gen is a tool for auto-generating Defaulter functions.
defaulter-gen is a tool for auto-generating Defaulter functions.
cmd/go-to-protobuf
go-to-protobuf generates a Protobuf IDL from a Go struct, respecting any existing IDL tags on the Go struct.
go-to-protobuf generates a Protobuf IDL from a Go struct, respecting any existing IDL tags on the Go struct.
cmd/go-to-protobuf/protobuf
go-to-protobuf generates a Protobuf IDL from a Go struct, respecting any existing IDL tags on the Go struct.
go-to-protobuf generates a Protobuf IDL from a Go struct, respecting any existing IDL tags on the Go struct.
cmd/go-to-protobuf/protoc-gen-gogo
Package main defines the protoc-gen-gogo binary we use to generate our proto go files, as well as takes dependencies on the correct gogo/protobuf packages for godeps.
Package main defines the protoc-gen-gogo binary we use to generate our proto go files, as well as takes dependencies on the correct gogo/protobuf packages for godeps.
cmd/import-boss
import-boss enforces import restrictions in a given repository.
import-boss enforces import restrictions in a given repository.
cmd/openapi-gen
This package generates openAPI definition file to be used in open API spec generation on API servers.
This package generates openAPI definition file to be used in open API spec generation on API servers.
cmd/set-gen
set-gen is an example usage of gengo.
set-gen is an example usage of gengo.
pkg/apis/postgrescontroller/v1
Package v1 is the v1 version of the API.
Package v1 is the v1 version of the API.
pkg/client/clientset/versioned
This package has the automatically generated clientset.
This package has the automatically generated clientset.
pkg/client/clientset/versioned/fake
This package has the automatically generated fake clientset.
This package has the automatically generated fake clientset.
pkg/client/clientset/versioned/scheme
This package contains the scheme of the automatically generated clientset.
This package contains the scheme of the automatically generated clientset.
pkg/client/clientset/versioned/typed/postgrescontroller/v1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
pkg/client/clientset/versioned/typed/postgrescontroller/v1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL