Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support managing Application CRD using K8S client (#140) #144

Merged
merged 2 commits into from
Jan 25, 2021

Conversation

alexmt
Copy link

@alexmt alexmt commented Jan 22, 2021

Signed-off-by: Alexander Matyushentsev [email protected]

Closes #140

PR implements proposal from #140:

  • By default image updater tries to manage Argo CD applications in the same namespace where it is running using K8S API
  • Namespace can be changed using --argocd-namespace flag
  • Updater can be switch back to Argo CD API using --applications-api argocd flag (or APPLICATIONS_API env variable).

@codecov
Copy link

codecov bot commented Jan 22, 2021

Codecov Report

Merging #144 (d748f39) into master (74e9d3f) will decrease coverage by 0.04%.
The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #144      +/-   ##
==========================================
- Coverage   68.12%   68.07%   -0.05%     
==========================================
  Files          19       19              
  Lines        1302     1322      +20     
==========================================
+ Hits          887      900      +13     
- Misses        336      340       +4     
- Partials       79       82       +3     
Impacted Files Coverage Δ
pkg/kube/kubernetes.go 80.00% <60.00%> (-3.34%) ⬇️
pkg/argocd/argocd.go 60.30% <68.75%> (+0.73%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 74e9d3f...d748f39. Read the comment docs.

@alexmt alexmt force-pushed the 140-argo-k8s-client branch 3 times, most recently from 912c196 to 23296f1 Compare January 22, 2021 23:30
@alexmt alexmt marked this pull request as ready for review January 22, 2021 23:30
@alexmt alexmt requested a review from jannfis January 22, 2021 23:42
@alexmt alexmt force-pushed the 140-argo-k8s-client branch from 23296f1 to 70e1f91 Compare January 25, 2021 19:47
Copy link
Contributor

@jannfis jannfis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @alexmt! LGTM, with just one nitpicker comment.

cmd/main.go Outdated
var argoClient argocd.ArgoCD
switch cfg.ApplicationsAPIKind {
case applicationsAPIKindK8S:
argoClient = argocd.NewK8SClient(cfg.KubeClient)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this never return an error?


// NewAPIClient creates a new API client for ArgoCD and connects to the ArgoCD
// API server.
func NewK8SClient(kubeClient *kube.KubernetesClient) ArgoCD {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be consistent with NewAPIClient, I think we should have the return value specified as (ArgoCD, error), even if we currently just return nil here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, we might need to return error in a future. Applied your suggestion.

Signed-off-by: Alexander Matyushentsev <[email protected]>
Copy link
Contributor

@jannfis jannfis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! LGTM!

@jannfis jannfis merged commit 707891a into argoproj-labs:master Jan 25, 2021
sribiere-jellysmack pushed a commit to sribiere-jellysmack/argocd-image-updater that referenced this pull request Aug 13, 2024
…s#140) (argoproj-labs#144)

* feat: support managing Application CRD using K8S client (argoproj-labs#140)

Signed-off-by: Alexander Matyushentsev <[email protected]>

* apply review notes

Signed-off-by: Alexander Matyushentsev <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support managing Application CRD using K8S client
2 participants