Giter Club home page Giter Club logo

parts's Introduction

ksonnet

The team behind ksonnet is stepping back from the project. As a result, work on ksonnet will end and the GitHub repositories will be archived. You can read more about our decision here.

Official Site

Build Status Go Report Card

ksonnet is a framework for writing, sharing, and deploying Kubernetes application manifests. With its CLI, you can generate a complete application from scratch in only a few commands, or manage a complex system at scale.

Specifically, ksonnet allows you to:

  • Reuse common manifest patterns (within your app or from external libraries)
  • Customize manifests directly with powerful object concatenation syntax
  • Deploy app manifests to multiple environments
  • Diff across environments to compare two running versions of your app
  • Track the entire state of your app configuration in version controllable files

All of this results in a more iterative process for developing manifests, one that can be supplemented by continuous integration (CI).

Install

The ksonnet CLI, ks, can be installed in three different ways. Choose the method that best matches your setup:

Homebrew on macOS

If you are using Homebrew on macOS, you can install ks with the following command:

brew install ksonnet/tap/ks

Download a prebuilt binary for your OS

See the releases page to download the latest released binary.

Build a docker image

A docker image can be built and used similarly to our manual build as seen here

Manually build and install

You can download and manually build from source by following these instructions.

Run through an example

Here we provide some commands that show some basic ksonnet features in action. You can run these commands to deploy and update a basic web app UI, via a Kubernetes Service and Deployment. This app is shown below:

guestbook screenshot

Note that we will not be implementing the entire app in this example, so the buttons will not work!

Minimal explanation is provided here, and only basic ksonnet features are shown---this is intended to be a quick demonstration. If you are interested in learning more, see Additional Documentation.

Prerequisites

  • You should have access to an up-and-running Kubernetes cluster — supported versions are 1.7 (default) and 1.8 (beta).

    If you do not have a cluster, choose a setup solution from the official Kubernetes docs.

  • You should have kubectl installed. If not, follow the instructions for installing via Homebrew (MacOS) or building the binary (Linux).

  • Your $KUBECONFIG should specify a valid kubeconfig file, which points at the cluster you want to use for this demonstration.

Commands

Start by creating your app directory. If you are running Kubernetes 1.8.x, you'll need to add --api-spec=version:v1.8.0 to the end of the following command:

# The ks-example app directory is created at the current path, and the
# app itself references your current cluster using $KUBECONFIG
ks init ks-example

You can copy and paste the commands below to deploy the web app UI:

# 'ks' commands should be run within a ksonnet app directory
cd ks-example

# Autogenerate a basic manifest
ks generate deployed-service guestbook-ui \
  --image gcr.io/heptio-images/ks-guestbook-demo:0.1 \
  --type ClusterIP

# Deploy your manifest to your cluster
ks apply default

Now there should be a Deployment and Service running on your cluster! Try accessing the guestbook-ui service in your browser. (How you do this may depend on your cluster setup).

If you are unsure what to do, we suggest using kubectl proxy.
# Set up an API proxy so that you can access the 'guestbook-ui' service locally
kubectl proxy > /dev/null &
PROXY_PID=$!
QUICKSTART_NAMESPACE=$(kubectl get svc guestbook-ui -o jsonpath="{.metadata.namespace}")
GUESTBOOK_SERVICE_URL=http://localhost:8001/api/v1/proxy/namespaces/$QUICKSTART_NAMESPACE/services/guestbook-ui
open $GUESTBOOK_SERVICE_URL

