mks-server

command module
v0.0.0-...-c054a23 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

README

 ███╗   ███╗██╗  ██╗███████╗  ███████╗███████╗██████╗ ██╗   ██╗███████╗██████╗
 ████╗ ████║██║ ██╔╝██╔════╝  ██╔════╝██╔════╝██╔══██╗██║   ██║██╔════╝██╔══██╗
 ██╔████╔██║█████╔╝ ███████╗  ███████╗█████╗  ██████╔╝██║   ██║█████╗  ██████╔╝
 ██║╚██╔╝██║██╔═██╗ ╚════██║  ╚════██║██╔══╝  ██╔══██╗╚██╗ ██╔╝██╔══╝  ██╔══██╗
 ██║ ╚═╝ ██║██║  ██╗███████║  ███████║███████╗██║  ██║ ╚████╔╝ ███████╗██║  ██║
 ╚═╝     ╚═╝╚═╝  ╚═╝╚══════╝  ╚══════╝╚══════╝╚═╝  ╚═╝  ╚═══╝  ╚══════╝╚═╝  ╚═╝

Minimal Tekton Server is a small application written in golang which listens for 'mks' custom resource being created and send requests to Tekton APIs to create corresponding resource on a Kubernetes/OpenShift Cluster. It only takes few required fields into consideration and provides options to customise them.

It runs as a server and currently three types of resources are supported.

  • MksTask (Equivalent to Tekton 'Task')
  • MksTaskRun (Equivalent to Tekton 'TaskRun')
  • MksPipelineRun (Equivalent to Tekton 'PipelineRun')
Usage:

	./mks-server [flags]

The flags are:

	-kubeconfig
		Kubernetes configuration file. Automatically selects configuration from
		the cluster and user's home($HOME/.kube/config).
	-master
		The address of the kubernetes API server. Overrides any value in the
		kubeconfig.
	-addr
		The address of the Redis server. Defaults to 127.0.0.1:6379.
	-password
		The password of the Redis database.

This minimal server also serves the redis database. Database is used to store the count the mks resources being created, deleted, is active, completed or failed. The choice of the database is Redis due to its simplicity and easy integration (see https://github.com/go-redis/redis).

This server can receive request via exposed API or by using Minimal Tekton Server CLI application aka 'mks-cli' (see https://github.com/MiniTeks/mks-cli). You can create, delete, list or update a particular resource and the changes are transferred to the Tekton API and applied. See more about mks-cli in its respective repository.

The live statistics of the resources can be seen using Minimal Tekton Server Dashboard aka 'mks-ui' (see https://github.com/MiniTeks/mks-ui). The dashboard is very minimal and shows all the stas in a tabular form. See more about mks-ui in its respective repository.


How To Build from the source

Prerequisites

This application needs a go compiler to build and a kubernetes cluster to run. You can also use minikube or kind to run on your local machine. Please install in advance.

Steps to build

  • Clone the repository using:
    git clone https://github.com/MiniTeks/mks-server.git
  • Make sure you have all the go dependencies
    go mod tidy

    go mod vendor
  • Build the project using:
    go build .
  • Make sure minikube cluster is running and tekton pipeline installed
  • Apply Custom Resource Definition present in config/ according to custom resource(s) you want create
    kubectl apply -f config/mksCRDs/
  • Running the redis-database
    kubectl apply -f k8s/ \
    kubectl port-forward <your redis-db pod, e.g-mks-db-6f544776bf-lsp2r > 6379:6379
  • Run the executable using:
    ./mks-server -kubeconfig=<your kube config, defaults to local/cluster config>
  • For checking create custom resource by applying custom-resource file
    kubectl apply -f config/mksResourceExample/<cr-example>.yaml

Steps to Deploy on k8s/openshift cluster

  1. Get the cluster configured, and create a namespace "mks"
	oc new-project mks
  1. Install tekton pipelines operator in the cluster.
	oc apply --filename https://storage.googleapis.com/tekton-releases/pipeline/latest/release.yaml
  1. Apply the files to create the mks resources inside the cluster
	oc apply -f config/mksCRDs

3 Get db server up and running.

	oc apply -f k8s/db-config
  1. Get mks-server up and running.
	oc apply -f k8s/mks-config
  1. Apply the files to create the mks resource examples
	oc apply -f config/mksResourceExample
  1. Check the logs to verify
	oc logs -f -n mks $(oc get pods -n mks | grep mks-server | cut -d' ' -f1)

Architectural Design

MKS-Server Architectural Design


License

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg
actions
Package actions provides functions to create, get, list, delete and update a Tekton resource on Kubernetes/OpenShift clusters.
Package actions provides functions to create, get, list, delete and update a Tekton resource on Kubernetes/OpenShift clusters.
apis/mkscontroller/v1alpha1
Package v1alpha1 containes the MKS CustomResourceDefinition and its structs.
Package v1alpha1 containes the MKS CustomResourceDefinition and its structs.
client/clientset/versioned
This package has the automatically generated clientset.
This package has the automatically generated clientset.
client/clientset/versioned/fake
This package has the automatically generated fake clientset.
This package has the automatically generated fake clientset.
client/clientset/versioned/scheme
This package contains the scheme of the automatically generated clientset.
This package contains the scheme of the automatically generated clientset.
client/clientset/versioned/typed/mkscontroller/v1alpha1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
client/clientset/versioned/typed/mkscontroller/v1alpha1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
db

Jump to

Keyboard shortcuts

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