Skip to content

Commit

Permalink
feat: Docz (#134)
Browse files Browse the repository at this point in the history
* docs: switch to docz

* feat: tutorial

* doc(tutorial): Using Jsonnet section

Adds a section about doing the same task, but this time using Jsonnet and Tanka

* feat: custom theme

* wip: parameters

* feat(docs): collapsing codeblocks

* fix(docs): font fixes

* feat(docs): description in header

* doc(tutorial): Abstraction

* doc(example): remove vendor/

* doc(tutorial): Kubernetes library

* fix(docs): link fixes

* doc(tutorial): environments

* fix(docs): file update

* doc: introduction

* doc: installation

* fix(docs): build using gatsby directly

Switches from the docz wrapper to plain gatsby (much more stable)

* doc: README fixes

* doc(tutorial): review feedback

* fix(examples): use upstream kausal in prom-grafana

* chore: netlify deploy dir

* chore(docs): add required vscode extensions in-tree

* chore(docs): remove unused files from vscext

* chore(docs): vscode highlighter debug

* feat(docs): PWA

* feat(docs): remark enhancements

* fix(docs): GitHub button dimensions on mobile

* style(docs): typos

Co-authored-by: Malcolm Holmes [email protected]

* feat(docs): use #140 in tutorial

Installation of ksonnet-lib is automated, no need to elaborate it anymore

* feat(docs): next/previous buttons in tutorial

* style(docs): %s/our/their/g

* docs: libraries

* fix(docs): update k-lib aliasing section

Simplified it a lot, as Tanka automatically does this now.
  • Loading branch information
sh0rez authored Jan 8, 2020
1 parent beae0a5 commit 65595a9
Show file tree
Hide file tree
Showing 77 changed files with 27,978 additions and 450 deletions.
125 changes: 24 additions & 101 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,118 +1,40 @@
# Overview
# Grafana Tanka

![Tanka Banner](docs/banner.png)
![Tanka Banner](docs/img/banner.png)

[![Build Status](https://cloud.drone.io/api/badges/grafana/tanka/status.svg)](https://cloud.drone.io/grafana/tanka)
![Golang](https://img.shields.io/badge/language-Go-blue)
![GitHub contributors](https://img.shields.io/github/contributors/grafana/tanka)
![GitHub release](https://img.shields.io/github/release/grafana/tanka)
![License](https://img.shields.io/github/license/grafana/tanka)

Tanka is a composable configuration utility for [Kubernetes](https://kubernetes.io/). It
leverages the [Jsonnet](https://jsonnet.org) language to realize flexible, reusable and
Tanka is a composable configuration utility for
[Kubernetes](https://kubernetes.io/). It leverages the
[Jsonnet](https://jsonnet.org) language to realize flexible, reusable and
concise configuration.

- **:repeat: `ksonnet` drop-in replacement**: Tanka aims to provide the same
workflow as `ksonnet`: `show`, `diff` and `apply` are just where you expect
them.
- **:nut_and_bolt: integrates with the ecosystem**: Tanka doesn't re-invent the
wheel. It rather makes heavy use of what is already there:
[`jsonnet-bundler`](https://github.com/jsonnet-bundler/jsonnet-bundler) for
package management and
[`kubectl`](https://kubernetes.io/docs/reference/kubectl/overview/) for
communicating with Kubernetes clusters.
- **:hammer: powerful:** Being a `jsonnet`-compatibility layer for Kubernetes,
it removes the limitations of static (or template-based) configuration languages.
- **:rocket: used in production**: We use Tanka internally at
Grafana Labs for all of our Kubernetes configuration needs.
- **:heart: fully open-source**: This is an open-source project. It is free as
## Highlights

- **:wrench: Flexible**: The
[Jsonnet data templating language](https://jsonnet.org) gives us much smarter
ways to express our Kubernetes configuration than YAML does.
- **:books: Reusable**: Code can be refactored into libraries, they can be
imported wherever you like and even shared on GitHub!
- **:pushpin: Concise**: Using the Kubernetes library and abstraction, you will
never see boilerplate again!
- **:dart: Work with confidence**: `tk diff` allows to check all changes before
they will be applied and `tk apply` makes sure you always select the correct
cluster. Stop guessing and make sure it's all good.
- **:rocket: Used in production**: While still a very young project, Tanka is
used internally at Grafana Labs for all of their Kubernetes configuration needs.
- **:heart: Fully open source**: This is an open-source project. It is free as
in beer and as in speech and this will never change.

## Getting started
Head over to the [Releases](https://github.com/grafana/tanka/releases) section
and download the most latest release of Tanka for your OS and arch.

Then check everything is working correctly with
```bash
$ tk --version
tk version v0.3.0
```

It is also recommended to install Jsonnet bundler:
```bash
$ go get -u github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb
```

### Creating a new project
To start from scratch with the recommended directory structure, do the following:

```bash
# create a directory and enter it
$ mkdir poetry && cd poetry

# initialize the Tanka application
$ tk init
```

### Deploying an application
As an example, [Promtail](https://github.com/grafana/loki/blob/master/docs/promtail/README.md) is being deployed using Tanka now.

After you initialized the directory structure, install the required libraries
using `jb`:
```bash
# Ksonnet kubernetes libraries
$ jb install github.com/ksonnet/ksonnet-lib/ksonnet.beta.4/k.libsonnet
$ jb install github.com/ksonnet/ksonnet-lib/ksonnet.beta.4/k8s.libsonnet

# Promtail library
$ jb install github.com/grafana/loki/production/ksonnet/promtail
```

Then, replace the contents of `environments/default/main.jsonnet` with the
following:

```js
local promtail = import 'promtail/promtail.libsonnet';

promtail + {
_config+:: {
namespace: 'loki',

promtail_config+: {
clients: [
{
scheme:: 'https',
hostname:: 'logs-us-west1.grafana.net',
username:: 'user-id',
password:: 'password',
external_labels: {},
}
],
container_root_path: '/var/lib/docker',
},
},
}

```

As a last step, fill add the correct `spec.apiServer` and `spec.namespace` to
`environments/default/spec.json`:

```json
{
"apiVersion": "tanka.dev/v1alpha1",
"kind": "Environment",
"spec": {
"apiServer": "https://localhost:6443",
"namespace": "default"
}
}
```

Now use `tk show environments/default` to see the `yaml`, and
`tk apply environments/default` to apply it to the cluster.

Congratulations! You have successfully set up your first application using Tanka :tada:
To get started, [install Tanka](https://tanka.dev/install) first, and then
[follow the tutorial](https://tanka.dev/tutorial/overview2). This should get you
on track quickly.

## Additional resources

Expand All @@ -122,4 +44,5 @@ Congratulations! You have successfully set up your first application using Tanka
rich set of configuration examples compatible with Tanka.

## License

Licensed Apache 2.0, see [LICENSE](LICENSE).
75 changes: 75 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
.docz

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
jspm_packages/

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# dotenv environment variable files
.env*

# gatsby files
public
.cache

# Mac files
.DS_Store

# Yarn
yarn-error.log
.pnp/
.pnp.js
# Yarn Integrity file
.yarn-integrity

# gatsby-remark-vscode extensions are required tho
node_modules/*
!/node_modules/vscext
!/node_modules/vscext/*
4 changes: 4 additions & 0 deletions docs/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.cache
package.json
package-lock.json
public
7 changes: 7 additions & 0 deletions docs/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"endOfLine": "lf",
"semi": false,
"singleQuote": false,
"tabWidth": 2,
"trailingComma": "es5"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
<Default Extension=".json" ContentType="application/json"/><Default Extension=".js" ContentType="application/javascript"/><Default Extension=".txt" ContentType="text/plain"/><Default Extension=".png" ContentType="image/png"/><Default Extension=".css" ContentType="text/css"/><Default Extension=".html" ContentType="text/html"/><Default Extension=".md" ContentType="text/markdown"/><Default Extension=".vsixmanifest" ContentType="text/xml"/>
</Types>
42 changes: 42 additions & 0 deletions docs/.vscext/Equinusocio.vsc-material-theme/extension.vsixmanifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Language="en-US" Id="vsc-material-theme" Version="30.0.0" Publisher="Equinusocio"/>
<DisplayName>Material Theme</DisplayName>
<Description xml:space="preserve">The most epic theme now for Visual Studio Code</Description>
<Tags>VSCode,Themes,theme,color-theme</Tags>
<Categories>Themes,Other</Categories>
<GalleryFlags>Public</GalleryFlags>
<Badges><Badge Link="https://github.com/equinusocio/vsc-material-theme/issues" ImgUri="https://camo.githubusercontent.com/d3c6e53aa66426dead24cdedab0e83082103bea6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f657175696e75736f63696f2f7673632d6d6174657269616c2d7468656d652e7376673f7374796c653d666c61742d737175617265" Description="Open issues" /><Badge Link="https://opencollective.com/vsc-material-theme" ImgUri="https://img.shields.io/badge/Support%20this%20project-%F0%9F%92%96%EF%B8%8F-green.svg?style=flat-square" Description="Support us!" /></Badges>
<Properties>
<Property Id="Microsoft.VisualStudio.Code.Engine" Value="&gt;=1.36.0" />
<Property Id="Microsoft.VisualStudio.Code.ExtensionDependencies" Value="" />
<Property Id="Microsoft.VisualStudio.Code.ExtensionPack" Value="" />
<Property Id="Microsoft.VisualStudio.Code.LocalizedLanguages" Value="" />

<Property Id="Microsoft.VisualStudio.Services.Links.Source" Value="https://github.com/equinusocio/vsc-material-theme.git" />
<Property Id="Microsoft.VisualStudio.Services.Links.Getstarted" Value="https://github.com/equinusocio/vsc-material-theme.git" />

<Property Id="Microsoft.VisualStudio.Services.Links.GitHub" Value="https://github.com/equinusocio/vsc-material-theme.git" />


<Property Id="Microsoft.VisualStudio.Services.Links.Support" Value="https://github.com/equinusocio/vsc-material-theme/issues" />
<Property Id="Microsoft.VisualStudio.Services.Links.Learn" Value="https://equinsuocha.io/projects/material-theme/" />
<Property Id="Microsoft.VisualStudio.Services.Branding.Color" Value="#11131C" />
<Property Id="Microsoft.VisualStudio.Services.Branding.Theme" Value="dark" />
<Property Id="Microsoft.VisualStudio.Services.GitHubFlavoredMarkdown" Value="true" />


</Properties>
<License>extension/LICENSE.txt</License>
<Icon>extension/logo.png</Icon>
</Metadata>
<Installation>
<InstallationTarget Id="Microsoft.VisualStudio.Code"/>
</Installation>
<Dependencies/>
<Assets>
<Asset Type="Microsoft.VisualStudio.Code.Manifest" Path="extension/package.json" Addressable="true" />
<Asset Type="Microsoft.VisualStudio.Services.Content.Details" Path="extension/README.md" Addressable="true" /><Asset Type="Microsoft.VisualStudio.Services.Content.License" Path="extension/LICENSE.txt" Addressable="true" /><Asset Type="Microsoft.VisualStudio.Services.Icons.Default" Path="extension/logo.png" Addressable="true" />
</Assets>
</PackageManifest>
Loading

0 comments on commit 65595a9

Please sign in to comment.