Skip to content

Commit

Permalink
Get builds working
Browse files Browse the repository at this point in the history
- Add notes about fetching additional dependencies
- Update to new make commands
- Fully qualify base docker image
  • Loading branch information
bdunne committed Jul 20, 2022
1 parent 29aa817 commit b25cbb2
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 20 deletions.
5 changes: 2 additions & 3 deletions bin/build
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,8 @@ popd
if [ -z "$NO_OPERATOR" ]; then
pushd "$OPERATOR_DIR"
echo "Building manageiq-operator manifest..."
mkdir -p ./build/_output
echo "$(date +"%Y%m%d%H%M%S")-$(git rev-parse HEAD)" > ./build/_output/BUILD
cat ./build/_output/BUILD
echo "$(date +"%Y%m%d%H%M%S")-$(git rev-parse HEAD)" > ./BUILD
cat ./BUILD
echo

image_build_args="--image-build-args --pull"
Expand Down
4 changes: 3 additions & 1 deletion manageiq-operator/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# Binaries for programs and plugins
*.exe
*.exe~
Expand All @@ -23,3 +22,6 @@ testbin/*
*.swp
*.swo
*~

# Build artifacts
BUILD
5 changes: 4 additions & 1 deletion manageiq-operator/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.17 as builder
FROM docker.io/library/golang:1.17 as builder

WORKDIR /workspace
# Copy the Go Modules manifests
Expand All @@ -24,4 +24,7 @@ WORKDIR /
COPY --from=builder /workspace/manager .
USER 65532:65532

# install operator manifest
COPY BUILD /opt/manageiq/manifest

ENTRYPOINT ["/manager"]
5 changes: 3 additions & 2 deletions manageiq-operator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)
#
# For example, running 'make bundle-build bundle-push catalog-build catalog-push' will build and push both
# manageiq.org/manageiq-operator-bundle:$VERSION and manageiq.org/manageiq-operator-catalog:$VERSION.
IMAGE_TAG_BASE ?= manageiq.org/manageiq-operator
IMAGE_TAG_BASE ?= docker.io/manageiq/manageiq-operator

# BUNDLE_IMG defines the image:tag used for the bundle.
# You can use it as an arg. (E.g make bundle-build BUNDLE_IMG=<some-registry>/<project-name-bundle>:<tag>)
Expand All @@ -47,7 +47,7 @@ ifeq ($(USE_IMAGE_DIGESTS), true)
endif

# Image URL to use all building/pushing image targets
IMG ?= controller:latest
IMG ?= $(IMAGE_TAG_BASE):latest
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.23

Expand Down Expand Up @@ -118,6 +118,7 @@ run: manifests generate fmt vet ## Run a controller from your host.

.PHONY: docker-build
docker-build: test ## Build docker image with the manager.
echo "$(date +"%Y%m%d%H%M%S")-$(git rev-parse HEAD)" > ./BUILD
docker build -t ${IMG} .

.PHONY: docker-push
Expand Down
26 changes: 13 additions & 13 deletions manageiq-operator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@

This operator manages the lifecycle of ManageIQ application on a Kubernetes or OCP4 cluster.

## Additional dependencies you may need for development

The following dependencies are required for some of the make commands:

- kustomize: https://github.com/kubernetes-sigs/kustomize/releases
- etcd: https://github.com/etcd-io/etcd/releases/
- kube-apiserver: `sudo dnf install kubernetes-master && sudo chmod +x /usr/bin/kube-apiserver` ???

## Running ManageIQ under operator control.

Follow the documentation for [preparing the namespace](https://www.manageiq.org/docs/reference/latest/installing_on_kubernetes/index.html#preparing-the-kubernetes-namespace) except for the `Deploy the operator in your namespace` step.


### Run The Operator

There are three different ways the operator can be run.
Expand All @@ -19,25 +25,19 @@ There are three different ways the operator can be run.

+ #### Option 2: Run your own custom ManageIQ image inside the Cluster

1 - Build your operator image:

```bash
$ operator-sdk build docker.io/<your_username_or_organization>/manageiq-operator:latest
```

2 - Push your new custom image to the registry:
1 - Build and push your operator image:

```bash
$ docker push docker.io/<your_username_or_organization>/manageiq-operator:latest
$ IMG=docker.io/<your_username_or_organization>/manageiq-operator make docker-build docker-push
```

3 - Update the operator deployment yaml file with your custom image:
2 - Update the operator deployment yaml file with your custom image:

```bash
$ sed -i 's|docker.io/manageiq/manageiq-operator:latest|docker.io/<your_username_or_organization>/manageiq-operator:latest|g' deploy/operator.yaml
$ sed -i 's|docker.io/manageiq/manageiq-operator:latest|docker.io/<your_username_or_organization>/manageiq-operator:latest|g' config/manager/manager.yaml
```

4 - Run your custom image from the registry:
3 - Run your custom image from the registry:

```bash
$ oc create -f deploy/operator.yaml
Expand All @@ -46,7 +46,7 @@ There are three different ways the operator can be run.
+ #### Option 3: Run locally (on your local laptop/computer, outside of the cluster)

```bash
$ WATCH_NAMESPACE=miq make run
$ WATCH_NAMESPACE=<your_namespace> make run
```

# Further Notes:
Expand Down

0 comments on commit b25cbb2

Please sign in to comment.