Skip to content

Commit

Permalink
Refactor Bootstrap Bitbucket doc
Browse files Browse the repository at this point in the history
Made updates in accordance to the GitHub, GitLab, etc docs as done in #1573

Signed-off-by: mehak151 <[email protected]>
  • Loading branch information
mehak151 authored and stefanprodan committed Aug 17, 2023
1 parent da62fac commit f48efea
Showing 1 changed file with 29 additions and 10 deletions.
39 changes: 29 additions & 10 deletions content/en/flux/installation/bootstrap/bitbucket.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,40 @@ description: "How to bootstrap Flux with Bitbucket Server and Data Center"
weight: 40
---

### Bitbucket Server and Data Center

The `bootstrap bitbucket-server` command creates a Bitbucket Server repository if one doesn't exist and
commits the Flux components manifests to the specified branch. Then it
configures the target cluster to synchronize with that repository by
setting up an SSH deploy key or by using token-based authentication.
The [flux bootstrap bitbucket-server](/flux/cmd/flux_bootstrap_bitbucket-server/) command deploys the Flux controllers
on a Kubernetes cluster and configures the controllers to sync the cluster state from a Bitbucket project.
Besides installing the controllers, the bootstrap command pushes the Flux manifests to the Bitbucket project
and configures Flux to update itself from Git.

After running the bootstrap command, any operation on the cluster (including Flux upgrades)
can be done via Git push, without the need to connect to the Kubernetes cluster.

{{% alert color="danger" title="Required permissions" %}}
To bootstrap Flux, the person running the command must have **cluster admin rights** for the target Kubernetes cluster.
It is also required that the person running the command to be the **owner** of the Bitbucket project,
or to have admin rights of a Bitbucket group.
{{% /alert %}}

{{% alert color="info" title="Bitbucket versions" %}}
This bootstrap command works with Bitbucket Server and Data Center only because it targets the [1.0](https://developer.atlassian.com/server/bitbucket/reference/rest-api/) REST API. Bitbucket Cloud has migrated to the [2.0](https://developer.atlassian.com/cloud/bitbucket/rest/intro/) REST API.
{{% /alert %}}

Generate a [personal access token](https://confluence.atlassian.com/bitbucketserver/http-access-tokens-939515499.html)
that grant read/write access to the repository.
## Bitbucket HTTP Access Token

Export your Bitbucket personal access token as an environment variable:
For accessing the Bitbucket API, the bootstrap command requires a [Bitbucket HTTP Access Token](https://confluence.atlassian.com/bitbucketserver/http-access-tokens-939515499.html)
with administration permissions.

The Bitbucket HTTP access token can be exported as an environment variable:

```sh
export BITBUCKET_TOKEN=<your-token>
export BITBUCKET_TOKEN=<bb-token>
```

If the `BITBUCKET_TOKEN` env var is not set, the bootstrap command will prompt you to type it the token.
You can also supply the token using a pipe e.g. `echo "<bb-token>" | flux bootstrap bitbucket-server`.

## Bitbucket Personal Account

Run the bootstrap for a repository on your personal Bitbucket Server account:

```sh
Expand All @@ -36,6 +50,7 @@ flux bootstrap bitbucket-server \
--hostname=my-bitbucket-server.com \
--personal
```
## Bitbucket Personal Project

Run the bootstrap for a repository owned by a Bitbucket Server project:

Expand All @@ -53,6 +68,8 @@ When you specify a list of groups, those teams will be granted write access to t

**Note:** The `username` is mandatory for `project` owned repositories. The specified user must own the `BITBUCKET_TOKEN` and have sufficient rights on the target `project` to create repositories.

## Bootstrap with a different SSH hostname

To run the bootstrap for a repository with a different SSH hostname (e.g. with a different port):

```sh
Expand All @@ -66,6 +83,8 @@ flux bootstrap bitbucket-server \
--path=clusters/my-cluster
```

## Bootstrap with SSH disabled

If your Bitbucket Server has SSH access disabled, you can use HTTPS and token authentication with:

```sh
Expand Down

0 comments on commit f48efea

Please sign in to comment.