Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/go_modules/go.uber.org/zap-1.26.0
Browse files Browse the repository at this point in the history
  • Loading branch information
agouin authored Oct 16, 2023
2 parents bfd5e7c + e00e01f commit ac416e2
Show file tree
Hide file tree
Showing 23 changed files with 678 additions and 125 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
push:
tags:
- '**'
branches:
- '**'

env:
REGISTRY: ghcr.io
Expand Down Expand Up @@ -42,12 +44,13 @@ jobs:
# set latest tag for default branch
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=tag
type=ref,event=branch
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64
platforms: linux/amd64,linux/arm64
file: Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
Expand Down
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ Run tests via:
make test
```

# Architecture

For a high-level overview of the architecture, see [docs/architecture.md](./docs/architecture.md).

# Release Process

Prereq: Write access to the repo.
Expand Down
28 changes: 21 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Build the manager binary
FROM golang:1.20 as builder
FROM --platform=$BUILDPLATFORM golang:1.20-alpine AS builder

RUN apk add --update --no-cache gcc libc-dev

ARG TARGETARCH
ARG BUILDARCH

RUN if [ "${TARGETARCH}" = "arm64" ] && [ "${BUILDARCH}" != "arm64" ]; then \
wget -c https://musl.cc/aarch64-linux-musl-cross.tgz -O - | tar -xzvv --strip-components 1 -C /usr; \
elif [ "${TARGETARCH}" = "amd64" ] && [ "${BUILDARCH}" != "amd64" ]; then \
wget -c https://musl.cc/x86_64-linux-musl-cross.tgz -O - | tar -xzvv --strip-components 1 -C /usr; \
fi

WORKDIR /workspace
# Copy the Go Modules manifests
Expand All @@ -17,12 +27,16 @@ COPY internal/ internal/

ARG VERSION

# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-X github.com/strangelove-ventures/cosmos-operator/internal/version.version=$VERSION" -a -o manager .
RUN if [ "${TARGETARCH}" = "arm64" ] && [ "${BUILDARCH}" != "arm64" ]; then \
export CC=aarch64-linux-musl-gcc CXX=aarch64-linux-musl-g++;\
elif [ "${TARGETARCH}" = "amd64" ] && [ "${BUILDARCH}" != "amd64" ]; then \
export CC=x86_64-linux-musl-gcc CXX=x86_64-linux-musl-g++; \
fi; \
export GOOS=linux GOARCH=$TARGETARCH CGO_ENABLED=1 LDFLAGS='-linkmode external -extldflags "-static"'; \
go build -ldflags "-X github.com/strangelove-ventures/cosmos-operator/internal/version.version=$VERSION $LDFLAGS" -a -o manager .

# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM gcr.io/distroless/static:nonroot
# Build final image from scratch
FROM scratch

LABEL org.opencontainers.image.source=https://github.com/strangelove-ventures/cosmos-operator

Expand Down
21 changes: 21 additions & 0 deletions api/v1/cosmosfullnode_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,27 @@ type ChainSpec struct {
// +optional
LogFormat *string `json:"logFormat"`

// URL to address book file to download from the internet.
// The operator detects and properly handles the following file extensions:
// .json, .json.gz, .tar, .tar.gz, .tar.gzip, .zip
// Use AddrbookScript if the chain has an unconventional file format or address book location.
// +optional
AddrbookURL *string `json:"addrbookURL"`

// Specify shell (sh) script commands to properly download and save the address book file.
// Prefer AddrbookURL if the file is in a conventional format.
// The available shell commands are from docker image ghcr.io/strangelove-ventures/infra-toolkit, including wget and curl.
// Save the file to env var $ADDRBOOK_FILE.
// E.g. curl https://url-to-addrbook.com > $ADDRBOOK_FILE
// Takes precedence over AddrbookURL.
// Hint: Use "set -eux" in your script.
// Available env vars:
// $HOME: The home directory.
// $ADDRBOOK_FILE: The location of the final address book file.
// $CONFIG_DIR: The location of the config dir that houses the address book file. Used for extracting from archives. The archive must have a single file called "addrbook.json".
// +optional
AddrbookScript *string `json:"addrbookScript"`

// URL to genesis file to download from the internet.
// Although this field is optional, you will almost always want to set it.
// If not set, uses the genesis file created from the init subcommand. (This behavior may be desirable for new chains or testing.)
Expand Down
10 changes: 10 additions & 0 deletions api/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions api/v1alpha1/scheduledvolumesnapshot_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ type LocalFullNodeRef struct {
// DEPRECATED: CosmosFullNode must be in the same namespace as the ScheduledVolumeSnapshot. This field is ignored.
// +optional
Namespace string `json:"namespace"`

// Index of the pod to snapshot. If not provided, will do any pod in the CosmosFullNode.
// Useful when snapshots are local to the same node as the pod, requiring snapshots across multiple pods/nodes.
// +optional
Ordinal *int32 `json:"ordinal"`
}

// ScheduledVolumeSnapshotStatus defines the observed state of ScheduledVolumeSnapshot
Expand Down
9 changes: 7 additions & 2 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions config/crd/bases/cosmos.strange.love_cosmosfullnodes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,27 @@ spec:
chain:
description: Blockchain-specific configuration.
properties:
addrbookScript:
description: 'Specify shell (sh) script commands to properly download
and save the address book file. Prefer AddrbookURL if the file
is in a conventional format. The available shell commands are
from docker image ghcr.io/strangelove-ventures/infra-toolkit,
including wget and curl. Save the file to env var $ADDRBOOK_FILE.
E.g. curl https://url-to-addrbook.com > $ADDRBOOK_FILE Takes
precedence over AddrbookURL. Hint: Use "set -eux" in your script.
Available env vars: $HOME: The home directory. $ADDRBOOK_FILE:
The location of the final address book file. $CONFIG_DIR: The
location of the config dir that houses the address book file.
Used for extracting from archives. The archive must have a single
file called "addrbook.json".'
type: string
addrbookURL:
description: 'URL to address book file to download from the internet.
The operator detects and properly handles the following file
extensions: .json, .json.gz, .tar, .tar.gz, .tar.gzip, .zip
Use AddrbookScript if the chain has an unconventional file format
or address book location.'
type: string
app:
description: App configuration applied to app.toml.
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@ spec:
description: 'DEPRECATED: CosmosFullNode must be in the same namespace
as the ScheduledVolumeSnapshot. This field is ignored.'
type: string
ordinal:
description: Index of the pod to snapshot. If not provided, will
do any pod in the CosmosFullNode. Useful when snapshots are
local to the same node as the pod, requiring snapshots across
multiple pods/nodes.
format: int32
type: integer
required:
- name
type: object
Expand Down
64 changes: 0 additions & 64 deletions controllers/suite_test.go

This file was deleted.

Loading

0 comments on commit ac416e2

Please sign in to comment.