Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HOLD FOR 1.104.0 RELEASE] note about KOTS support bundle spec discovery #1582

Merged
merged 7 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 20 additions & 11 deletions docs/partials/support-bundles/_generate-bundle.mdx
Original file line number Diff line number Diff line change
@@ -1,36 +1,45 @@
Support bundles are generated from one or more support bundle specifications. Specification locations include YAML manifest files in the cluster, URLs, and Secrets or ConfigMap objects embedded in a Kubernetes cluster. For more information, see [Collecting a Support Bundle](https://troubleshoot.sh/docs/support-bundle/collecting/) and [Discover Cluster Specs](https://troubleshoot.sh/docs/support-bundle/discover-cluster-specs/) in the Troubleshoot documentation.
Support bundles are generated by providing one or more support bundle specifications with the `kubectl support-bundle` command.

The following examples show some possible CLI commands to generate a support bundle for one or more specifications and locations:
For installations with the Helm CLI or with KOTS v1.104.0 and later, specifications can be automatically discovered in Secrets or ConfigMap objects in the cluster using the `--load-cluster-specs` flag with the `kubectl support-bundle`. Alternatively, for installations with the Helm CLI or with KOTS versions earlier than 1.104.0, specifications can be provided from YAML files in the local directory or from a URL.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clarify that --load-cluster-specs flag applies to Helm CLI installs and to KOTS v1.104.0 or later.

Also made some edits to this description overall because I found it a little difficult to follow before

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be read to say that 1.104.0 and later can't use YAML files or a URL, which isn't true.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah good call


- Automatically discover specifications in the cluster that are contained in Secrets or ConfigMaps:
For a complete list of options with the `kubectl support-bundle` command, run `kubectl support-bundle --help`. For more information, see [Collecting a Support Bundle](https://troubleshoot.sh/docs/support-bundle/collecting/) and [Discover Cluster Specs](https://troubleshoot.sh/docs/support-bundle/discover-cluster-specs/) in the Troubleshoot documentation.

The following lists some possible uses of the `kubectl support-bundle` CLI command to generate a support bundle from one or more specifications:

- Discover all specifications defined in Secrets or ConfigMaps in the cluster:

```bash
kubectl support-bundle --load-cluster-specs
```
- Automatically discover specifications found in the cluster that match a custom label:

:::note
The `--load-cluster-specs` flag is supported for Helm CLI installations and KOTS v1.104.0 or later.
:::

- Discover all specifications defined in Secrets or ConfigMaps in the cluster that match a custom label:

```bash
kubectl support-bundle --load-cluster-specs -l LABEL
```

Replace `LABEL` with the label name.
Where `LABEL` is the name of the custom label.

- Using one or more files:
- Provide one or more files that contain support bundle specifications:

```bash
kubectl support-bundle ./PATH_TO_FILE1 ./PATH_TO_FILE2 ./PATH_TO_FILE3
```

Replace `PATH_TO_FILE` with the path and YAML file name for each file.
Where `PATH_TO_FILE` is the path and YAML file name for each file.

- Using a URL and a specification in the cluster:
- Provide one specification that is located at a URL and another specification located in the local directory:

```bash
kubectl support-bundle URL \
./PATH_TO_FILE
```

Replace:
Where:

- `URL` with the online specification location provided by your vendor
- `PATH_TO_FILE` with the path and YAML file name
- `URL` is the URL where the specification is located
- `PATH_TO_FILE` is the path and YAML file name
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,20 @@ A KOTS entitlement is required to create KOTS releases.

Preflight checks are not included by default, so you must enable them.

For Helm installations, preflight checks run using a `helm template` command before running the installation to confirm the target cluster has the resources required for a successful installation. For more information about running the `helm install` command, see [Running Preflight Checks for Helm Installations](preflight-running).

For KOTS installations with Helm charts, preflight checks run automatically.
For KOTS installations, preflight checks run automatically during installation. For Helm CLI installations, preflight checks run when the user runs a `helm template` command before they install the application. For more information, see [Running Preflight Checks for Helm Installations](preflight-running).

## Choose an Input Kind

You run preflight checks with the open source preflight kubectl plugin. For information about the preflight plugin, see [Getting Started](https://troubleshoot.sh/docs/) in the open source Troubleshoot documentation.

The plugin requires a preflight check specification as input. For Helm installations, you provide this specification by running `helm template` to produce a stream of stdout and pipe the result to `preflight -`. The preflight plugin automatically finds and runs preflight specifications by filtering the stream of stdout for the following input kinds:
The plugin requires a preflight check specification as input. For Helm installations, this specification is provided by running `helm template` to produce a stream of stdout and piping the result to `preflight -`. The preflight plugin automatically finds and runs preflight specifications by filtering the stream of stdout. For KOTS installations, KOTS v1.101.0 and later automatically looks for preflights specified in the Helm chart archive.

- Secret (`kind: Secret`)
- ConfigMap (`kind: ConfigMap`)
- Preflight custom resource (`kind: Preflight`)
You can define preflight check specifications in the following input kinds:

All of these input options allow customization of preflight checks based on values unique to the customer, using Helm templates with conditional statements.
- Kubernetes Secret or ConfigMap
- Troubleshoot Preflight custom resource (`apiVersion: troubleshoot.sh/v1beta2` and `kind: Preflight`)

In KOTS v1.101.0 and later, a KOTS installation looks for the preflights specified in the Helm chart archive.
All of these input options allow customization of preflight checks based on values unique to the customer using Helm templates and conditional statements.

### Create a Secret (Recommended)

Expand Down
8 changes: 2 additions & 6 deletions docs/vendor/preflight-kots-defining.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,9 @@ For information about defining host preflight checks for Replicated kURL, see [C

## Define the Preflight Checks Specification
paigecalvert marked this conversation as resolved.
Show resolved Hide resolved

Preflight checks are not included by default, so you must enable them. For releases that use standard Kubernetes manifests or Kubernetes Operators, you add a Preflight custom resource to your release to define a specification for preflight checks.
Preflight checks are not included by default. For releases that use standard Kubernetes manifests or Kubernetes Operators, you can add a Preflight custom resource to your release to define preflight checks.

In the `spec:` of the Preflight custom resource, you define collectors and analyzers for the preflight checks that you want to add.

<PreflightsDefineXref/>

The following is a template manifest file for the Preflight custom resource (`apiVersion: troubleshoot.sh/v1beta2` and `kind: Preflight`):
The following is an empty template for the Preflight custom resource (`apiVersion: troubleshoot.sh/v1beta2` and `kind: Preflight`):

```yaml
apiVersion: troubleshoot.sh/v1beta2
Expand Down
10 changes: 3 additions & 7 deletions docs/vendor/support-bundle-generating.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,16 @@ import GenerateBundle from "../partials/support-bundles/_generate-bundle.mdx"

# Generating Support Bundles

For Helm and KOTS installations, support bundles can be generated using these CLI commands.
This topic describes how to use the support-bundle kubectl CLI plugin to generate support bundles.

:::note
For KOTS, using the admin console and additional CLI options are available. For more information, see [Generating Support Bundles](https://docs.replicated.com/enterprise/troubleshooting-an-app) in the KOTS documentation.
:::
For KOTS installations, users can also generate support bundles from the Replicated admin console. For more information, see [Generating Support Bundles](https://docs.replicated.com/enterprise/troubleshooting-an-app) in the KOTS documentation.

## Prerequisite

<InstallPlugin/>

## Generate a Bundle from the CLI

## Generate a Bundle

The following methods are supported for Helm installations and for KOTS version 1.94.2 and later.
<GenerateBundle/>

## Generate a Bundle when a Helm Installation Fails
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import RedactorsAbout from "../partials/redactors/_redactors-about.mdx"
import PreflightSbHelmTemplates from "../partials/preflights/_preflight-sb-helm-templates.mdx"


# Customize Support Bundles for Helm Installations
# Customize Support Bundles for Helm Charts

This topic provides a basic understanding and some key considerations about support bundle specifications for Helm installations to help guide you in defining them for your application.
This topic provides a basic understanding and some key considerations about support bundle specifications for Helm charts to help guide you in defining them for your application. The content in this topic applies to Helm chart-based applications installed with the Helm CLI or with Replicated KOTS v1.104.0 and later.
paigecalvert marked this conversation as resolved.
Show resolved Hide resolved

## About Support Bundles

Expand All @@ -23,14 +23,16 @@ Customizing a support bundle is unique to your application and depends on what k

## Choose an Input Kind

You can create support bundle specifications using the following kinds:
Support bundles are generated with the open source support-bundle kubectl plugin by running `kubectl support-bundle`. For more information about the support-bundle plugin, see [Getting Started](https://troubleshoot.sh/docs/) in the open source Troubleshoot documentation.

- Secret (`kind: Secret`)
- SupportBundle custom resource (`kind: SupportBundle`)
The support-bundle plugin requires a support bundle specification as input. You can define support bundle specifications in using the following kinds of resources:

- Kubernetes Secret or ConfigMap with `label.troubleshoot.sh/kind: support-bundle`
- SupportBundle custom resource (`apiVersion: troubleshoot.sh/v1beta2` and `kind: SupportBundle`)

### Create a Secret (Recommended)

Replicated recommends using Secrets to contain a support bundle specifications in your Helm chart. This method allows customers to automatically discover and generate a support bundle without specifying a long URL. Using Secrets also allows specifications to be templated using information in the `values.yaml` file.
Replicated recommends defining support bundle specifications in Secrets in your Helm chart templates. For installations with the Helm CLI or with KOTS v1.104.0 and later, defining specifications in Secrets allows your users to automatically discover and generate a support bundle without needing to provide multiple files or specify a long URL with the `kubectl support-bundle` command. Using Secrets also allows specifications to be templated using information in the `values.yaml` file.
paigecalvert marked this conversation as resolved.
Show resolved Hide resolved

<ConfigmapNote/>

Expand Down Expand Up @@ -65,13 +67,13 @@ To create a Secret for the support bundle specification:
analyzers: []
```

1. Add the Secret to your Helm chart `templates/` directory.
1. Add the Secret to your Helm chart `templates/` directory.

Next, define the support bundle specification by adding collectors and analyzers. For more information, see [Define the Support Bundle Specification](#spec).

### Create a SupportBundle Custom Resource

If you do not want to use Secrets, you can create a SupportBundle custom resource instead. Helm templates are supported when the specification is distributed using an OCI registry.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Helm templates are supported when the specification is distributed using an OCI registry.

I didn't see anything in the output of kubectl support-bundle --help or in the troubleshoot docs that indicated you could provide a link to the OCI registry. I think this might have been accidentally conflated with the kubectl preflight option to point to an OCI registry

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An engineer would know better than I do. You could be right. I know you can point to an HTTP endpoint, but maybe we modified this to include an OCI registry too (like back when we were first working on Helm CLI support).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Diamon says "Looks like the answer is yes". so I'll add this statement back in and then take the same approach to investigate further as part of a follow up story

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, added this info back in with an example of what this is talking about:

:::note
For specifications created in a SupportBundle custom resource, Helm templates are supported only when the support bundle is generated from a link to the specification at an OCI registry. For example, `kubectl support-bundle oci://my.oci.registry/image`.
:::

Figured this could be a placeholder, but still needs to be revisited to fully document generating a SB from a spec at an OCI registry URL

If you do not want to use Secrets or ConfigMaps, you can create a SupportBundle custom resource instead.

Create a SupportBundle custom resource (`kind: SupportBundle`) using the following basic support bundle template. For more information about this custom resource, see [Preflight and Support Bundle](/reference/custom-resource-preflight).
Copy link
Contributor

@paigecalvert paigecalvert Nov 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^ Is there any requirement that this spec is wrapped in a template so that it's deployed to the cluster? or does that only matter for the preflight specs? It's not really clear to me, if I'm trying to distribute with the Helm CLI, what I would do with this SupportBundle custom resource. Add it to my templates? Just save it in a YAML file and email it to my customer as needed?

here's the corresponding info about defining a Preflight custom resource for Helm charts for reference: https://docs.replicated.com/vendor/preflight-helm-defining#create-a-preflight-custom-resource

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should clarify that renderpreflights thing. The name itself is ambiguous—I assume it's a name we chose and not a hardcoded string, but the name isn't obvious to me. Maybe this lets you skip preflights. My guess is that it lets you skip preflights somehow, so we don't need it for support bundles, but we should confirm and clarify in that doc too.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The renderpreflights thing is indeed just an example string. The purpose of it is: "If you use this input kind, you must use conditional statements because the custom resource definition is not installed in the cluster." As in, if you want to create a preflight definition in a Preflight custom resource manifest and add it to your templates (instead of creating a preflight spec in a Secret or ConfigMap), then you need to wrap it in a conditional statement that evaluates to true so that the preflight custom resource is installed in the cluster. (I think you can always skip preflights for Helm CLI installs since it requires running a separate command anyway, right?)

What I wasn't understanding was why that same thing doesn't seem to apply to this support bundle spec. Like, is the spec supposed to get installed to the cluster?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still trying to get my head fully around that. If the CRD isn't installed, what does the value do? I don't quite see how it's any different.

But I get your point about why would that not also be needed for support bundles.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah good point. Maybe this option can just be removed from the docs all together if it's not recommended and added to a community article instead...I'll add this to a new story to investigate more fully.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ You can customize the default support bundle specification by adding, editing, o

<PreflightsSbNote/>


<PreflightsSpecLocations/>

## Customize the Support Bundle Resource
Expand Down