Building Keycloak Realm Operator

17 views
Skip to first unread message

Kevin Reis

unread,
Feb 16, 2023, 7:43:07 AM2/16/23
to Keycloak Dev
Hi everyone,

does somebody have experience with building Keycloak Realm Operator from source? I tried to work with devcontainers + Go 1.13.15 (go.mod specifies go >=1.13), as well as go 1.19 and 1.20, but

- go.mod keeps being adjusted
- when generating CRDs, validation errors are thrown
- vendor/ keeps being updated
- Prometheus dependency gets readded as it's imported implictly
- variable `log` has double declarations

The GitHub Action pipeline also uses go 1.13 and the last pipeline build is successful. That's why I'd expect to have the build working with go 1.13 "flawlessly" and not having the changes/error mentioned in the former list.

Does anybody have some clues? I used devcontainers with golang:1.13 as base image und cloned the repository to $GOPATH/src/github.com/keycloak/keycloak-realm-operator. I haven't tried it locally on Windows though.

Thanks in advance!

Cheers,
Kevin

Kevin Reis

unread,
Feb 21, 2023, 7:29:06 AM2/21/23
to Keycloak Dev
I resolved my issues. I guess it's not really the way to go by following the older instruction to build the project.

- Checking the source code out and running `make code/compile` like the CI does is simply enough
- No need to run `make setup` except for `make setup/operator-sdk`. Otherwise, go mod tidy will try to fix the go.mod file, resulting in changes of the file and eventually of the vendor/ folder.
- I refrained from running `make code/gen`. It seems like something has changed in the used generator. Also, as long as there are no changes to the CRD, I think there is no need to run that target.
- You can run this project on Windows, but you have to check the source code of operator-sdk out and build it yourself.
- Regarding Prometheus dependency being readded and double declarations of `log`: This was a mistake on my end; I just messed something up while coding. :)
Reply all
Reply to author
Forward
0 new messages