Skip to content

Instantly share code, notes, and snippets.

@jrafanie
Created March 25, 2021 19:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jrafanie/5711403a311aefce0dfa762e51a45663 to your computer and use it in GitHub Desktop.
Save jrafanie/5711403a311aefce0dfa762e51a45663 to your computer and use it in GitHub Desktop.
* Install go
brew install go@1.13
echo 'export PATH="/usr/local/opt/go@1.13/bin:$PATH"' >> ~/.zshrc
export PATH="/usr/local/opt/go@1.13/bin:$PATH"
go version
* Install the operator-sdk:
(Note, redhat laptop is using operator-sdk 0.19.3, go, 1.13 and bin/build works but the operator-sdk generate commands were not tested)
RELEASE_VERSION=v0.15.2
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
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
* Create a docker.io login @ https://hub.docker.com/
* Install docker desktop - I used Docker.dmg / docker.app
Currently using 3.2.2 (61853) / redhat laptop has 2.3.0.4
Make sure you check the resources in docker desktop, I use 8 cpu, 16 GB memory with 2 GB swap and 60 GB disk.
If you choose too small of disk, you'll have to remember to remove images frequently.
* Run a full operator + orchestrator + all worker image build:
Make sure you can `docker login` from CLI as we'll need to be able to push our images to docker when it's done.
I have this in my config.json and I login in docker desktop also:
cat ~/.docker/config.json
{
"auths": {
"https://index.docker.io/v1/": {}
},
"credsStore": "desktop",
"experimental": "disabled",
"stackOrchestrator": "swarm"
}%
Git clone manageiq-pods.
Add an options.yml:
Specify the fork/branch you want to use:
$ cat options.yml
---
product_name: manageiq
repos:
ref: master
manageiq:
url: https://github.com/A_FORK/manageiq.git
ref: master
To build everything, including rpms, for my account on docker.io (DOCKER_USER) and use the docker tag "latest"
RPM_BUILD_OPTIONS="./" bin/build -d . -b -r DOCKER_USER -p -t latest
Another useful option is to reuse the existing built rpms and not push to docker.io but instead let you inspect the images locally:
RPM_BUILD_OPTIONS="./" bin/build -o -d . -l -r DOCKER_USER -t latest
There are options for skipping the operator, reusing local rpms, etc., see bin/build in manageiq-pods.
# To deploy, docker.io will throttle image pulls so you want to create a pull secret so at least you're using an authenticated session which gets a high rate limit:
oc create secret docker-registry MY_SECRET_NAME --docker-server=docker.io --docker-username=DOCKER_USER --docker-password=XXX --docker-email=XXX
Add this to the the cr:
diff --git a/manageiq-operator/deploy/crds/manageiq.org_v1alpha1_manageiq_cr.yaml b/manageiq-operator/deploy/crds/manageiq.org_v1alpha1_manageiq_cr.yaml
index f04317f..20d46c0 100644
--- a/manageiq-operator/deploy/crds/manageiq.org_v1alpha1_manageiq_cr.yaml
+++ b/manageiq-operator/deploy/crds/manageiq.org_v1alpha1_manageiq_cr.yaml
@@ -3,4 +3,11 @@ kind: ManageIQ
metadata:
name: miq
spec:
- applicationDomain: miqproject.apps-crc.testing
+ applicationDomain: unique-name # whatever name you want httpd to be made available over, this must be unique for each deployment
+ baseWorkerImage: DOCKER_USER/manageiq-base-worker:latest # use the right user and tag
+ orchestratorImageNamespace: DOCKER_USER
+ orchestratorImageTag: latest
+ uiWorkerImage: DOCKER_USER/manageiq-ui-worker:latest
+ webserverWorkerImage: DOCKER_USER/manageiq-webserver-worker:latest
+ imagePullSecret: MY_SECRET_NAME # add this based on the secret name
diff --git a/manageiq-operator/deploy/operator.yaml b/manageiq-operator/deploy/operator.yaml
index 3a44468..6aad449 100644
--- a/manageiq-operator/deploy/operator.yaml
+++ b/manageiq-operator/deploy/operator.yaml
@@ -15,7 +15,7 @@ spec:
serviceAccountName: manageiq-operator
containers:
- name: manageiq-operator
- image: docker.io/manageiq/manageiq-operator:latest
+ image: docker.io/DOCKER_USER/manageiq-operator:latest
command:
- manageiq-operator
imagePullPolicy: Always
oc login ... # log into your oc env
oc project ... # set the project to your project
cd to manageiq-pods/manageiq-operator
oc create -f deploy/crds/manageiq.org_manageiqs_crd.yaml; oc create -f deploy/role.yaml; oc create -f deploy/role_binding.yaml; oc create -f deploy/service_account.yaml; oc create -f deploy/crds/manageiq.org_v1alpha1_manageiq_cr.yaml; oc create -f deploy/operator.yaml
# To generate various things for the operator (this isn't needed for building images):
operator-sdk generate k8s
operator-sdk generate crds
operator-sdk generate csv --csv-version 0.0.1
# if the k8s fails:
unset GOROOT
export GOROOT=$(go env GOROOT)
# try again
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment