Skip to content
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
52 changes: 45 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ VERSION = $(shell git describe --dirty --tags --always)
GIT_COMMIT = $(shell git rev-parse HEAD)
K8S_VERSION = v1.18.2
REPO = github.com/operator-framework/operator-sdk
BUILD_PATH = $(REPO)/cmd/operator-sdk
SDK_BUILD_PATH = $(REPO)/cmd/operator-sdk
ANSIBLE_BUILD_PATH = $(REPO)/cmd/ansible-operator
HELM_BUILD_PATH = $(REPO)/cmd/helm-operator
PKGS = $(shell go list ./... | grep -v /vendor/)
TEST_PKGS = $(shell go list ./... | grep -v -E 'github.com/operator-framework/operator-sdk/test/')
SOURCES = $(shell find . -name '*.go' -not -path "*/vendor/*")
Expand Down Expand Up @@ -68,7 +70,13 @@ help: ## Show this help screen
all: format test build/operator-sdk ## Test and Build the Operator SDK

install: ## Install the operator-sdk binary
$(Q)$(GOARGS) go install $(GO_BUILD_ARGS) $(BUILD_PATH)
$(Q)$(GOARGS) go install $(GO_BUILD_ARGS) $(SDK_BUILD_PATH)

install-ansible: ## Install the ansible-operator binary
$(Q)$(GOARGS) go install $(GO_BUILD_ARGS) $(ANSIBLE_BUILD_PATH)

install-helm: ## Install the helm-operator binary
$(Q)$(GOARGS) go install $(GO_BUILD_ARGS) $(HELM_BUILD_PATH)

# Code management.
.PHONY: format tidy clean cli-doc lint
Expand Down Expand Up @@ -127,7 +135,17 @@ release_builds := \
build/operator-sdk-$(VERSION)-x86_64-linux-gnu \
build/operator-sdk-$(VERSION)-x86_64-apple-darwin \
build/operator-sdk-$(VERSION)-ppc64le-linux-gnu \
build/operator-sdk-$(VERSION)-s390x-linux-gnu
build/operator-sdk-$(VERSION)-s390x-linux-gnu \
build/ansible-operator-$(VERSION)-aarch64-linux-gnu \
build/ansible-operator-$(VERSION)-x86_64-linux-gnu \
build/ansible-operator-$(VERSION)-x86_64-apple-darwin \
build/ansible-operator-$(VERSION)-ppc64le-linux-gnu \
build/ansible-operator-$(VERSION)-s390x-linux-gnu \
build/helm-operator-$(VERSION)-aarch64-linux-gnu \
build/helm-operator-$(VERSION)-x86_64-linux-gnu \
build/helm-operator-$(VERSION)-x86_64-apple-darwin \
build/helm-operator-$(VERSION)-ppc64le-linux-gnu \
build/helm-operator-$(VERSION)-s390x-linux-gnu

release: clean $(release_builds) $(release_builds:=.asc) ## Release the Operator SDK

Expand All @@ -138,8 +156,28 @@ build/operator-sdk-%-ppc64le-linux-gnu: GOARGS = GOOS=linux GOARCH=ppc64le
build/operator-sdk-%-s390x-linux-gnu: GOARGS = GOOS=linux GOARCH=s390x
build/operator-sdk-%-linux-gnu: GOARGS = GOOS=linux

build/%: $(SOURCES) ## Build the operator-sdk binary
$(Q)$(GOARGS) go build $(GO_BUILD_ARGS) -o $@ $(BUILD_PATH)
build/ansible-operator-%-aarch64-linux-gnu: GOARGS = GOOS=linux GOARCH=arm64
build/ansible-operator-%-x86_64-linux-gnu: GOARGS = GOOS=linux GOARCH=amd64
build/ansible-operator-%-x86_64-apple-darwin: GOARGS = GOOS=darwin GOARCH=amd64
build/ansible-operator-%-ppc64le-linux-gnu: GOARGS = GOOS=linux GOARCH=ppc64le
build/ansible-operator-%-s390x-linux-gnu: GOARGS = GOOS=linux GOARCH=s390x
build/ansible-operator-%-linux-gnu: GOARGS = GOOS=linux

build/helm-operator-%-aarch64-linux-gnu: GOARGS = GOOS=linux GOARCH=arm64
build/helm-operator-%-x86_64-linux-gnu: GOARGS = GOOS=linux GOARCH=amd64
build/helm-operator-%-x86_64-apple-darwin: GOARGS = GOOS=darwin GOARCH=amd64
build/helm-operator-%-ppc64le-linux-gnu: GOARGS = GOOS=linux GOARCH=ppc64le
build/helm-operator-%-s390x-linux-gnu: GOARGS = GOOS=linux GOARCH=s390x
build/helm-operator-%-linux-gnu: GOARGS = GOOS=linux

build/operator-%: $(SOURCES) ## Build the operator-sdk binary
Copy link
Copy Markdown
Member

@estroz estroz Jul 8, 2020

Choose a reason for hiding this comment

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

Can we make this more specific?

