open-gitops / project

Repository for top-level information about the OpenGitOps project
https://opengitops.dev/
Other
888 stars 36 forks source link

How can I CRUD my configuration when work with my GitOps (IaC) #47

Closed s304981561 closed 2 years ago

s304981561 commented 2 years ago

Since I have done some IaC works, all of my App configurations are stored in a gitlab repository. But how can i query/ update these configurations in gitlab just like I query or update configurations in DB before?

s304981561 commented 2 years ago

We has a sever named BaselineManage, which manages configurations of Apps and stores configs in DB, and we provide api such as Update/ Query to each team who wanna update App configuration. However, we use git repo as storage, then the Update/ Query can't access git files just like update or query Database.

lloydchang commented 2 years ago

@s304981561 You may be misunderstanding what GitOps is, and misunderstanding what Git is.

GitOps, Git, SQL databases are very different things with very different shapes. They aren't drop-in replacements for each other at all.

Hypothetically as a thought exercise with incorrect assumptions, if you still want to pattern match very different things of very different shapes, then GitLab APIs are at https://docs.gitlab.com/ee/api/commits.html

Create https://docs.gitlab.com/ee/api/commits.html#create-a-commit-with-multiple-files-and-actions

Read via Get https://docs.gitlab.com/ee/api/commits.html#get-a-single-commit

Update: Not Applicable A Git commit is immutable, so you can't update a Git commit by default.

Delete: Not Applicable A Git commit is immutable, so you can't delete a Git commit by default.

In extraordinary circumstances when you need to update and delete Git commits, then there are tools such as https://rtyley.github.io/bfg-repo-cleaner/

I hope the above details help explain why you may be misunderstanding GitOps, Git, SQL databases.

s304981561 commented 2 years ago

@s304981561 You may be misunderstanding what GitOps is, and misunderstanding what Git is.

GitOps, Git, SQL databases are very different things with very different shapes. They aren't drop-in replacements for each other at all.

Hypothetically as a thought exercise with incorrect assumptions, if you still want to pattern match very different things of very different shapes, then GitLab APIs are at https://docs.gitlab.com/ee/api/commits.html

Create https://docs.gitlab.com/ee/api/commits.html#create-a-commit-with-multiple-files-and-actions

Read via Get https://docs.gitlab.com/ee/api/commits.html#get-a-single-commit

Update: Not Applicable A Git commit is immutable, so you can't update a Git commit by default.

Delete: Not Applicable A Git commit is immutable, so you can't delete a Git commit by default.

In extraordinary circumstances when you need to update and delete Git commits, then there are tools such as https://rtyley.github.io/bfg-repo-cleaner/

I hope the above details help explain why you may be misunderstanding GitOps, Git, SQL databases.

Thanks for your reply, lloydchang. Truly I should not try to replace them with one another. Actually what I wanna ask is that when we use GitOps, how can we commit our change to the Git repo?

For example, we can Clone the repo to local , edit files, and Commit the files and finally Push the commit to the Git repo. Also we can use Gitlab or GitHub API to make a Commit. In my case, GitOps is just an implement of CI CD PaaS platform. I also provide APIs to my customers who can update there APP configs with APIs I provide and they never know I store their configs in the Git and apply the config to cluster by GitOps flow.

So my problem is how can I abstract Git(gitlab or github) APIs to another group APIs, which my customers can use to update their images, replicas, ports and so on. By the way, I use a template language like CueLang to do describe configs in the git.

lloydchang commented 2 years ago

@s304981561 asked:

When we use GitOps, how can we commit our change to the Git repo? In my case, GitOps is just an implement of CI CD PaaS platform.

You would need ask the author(s) of your CI/CD PaaS for support.

If you authored your own CI/CD PaaS, then you can try reading the source code of Argo CD, Carvel, Flux, PipeCD, etc. as comparisons & contrasts.

lloydchang commented 2 years ago

@s304981561 If the above replies are satisfactory, then would you kindly close this issue? If not, then please clarify your additional "How can ..." questions. Thank you.