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

Make Zarf a Library #934

Merged
merged 101 commits into from
Nov 30, 2022
Merged

Make Zarf a Library #934

merged 101 commits into from
Nov 30, 2022

Conversation

jeff-mccoy
Copy link
Contributor

@jeff-mccoy jeff-mccoy commented Oct 20, 2022

This PR is a major refactor of the zarf code base primarily designed around better structure to support the current Zarf API as well as expose some key portions of Zarf as an SDK for other tools to consume. This major refactor came out of growing API needs as well as needs in #892 and the zarf-controller prototype.

Major changes:

  • Migrate all global configs used by the packager into receiver methods to avoid concurrency issues
  • Migrate from heavy fatal use to conventional error bubbling / wrapping
  • Expose core packager code as github.com/defenseunicorns/zarf/src/pkg/packager
  • Split the k8s package into github.com/defenseunicorns/zarf/src/pkg/k8s (external) and src/internal/cluster (internal)
  • Expose message, pki, and utils as github.com/defenseunicorns/zarf/src/pkg/*
  • Move the remaining src/internal/* packages (except for agent & api) into src/internal/packager/*
  • Change K8s connections to a reusable connection, except for cluster.Tunnel
  • Switch to Revive for linting
  • Introduce language file and establish basic patterns, related to Add language file support for Zarf #631
  • Add SPDX headers to all files
  • Begin work to standardize on the Uber Go Style Guide
  • Address a lot of lint issues
  • Return confirm yaml display to only show populated values

Copy link
Contributor

@Racer159 Racer159 left a comment

Choose a reason for hiding this comment

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

small things and qs

src/cmd/connect.go Show resolved Hide resolved
src/internal/packager/deploy.go Outdated Show resolved Hide resolved
src/internal/packager/common.go Show resolved Hide resolved
src/pkg/k8s/configmap.go Show resolved Hide resolved
src/pkg/k8s/namespace.go Outdated Show resolved Hide resolved
YrrepNoj
YrrepNoj previously approved these changes Nov 30, 2022
.github/codeql.yaml Show resolved Hide resolved
src/config/config.go Outdated Show resolved Hide resolved
src/pkg/packager/common.go Outdated Show resolved Hide resolved
@Racer159
Copy link
Contributor

Assuming tests still pass I am good with this now (there will be lots of cleanup though so I would argue we should give it a little time to soak on main before a release)

Copy link
Contributor

@YrrepNoj YrrepNoj left a comment

Choose a reason for hiding this comment

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

🔙 ✋

@jeff-mccoy jeff-mccoy merged commit a3d8c1f into main Nov 30, 2022
@jeff-mccoy jeff-mccoy deleted the make-zarf-a-library branch November 30, 2022 21:11
@jeff-mccoy jeff-mccoy mentioned this pull request Dec 7, 2022
jeff-mccoy added a commit that referenced this pull request Dec 7, 2022
This PR changes the behavior of the internal Zarf Registry to behave
correctly on mulit-node clusters with storage (a change in v0.22.x made
this unstable). Change list:

- Use [Pod
Affinity](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#an-example-of-a-pod-that-uses-pod-affinity)
to force pods onto the same node for proper upgrades/restarts
- Add K8s
[HPA](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/)
to increase performance of image pushes
- Add [Priority
Classes](https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/#priorityclass)
to the Zarf Agent and Zarf Registry deployments
- Add [Pod Disruption
Budget](https://kubernetes.io/docs/concepts/workloads/pods/disruptions/#pod-disruption-budgets)
for the Zarf Registry
- Add Zarf variables to support custom registry resources
requests/limits, custom PVC size, and alternatively the use of a custom
PVC
- Move the Zarf Registry chart to a local chart
- Fix a small issue with log files not being properly saved for K3s
workflows
- Fix issue from #934 with cross-platform commands
- Remove makefile config overrides and replace with `zarf-config.toml`


Fixes #1004 
Related to #1062
Noxsios pushed a commit that referenced this pull request Mar 8, 2023
This PR is a major refactor of the zarf code base primarily designed
around better structure to support the current Zarf API as well as
expose some key portions of Zarf as an SDK for other tools to consume.
This major refactor came out of growing API needs as well as needs in
#892 and the
[zarf-controller](https://github.com/defenseunicorns/zarf-controller)
prototype.

Major changes:
- Migrate all global configs used by the packager into [receiver
methods](https://medium.com/globant/go-method-receiver-pointer-vs-value-ffc5ab7acdb)
to avoid concurrency issues
- Migrate from heavy `fatal` use to conventional error bubbling /
wrapping
- Expose core packager code as
`github.com/defenseunicorns/zarf/src/pkg/packager`
- Split the k8s package into
`github.com/defenseunicorns/zarf/src/pkg/k8s` (external) and
`src/internal/cluster` (internal)
- Expose `message`, `pki`, and `utils` as
`github.com/defenseunicorns/zarf/src/pkg/*`
- Move the remaining `src/internal/*` packages (except for `agent` &
`api`) into `src/internal/packager/*`
- Change K8s connections to a reusable connection, except for
`cluster.Tunnel`
- Switch to Revive for linting
- Introduce language file and establish basic patterns, related to #631
- Add SPDX headers to all files
- Begin work to standardize on the [Uber Go Style
Guide](https://github.com/uber-go/guide/blob/master/style.md)
- Address a lot of lint issues
- Return confirm yaml display to only show populated values

Co-authored-by: Jon Perry <[email protected]>
Co-authored-by: Wayne Starr <[email protected]>
Noxsios pushed a commit that referenced this pull request Mar 8, 2023
This PR changes the behavior of the internal Zarf Registry to behave
correctly on mulit-node clusters with storage (a change in v0.22.x made
this unstable). Change list:

- Use [Pod
Affinity](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#an-example-of-a-pod-that-uses-pod-affinity)
to force pods onto the same node for proper upgrades/restarts
- Add K8s
[HPA](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/)
to increase performance of image pushes
- Add [Priority
Classes](https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/#priorityclass)
to the Zarf Agent and Zarf Registry deployments
- Add [Pod Disruption
Budget](https://kubernetes.io/docs/concepts/workloads/pods/disruptions/#pod-disruption-budgets)
for the Zarf Registry
- Add Zarf variables to support custom registry resources
requests/limits, custom PVC size, and alternatively the use of a custom
PVC
- Move the Zarf Registry chart to a local chart
- Fix a small issue with log files not being properly saved for K3s
workflows
- Fix issue from #934 with cross-platform commands
- Remove makefile config overrides and replace with `zarf-config.toml`


Fixes #1004 
Related to #1062
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.

4 participants