Code Monkey home page Code Monkey logo

clustercloner's Introduction

Cluster Cloner

Reads the Kubernetes clusters in one location (optionally filtering by labels) and clones them into another (or just outputs JSON as a dry run), to/from AWS, GCP, and Azure.

Article

The Cluster Cloner project is discussed in this article, and the different cluster models are compared.

Usage

For usage, run clustercloner --help

Setup

Add Credentials in local development environment

  • Add a file credentials-cluster-manager.json (or another file name) with credentials for a service account with the Kubernetes Cluster Admin role (to read and create clusters).
    • This is loaded through the GOOGLE_APPLICATION_CREDENTIALS environment variable, which you should set to credentials-cluster-manager.json (or other file name). If this environment variable is not set, your logged-in gcloud account will be used.
  • Add a file .env with Azure credentials.
    • Use .env.tpl as a template.
    • The user should have the Azure Kubernetes Service Cluster Admin Role.
  • Add a file awscredentials with AWS credentials.
    • The application uses the AWS_SHARED_CREDENTIALS_FILE environment variable to find this file, but awscredentials is the default.
    • Use awscredentials.tpl as a template.
    • The user should have the policy discussed here. Specific example here

Define Secrets for GitHub Continuous Integration

  • Not needed for local build.
  • Store the base-64 encodings, for example echo my-credential.json |base64
  • For GitHub CI, please specify the following Secrets in GitHub:
    • AZ_ENV_BASE64 .env file with Azure credentials for the application, following .env.tpl as a template.
    • AWS_CREDENTIALS_BASE64 AWS credentials file for the application. Use awscredentials.tpl as a template.
    • GCP_CLUSTER_MANAGER_KEYJSON_BASE64 Google credentials file (JSON) for the application.
    • GCR_PUSHER_KEYJSON_BASE64 Google credentials file (JSON) with role Storage Admin for pushing to your GCR registry
    • DOCKER_REGISTRY - Registry to which the GitHub action with authenticate, for example gcr.io.
    • DOCKER_REPOSITORY - optional. For example gcr.io/my-gcp-project/image-name. If missing, the value defaults to $GITHUB_REPOSITORY, in the form user/repo.

Building

Docker Docker

The Docker image is built in Github Workflows. In development, you can run DOCKER_BUILDKIT=1 docker build -t <TAG> . (Don't forget that final dot.)

Using make

In the GitHub actions, make is used to build the application.

In development:

Build

Plain make to format, lint and build

Lint and format

make lint and make fmt

Unit tests

make test-short

Integration and unit tests

make test. Before running, make sure that your Google Project and Azure Group are set up (see "Credentials" above) and have the same name. The full suite can take up to an hour.

Credits

This project was started from the goapp template, a bootstrap project for Go CLI applications.

clustercloner's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

clustercloner's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.