{"id":14972006,"url":"https://github.com/glasskube/gitops-template","last_synced_at":"2025-04-04T13:08:21.650Z","repository":{"id":250275187,"uuid":"833986590","full_name":"glasskube/gitops-template","owner":"glasskube","description":"ArgoCD based GitOps template with preconfigured Glasskube Package Manager and an example application.","archived":false,"fork":false,"pushed_at":"2025-02-05T10:05:38.000Z","size":116,"stargazers_count":178,"open_issues_count":2,"forks_count":30,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-28T12:05:36.829Z","etag":null,"topics":["argocd","cloudnative-pg","gitops","glasskube","grafana","infrastructure-as-code","kube-prometheus-stack","kubernetes","minikube","postgresql","shiori","template"],"latest_commit_sha":null,"homepage":"https://glasskube.dev/docs/design/gitops/","language":null,"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/glasskube.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":"2024-07-26T07:23:15.000Z","updated_at":"2025-03-24T05:08:24.000Z","dependencies_parsed_at":"2024-08-16T21:48:02.493Z","dependency_job_id":"0003efaf-d86d-4209-ac3c-719c7f1649d8","html_url":"https://github.com/glasskube/gitops-template","commit_stats":{"total_commits":26,"total_committers":6,"mean_commits":4.333333333333333,"dds":0.5,"last_synced_commit":"60306298b56e7bb56217c887e6d69eff42bbd9cd"},"previous_names":["glasskube/glasskube-argocd-starter"],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glasskube%2Fgitops-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glasskube%2Fgitops-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glasskube%2Fgitops-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glasskube%2Fgitops-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/glasskube","download_url":"https://codeload.github.com/glasskube/gitops-template/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247182334,"owners_count":20897379,"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":["argocd","cloudnative-pg","gitops","glasskube","grafana","infrastructure-as-code","kube-prometheus-stack","kubernetes","minikube","postgresql","shiori","template"],"created_at":"2024-09-24T13:46:11.261Z","updated_at":"2025-04-04T13:08:21.630Z","avatar_url":"https://github.com/glasskube.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# gitops-template\n\nUse this repository as a template to get started with ArgoCD \u0026 Glasskube in minutes instead of hours.\n\n## Getting Started\n\n### Prerequisites\n\n#### Access to an empty Kubernetes cluster\n\nThe easiest would be creating a new [Minikube](https://minikube.sigs.k8s.io/docs/start/) cluster with:\n\n```shell\nminikube start -p gitops\nminikube addons enable ingress -p gitops \nminikube addons enable metrics-server -p gitops \n````\nGlasskube should not yet be bootstrapped in that cluster.\nEnabling the ingress and metrics-server addon ensures the demo application will be successfully installed.\n\n#### Install the Glasskube CLI\n\nMake sure to have at least [Glasskube](https://glasskube.dev/docs/getting-started/install/) version 0.16.0 installed locally.\nIf you don't, you can simply run:\n\n```shell\nbrew install glasskube/tap/glasskube\n````\n\n### Installation\n\n#### 1. Use this repository as your GitOps template\n\nCreate a GitHub repository based on this starter template (see the green \"Use this template\" button).\n\n#### 2. Replace the placeholder `repoURL` in your GitOps repository\n\nReplace the default value of `repoURL` to your repository url.\n\n- Line 12 in: [`bootstrap/glasskube-application.yaml`](bootstrap/glasskube-application.yaml#L12)\n- Lines 11, 16 and 26 in: [`bootstrap/glasskube/applicationset.yaml`](bootstrap/glasskube/applicationset.yaml#L11-L26)\n- Commit and push changes to your target git repository.\n\nYou can also execute following shell commands:\n\n```shell\nexport USERNAME=user # replace user with your github username\nexport REPO=repo # replace repo with the repository name of your git-ops repository\nsed -i 's/TODO\\/TODO/'$USERNAME'\\/'$REPO'/g' bootstrap/glasskube/applicationset.yaml\nsed -i 's/TODO\\/TODO/'$USERNAME'\\/'$REPO'/g' bootstrap/glasskube-application.yaml\ngit commit -m \"chore: configure source git repository\"\ngit push\n```\n\n#### 3. Bootstrap ArgoCD and Glasskube for your Kubernetes cluster\n\nMake sure you are connected to the right cluster and execute:\n\n```shell\nglasskube bootstrap git --url \u003cyour-repo\u003e --username \u003corg-or-username\u003e --token \u003cyour-token\u003e\n```\n\nFor public repositories you can omit `--username` and `--token`. \n\nFor private repositories, make sure to [obtain a token from GitHub](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens), \nthat has read access to the repository.\n\n#### Result\n\nAs a result, your cluster will be powered with GitOps capabilities by ArgoCD, as well as package management features by\nGlasskube. Argo manages itself, the Glasskube installation, as well as Glasskube packages – all of which you can now manage\nGitOps-style with this repo. \n\nRun `glasskube serve` to open the Glasskube UI and either open the ArgoCD UI there, or with the command `glasskube open argo-cd` –\nbut of course you can also use the Argo CLI.\nFollow the [ArgoCD docs](https://argo-cd.readthedocs.io/en/stable/getting_started/#4-login-using-the-cli) to get and reset the password to log in.\n\nNote that it might take a couple of minutes for ArgoCD to start up, and for the initial GitOps sync to happen. \n\nIn this template, for demonstration purposes we also install the `cloudnative-pg` and `kube-prometheus-stack` clusterpackage as well as a bookmarking \napplication ([shiori](https://github.com/go-shiori/shiori)), which is making use of `cloudnative-pg`. \n\n## Managing your cluster\n\nBoth CLI and UI offer features to manage your cluster according to GitOps best practices: CLI commands include `--dry-run` and `-o yaml` flags. The UI, when installed with the above `glasskube bootstrap git` command, \nwill also output the `yaml` objects which you can copy to use in your git repo, instead of applying your changes directly. \n\n### Installing packages\n\nTo install a `ClusterPackage`, e.g. `cert-manager`, use the `install` command like this:\n\n```shell\nglasskube install cert-manager --dry-run -o yaml --yes \u003e cert-manager.yaml\n```\n\nInstead of directly installing the `ClusterPackage`, this command writes the `ClusterPackage` custom resource to the `cert-manager.yaml` file, \nwhich can now be put into a new directory `packages/cert-manager/` in the git repository. \nOnce pushed to the repo, ArgoCD will pick up the changes after at most 5 minutes, create the ArgoCD `Application` wrapping \nthe Glasskube `ClusterPackage`. After that, the Glasskube operator will pick up the `ClusterPackage` and finally install it in the cluster.\n\nSimilarly, when using the Glasskube UI, one can generate the `ClusterPackage` resource by using the \"Show YAML\" button on the page of the `ClusterPackage`.\n\n### Updating packages\n\nThere are two options handling package version updates:\n* Using the `glasskube update --dry-run -o yaml` command, or the corresponding button on the Glasskube UI.\n* Integrating [renovate](https://github.com/renovatebot/renovate) into the cluster.\n\nThe first option follows the same approach as the previously shown package installation, and will be omitted here. The\ndownside of doing it that way, is that someone has to manually execute the command, even though checking for updates and\npreparing the updates to the git repository as an automatable task. Renovate is a tool allowing for exactly that kind of\ntask, as explained in the following.\n\n#### Integrating with Renovate\n\nGlasskube integrates with Renovate in order to simplify package updates.\n\nTherefore, install the [Renovate GitHub App](https://github.com/apps/renovate) and enable it for your GitOps repo.\n\nThe renovate configuration of this template repo (`renovate.json`) contains the `glasskube` manager, looking for all appearances\nof Glasskube (`Cluster`-)`Package`s in all the repo's yaml files. \n\nAs soon as one of the installed Glasskube packages uses an outdated version, renovate will open a Pull Request to update to the latest version,\nwhich you only need to approve and merge.\n\nBe aware that the Glasskube Renovate manager is not aware of the package dependencies in your cluster. As a consequence, this could lead to somebody installing a version that is not allowed \nbecause of dependency restrictions, however, the package operator will not actually install it. \nThe package status would be set to \"Failed\" with an error message indicating the dependency conflict, \nbut the previously installed version of the package would not be touched/destroyed. In such a case, you would have to manually\nintervene and roll back to the previously used package version. \n\n### Uninstalling packages\n\nTo uninstall a package or a `ClusterPackage`, simply remove the custom resource from the git repository. \n\n### Updating Glasskube\n\nWhen a new Glasskube version is available, the manifests have to be updated. Run\n\n```shell\nglasskube bootstrap --dry-run -o yaml --force \u003e bootstrap/glasskube/glasskube.yaml\n```\n\nto update the Glasskube manifests in your git repo. After reviewing and merging those changes the update will be picked up\nby ArgoCD. The `--force` flag is necessary for the command to continue manifest validation, even though failures occur. \n\n### Working with Apps\n\nThis template also contains a demo application: a bookmark manager called [shiori](https://github.com/go-shiori/shiori).\nIts manifests are defined in `apps/shiori`, which is a pattern you can follow for your own custom applications.\n\nIn a minikube environment, two manual steps are required to access the application (for more information consult the \n[minikube docs](https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/)):\n* Run `minikube addons enable ingress -p gitops`.\n* Run `minikube ip -p gitops` and add the line `\u003cyour-IP\u003e my-shiori.example` to your `/etc/hosts` file. \n\nAfter that you will be able to access the application via [http://my-shiori.example](http://my-shiori.example) in your browser. \nThe default login credentials are `shiori` / `gopher` – for more information check the [shiori docs](https://github.com/go-shiori/shiori/tree/master/docs).\n\nIn general, you can use the `apps` directory to deploy such custom applications into your cluster. Any subdirectory will be\npicked up by ArgoCD and grouped as an `Application`. \n\n### Monitoring with `kube-prometheus-stack`\n\nThis template also installs the `kube-prometheus-stack` clusterpackage, which is an easy way to get started with monitoring your cluster.\nYou can open Grafana with `glasskube open kube-prometheus-stack`. It does not come preconfigured in this example, but you \ncan easily add a nice postgres dashboard and observe the metrics of the database while you are working with the bookmarking application.\n\n#### Setting up a postgres dashboard\n\nWe are going to make use of the [cloudnativepg dashboard](https://grafana.com/grafana/dashboards/20417-cloudnativepg/).\nImport it by opening the [dashboard-import page](http://localhost:8888/dashboard/import), pasting\n[https://grafana.com/grafana/dashboards/20417-cloudnativepg/](https://grafana.com/grafana/dashboards/20417-cloudnativepg/)\ninto the first textfield, and pressing \"Load\". Use the \"Prometheus\" data source on the following screen and finish the import process.\n\n![CloudNativePG dashboard](https://github.com/user-attachments/assets/d54dcefe-535c-4812-bd80-486558f6caa4)\n\nOf course monitoring your experimental minikube cluster is a bit of an overkill, but this is simply to demonstrate how\nthese kind of cluster administration tasks can be integrated into this gitops stack. \n\n## Repository Structure\n\nInitially, this repository will come with\n* a `bootstrap` directory containing the initial/parent Argo `Application`, and the necessary Glasskube manifests\n* a `packages` directory containing the `argo-cd` cluster package. \n* an `apps` directory containing your applications. \n* the renovate configuration in `renovate.json`. \n\nGlasskube custom resources will only be picked up by Argo when being put inside the `packages` directory. Please do not\ndelete/uninstall the `argo-cd` package, as this will also remove everything else!\n\nNote that the parent application used to bootstrap (`bootstrap/glasskube-application.yaml`) will not be synced after the initial setup.\nIf you want to change something about it, you will have to change the application via argo directly. \n\n### Private Repositories\n\nYour gitops repository can be public or private (recommended).\n\nThe given username and token are [stored in a secret](https://argo-cd.readthedocs.io/en/stable/operator-manual/declarative-setup/#repositories) by the bootstrap command.\nThis secret is not commited the git repository. \n\nIf you initially chose to use a public repository, or if you need to change the repo credentials (e.g. because the token expired), you can still do so by adding or updating this secret [manually via ArgoCD](https://argo-cd.readthedocs.io/en/stable/user-guide/private-repositories/).\n\n## Upcoming Features\n\n### Improved Dependency Resolution\n\nInstalling packages with dependencies is not 100% GitOps-compatible yet, as the dependencies will be created by the operator.\nConsider this: To install a `ClusterPackage` `\u003cP\u003e` that has a dependency on `D`, one would do `glasskube install \u003cP\u003e --dry-run -o yaml`, which\nwould output the `ClusterPackage` custom resource for `\u003cP\u003e`. However, the dependency `D` will only be resolved at reconciliation time by\nthe package operator, and will therefore not be represented in the git repository at all. A temporary workaround would be to have a closer look\nat the output of the `install` command, which also shows the dependencies which will be installed and in which version. One could then\nmanually add the required packages custom resources to the git repo as well. However, this will be tackled in a future version to make the\nuser experience better, see [glasskube/glasskube#430](https://github.com/glasskube/glasskube/issues/430).\n\n## Summary\n\nWith this template repository and guide we show how Glasskube can easily be set up in a ArgoCD powered Gitops environment, \nand how efficient package management is possible with this stack. Additionally we install a web application to show how\ncustom applications can make use of the Gitops setup and Glasskube packages.\n\nThis is still in early stages and therefore has some minor shortcomings, but we will continue to improve GitOps support. \n\n### Feedback\n\nWe love feedback! Whether you are just starting out or you are a seasoned professional, we'd like to hear your thoughts, inputs and questions\nregarding this starter template and corresponding guide here, in the [glasskube/glasskube repo](https://github.com/glasskube/glasskube) or on\nour [Discord](https://discord.gg/SxH6KUCGH7). Thanks!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglasskube%2Fgitops-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fglasskube%2Fgitops-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglasskube%2Fgitops-template/lists"}