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

Add Metadata CRD #712

Merged
merged 6 commits into from
Apr 30, 2024
Merged

Add Metadata CRD #712

merged 6 commits into from
Apr 30, 2024

Conversation

anmazzotti
Copy link
Contributor

Closes #711

As suggested by @aalves08 I created a new UISettings CRD that we can use to propagate the appVersion and annotations from charts.

kubectl -n cattle-elemental-system get uisettings -o yaml
apiVersion: v1
items:
  - apiVersion: elemental.cattle.io/v1beta1
    kind: UISettings
    metadata:
      annotations:
        meta.helm.sh/release-name: elemental-operator
        meta.helm.sh/release-namespace: cattle-elemental-system
      creationTimestamp: "2024-04-23T12:39:11Z"
      generation: 1
      labels:
        app.kubernetes.io/managed-by: Helm
      name: elemental-operator
      namespace: cattle-elemental-system
      resourceVersion: "7104"
      uid: 4f3d97e6-dd73-4ad1-aca2-3436d81f97ab
    spec:
      annotations:
        catalog.cattle.io/auto-install: elemental-operator-crds=match
        catalog.cattle.io/certified: rancher
        catalog.cattle.io/display-name: Elemental
        catalog.cattle.io/kube-version: '>= 1.23.0-0'
        catalog.cattle.io/namespace: cattle-elemental-system
        catalog.cattle.io/os: linux
        catalog.cattle.io/permits-os: linux
        catalog.cattle.io/provides-gvr: elemental.cattle.io/v1beta1
        catalog.cattle.io/rancher-version: '>= 2.7.0-0'
        catalog.cattle.io/release-name: elemental-operator
        catalog.cattle.io/scope: management
        catalog.cattle.io/type: cluster-tool
        catalog.cattle.io/upstream-version: v1.6.0-dev
      appVersion: v1.6.0-dev

Copy link

codecov bot commented Apr 23, 2024

Codecov Report

Attention: Patch coverage is 3.44828% with 56 lines in your changes are missing coverage. Please review.

Project coverage is 57.38%. Comparing base (f07a038) to head (9fdd9e7).
Report is 76 commits behind head on main.

Files Patch % Lines
api/v1beta1/zz_generated.deepcopy.go 0.00% 56 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #712      +/-   ##
==========================================
+ Coverage   53.79%   57.38%   +3.58%     
==========================================
  Files          40       41       +1     
  Lines        6073     5031    -1042     
==========================================
- Hits         3267     2887     -380     
+ Misses       2519     1835     -684     
- Partials      287      309      +22     

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

@aalves08
Copy link

Also, with this work moving forward, we might ditch what @fgiudici did here: #691 (sorry about that 😢 )

So that you guys don't need to maintain this on two different places.

FYI @davidcassany

@anmazzotti
Copy link
Contributor Author

Also, with this work moving forward, we might ditch what @fgiudici did here: #691 (sorry about that 😢 )

So that you guys don't need to maintain this on two different places.

FYI @davidcassany

No problem at all. Labels are gone now, thank you for pointing out.

Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>
Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>
Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>
Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>
Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>
@fgiudici
Copy link
Member

Thanks Andrea, the PR is pretty good 👍🏼
While looking at the code I realized this is something we will likely never change or drop. There are two things I would consider to change:

  1. the kind name: "UISettings" refers to what we want the resource to be used for but not what it actually contains. I would consider something more generic and not related to UI, like "Version", "Versioning", "Metadata", ... you name it.
  2. having "annotations" in the spec: why not having a dummy object then, with no spec at all, and just use the metadata annotations?

Something like:

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: versions.elemental.cattle.io
spec:
  group: elemental.cattle.io
  versions:
    - name: v1beta1
      served: true
      storage: true
      schema:
        # openAPIV3Schema is the schema for validating custom objects.
        openAPIV3Schema:
          type: object
  scope: Namespaced
  names:
    plural: versions
    singular: version
    kind: Version

Otherwise, I would then really go with a "UISettings" or "UIFeatures" CRD, but then in the spec I would put a "features" map[string]bool to enable (or disable) specific features of the UI extension.

@anmazzotti
Copy link
Contributor Author

  1. Metadata

I raised this point with the team and we decided for Metadata as it's generic enough.

Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>
@anmazzotti anmazzotti changed the title Add uisettings crd Add Metadata CRD Apr 25, 2024
Copy link
Member

@fgiudici fgiudici left a comment

Choose a reason for hiding this comment

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

LGTM

@anmazzotti anmazzotti merged commit 8038dc6 into rancher:main Apr 30, 2024
26 checks passed
anmazzotti added a commit to anmazzotti/elemental-operator that referenced this pull request Apr 30, 2024
* Add Metadata CRD

Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>
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.

Wrong default cloud config file with standard user
3 participants