{"id":31358302,"url":"https://github.com/leonsteinhaeuser/openshift-gitops-cli","last_synced_at":"2025-09-26T21:58:20.203Z","repository":{"id":282740238,"uuid":"938817289","full_name":"leonsteinhaeuser/openshift-gitops-cli","owner":"leonsteinhaeuser","description":null,"archived":false,"fork":false,"pushed_at":"2025-03-16T16:25:29.000Z","size":106,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-16T17:28:52.505Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leonsteinhaeuser.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}},"created_at":"2025-02-25T14:51:13.000Z","updated_at":"2025-03-11T12:50:33.000Z","dependencies_parsed_at":"2025-03-16T17:39:22.098Z","dependency_job_id":null,"html_url":"https://github.com/leonsteinhaeuser/openshift-gitops-cli","commit_stats":null,"previous_names":["leonsteinhaeuser/openshift-gitops-cli"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/leonsteinhaeuser/openshift-gitops-cli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonsteinhaeuser%2Fopenshift-gitops-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonsteinhaeuser%2Fopenshift-gitops-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonsteinhaeuser%2Fopenshift-gitops-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonsteinhaeuser%2Fopenshift-gitops-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leonsteinhaeuser","download_url":"https://codeload.github.com/leonsteinhaeuser/openshift-gitops-cli/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonsteinhaeuser%2Fopenshift-gitops-cli/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":277149974,"owners_count":25769492,"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","status":"online","status_checked_at":"2025-09-26T02:00:09.010Z","response_time":78,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2025-09-26T21:58:17.507Z","updated_at":"2025-09-26T21:58:20.189Z","avatar_url":"https://github.com/leonsteinhaeuser.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OpenShift GitOps Cluster Bootstrap CLI\n\nThe OpenShift GitOps Cluster Bootstrap CLI is a command line tool that helps you bootstrap an OpenShift GitOps cluster. The CLI is designed to be used to bootrap the folder structure and files needed to create an OpenShift GitOps cluster using ArgoCD.\n\n## How it works\n\nWhen you run the CLI, it will ask you a series of questions to gather information about your OpenShift GitOps cluster. Let's say you want to create an OpenShift Cluster with the following information:\n\n```yaml\nEnvironment: dev\nStage: testing\nCluster name: my-cluster\n```\n\nThe first thing we need to create is the environment. For this, select the \"Manage Environment\" and next select \"Create\". The CLI will ask you several questions to gather information about the environment. For example, you can provide the name of the environment and properties. When you have provided all the information, select \"Done\". This option will lead you back to the main menu.\n\nThe next step is to create the stage. For this, select the \"Manage Stage\" option, select the \"Environment\" you just created, and answer the questions the CLI provides. For example, you can provide the name of the stage and properties. When you have provided all the information, select \"Done\". This option will lead you back to the main menu.\n\nThe last step is to create the cluster. For this, select the \"Manage Cluster\" option followed by the \"Create\" option. Select the \"Environment\" and \"Stage\" you just created and answer the questions the CLI provides. For example, you can provide the name of the cluster, addons, and properties. When you have provided all the information, select \"Done\". This option will lead you back to the main menu and create the folder structure and files needed to create the bootstrap.\n\nFor each of the steps, you will be asked if you want to add additional properties. Properties are key-value pairs that you can use to store additional information about the environment, stage, or cluster. For example, you can add properties like `region`, `zone`, `network`, etc. These properties can then be used in the templates to customize the resources that will be created. If you define the same key in the environment, stage, and cluster, the value of the highest level will be used.\n\n* For example, if you define a property called `region` in the environment and the stage, the value of the stage will be used.\n* If you define a property called `region` in the environment and the cluster, the value of the cluster will be used.\n* If you define a property called `region` in the stage and the cluster, the value of the cluster will be used.\n\nAfter you have created the environment, stage, and cluster, the CLI will create the `PROJECT.yaml` file, which contains the information about the environment, stage, and cluster. The CLI will also create the folder structure for our OpenShift cluster.\n\n```plaintext\n├── PROJECT.yaml\n├── examples\n│   ├── addons\n│   │   └── disco-operator\n│   │       ├── kustomization.yaml\n│   │       ├── manifest.yaml\n│   │       └── patch.yaml\n│   └── templates\n│       └── appofapps\n│           └── database\n│               ├── kustomization.yaml\n│               ├── manifest.yaml\n│               └── values.yaml\n└── overlays\n    └── dev                                           # The environment\n        └── dev01                                     # The stage\n            └── test01                                # The cluster\n                ├── app-of-apps\n                │   ├── kustomization.yaml\n                │   └── values.yaml\n                └── cluster-configs                   # The addon group folder\n                    └── disco-operator                # The addon folder\n                        ├── kustomization.yaml        # The kustomization file\n                        └── patch.yaml                # The patch file (imported by the kustomization file)\n```\n\n## What is an environment and stage?\n\nAn environment in terms of infrastructure is a collection of resources that share the same hardware and network. For example, you can have infrastructure at `aws`, `gcp`, `azure` or even `on-prem`. Each of these environments can be named accordingly. For example, you can have an environment called `aws` which is hosted on `aws`, an environment called `gcp` which is hosted on `gcp`, and an environment called `azure` which is hosted on `azure`.\n\nA stage is a subset of an environment. For example, you can have a `aws` environment with multiple stages like `dev`, `staging`, and `production`, and a `gcp` environment with multiple stages like `dev`, `staging`, and `production`. Each stage can have its own set of resources that are used for different purposes. For example, the `dev` stage can be used for development with unrestricted access to resources, the `staging` stage can be used for testing production-like applications, and the `production` stage can be used for running production applications with restricted access to resources.\n\n## What is a cluster?\n\nA cluster is a set of resources that are used to run an application. For example, you can have a cluster that runs a web application, a database, and a cache. A second cluster can run a web application, a database, and a kafka cluster. Each cluster can have a baseline set of resources that are used to provision the cluster. For example, a policy engine, network policies, ingress controllers, monitoring, tracing, and logging or any other resources that are needed to run the application. We call this type of resources `addons`. Addons are pre-configured resources that can be applied to a cluster to extend its functionality. During the cluster creation, you can select which addons you want to apply to the cluster.\n\n### How to create a cluster?\n\nTo create a cluster, execute the `ogc` binary and select the \"Create Cluster\" option. The CLI will ask you for the name of the `environment`, `stage`, and `cluster` name, followed by `addons` that you want to apply to the cluster and `properties` that you want to set for the cluster.\n\n### Example\n\nLet's say you want to create an OpenShift cluster with the following information:\n\n```bash\nEnvironment: dev\nStage: dev\nCluster name: my-cluster\nAddons: [kyverno, monitoring{ingress_host: monitoring.my-domain.local}]\nProperties: [gitURL: https://git.example.com/repo/name.git, gitBranch: main]\n```\n\n1) Create the environment:\n\n```bash\nuser@pc % ogc\n✔ Manage Environment\n✔ Create\nEnvironment Name: aws\nCreate Property: gitURL\nProperty Value: https://git.my-url.local\n✔ Done\n✔ Done\n```\n\n2) Create the stage:\n\n```bash\nuser@pc % ogc\n✔ Manage Stage\n✔ Create\n✔ aws\nStage Name: dev\nCreate Property: gitBranch\nProperty Value: main\n✔ Done\n```\n\n3) Create the cluster:\n\n```bash\n✔ Manage Cluster\n✔ Create\n✔ aws\n✔ dev\nCluster Name: my-cluster\n✔ Addons\n✔ monitoring\n✔ Enable\nEnable addon monitoring\n✔ Done\n✔ kyverno\n✔ Enable\nEnable addon kyverno\n✔ Done\n✔ cluster-policies\n✔ Enable\nEnable addon cluster-policies\n✔ Settings\n✔ enableNetworkPolicies\nValue: true\n✔ Done\n✔ Done\n✔ Done\n✔ Done\n✔ Done\n```\n\nWhen you have created the environment, stage, and cluster, the CLI will create the corresponding entries in the `PROJECT.yaml` and directory structure.\n\n## What is a cluster addon?\n\nA cluster addon is a set of resources that can be applied to an OpenShift cluster to extend its functionality. For example, you can create a cluster addon that installs a set of operators, CRDs, and other resources that are needed to run a specific application on the cluster. The cluster addon can be applied to the cluster using ArgoCD.\n\n### How to create a cluster addon?\n\nTo create a cluster addon, you need to create a folder with the name of the addon somewhere in the git repository. Inside the folder, you need to create a `manifest.yaml` file that contains the information about the addon.\n\n```yaml\nname: my-addon                                      # The name of the addon\nproperties:                                         # The properties define a set of key-value pairs the user has to enter during cluster creation\n  my-property:                                      # The name of the property\n    description: My property description            # The description of the property\n    type: string                                    # The type of the property (string, int, bool)\n    required: true                                  # If the property is required\n    default: my-default-value                       # The default value of the property\nfiles:                                              # The files define a set of files that will be created in the cluster folder during cluster creation\n  - values.yaml                                     # A reference to the file inside the same folder as the manifest.yaml\n  - resources/                                      # A reference to the folder inside the same folder as the manifest.yaml\n```\n\nAfter you have created the `manifest.yaml` file and the files that are needed for the addon, you can add the addon to the `PROJECT.yaml` file. To do this, execute the `ogc` binary and select the \"Add Addon\" option. The CLI will ask you for the name of the addon and the path to the folder where the addon is located. The CLI will then add the addon to the `PROJECT.yaml` file. The next time you create or update a cluster, the addon will be included in the selection of addons.\n\n### Example\n\nLet's say you want to create a cluster addon that installs the `grafana` stack on the cluster.\n\n1) Create a folder with the name of the addon:\n\n```bash\nmkdir -p examples/addons/grafana\n```\n\n2) Create all resources that are needed for the addon:\n\n```bash\ncat \u003c\u003cEOF\u003e examples/addons/grafana/values.yaml\n# https://github.com/grafana/helm-charts/blob/main/charts/grafana/values.yaml\ningress:\n  enabled: true\n  hosts:\n    - grafana.my-domain.local\nresources:\n  requests:\n    cpu: {{ .Properties.request_cpu | default \"100m\" }}\n    memory: {{ .Properties.request_memory | default \"128Mi\" }}\n  limits:\n    cpu: {{ .Properties.limit_cpu | default \"100m\" }}\n    memory: {{ .Properties.limit_memory | default \"128Mi\" }}\nEOF\n```\n\n3) Create the `manifest.yaml` file and include the values.yaml file:\n\n```bash\ncat \u003c\u003cEOF\u003e examples/addons/grafana/manifest.yaml\nname: grafana\nproperties:\n  request_cpu:\n    description: The CPU request for the grafana pod\n    type: string\n    required: false\n    default: 100m\n  request_memory:\n    description: The memory request for the grafana pod\n    type: string\n    required: false\n    default: 128Mi\n  limit_cpu:\n    description: The CPU limit for the grafana pod\n    type: string\n    required: true\n    default: 100m\n  limit_memory:\n    description: The memory limit for the grafana pod\n    type: string\n    required: true\n    default: 128Mi\nfiles:\n  - values.yaml\nEOF\n```\n\n4) Add the addon to the `PROJECT.yaml` file:\n\nThe **group** is the name of the parent folder where the addon is located. In our case, the group is called ***cluster-configs***. During the *cluster* creation, this will result in the following folder structure for the addon configs: `\u003cbasePath\u003e/\u003cenvironment\u003e/\u003cstage\u003e/\u003ccluster\u003e/cluster-configs/grafana`\n\n```bash\nuser@pc % ogc\n✔ Manage Addon\n✔ Create\nAddon Name: grafana\nShould this addon be enabled by default? [Y/N]: y\nPlease provide the path to the location of the addon (the directory must contain a manifest.yaml file): examples/addons/grafana\nCreate new group: monitoring\nAre you sure you want to create the addon? [Y/N]: y\n✔ Done\n```\n\n## Template / Addon scopes\n\nNo matter if you define an addon or a template, you always have access to the following variables:\n\n| Variable | Scope | Description |\n| --- | --- | --- |\n| `{{ .BasePath }}` | template | The configured base path to the `environment` folder |\n| `{{ .ClusterPath }}` | template | The complete path to the cluster |\n| `{{ .Environment }}` | addon, template | The environment variable returns the name of the environment we are currenlty in |\n| `{{ .Stage }}` | addon, template | The stage variable returns the name of the stage we are currently in |\n| `{{ .Cluster }}` | addon, template | The cluster variable returns the name of the cluster we are currently in |\n| `{{ .Properties.\u003ckey\u003e }}` | addon, template | The properties variable returns the value of the property with the key `\u003ckey\u003e`. The property keys in addons differ from the property keys in the template, as the addon does not currently have access to the environment, stage or cluster properties. In order for the addon to have properties available, you must define a property key in the `manifest.yaml` file. All properties defined there are then available for your addon template files. |\n| `{{ .ClusterProperties.\u003ckey\u003e }}` | addon | The cluster properties is a map that contains all properties that are defined for the cluster. |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleonsteinhaeuser%2Fopenshift-gitops-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleonsteinhaeuser%2Fopenshift-gitops-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleonsteinhaeuser%2Fopenshift-gitops-cli/lists"}