Suggested change
build/operator-%: $(SOURCES) ## Build the operator-sdk binary
build/operator-sdk$%: $(SOURCES) ## Build the operator-sdk binary

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I tried that, but it resulted in a weird build error I couldn't figure out how to solve. I'm not a Makefile guru by any means though, so suggestions welcome.

Copy link
Copy Markdown
Member

@estroz estroz Jul 8, 2020

Choose a reason for hiding this comment

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

Fixed the above to specify the right target ($%). That still doesn't work. Let me look into this.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is not a blocker, just a cosmetic nit.

$(Q)$(GOARGS) go build $(GO_BUILD_ARGS) -o $@ $(SDK_BUILD_PATH)

build/ansible-%: $(SOURCES) ## Build the ansible-operator binary
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we make this more specific? Ditto for helm.

Suggested change
build/ansible-%: $(SOURCES) ## Build the ansible-operator binary
build/ansible-operator%: $(SOURCES) ## Build the ansible-operator binary

$(Q)$(GOARGS) go build $(GO_BUILD_ARGS) -o $@ $(ANSIBLE_BUILD_PATH)

build/helm-%: $(SOURCES) ## Build the helm-operator binary
$(Q)$(GOARGS) go build $(GO_BUILD_ARGS) -o $@ $(HELM_BUILD_PATH)

