{"id":18637094,"url":"https://github.com/openshift/console-operator","last_synced_at":"2025-05-16T10:08:42.198Z","repository":{"id":37405835,"uuid":"148216080","full_name":"openshift/console-operator","owner":"openshift","description":"The console operator installs and maintains the web console on a cluster","archived":false,"fork":false,"pushed_at":"2025-05-14T16:19:12.000Z","size":103898,"stargazers_count":52,"open_issues_count":10,"forks_count":136,"subscribers_count":19,"default_branch":"main","last_synced_at":"2025-05-14T17:28:19.703Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/openshift.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-09-10T20:38:19.000Z","updated_at":"2025-05-07T13:25:35.000Z","dependencies_parsed_at":"2024-01-28T02:28:39.999Z","dependency_job_id":"7ac15091-a005-4bb0-8826-2cb32597e3d8","html_url":"https://github.com/openshift/console-operator","commit_stats":{"total_commits":861,"total_committers":89,"mean_commits":9.674157303370787,"dds":0.6968641114982579,"last_synced_commit":"570755c8a141b4acbb2afca3e1c104b691747d58"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openshift%2Fconsole-operator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openshift%2Fconsole-operator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openshift%2Fconsole-operator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openshift%2Fconsole-operator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/openshift","download_url":"https://codeload.github.com/openshift/console-operator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254509477,"owners_count":22082892,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T05:33:18.957Z","updated_at":"2025-05-16T10:08:37.145Z","avatar_url":"https://github.com/openshift.png","language":"Go","readme":"# Console Operator\n\nAn operator for OpenShift Console.\n\nThe console-operator installs and maintains the web console on a cluster.\n\n## Run on a 4.0.0 Cluster\n\nThe console operator is installed by default and will automatically maintain a console.  \n\n## Development Setup\n\n* Install Go 1.15.2 -- https://golang.org/dl/\n* GVM is recommended but not required -- https://github.com/moovweb/gvm\n  * On MacOS you may need to execute `go env -w GO111MODULE=auto` after installing the main go binary before you can install other versions via GVM\n\n## Clone the Repo \u0026 Build Locally\n\nTo avoid some of the standard quirks of `gopath`, the recommended way to clone and \nwork with this repository is to do the following:\n\n### Cloning the Repo\n\nRather than ~/go for everything, provide separate gopaths. For this example we will\nuse $HOME/gopaths as the root of our projects and consoleoperator as our project directory.\n\n\n```bash \nmkdir -p $HOME/gopaths/consoleoperator\n``` \n\nNow get the repository from github.\n\n```bash \ncd $HOME/gopaths/consoleoperator\nexport GOPATH=`pwd`\ngo get github.com/openshift/console-operator\n```\n\nYou may see a message like `package github.com/openshift/console-operator: no Go files in $HOME/gopaths/consoleoperator/src/github.com/openshift/console-operator`\nand you can safely ignore it.\n\nYou may now add your fork to the repo as a remote.\n```bash\ncd src/github.com/openshift/console-operator/\ngit remote rename origin upstream\ngit remote add origin {Your fork url}\n```\n\n### Gopath\n\nNote that we created `$HOME/gopaths`.  This implies that each project will have\nits own gopath, so you will need to set that while working:\n\n```bash \nexport GOPATH=$HOME/gopaths/consoleoperator\n``` \n\nIf you have multiple goprojects and don't want to fuss with maintaining this when\nyou `cd` to different projects, give [this script](https://www.jtolio.com/2017/01/magic-gopath/)\na try. It will add a command called `calc_gopath` to your `prompt_command` and \nset your gopath appropriately depending on the current working directory.\n\n(At some point `golang` will fix `$GOPATH` and this won't be necessary)\n\n### Development \u0026 Building the Binary\n\nRunning the `make` command will build the binary:\n\n```bash \nmake \n```\n\nThe binary output will be:\n\n```bash \n./_output/local/bin/\u003cos\u003e/\u003carch\u003e/console\n```\n\nYou may want to add this to your path or symlink it:\n\n```bash \n# if your ~/bin is in your path:\nln -s ./_output/local/bin/\u003cos\u003e/\u003carch\u003e/console ~/bin/console \n```\n\nHowever, it is no longer recommended to run the operator locally.  Instead, you \nshould be building a docker image and deploying it into a development cluster.\nContinue below for instructions to do this with a reasonable feedback loop.\n\n### Verify Source Code\n\nTest `gofmt` and other verification tools:\n\n```bash \nmake verify\n```\n\nLet `gofmt` automatically update your source:\n\n```bash \ngofmt -w ./pkg\ngofmt -w ./cmd \n```\n\n### Run Unit Tests\n\n```bash\nmake test-unit\n```\n\nIt is suggested to run `integration` and `e2e` tests with CI.  This is automatic when opening a PR.\n\n\n### Development Against a 4.0 Dev Cluster \n\nThe approach here is to build \u0026 deploy your code in a new container on a development cluster.  Don't \nbe put off by the need to redeploy your container, this is intended to provide a quick feedback loop.\n\n#### Create a Cluster\nTo develop features for the `console-operator`, you will need to run your code against a dev cluster.\nThe `console-operator` expects to be running in a container.  It is difficult to fake a local \nenvironment, and the debuggin experience is not like debugging a real container.  Instead, do the following \nto set yourself up to build your binary \u0026 deploy a new container quickly and frequently.\n\nVisit [https://try.openshift.com/](https://try.openshift.com/), download the installer and create \na cluster.  [Instructions](https://cloud.openshift.com/clusters/install) (including pull secret) \nare maintained here.\n\n```bash\n# create a directory for your install config\n# aws is recommended\nmkdir ~/openshift/aws/us-east\ncd ~/openshift/aws/us-east\n# generate configs using the wizard\nopenshift-install create install-config\n# then run the installer to get a cluster \nopenshift-install create cluster --dir ~/openshift/aws/us-east --log-level debug\n```\n\nIf successful, you should have gotten instructions to set `KUBECONFIG`, login to the console, etc.\n\n#### Shut down CVO \u0026 the Default Console Operator\n\nWe don't want the default `console-operator` to run if we are going to test our own. Therefore, do \nthe following:\n\n```bash\n# Instruct CVO to stop managing the console operator\n# CVO's job is to ensure all of the operators are functioning correctly\n# if we want to make changes to the operator, we need to tell CVO to stop caring.\noc apply -f examples/cvo-unmanage-operator.yaml\n# Then, scale down the default console-operator \noc scale --replicas 0 deployment console-operator --namespace openshift-console-operator\n```\nNote that you can also simply delete the CVO namespace if you want to turn it off completely (for all operators).\n\nNow we should be ready to build \u0026 deploy the operator with our changes.\n\n#### Preparation to Deploy Operator Changes Quickly\n\nTypically to build your binary you will use the `make` command:\n\n```bash\n# this will build for your platform:\nmake\n# if you are running OSX, you will need to build for linux doing something like:\nOS_DEBUG=true OS_BUILD_PLATFORMS=linux/amd64 make\n# note that you can build for mulitiple platforms with:\nmake build-cross\n```\nBut the `make` step is included in the `Dockerfile`, so this does not need to be done manually.\nYou can instead simply build the container image and push the it to your own registry:\n\n```bash \n# the pattern is:\ndocker build -t \u003cregistry\u003e/\u003cyour-username\u003e/console-operator:\u003cversion\u003e .\n# following: docker.io/openshift/origin-console-operator:latest\n# for development, you are going to push to an alternate registry.\n# specifically it can look something like this:\ndocker build -f Dockerfile.rhel7 -t quay.io/benjaminapetersen/console-operator:latest .\n```\nYou can optionally build a specific version.\n\nThen, push your image:\n\n```bash \ndocker push \u003cregistry\u003e/\u003cyour-username\u003e/console-operator:\u003cversion\u003e\n# Be sure your repository is public else the image will not be able to be pulled later\ndocker push quay.io/benjaminapetersen/console-operator:latest\n```\nThen, you will want to deploy your new container.  This means duplicating the `manifests/07-operator.yaml`\nand updating the line `image: docker.io/openshift/origin-console-operator:latest` to instead use the\nimage you just pushed.\n\n```bash\n# duplicate the operator manifest to /examples or your ~/ home dir\ncp manifests/07-operator.yaml ~/07-operator-alt-image.yaml\n```\nThen, update the image \u0026 replicas in your `07-operator-alt-image.yaml` file:\n\n```yaml\n# before\nreplicas: 2\nimage: docker.io/openshift/origin-console-operator:latest\n# after \n# image: \u003cregistry\u003e/\u003cyour-username\u003e/console-operator:\u003cversion\u003e\nreplicas: 1\nimage: quay.io/benjaminapetersen/console-operator:latest\n```\nAnd ensure that the `imagePullPolicy` is still `Always`.  This will ensure a fast development feedback loop. \n\n```yaml\nimagePullPolicy: Always\n```\n\n#### Deploying \n\nAt this point, your pattern will be \n\n- Change code\n- Build a new docker image\n    - This will automatically \u0026 implicitly `make build` a new binary\n- Push the image to your repository\n- Delete the running `console-operator` pod\n    - This will cause the Deployment to pull the image again before deploying a new pod\n\nWhich looks like the following:\n\n```bash\n# build binary + container\ndocker build -t quay.io/benjaminapetersen/console-operator:latest .\n# push container\ndocker push quay.io/benjaminapetersen/console-operator:latest\n# delete pod, trigger a new pull \u0026 deploy\noc delete pod console-operator --namespace openshift-console-operator\n```\nDocker containers are layered, so there should not be a significant time delay in between your pushes.\n\n#### Manifest changes\n\nIf you are making changes to the manifests, you will need to `oc apply` the manifest.\n\n#### Debugging \n\n```bash\n# inspect the clusteroperator object\noc describe clusteroperator console\n# get all events in openshift-console-operator namespace\noc get events -n openshift-console-operator\n# retrieve deployment info (including related events)\noc describe deployment console-operator -n openshift-console-operator\n# retrieve pod info (including related events)\noc describe pod console-operator-\u003csha\u003e -n openshift-console-operator\n# watch the logs of the operator pod (scale down to 1, no need for mulitple during dev)\noc logs -f console-operator-\u003csha\u003e -n openshift-console-operator\n# exec into the pod\n oc exec -it console-operator-\u003csha\u003e -- /bin/bash\n```\n\n## Tips\n\nIf you don't know where your `kubeconfig` is due to running against multiple clusters this can be handy:\n\n```bash \n# just a high number\noc whoami --loglevel=100\n# likely output will be $HOME/.kube/config \n``` \nIf you need to know information about your cluster:\n\n```bash\n# this will list all images, associated github repo, and the commit # currently running.\n# very useful to see if the image is running current code...or not.\noc adm release info --commits\n# get just the list of images \u0026 sha256 digest\noc adm release info\n# coming soon...\noc adm release extract \n```\n## Quick Starts\n\nSee the [Quick Starts README](quickstarts/README.md) for contributing console\nquick starts.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenshift%2Fconsole-operator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenshift%2Fconsole-operator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenshift%2Fconsole-operator/lists"}