(Remember, the buttons won't work in this example.)

Now let's try upgrading the container image to a new version:

# Bump the container image to a different version
ks param set guestbook-ui image gcr.io/heptio-images/ks-guestbook-demo:0.2

# View updated param values
ks param list

# Update your cluster with your latest changes
ks apply default

Check out the webpage again in your browser (force-refresh to update the javascript). Notice that it looks different! Clean up:

# Teardown
ks delete default

# There should be no guestbook service left running
kubectl get svc guestbook-ui

(If you ended up copying and pasting the kubectl proxy code above, make sure to clean up that process with kill -9 $PROXY_PID).

Now, even though you've made modifications to the Guestbook app and removed it from your cluster, ksonnet still tracks all your manifests locally:

# View all expanded manifests (YAML)
ks show default

If you're still wondering how ksonnet differs from existing tools, the tutorial shows you how to use other ksonnet features to implement the rest of the Guestbook app (and yes, the buttons will work!).

Additional documentation

ksonnet is a feature-rich framework. To learn more about how to integrate it into your workflow, check out the resources below:

  • Tutorial - What can I build with ksonnet and why? This finishes the Guestbook app from the example above.

  • Interactive tour of ksonnet - How do ks commands work under the hood?

  • CLI Reference - What ksonnet commands are available, and how do I use them?

  • Concept Reference - What do all these special ksonnet terms mean (e.g. prototypes) ?

  • Design Docs - What are the detailed design specs, and what's next on the feature roadmap?

Troubleshooting

If you encounter any problems that the documentation does not address, file an issue.

Contributing

Thanks for taking the time to join our community and start contributing!

Before you start

  • Please familiarize yourself with the Code of Conduct before contributing.
  • Read the contribution guidelines in CONTRIBUTING.md.
  • There is a mailing list or the #ksonnet channel on Slack if you want to interact with other members of the community.

Pull requests

  • We welcome pull requests. Feel free to dig through the issues and jump in.

Changelog

See the list of releases to find out about feature changes.

parts's People

Contributors

aboyett avatar bryanl avatar emfree avatar hausdorff avatar mattjmcnaughton avatar rosskukulinski avatar shomron avatar tamikot avatar tehut avatar

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

parts's Issues

istio package

A ksonnet package for istio seems like it would be very useful.

Add CI

At a minimum, we want CI to invoke the Jsonnet compiler with the correct -J flags to make sure PRs don't break the examples, and perhaps also to make sure examples emit the same code as a golden version.

nginx parts contain syntax error

Unknown escape sequence in string literal: \.

        |||
        server {
          listen 0.0.0.0:80;
          root /app;
          location / {
            index index.html index.php;
          }
          location ~ \.php$ {
            fastcgi_pass phpfpm-server:9000;
            fastcgi_index index.php;
            include fastcgi.conf;
          }
        }
      |||

EFK elasticsearch-kibana fails to generate

To reproduce:

$ ks init TestApp
INFO Using context "..." from kubeconfig file "..."
INFO Creating environment "default" with namespace "prod", pointing to "version:v1.10.4" cluster at address "..." 
INFO Generating ksonnet-lib data at path '.../TestApp/lib/ksonnet-lib/v1.10.4' 

$ cd TestApp

$ ks pkg install incubator/efk
INFO Retrieved 4 files                            

$ ks generate elasticsearch-kibana kibana
ERROR flag accessed but not defined: name

$ ks generate elasticsearch-kibana kibana --name=kibana
ERROR parse preview args: unknown flag: --name

Additional details:

$ ks version
ksonnet version: dev-2018-10-17T15:51:23-0400
jsonnet version: v0.11.2
client-go version: kubernetes-1.10.4
$ cd $GOPATH/src/github.com/ksonnet/ksonnet/ && git rev-parse HEAD
1ad7bbff88cd9eb910899fc7580b2ec446ca7164
$ tree vendor/incubator/
vendor/incubator/
└── efk@40285d8a14f1ac5787e405e1023cf0c07f6aa28c
    ├── efk.libsonnet
    ├── parts.yaml
    └── prototypes
        ├── elasticsearch-kibana.jsonnet
        └── fluentd-es-sidecar.jsonnet

2 directories, 4 files

Create 0.1.0 parts

  • Update examples to use env.X
  • Update examples to use params.X
  • Update examples to include the param and environment extVars
  • Remove hard-coded namespace values and remove the namespace param.
  • Update version references

Relates to the proposal here.

Clean up repository branches

There are a lot of branches in this repository that are no longer used. If used, they can probably be moved to individual forks.

MySql generates incorrect yaml for ConfigMap

I ran into a problem when trying to sue the MySql template

When it generates the ConfigMap it seems to add in a key under the data property called configurationFiles:

You can see the line here int he generated example
https://github.com/ksonnet/parts/blob/master/incubator/mysql/examples/generated.yaml#L4

When you try to apply this example to a cluster

apiVersion: v1
data: 
  configurationFiles: 
    mysql.cnf: |
        - [mysqld]
        skip-name-resolve
kind: ConfigMap
metadata: 
  name: mysql
  namespace: default

you get the following response

error: error validating "test.yaml": error validating data: ValidationError(ConfigMap.data.configurationFiles): invalid type for io.k8s.api.core.v1.ConfigMap.data: got "map", expected "string"; if you choose to ignore these errors, turn validation off with --validate=false

But when you remove the line containing configurationFiles: it applies sucessfully

mongodb part is invalid

Users are reporting the following error:

RUNTIME ERROR: Field does not exist: withVolumes

Cleanup typos in parts library descriptions

I had addressed this in #41, but that PR is too big to merge so close to launch.

I would check changes ONLY in the incubator/.../*.jsonnet files----not all of them are necessary to update, but the above PR fixes a couple of typos/bugs.

If it's too messy to look at, you can also feel free to just start from scratch though. Whichever is easiest!

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.