build/%.asc: ## Create release signatures for operator-sdk release binaries
$(Q){ \
Expand Down Expand Up @@ -169,7 +207,7 @@ image-push: image-push-ansible image-push-helm image-push-scorecard-proxy image-
image-scaffold-ansible:
go run ./hack/image/ansible/scaffold-ansible-image.go

image-build-ansible: build/operator-sdk-dev-linux-gnu
image-build-ansible: build/ansible-operator-dev-linux-gnu
./hack/image/build-ansible-image.sh $(ANSIBLE_BASE_IMAGE):dev

image-push-ansible:
Expand All @@ -184,7 +222,7 @@ image-push-ansible-multiarch:
image-scaffold-helm:
go run ./hack/image/helm/scaffold-helm-image.go

image-build-helm: build/operator-sdk-dev-linux-gnu
image-build-helm: build/helm-operator-dev-linux-gnu
./hack/image/build-helm-image.sh $(HELM_BASE_IMAGE):dev

image-push-helm:
Expand Down
5 changes: 5 additions & 0 deletions changelog/fragments/release-helm-ansible-binaries.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
entries:
- description: >
Add builds for `ansible-operator` and `helm-operator` binaries
kind: addition
breaking: false
5 changes: 1 addition & 4 deletions hack/image/build-ansible-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,12 @@ BASEIMAGEDIR="$TMPDIR/ansible-operator"
mkdir -p "$BASEIMAGEDIR"
go build -o $BASEIMAGEDIR/scaffold-ansible-image ./hack/image/ansible/scaffold-ansible-image.go

# build binary for specific target platform (for purposes of base image only)
env GOOS=linux GOARCH=amd64 go build -o $BASEIMAGEDIR/ansible-operator-dev-linux-gnu ./cmd/ansible-operator/main.go

# build operator binary and base image
pushd "$BASEIMAGEDIR"
./scaffold-ansible-image

mkdir -p build/_output/bin/
cp $BASEIMAGEDIR/ansible-operator-dev-linux-gnu build/_output/bin/ansible-operator
cp $ROOTDIR/build/ansible-operator-dev-linux-gnu build/_output/bin/ansible-operator
operator-sdk build $1
# If using a kind cluster, load the image into all nodes.
load_image_if_kind "$1"
Expand Down
5 changes: 1 addition & 4 deletions hack/image/build-helm-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,12 @@ BASEIMAGEDIR="$TMPDIR/helm-operator"
mkdir -p "$BASEIMAGEDIR"
go build -o $BASEIMAGEDIR/scaffold-helm-image ./hack/image/helm/scaffold-helm-image.go

# build binary for specific target platform (for purposes of base image only)
env GOOS=linux GOARCH=amd64 go build -o $BASEIMAGEDIR/helm-operator-dev-linux-gnu ./cmd/helm-operator/main.go

# build operator binary and base image
pushd "$BASEIMAGEDIR"
./scaffold-helm-image

mkdir -p build/_output/bin/
cp $BASEIMAGEDIR/helm-operator-dev-linux-gnu build/_output/bin/helm-operator
cp $ROOTDIR/build/helm-operator-dev-linux-gnu build/_output/bin/helm-operator
operator-sdk build $1
# If using a kind cluster, load the image into all nodes.
load_image_if_kind "$1"
Expand Down
22 changes: 20 additions & 2 deletions website/content/en/docs/install-operator-sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,33 +18,45 @@ $ brew install operator-sdk

## Install from GitHub release

### Download the release binary
### Download the release binaries

```sh
# Set the release version variable
$ RELEASE_VERSION=v0.18.0
# Linux
$ curl -LO https://github.com/operator-framework/operator-sdk/releases/download/${RELEASE_VERSION}/operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu
$ curl -LO https://github.com/operator-framework/operator-sdk/releases/download/${RELEASE_VERSION}/ansible-operator-${RELEASE_VERSION}-x86_64-linux-gnu
$ curl -LO https://github.com/operator-framework/operator-sdk/releases/download/${RELEASE_VERSION}/helm-operator-${RELEASE_VERSION}-x86_64-linux-gnu
# macOS
$ curl -LO https://github.com/operator-framework/operator-sdk/releases/download/${RELEASE_VERSION}/operator-sdk-${RELEASE_VERSION}-x86_64-apple-darwin
$ curl -LO https://github.com/operator-framework/operator-sdk/releases/download/${RELEASE_VERSION}/ansible-operator-${RELEASE_VERSION}-x86_64-apple-darwin
$ curl -LO https://github.com/operator-framework/operator-sdk/releases/download/${RELEASE_VERSION}/helm-operator-${RELEASE_VERSION}-x86_64-apple-darwin
```

#### Verify the downloaded release binary
#### Verify the downloaded release binaries

```sh
# Linux
$ curl -LO https://github.com/operator-framework/operator-sdk/releases/download/${RELEASE_VERSION}/operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu.asc
$ curl -LO https://github.com/operator-framework/operator-sdk/releases/download/${RELEASE_VERSION}/ansible-operator-${RELEASE_VERSION}-x86_64-linux-gnu.asc
$ curl -LO https://github.com/operator-framework/operator-sdk/releases/download/${RELEASE_VERSION}/helm-operator-${RELEASE_VERSION}-x86_64-linux-gnu.asc
# macOS
$ curl -LO https://github.com/operator-framework/operator-sdk/releases/download/${RELEASE_VERSION}/operator-sdk-${RELEASE_VERSION}-x86_64-apple-darwin.asc
$ curl -LO https://github.com/operator-framework/operator-sdk/releases/download/${RELEASE_VERSION}/ansible-operator-${RELEASE_VERSION}-x86_64-apple-darwin.asc
$ curl -LO https://github.com/operator-framework/operator-sdk/releases/download/${RELEASE_VERSION}/helm-operator-${RELEASE_VERSION}-x86_64-apple-darwin.asc
```

To verify a release binary using the provided asc files, place the binary and corresponding asc file into the same directory and use the corresponding command:

```sh
# Linux
$ gpg --verify operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu.asc
$ gpg --verify ansible-operator-${RELEASE_VERSION}-x86_64-linux-gnu.asc
$ gpg --verify helm-operator-${RELEASE_VERSION}-x86_64-linux-gnu.asc
# macOS
$ gpg --verify operator-sdk-${RELEASE_VERSION}-x86_64-apple-darwin.asc
$ gpg --verify ansible-operator-${RELEASE_VERSION}-x86_64-apple-darwin.asc
$ gpg --verify helm-operator-${RELEASE_VERSION}-x86_64-apple-darwin.asc
```

If you do not have the maintainers public key on your machine, you will get an error message similar to this:
Expand Down Expand Up @@ -76,8 +88,12 @@ Now you should be able to verify the binary.
```sh
# Linux
$ chmod +x operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu && sudo mkdir -p /usr/local/bin/ && sudo cp operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu /usr/local/bin/operator-sdk && rm operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu
$ chmod +x ansible-operator-${RELEASE_VERSION}-x86_64-linux-gnu && sudo mkdir -p /usr/local/bin/ && sudo cp ansible-operator-${RELEASE_VERSION}-x86_64-linux-gnu /usr/local/bin/ansible-operator && rm ansible-operator-${RELEASE_VERSION}-x86_64-linux-gnu
$ chmod +x helm-operator-${RELEASE_VERSION}-x86_64-linux-gnu && sudo mkdir -p /usr/local/bin/ && sudo cp helm-operator-${RELEASE_VERSION}-x86_64-linux-gnu /usr/local/bin/helm-operator && rm helm-operator-${RELEASE_VERSION}-x86_64-linux-gnu
# macOS
$ chmod +x operator-sdk-${RELEASE_VERSION}-x86_64-apple-darwin && sudo mkdir -p /usr/local/bin/ && sudo cp operator-sdk-${RELEASE_VERSION}-x86_64-apple-darwin /usr/local/bin/operator-sdk && rm operator-sdk-${RELEASE_VERSION}-x86_64-apple-darwin
$ chmod +x ansible-operator-${RELEASE_VERSION}-x86_64-apple-darwin && sudo mkdir -p /usr/local/bin/ && sudo cp ansible-operator-${RELEASE_VERSION}-x86_64-apple-darwin /usr/local/bin/ansible-operator && rm ansible-operator-${RELEASE_VERSION}-x86_64-apple-darwin
$ chmod +x helm-operator-${RELEASE_VERSION}-x86_64-apple-darwin && sudo mkdir -p /usr/local/bin/ && sudo cp helm-operator-${RELEASE_VERSION}-x86_64-apple-darwin /usr/local/bin/helm-operator && rm helm-operator-${RELEASE_VERSION}-x86_64-apple-darwin
```

## Compile and install from master
Expand All @@ -95,6 +111,8 @@ $ cd operator-sdk
$ git checkout master
$ make tidy
$ make install
$ make install-ansible
$ make install-helm
```

**Note:** Ensure that your `GOPROXY` is set with its default value for Go
Expand Down