Documentation
¶
Overview ¶
Package argosim is the API server's field ownership of an Argo CD Application's automated sync switch, spec.syncPolicy.automated.enabled, for tests of code that holds it. The fake dynamic client keeps no managedFields, and the ArgoCDClaim's hold is decided by them.
Index ¶
- func ApplicationGVR() schema.GroupVersionResource
- func OwnSwitch(t testing.TB, app *unstructured.Unstructured, enabled bool, manager string, ...) *unstructured.Unstructured
- func Serve(client *dynamicfake.FakeDynamicClient, opts ...Option)
- func SwitchEntry(manager string, operation metav1.ManagedFieldsOperationType) metav1.ManagedFieldsEntry
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplicationGVR ¶
func ApplicationGVR() schema.GroupVersionResource
ApplicationGVR is Argo CD's Application.
func OwnSwitch ¶
func OwnSwitch(t testing.TB, app *unstructured.Unstructured, enabled bool, manager string, operation metav1.ManagedFieldsOperationType) *unstructured.Unstructured
OwnSwitch sets an Application's switch to enabled, owned by manager through a write of operation, as a manifest applied by something else, or a click in Argo CD's UI, leaves it.
func Serve ¶
func Serve(client *dynamicfake.FakeDynamicClient, opts ...Option)
Serve makes client serve the patches of an Application as the API server does for the switch, as measured in envtest (internal/controller/argocdclaim_apiserver_test.go):
- A write that changes the switch's value takes it from every other owner.
- An update (a merge patch) that writes the value the switch holds takes nothing.
- A server-side apply of the value it holds shares it with its owners.
- A server-side apply that leaves out a switch its manager owned gives it up, and removes it when nobody else owns it, with the syncPolicy maps a write of the switch created: a map somebody else wrote stays, even empty.
- A merge patch that sets it to null removes it, as kubectl's client-side apply does for a field its last applied manifest had.
Every other field of a merge patch is merged as a merge patch merges it. A server-side apply carries only the switch here: nothing else applies an Application in these tests. A dry run (DryRun: All) answers with the Application the write would leave, and stores nothing.
func SwitchEntry ¶
func SwitchEntry(manager string, operation metav1.ManagedFieldsOperationType) metav1.ManagedFieldsEntry
SwitchEntry is the managedFields entry of manager owning the switch, through a write of operation.
Types ¶
type Option ¶
type Option func(*config)
Option changes what Serve serves.
func WithoutSwitch ¶
func WithoutSwitch() Option
WithoutSwitch serves an Argo CD before 3.1, whose Application has no spec.syncPolicy.automated.enabled in its schema. The API server refuses a server-side apply of it, with a 500 that says "field not declared in schema", and prunes it from a merge patch, keeping the maps around it: a merge patch of it to an Application without an automated block leaves automated: {}, which is automated sync on.