-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update docs site for version 2.26.0.dev7 (#338)
- Loading branch information
1 parent
1111d3e
commit 5ccdc63
Showing
202 changed files
with
2,401 additions
and
2,190 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"label": "Docker", | ||
"position": 9 | ||
"position": 8 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"label": "Go", | ||
"position": 6 | ||
"position": 5 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"label": "JVM", | ||
"position": 7 | ||
"position": 6 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"label": "Kubernetes", | ||
"position": 9 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
--- | ||
title: Kubernetes Overview | ||
sidebar_position: 999 | ||
--- | ||
|
||
--- | ||
|
||
:::caution Kubernetes support is in alpha stage | ||
Pants is currently building support for Kubernetes. Simple use cases might be | ||
supported, but many options are missing. | ||
|
||
Please share feedback for what you need to use Pants with your Kubernetes queries by | ||
either [opening a GitHub | ||
issue](https://github.com/pantsbuild/pants/issues/new/choose) or [joining our | ||
Slack](/community/getting-help)! | ||
::: | ||
|
||
## Initial setup | ||
|
||
First, activate the relevant backend in `pants.toml`: | ||
|
||
```toml title="pants.toml" | ||
[GLOBAL] | ||
backend_packages = [ | ||
... | ||
"pants.backend.experimental.k8s", | ||
... | ||
] | ||
``` | ||
|
||
The Kubernetes backend adds [`k8s_source`](../../reference/targets/k8s_source.mdx) and | ||
[`k8s_sources`](../../reference/targets/k8s_sources.mdx) target types for Kubernetes object | ||
files. | ||
|
||
For example, create a file `src/k8s/webpages.yaml`: | ||
|
||
```yaml title="src/k8s/webpages.yaml" | ||
--- | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: webpages | ||
data: | ||
index.html: | | ||
<html> | ||
<head>Hello pants!</head> | ||
<body>Hello pants!</body> | ||
</html> | ||
``` | ||
Now add a `k8s_sources` target in `src/k8s/BUILD`: | ||
|
||
```python title="src/k8s/BUILD" | ||
k8s_sources() | ||
``` | ||
|
||
## Deploying objects to a cluster | ||
|
||
We'll be using a local [kind](https://kind.sigs.k8s.io/) cluster throughout the | ||
tutorial. First, spin up a cluster: | ||
|
||
```bash | ||
kind create cluster | ||
``` | ||
``` | ||
Creating cluster "kind" ... | ||
✓ Ensuring node image (kindest/node:v1.25.3) 🖼 | ||
✓ Preparing nodes 📦 | ||
✓ Writing configuration 📜 | ||
✓ Starting control-plane 🕹️ | ||
✓ Installing CNI 🔌 | ||
✓ Installing StorageClass 💾 | ||
Set kubectl context to "kind-kind" | ||
``` | ||
Second, configure the list of available contexts in `pants.toml`: | ||
```toml title="pants.toml" | ||
... | ||
[k8s] | ||
available_contexts = [ | ||
"kind-kind", | ||
] | ||
``` | ||
|
||
Third, create a deployable target `k8s_bundle` in `src/k8s/BUILD`: | ||
|
||
```python title="src/k8s/BUILD" | ||
k8s_sources() | ||
k8s_bundle( | ||
name="webpages", | ||
sources=("src/k8s/webpages.yaml",), | ||
context="kind-kind", | ||
) | ||
``` | ||
|
||
Now you can deploy the target: | ||
|
||
```bash | ||
pants experimental-deploy src/k8s:webpages | ||
``` | ||
``` | ||
✓ src/k8s:webpages deployed to context kind-kind | ||
``` | ||
|
||
note::: To prevent accidentally deploying kubernetes manifests to the wrong | ||
cluster, the context field is required on `k8s_bundle` for deployment. For | ||
deploying the same `k8s_bundle` to multiple contexts, consider using | ||
`parametrize` like `k8s_bundle(..., context=parametrize("stage", "prod"))`. For | ||
CI agents which will only have access to a single context, set the | ||
`[kubectl].pass_context` to false in `pants.toml` to have them use their | ||
default context. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"label": "Python", | ||
"position": 5 | ||
"position": 4 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"label": "Shell", | ||
"position": 8 | ||
"position": 7 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"label": "Using Pants", | ||
"position": 4 | ||
"position": 3 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.