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

chore: v1 api #544

Merged
merged 12 commits into from
Jan 6, 2023
Merged

chore: v1 api #544

merged 12 commits into from
Jan 6, 2023

Commits on Jan 6, 2023

  1. Create v1 api

    In order to create the v1 api for eraser, a number of additional changes
    had to be made.
    
    Our eraser-tooling image had to be modified to include the
    `conversion-gen` tool. This is to generate type conversions between the
    older `v1alpha1` API and the newer `v1`.
    
    To facilitate conversion between the two, an `unversioned` api was
    created. This becomes a common hub between `v1` and `v1alpha1` and
    facilitates conversion. It also makes it easier for our code: with the
    `unversioned` api, we no longer need to update large swaths of code when
    a new api version is introduced.
    
    In order to get the `conversion-gen` tool to work, I needed to add
    several magic comments throughout the api code. Most importantly, I
    needed to add a `doc.go` file to each of the api version directories.
    `conversion-gen` looks for this file and will not work without it. Above
    the package name in those files, I added the following two magic
    comments:
    
    ```
    +// +k8s:conversion-gen=github.com/Azure/eraser/api/unversioned
    +// -external-types=github.com/Azure/eraser/api/v1
    ```
    
    This tells `conversion-gen` to use the `unversioned` api as the
    conversion hub.
    
    To skip kubebuilder processing the `unversioned` api,
    `+kubebuilder:skip` had to be added before the package declaration. To
    specify which api version should be stored in etcd, the
    `+kubebuilder:storageversion` comment was added to the `v1` types. In
    addition, `kubebuilder:deprecatedversion:warning="v1alpha1 of the eraser API has been deprecated"`
    was added to the `v1alpha1` API in order to warn the user to upgrade.
    
    In the `groupversion_info.go` file of each version directory, I had to
    add the line
    
    ```go
    localSchemeBuilder = runtime.NewSchemeBuilder(SchemeBuilder.AddToScheme)
    ```
    
    To be perfectly honest, I'm not sure what this does, but it is required
    for the `conversion-gen` process to generate working code.
    
    Finally, a new file was added to `test/e2e/test-data` which deploys an
    imagelist using the new API version. One of the tests was updated to use
    this file instead.
    
    Signed-off-by: Peter Engelbert <pmengelbert@gmail.com>
    pmengelbert committed Jan 6, 2023
    Configuration menu
    Copy the full SHA
    0ae1a78 View commit details
    Browse the repository at this point in the history
  2. Re-run generation and make manifests

    Signed-off-by: Peter Engelbert <pmengelbert@gmail.com>
    pmengelbert committed Jan 6, 2023
    Configuration menu
    Copy the full SHA
    55c5f74 View commit details
    Browse the repository at this point in the history
  3. Remove unused lines

    Signed-off-by: Peter Engelbert <pmengelbert@gmail.com>
    pmengelbert committed Jan 6, 2023
    Configuration menu
    Copy the full SHA
    9080f33 View commit details
    Browse the repository at this point in the history
  4. For now, use --server-side to circumvent CRD size problems

    Signed-off-by: Peter Engelbert <pmengelbert@gmail.com>
    pmengelbert committed Jan 6, 2023
    Configuration menu
    Copy the full SHA
    661c9fb View commit details
    Browse the repository at this point in the history
  5. Rebase on PodTemplate changes (eraser-dev#555) and regenerate

    Signed-off-by: Peter Engelbert <pmengelbert@gmail.com>
    pmengelbert committed Jan 6, 2023
    Configuration menu
    Copy the full SHA
    b50ac66 View commit details
    Browse the repository at this point in the history
  6. Remove ImageJobSpec everywhere

    Signed-off-by: Peter Engelbert <pmengelbert@gmail.com>
    pmengelbert committed Jan 6, 2023
    Configuration menu
    Copy the full SHA
    11bdd8d View commit details
    Browse the repository at this point in the history
  7. Address linter concerns

    Signed-off-by: Peter Engelbert <pmengelbert@gmail.com>
    pmengelbert committed Jan 6, 2023
    Configuration menu
    Copy the full SHA
    957bd84 View commit details
    Browse the repository at this point in the history
  8. Add empty package

    In order to avoid changing the Makefile every time  a new version is
    added, add an empty package to the `./api` directory in order to use
    the `...` wildcard.
    
    Signed-off-by: Peter Engelbert <pmengelbert@gmail.com>
    pmengelbert committed Jan 6, 2023
    Configuration menu
    Copy the full SHA
    e676d59 View commit details
    Browse the repository at this point in the history
  9. Remove --server-side flag from Makefile

    This flag will no longer be needed, because we have reduced the size of
    the CRDs.
    
    Signed-off-by: Peter Engelbert <pmengelbert@gmail.com>
    pmengelbert committed Jan 6, 2023
    Configuration menu
    Copy the full SHA
    f16077c View commit details
    Browse the repository at this point in the history
  10. Remove --server-side flag in Makefile (again)

    Signed-off-by: Peter Engelbert <pmengelbert@gmail.com>
    pmengelbert committed Jan 6, 2023
    Configuration menu
    Copy the full SHA
    a788bde View commit details
    Browse the repository at this point in the history
  11. Instruct user to migrate to v1 in deprecation warning

    Signed-off-by: Peter Engelbert <pmengelbert@gmail.com>
    pmengelbert committed Jan 6, 2023
    Configuration menu
    Copy the full SHA
    d660b13 View commit details
    Browse the repository at this point in the history
  12. Re-generate manifests and codegen after rebasing

    Signed-off-by: Peter Engelbert <pmengelbert@gmail.com>
    pmengelbert committed Jan 6, 2023
    Configuration menu
    Copy the full SHA
    bbfd528 View commit details
    Browse the repository at this point in the history