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

Refactor for argocd #160

Merged
merged 5 commits into from
Aug 30, 2024
Merged

Refactor for argocd #160

merged 5 commits into from
Aug 30, 2024

Conversation

marcelldls
Copy link
Collaborator

Touch up front end:

  • Use typer to handle env variables (Show in --help and do type casting/sanitising for things like export ENV_VARIABLE=false to read as boolean false)
  • Dynamic command hiding based on chosen backend and commands implemented
  • Consistant flow of user inputs for commands through backend rather than a mix of typer ctx, env reads, globals - to support validation, sanitising
  • Separate frontend (typer) from backend (particular: error handling)
  • Lazy import of monitor to reduce load time for everytime ec is called

Backend work:

  • Remove docker ("local" backend) and related
  • Implement an argocd backend
  • Remove handling of symlink charts for helm commands and replace with shared helm values
  • Allow changes to shared files to show as a new revision of a service
  • Only interact with "ec-services" - These are statefulsets which are tagged "ec_service=true"
  • Use custom errors over "typer error" so that targetted error handling can be done
  • Add schema validation and type hinting for polars schemas to interface more clear
  • Add tempfile context manager for file retension at debug and handle case of multiple temp files

Touch up front end:
- Use typer to handle env variables (Show in --help and do type casting/sanitising for things like export ENV_VARIABLE=false to read as boolean false)
- Dynamic command hiding based on chosen backend and commands implemented
- Consistant flow of user inputs for commands through backend rather than a mix of typer ctx, env reads, globals - to support validation, sanitising
- Separate frontend (typer) from backend (particular: error handling)
- Lazy import of monitor to reduce load time for everytime ec is called

Backend work:
- Remove docker ("local" backend) and related
- Implement an argocd backend
- Remove handling of symlink charts for helm commands and replace with shared helm values
- Allow changes to shared files to show as a new revision of a service
- Only interact with "ec-services" - These are statefulsets which are tagged "ec_service=true"
- Use custom errors over "typer error" so that targetted error handling can be done
- Add schema validation and type hinting for polars schemas to interface more clear
- Add tempfile context manager for file retension at debug and handle case of multiple temp files
@marcelldls
Copy link
Collaborator Author

marcelldls commented Aug 28, 2024

After this is merged I will proceed with the change the name of the project to ec-cli

Copy link

codecov bot commented Aug 28, 2024

Codecov Report

Attention: Patch coverage is 79.37008% with 131 lines in your changes missing coverage. Please review.

Project coverage is 80.62%. Comparing base (302c4fd) to head (2c84c89).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/edge_containers_cli/shell.py 28.07% 41 Missing ⚠️
src/edge_containers_cli/autocomplete.py 21.62% 29 Missing ⚠️
src/edge_containers_cli/cmds/commands.py 83.56% 12 Missing ⚠️
src/edge_containers_cli/utils.py 75.51% 12 Missing ⚠️
src/edge_containers_cli/cmds/argo_commands.py 87.77% 11 Missing ⚠️
src/edge_containers_cli/cli.py 89.87% 8 Missing ⚠️
src/edge_containers_cli/cmds/k8s_commands.py 88.88% 8 Missing ⚠️
src/edge_containers_cli/git.py 90.19% 5 Missing ⚠️
src/edge_containers_cli/backend.py 92.50% 3 Missing ⚠️
src/edge_containers_cli/cmds/helm.py 92.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #160      +/-   ##
==========================================
- Coverage   84.68%   80.62%   -4.07%     
==========================================
  Files          15       15              
  Lines         862      805      -57     
==========================================
- Hits          730      649      -81     
- Misses        132      156      +24     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@gilesknap gilesknap left a comment

Choose a reason for hiding this comment

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

General

I just tried this out on my personal namespace and its working beautifully. Even the auto complete is now nippy.

I also tried it against the argocd beamline p47 and all was good there too.

A couple of things:

  • I'm not sure that we need a verification question for all deploy commands. Previouslyi had it only for deploy-local - open to discuss this.
  • the services-template-helm and deployment-template-argocd both incorrectly set the graylog URL because that has changed. It needs to drop the '2' from graylog2.xxxxx
  • the templates also need to put single quotes around the graylog URL otherwise zsh does not like it.

ArgoCD

I think this is working great as we originally specified. So great work.

However I'm feeling like it is a bit of a downgrade from helm. Things I don't like are:

  • the ec_services flag means that I can't see things other than IOCs with ec - maybe we should review the enabled/removed discussion
  • loss of functionality - attach is a pretty important thing to have for an IOC and you need to go work out how to do that with kubectl

There is also an argument to say - let ec be for end users and let engineers know what they are doing and use kubectl. So if this argument wins out then we are already good to go (but maybe should also hobble the helm based one for consistency?)

@gilesknap
Copy link
Member

Oh and I also tried it out on a k3s namespace.

I had issues that the PVCS were not getting created but that was nothing to do with you. So the helm template and ec work great for this use case too.

Copy link
Member

@gilesknap gilesknap left a comment

Choose a reason for hiding this comment

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

I trust your judgement on this one.

@marcelldls
Copy link
Collaborator Author

To clarify - Because we got rid of a lot of the complexity of the "local backend", the system tests no longer did very much & also started feeling over engineered with the minikube action

@marcelldls marcelldls merged commit 748e9a7 into main Aug 30, 2024
15 of 17 checks passed
@marcelldls marcelldls deleted the refactor-argocd branch September 10, 2024 10:20
@marcelldls marcelldls mentioned this pull request Oct 8, 2024
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.

2 participants