Skip to content
This repository was archived by the owner on Jun 14, 2023. It is now read-only.

feat: add gitopsapi delete operation#45

Closed
Kaitou786 wants to merge 6 commits intomasterfrom
delete-object
Closed

feat: add gitopsapi delete operation#45
Kaitou786 wants to merge 6 commits intomasterfrom
delete-object

Conversation

@Kaitou786
Copy link
Copy Markdown
Contributor

@Kaitou786 Kaitou786 commented Jul 14, 2021

Description

Exposed a different endpoint starting with /_delete to let the server know that the request is for delete object

Breaking Change

  • Yes
  • No

Testing Notes

Created a gitopsapi object and sent a post request with a object to the delete endpoint to see it gets deleted
GitOpsApi object used:

apiVersion: git.flanksource.com/v1
kind: GitopsAPI
metadata:
  name: gitopsapi-sample
spec:
  gitRepository: https://github.com/Kaitou786/test-gitops-api.git
  kustomization: clusters/dev01/kustomization.yaml
  secretRef:
    name: git-operator-test
  tokenRef:
    name: token
  branch: random
  searchPath: "clusters/"
  pullRequest:
    body: "my test PR"
    title: "some awesome title"

The post data

{
  "apiVersion": "acmp.corp/v1",
  "kind": "NamespaceRequest",
  "metadata": {
    "name": "tenant3",
    "annotations": {
      "a": "b"
    },
    "labels": {
      "c": "d"
    }
  },
  "spec": {
    "memory": 10,
    "cluster": "dev01"
  },
  "cluster": "dev02"
}

The Curl request:

 curl -X POST 'localhost:8888/_delete/default/gitopsapi-sample/mypassword' -d @data.json

See my testing PR: Kaitou786/test-gitops-api#15
How you can replicate my testing:
How can the reviewer validate this PR?

Links

Issues links or other related resources

@Kaitou786 Kaitou786 requested a review from moshloop July 14, 2021 12:07
@Kaitou786 Kaitou786 marked this pull request as draft July 14, 2021 12:27
@Kaitou786 Kaitou786 marked this pull request as ready for review July 14, 2021 13:39
Comment thread controllers/gitopsapi_controller.go Outdated
Comment thread controllers/gitopsapi_controller.go Outdated
@moshloop
Copy link
Copy Markdown
Member

Can we also add an e2e ?

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Jul 16, 2021

CLA assistant check
All committers have signed the CLA.

@Kaitou786 Kaitou786 force-pushed the delete-object branch 4 times, most recently from 9540eb6 to 416c619 Compare July 16, 2021 14:16
@Kaitou786 Kaitou786 marked this pull request as draft July 16, 2021 15:09
@Kaitou786 Kaitou786 marked this pull request as ready for review July 16, 2021 16:55
@Kaitou786
Copy link
Copy Markdown
Contributor Author

@Kaitou786 Kaitou786 requested a review from moshloop July 16, 2021 16:56
@Kaitou786
Copy link
Copy Markdown
Contributor Author

Refactored a bit with some more functions. Not sure but let me know about this approach... PRs with this approach:
flanksource/git-operator-test#349
flanksource/git-operator-test#350
flanksource/git-operator-test#351

Comment thread controllers/gitopsapi_controller.go Outdated
@Kaitou786
Copy link
Copy Markdown
Contributor Author

subset of #46

@moshloop moshloop closed this Jul 25, 2021
@Kaitou786 Kaitou786 deleted the delete-object branch July 25, 2021 15:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants