Skip to content

Commit

Permalink
Adds documentation for the Deploy Raw Yaml Step - Git Manifest and Gl…
Browse files Browse the repository at this point in the history
…ob Expression features (#1925)

* Add deploy raw yaml page and images

* Add missing conditions

* improve wording

* Fix typo

* Add screen cap of git-repository configuration and make other minor adjustments

* Update glob pattern cheat sheet

* small fix

* Update screen caps

* Fix typos and general review

* fix pub and mod dates

* Increase prominence of Group Pattern matching coming soon title

* Fix title

* Add warning about directory separators

* Fix coming soon thing

* Add warning for sensitive data on git repository

* typo

* Update index.md

---------

Co-authored-by: Steve Fenton <[email protected]>
  • Loading branch information
scme0 and steve-fenton-octopus authored Jul 31, 2023
1 parent 0f552c1 commit b475e5b
Show file tree
Hide file tree
Showing 5 changed files with 150 additions and 7 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
149 changes: 149 additions & 0 deletions src/pages/docs/deployments/kubernetes/deploy-raw-yaml/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
---
layout: src/layouts/Default.astro
pubDate: 2023-07-28
modDate: 2023-07-28
title: Deploy Raw YAML
description: Deploy Raw YAML to a Kubernetes cluster.
navOrder: 8
---

Octopus supports the deployment of Kubernetes resources through the `Deploy Raw Kubernetes YAML` step.

This step allows you to configure Kubernetes manually, leveraging the full power of Octopus features to support your setup.
This approach is more flexible and gives you complete control over the YAML but requires deeper knowledge of Kubernetes configuration.

# YAML Sources

You can source your YAML from three different sources:
- Git Repository - *New!*
- Package
- Inline Script

## Git Repository

:::div{.hint}
Sourcing from Git Repositories was added in Octopus **2023.3**.

You can find more information about this feature in [this blog post](https://octopus.com/blog/manifests-from-git).
:::

:::div{.warning}
Sourcing from a Git repository clones the whole repository onto Octopus Server during a deployment. Ensure that you **do not have any sensitive data** in your git repository.
:::

Sourcing from a Git Repository can streamline your deployment process by reducing the amount of steps required to get your YAML into Octopus.
In Octopus, when YAML is sourced from a Git repository, we call it a Git Manifest.

To configure a Git Repository source, select the `Git Repository` option as your YAML Source.

:::figure
![Deploy Raw Kubernetes YAML with a Git Manifest](/docs/deployments/kubernetes/deploy-raw-yaml/git-repository.png "width=500")
:::

:::div{.hint}
When you choose the tip of a branch for your Git Manifest when creating a Release, the commit hash is saved to the Release.
This means redeploying that release will only ever use that specific commit and not the _new_ tip of the branch.
:::
## Package

Sourcing from a Package is the traditional way to load data from external sources.
You can specify the Package Feed and Package ID as well as a path or paths† to the file(s) in the package that you want to deploy.

To configure a package source, select the `Package` option as your YAML Source.

:::figure
![Deploy Raw Kubernetes YAML with a Package](/docs/deployments/kubernetes/deploy-raw-yaml/package.png "width=500")
:::

†In 2023.3, sourcing from packages can take advantage of [Glob Patterns and Multiple Paths](/docs/deployments/kubernetes/deploy-raw-yaml#glob-patterns-and-multiple-paths).

## Inline YAML

The simplest way to get going with this step is to use Inline YAML.
You can create your YAML resources in the inline editor which will be saved in the project in Octopus.

To configure an inline YAML source, select the `Inline YAML` as your YAML Source, click `Add Source Code` and start writing!

:::figure
![Deploy Raw Kubernetes YAML with an Inline Script](/docs/deployments/kubernetes/deploy-raw-yaml/inline-yaml.png "width=500")
:::

:::div{.warning}
This is **not** the recommended approach for advanced cases as it does not allow for version management unless you are using it in conjunction with [Config As Code](/docs/projects/version-control).
:::

## Glob Patterns and Multiple Paths

The Git Repository and Package data sources require you to specify which files you would like to apply from the git repo or package.
Previously we only allowed a single file to be applied via an explicit path.
In release 2023.3, we have added the ability to source multiple files via multiple paths for both Git Repositories and Packages.

There are a few different ways to take advantage of this feature:
1. You can list several paths by separating them with a new line.
```
deployments/apply-first.yaml
services/apply-second.yml
```

**Note:** *Each path will be applied in order from top to bottom.*

2. You can use a glob pattern to select multiple files in a single path.
```
**/*.{yaml,yml}
```

**Note:** *All files matching a glob pattern will be applied at the same time.*

3. Both options at the same time. This gives you the best of both worlds!

**Note:** *If multiple glob patterns find the same file, the file will be applied twice.*

### Glob Pattern Cheat Sheet

Patterns are always relative so start them with a file or folder name. eg: `my/folder/*.yml` and `**/dep.yml`.

:::div{.warning}
Directory separators should be forward slashes `/` for all platforms. Backslashes `\` only work when the server and worker are running on Windows.
:::

:::div{.hint}
Glob patterns cannot contain folders stemming from a root directory. eg: `/` and `C:\`

Glob patterns cannot start with a relative path indicator. eg: `./` and `.\`

The directory traversal path `../` is not supported.
:::

`?` matches any single character in a file or directory name:
```
deployments/resource-?.yaml => deployments/resource-1.yaml, deployments/resource-g.yaml
```

`*` matches zero or more characters in a file or directory name:
```
deployments/*.yaml => deployments/anything-here.yaml, deployments/123-another-file.yaml
*/resource.yaml => deployments/resource.yaml, services/resource.yaml
```

`**` matches zero or more recursive directories:
```
**/resource.yaml => deployments/resource.yaml, services/resource.yaml, deployments/child-folder/resource.yaml
```

:::div{.hint}
<span style="font-size:14pt;">**Group pattern matching is coming soon**!</span>

`[123]` matches a set of characters in a name. Syntax is similar to character groups in Regex:
```
deployments/resource-[123].yaml => deployments/resource-1.yaml, deployments/resource-2.yaml, deployments/resource-3.yaml
"deployments/resource-g.yaml" would not match the example glob pattern.
deployments/resource-[1-3].yaml => deployments/resource-1.yaml, deployments/resource-2.yaml, deployments/resource-3.yaml
"deployments/resource-g.yaml" would not match the example glob pattern.
```

`{abc,123,xyz}` matches any of the comma separated strings:
```
deployments/resource-{123,abc}.yaml => deployments/resource-123.yaml, deployments/resource-abc.yaml
```
:::
8 changes: 1 addition & 7 deletions src/pages/docs/deployments/kubernetes/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
layout: src/layouts/Default.astro
pubDate: 2023-01-01
modDate: 2023-01-01
modDate: 2023-07-28
title: Kubernetes
description: Octopus Deploy provides support for deploying Kubernetes resources.
navOrder: 80
Expand Down Expand Up @@ -40,12 +40,6 @@ All three methods:

If you're getting started with Kubernetes, we recommend the structured UI step. Octopus prompts you for the required properties and provides deep links to the official Kubernetes documentation so you can learn how Kubernetes works.

### Raw YAML step

The raw YAML step allows you to configure Kubernetes manually, leveraging the full power of Octopus features to support your setup. This approach is more flexible and gives you complete control over the YAML but requires deeper knowledge of Kubernetes configuration.

You can also edit the YAML underlying the UI step if you find it faster or more convenient. This also makes it easy to upgrade to the raw YAML step if you outgrow the UI approach.

### Helm chart automation steps

Helm is the de facto Kubernetes package manager, so our [Helm chart steps](/docs/deployments/kubernetes/helm-update) are a popular option. Again, you have the full power of Octopus at your disposal, but there's less raw YAML to configure.
Expand Down

0 comments on commit b475e5b

Please sign in to comment.