Skip to content

Weave GitOps provides insights into your application deployments, and makes continuous delivery with GitOps easier to adopt and scale across your teams.

License

Notifications You must be signed in to change notification settings

ivaylo-mi/weave-gitops

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

weave-gitops

Weave GitOps

Test status LICENSE Contributors Release FOSSA Status

Overview

Weave GitOps enables an effective GitOps workflow for continuous delivery of applications into Kubernetes clusters. It is based on CNCF Flux, a leading GitOps engine.

Getting Started

CLI Installation

Mac / Linux

curl --silent --location "https://github.com/weaveworks/weave-gitops/releases/download/v0.7.0/gitops-$(uname)-$(uname -m).tar.gz" | tar xz -C /tmp
sudo mv /tmp/gitops /usr/local/bin
gitops version

Alternatively, users can use Homebrew:

brew tap weaveworks/tap
brew install weaveworks/tap/gitops

Please see the getting started guide.

CLI Reference

Command line utility for managing Kubernetes applications via GitOps.

Usage:
  gitops [command]

Examples:

  # Get verbose output for any gitops command
  gitops [command] -v, --verbose

  # Get help for gitops add cluster command
  gitops add cluster -h
  gitops help add cluster

  # Get the version of gitops along with commit, branch, and flux version
  gitops version

  To learn more, you can find our documentation at https://docs.gitops.weave.works/


Available Commands:
  add         Add a new Weave GitOps resource
  check       Validates flux compatibility
  completion  Generate the autocompletion script for the specified shell
  delete      Delete one or many Weave GitOps resources
  get         Display one or many Weave GitOps resources
  help        Help about any command
  update      Update a Weave GitOps resource
  upgrade     Upgrade to Weave GitOps Enterprise
  version     Display gitops version

Flags:
  -e, --endpoint string            The Weave GitOps Enterprise HTTP API endpoint
  -h, --help                       help for gitops
      --insecure-skip-tls-verify   If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
      --namespace string           The namespace scope for this operation (default "flux-system")
  -v, --verbose                    Enable verbose output

Use "gitops [command] --help" for more information about a command.

For more information please see the docs

CLI/API development

To set up a development environment for the CLI

To use an existing environment

  1. Install go v1.17
  2. Install buf
  3. Run make all to install dependencies and build binaries and assets
  4. Start a kind cluster like so: KIND_CLUSTER_NAME=<some name> ./tools/kind-with-registry.sh
  5. Run flux install -n flux-system
  6. Start the in-cluster API replacement job (powered by http://tilt.dev) with make cluster-dev
  7. make or make unit-tests to ensure everything built correctly.
  8. Navigate to http://localhost:9001 in your browser. The login is dev with the password dev.

Requirements/tools

This is a list of the tools you may need to install:

  • go -- Primary compiler for the CLI.
  • npm -- Package manager for UI components.
  • ginkgo -- A go testing framework.
  • docker -- Used for generating containers & testing kubernetes set-ups.
  • golangci-lint -- A go linter.
  • buf -- To generate the protobufs used by the API.
  • reflex -- A file watcher.
  • kind -- Run kubernetes clusters in docker for testing.
  • lcov -- Used for code coverage.
  • flux -- Continuous delivery system for kubernetes that weave-gitops enriches.

Some other tools are installed automatically by the makefile for you:

  • go-acc -- Calculates code coverage for go.
  • gcov2lcov -- Converts output from go-acc to a format lcov understands.

And some tools that are installed by the tools/download-deps.sh script:

  • envtest -- Run a kubernetes control plane locally for testing.
  • tilt -- Automatically build and deploy to a local cluster.

To use a bootstrapped, ready made environment

  1. Install go v1.17
  2. Install buf
  3. Run make all to install dependencies and build binaries and assets
  4. Run make cluster-dev which should install and bring up everything and then start tilt to take over monitoring

Cluster Dev Tips

  • You may need to turn off your kustomize-controller to prevent it from reconciling your "GitOps RunTime" and over-writing the wego-app deployment.
  • Setting the system kustomization to suspend: true in the config repo will also keep kustomize-controller from fighting with tilt. You may need to kill a failing pod after suspending the kustomization.

Unit testing

We are using Ginko for our unit tests. To execute the all the unit tests, run make unit-tests.

To run a single test, you will need to set the KUBEBUILDER_ASSESTS environment variable to point to the directory containing our mock K8s objects.

export KUBEBUILDER_ASSETS=$(git rev-parse --show-toplevel)/tools/bin/envtest
go test github.com/weaveworks/weave-gitops/pkg/kube

or

export KUBEBUILDER_ASSETS=$(git rev-parse --show-toplevel)/tools/bin/envtest
cd pkg/kube
go test

Executing a subset of tests

Ginkgo allows you to run a subset of Describe/Context/It specs. See Focused Specs for more information

Setup golangci-lint in your editor

Link for golangci-lint editor integration: https://golangci-lint.run/usage/integrations/

For VSCode, use these editor configuration flags:

    "go.lintFlags": [
        "--fast",
    ],

UI Development

To set up a development environment for the UI

  1. Install go v1.17
  2. Install Node.js version 16.13.2
  3. Make sure your $GOPATH is added to your $PATH in your bashrc or zshrc file, then install reflex for automated server builds: go get github.com/cespare/reflex
  4. Go through the Weave GitOps getting started docs here: https://docs.gitops.weave.works/docs/getting-started/
  5. Run make node_modules. NOTE: Running npm install could leave you unable to pass our ui-tests. If you're getting an error about a git diff in your package.lock, run rm -rf node_modules && make node_modules.
  6. Make sure GitOps is installed on a fresh kind cluster for this repo by running kind delete cluster, kind create cluster, and finally gitops install.
  7. To start up the HTTP server with automated re-compliation, run make api-dev
  8. Run npm start to start the frontend dev server (with hot-reloading)

Lint frontend code with make ui-lint - using Prettier (https://prettier.io/) will get you on the right track!

Run frontend tests with make ui-test - update CSS snapshots with npm run test -- -u

Check dependency vulnerabilities with make ui-audit

To avoid invalidating JWT tokens on every server restart set the GITOPS_JWT_ENCRYPTION_SECRET env variable in your shell to use a static encryption secret. Else, a random encryption secret will be used that will change on every server (or pod) restart, thus invalidating any JWTs that were created with the old secret.

Recommended Snippets

To create a new styled React component (with typescript):

{
  "Export Default React Component": {
    "prefix": "tsx",
    "body": [
      "import * as React from 'react';",
      "import styled from 'styled-components'",
      "",
      "type Props = {",
      "  className?: string",
      "}",
      "",
      "function ${1:} ({ className }: Props) {",
      "  return (",
      "    <div className={className}>",
      "      ${0}",
      "    </div>",
      "  );",
      "}",
      "",
      "export default styled(${1:}).attrs({ className: ${1:}.name })``"
    ],
    "description": "Create a default-exported, styled React Component."
  }
}

FAQ

Please see our Weave GitOps Core FAQ

Contribution

Need help or want to contribute? Please see the links below.

License scan details

FOSSA Status

About

Weave GitOps provides insights into your application deployments, and makes continuous delivery with GitOps easier to adopt and scale across your teams.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • MDX 88.0%
  • Go 6.7%
  • TypeScript 4.7%
  • JavaScript 0.4%
  • Shell 0.1%
  • Makefile 0.1%