Skip to content

Commit

Permalink
remove vendorized argo models and use the argo package directly
Browse files Browse the repository at this point in the history
  • Loading branch information
corymurphy committed Oct 8, 2024
1 parent 1cfe9d3 commit 5b31cfa
Show file tree
Hide file tree
Showing 245 changed files with 16 additions and 31,009 deletions.
4 changes: 2 additions & 2 deletions charts/argobot/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ apiVersion: v2
name: argobot
description: Helm chart for the corymurphy/argobot app
type: application
version: 0.9.0
appVersion: 0.9.0
version: 0.10.0
appVersion: 0.10.0
16 changes: 8 additions & 8 deletions pkg/argocd/applications_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/argoproj/argo-cd/v2/pkg/apiclient/application"
"github.com/argoproj/argo-cd/v2/pkg/apiclient/settings"
argoappv1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
models "github.com/corymurphy/argobot/pkg/argocd/models"
// argp
// models "github.com/corymurphy/argobot/pkg/argocd/models"
)

Expand Down Expand Up @@ -63,32 +63,32 @@ func (c *ApplicationsClient) Apply(app string, revision string) (string, error)
return string(body), nil
}

func (c *ApplicationsClient) List() (models.V1alpha1ApplicationList, error) {
var apps models.V1alpha1ApplicationList
func (c *ApplicationsClient) List() (*argoappv1.ApplicationList, error) {
var apps argoappv1.ApplicationList
url := fmt.Sprintf("%s/api/v1/applications", c.BaseUrl)
req, err := http.NewRequest("GET", url, nil)

if err != nil {
return apps, err
return &apps, err
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", c.Token))
resp, err := http.DefaultClient.Do(req)
if err != nil {
return apps, err
return &apps, err
}
defer resp.Body.Close()

body, err := io.ReadAll(resp.Body)
if err != nil {
return apps, err
return &apps, err
}

if err := json.Unmarshal(body, &apps); err != nil {
return apps, err
return &apps, err
}

return apps, nil
return &apps, nil
}

func (c *ApplicationsClient) Get(name string) (*argoappv1.Application, error) {
Expand Down
3 changes: 1 addition & 2 deletions pkg/argocd/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"github.com/argoproj/gitops-engine/pkg/sync/hook"
"github.com/argoproj/gitops-engine/pkg/sync/ignore"
"github.com/argoproj/gitops-engine/pkg/utils/kube"
models "github.com/corymurphy/argobot/pkg/argocd/models"
"github.com/corymurphy/argobot/pkg/logging"
"gopkg.in/yaml.v2"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
Expand All @@ -40,7 +39,7 @@ func Plan(ctx context.Context, argoSettings *settings.Settings, app *argoappv1.A
var unstructureds []*unstructured.Unstructured

for _, mfst := range target.Manifests {
obj, err := models.UnmarshalToUnstructured(mfst)
obj, err := UnmarshalToUnstructured(mfst)
if err != nil {
return plan, hasDiff, nil
}
Expand Down
6 changes: 1 addition & 5 deletions pkg/argocd/models/extensions.go → pkg/argocd/extensions.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
package models
package argocd

import (
"encoding/json"

"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
)

func (r V1alpha1ResourceDiff) LiveObject() (*unstructured.Unstructured, error) {
return UnmarshalToUnstructured(r.LiveState)
}

func UnmarshalToUnstructured(resource string) (*unstructured.Unstructured, error) {
if resource == "" || resource == "null" {
return nil, nil
Expand Down
130 changes: 0 additions & 130 deletions pkg/argocd/models/account_account.go

This file was deleted.

121 changes: 0 additions & 121 deletions pkg/argocd/models/account_accounts_list.go

This file was deleted.

50 changes: 0 additions & 50 deletions pkg/argocd/models/account_can_i_response.go

This file was deleted.

Loading

0 comments on commit 5b31cfa

Please sign in to comment.