Skip to content

Commit

Permalink
Split former okra commmand into new okrad, okractl and okra c…
Browse files Browse the repository at this point in the history
…ommands
  • Loading branch information
mumoshu committed Nov 24, 2021
1 parent ae4384b commit c541094
Show file tree
Hide file tree
Showing 39 changed files with 931 additions and 736 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.envrc
.testenv
bin/
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@ COPY . .
RUN export GOOS=$(echo ${TARGETPLATFORM} | cut -d / -f1) && \
export GOARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) && \
GOARM=$(echo ${TARGETPLATFORM} | cut -d / -f3 | cut -c2-) && \
go build -a -o okra main.go && \
go build -a ./cmd/aws
go build -a -o . ./cmd/*

# 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

WORKDIR /

COPY --from=builder /workspace/okra .
COPY --from=builder /workspace/okra /workspace/okrad .
COPY --from=builder /workspace/okractl /bin/okractl
COPY --from=builder /workspace/aws /bin/aws

USER nonroot:nonroot

ENTRYPOINT ["/okra"]
ENTRYPOINT ["/okrad"]
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ vet:
$(GO) vet ./...

build: generate
$(GO) build .
mkdir -p bin
$(GO) build -o bin ./cmd/okra ./cmd/okrad ./cmd/okractl

.PHONY: smoke
smoke:
Expand Down
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -495,10 +495,15 @@ See [crd.md](/docs/crd.md) for more documentation and details of each CRD.
## CLI
`okra` is the CLI application that consists of the controller and other utility commands for testing.
`okra` provides 3 executables.
We do our best to expose every single `okra` controller's functionality via respective `okra` CLI commands, so that you
can test each functionality in isolation.
- `okrad`: the Kubernetes controller manager that consists of various Kubernetes controller for Okra CRDs. Intended to be run in a Kubernetes cluster.
- `okractl`: A `kubectl`-like CLI application that is for interacting with `okrad` through Kubernetes API server. Intended to be run on your machine or on a CI system for automation.
- `okra`: the standalone CLI application that does its best to provide every single logic implemented in `okrad`'s controllers. Intended to be run in CI to replicate `okrad`'s functionality on a CI system, or to test each okra functionality in isolation.
The standard and author's recommended usage of Okra involves `okrad` and `okractl`.
For `okra`, we do our best to expose every single `okrad` + `okractl` functionality via respective `okra` CLI commands, so that you can test each functionality in isolation.
It may be even possible to build your own CI job that replaces `okra` out of those commands!
Expand Down
3 changes: 1 addition & 2 deletions charts/okra/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ spec:
- --enable-leader-election
- --sync-period={{ .Values.syncPeriod }}
command:
- /okra
- controller-manager
- /okrad
env:
- name: PATH
value: /bin
Expand Down
73 changes: 0 additions & 73 deletions cmd/okra/create_or_update_awstargetgroupset.go

This file was deleted.

155 changes: 0 additions & 155 deletions cmd/okra/create_or_update_cell.go

This file was deleted.

4 changes: 2 additions & 2 deletions main.go → cmd/okra/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import (
"fmt"
"os"

"github.com/mumoshu/okra/cmd/okra"
"github.com/mumoshu/okra/pkg/okra/cmd"
)

func main() {
if err := okra.Run(); err != nil {
if err := cmd.Run(); err != nil {
if os.Getenv("TRACE") != "" {
fmt.Fprintf(os.Stderr, "Error: %+v\n", err)
} else {
Expand Down
Loading

0 comments on commit c541094

Please sign in to comment.