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

Adapt the Bootstrap feature to the CLI #1789

Merged
merged 15 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
10 changes: 5 additions & 5 deletions Dockerfile.bootstrap → Dockerfile.cli
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ RUN go mod download
COPY . .

ENV CGO_ENABLED=0
RUN make build-bootstrap GOARCH=$TARGETARCH
RUN make build-cli GOARCH=$TARGETARCH

FROM --platform=$TARGETPLATFORM registry.access.redhat.com/ubi9-minimal
LABEL \
org.opencontainers.image.title="Skupper Bootstrap" \
org.opencontainers.image.description="Produces and manges static configurations for non-kube installations of Skupper"
org.opencontainers.image.title="Skupper CLI" \
org.opencontainers.image.description="Provide users with the ability to operate their Skupper resources."

# Create user and group and switch to user's context
RUN microdnf -y install shadow-utils \
Expand All @@ -23,5 +23,5 @@ RUN useradd --uid 10000 runner
USER 10000

WORKDIR /app
COPY --from=builder /go/src/app/bootstrap .
CMD ["/app/bootstrap"]
COPY --from=builder /go/src/app/skupper .
ENTRYPOINT ["/app/skupper"]
11 changes: 4 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ GOARCH ?= amd64
REGISTRY := quay.io/skupper
IMAGE_TAG := v2-latest
PLATFORMS ?= linux/amd64,linux/arm64
CONTAINERFILES := Dockerfile.bootstrap Dockerfile.config-sync Dockerfile.controller Dockerfile.network-observer
CONTAINERFILES := Dockerfile.cli Dockerfile.config-sync Dockerfile.controller Dockerfile.network-observer
SHARED_IMAGE_LABELS = \
--label "org.opencontainers.image.created=$(shell TZ=GMT date --iso-8601=seconds)" \
--label "org.opencontainers.image.url=https://skupper.io/" \
Expand All @@ -25,14 +25,11 @@ DOCKER := docker
SKOPEO := skopeo
PODMAN := podman

all: build-cmd build-config-sync build-controller build-bootstrap build-network-observer update-helm-crd
all: build-cli build-config-sync build-controller build-network-observer update-helm-crd

build-cmd:
build-cli:
GOOS=${GOOS} GOARCH=${GOARCH} go build -ldflags="${LDFLAGS}" -o skupper ./cmd/skupper

build-bootstrap:
GOOS=${GOOS} GOARCH=${GOARCH} go build -ldflags="${LDFLAGS}" -o bootstrap ./cmd/bootstrap

build-controller:
GOOS=${GOOS} GOARCH=${GOARCH} go build -ldflags="${LDFLAGS}" -o controller ./cmd/controller

Expand Down Expand Up @@ -124,5 +121,5 @@ update-helm-crd:

clean:
rm -rf skupper controller config-sync \
bootstrap network-observer generate-doc \
network-observer generate-doc \
cover.out oci-archives
55 changes: 46 additions & 9 deletions cmd/bootstrap/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# Bootstrapping non-kubernetes sites

In this current phase of the Skupper V2 implementation, non-kubernetes sites
can be bootstrapped using a locally built binary, that can be produced by running
`make build-bootstrap`, using the quay.io/skupper/bootstrap:v2-latest
can be bootstrapped using the Skupper CLI, using the quay.io/skupper/skupper-cli:v2-latest
container image by calling `./cmd/bootstrap/bootstrap.sh` with the appropriate
flags.

Expand Down Expand Up @@ -120,9 +119,9 @@ Now that you have all your CRs placed on a local directory, just run:
#### Bootstrapping

```shell
# To bootstrap your site using the binary
# To bootstrap your site using Skupper
export SKUPPER_PLATFORM=podman
./bootstrap -p ./
skupper system setup --path ./
```

You can also use `-n=<name>` to override the namespace specified in the CRs.
Expand Down Expand Up @@ -179,12 +178,16 @@ The bundle installation script accepts the following flags:

#### Removing

To remove your site, you can run a local script, that takes the namespace
To remove your site, you can run the `system teardown` command, providing a namespace as a flag.
If the namespace is omitted, the "default" namespace is used.

```shell
skupper system teardown -n [namespace]
```
Or you can run a local script, that takes the namespace
as an argument. The platform is identified by the script so you don't need
to export it.

If the namespace is omitted, the "default" namespace is used.

```shell
./cmd/bootstrap/remove.sh [namespace]
```
Expand Down Expand Up @@ -299,6 +302,11 @@ Considering all your CRs have been saved to a directory named `west`, use:
```shell
./bootstrap -p ./west -n west
```
or

```shell
skupper system setup --path ./west -n west
```

The CRs are defined without a namespace, that is why we have the `-n west` flag,
to indicate we want this site to run under the `west` namespace.
Expand Down Expand Up @@ -373,6 +381,12 @@ Considering all your CRs have been saved to a directory named `east`, use:
./bootstrap -p ./east -n east
```

or

```shell
skupper system setup --path ./east -n east
```

### Testing the scenario

Once both sites have been initialized, open **http://127.0.0.1:7070**
Expand All @@ -389,17 +403,30 @@ To re-initialize the west site, run:
bootstrap -n west -f
```

or

```shell
system setup -n west -f
```

or

```shell
system reload -n west
```

The command above will reprocess all source CRs from the namespace path and
restart the related components. The Certificate Authorities (CAs) are preserved,
therefore eventual incoming links must still work.


### Cleanup

To remove both namespaces, run:

```shell
./cmd/bootstrap/remove.sh west
./cmd/bootstrap/remove.sh east
skupper system teardown -n west
skupper system teardown -n east
```

### Producing site bundles
Expand All @@ -416,6 +443,16 @@ Installation bundle available at: /home/user/.local/share/skupper/bundles/skuppe
Default namespace: default
Default platform: podman
```
or

```shell
skupper system setup --path ./west -b bundle
2024/11/18 12:17:56 updating listener /backend...
Site "west" has been created (as a distributable bundle)
Installation bundle available at: {HOME}/.local/share/skupper/bundles/skupper-install-west.sh
Default namespace: default
Default platform: podman
```

#### Extracting the static links

Expand Down
Loading