kubebb / core

A declarative component lifecycle management platform
https://kubebb.github.io/website
Apache License 2.0
8 stars 9 forks source link

feat: add displayName to component in status #301

Closed bjwswang closed 1 year ago

bjwswang commented 1 year ago

What type of PR is this?

/kind feat

What this PR does / why we need it

Which issue(s) this PR fixes

Fixes #300

Special notes for your reviewer

For HTTP/HTTPS repo

For a component with this Chat.yaml

apiVersion: v2
name: core
annotations:
  core.kubebb.k8s.com.cn/displayname: "内核"
description: Kubebb Core provides core implementations on Component Lifecycle Management.Our design and development follows operator pattern which extends kubernetes APIs.
type: application
version: v0.1.11
appVersion: v0.1.4
icon: https://avatars.githubusercontent.com/u/85277200
keywords:
  - repository
  - helm
  - lifecycle-management
sources:
  - https://github.com/kubebb/core
maintainers:
  - name: bjwswang
    url: https://github.com/bjwswang
  - name: Abirdcfly
    url: https://github.com/Abirdcfly
  - name: 0xff-dev
    url: https://github.com/0xff-dev

The component synced by repository watcher will be

apiVersion: core.kubebb.k8s.com.cn/v1alpha1
kind: Component
metadata:
  creationTimestamp: "2023-08-28T02:31:36Z"
  generation: 1
  labels:
    kubebb.component.repository: chartmuseum
  name: chartmuseum.core
  namespace: kubebb-system
  ownerReferences:
  - apiVersion: core.kubebb.k8s.com.cn/v1alpha1
    kind: Repository
    name: chartmuseum
    uid: dde61679-dac8-4b20-8702-5818ceb749dc
  resourceVersion: "375033"
  uid: 73ecdd02-1cc6-47ae-ab3a-c8c66bfd1811
spec: {}
status:
  description: Kubebb Core provides core implementations on Component Lifecycle Management.Our
    design and development follows operator pattern which extends kubernetes APIs.
  displayName: 内核
  icon: https://avatars.githubusercontent.com/u/85277200
  keywords:
  - repository
  - helm
  - lifecycle-management
  maintainers:
  - name: Abirdcfly
    url: https://github.com/Abirdcfly
  - name: 0xff-dev
    url: https://github.com/0xff-dev
  - name: bjwswang
    url: https://github.com/bjwswang
  name: core
  repository:
    apiVersion: core.kubebb.k8s.com.cn/v1alpha1
    kind: Repository
    name: chartmuseum
    namespace: kubebb-system
    uid: dde61679-dac8-4b20-8702-5818ceb749dc
  sources:
  - https://github.com/kubebb/core
  versions:
  - annotations:
      core.kubebb.k8s.com.cn/displayname: 内核
    appVersion: v0.1.4
    createdAt: "2023-08-28T02:30:31Z"
    deprecated: false
    digest: c79d061434011b6815c8c8cb4013bc16233ebb6c58c0fd3ec59cee13cf7eaa4c
    updatedAt: "2023-08-28T02:31:36Z"
    version: v0.1.11

When there is a new version detected with different displayname, the component will keep the latest one.

apiVersion: core.kubebb.k8s.com.cn/v1alpha1
kind: Component
metadata:
  creationTimestamp: "2023-08-28T02:31:36Z"
  generation: 1
  labels:
    kubebb.component.repository: chartmuseum
  name: chartmuseum.core
  namespace: kubebb-system
  ownerReferences:
  - apiVersion: core.kubebb.k8s.com.cn/v1alpha1
    kind: Repository
    name: chartmuseum
    uid: dde61679-dac8-4b20-8702-5818ceb749dc
  resourceVersion: "379412"
  uid: 73ecdd02-1cc6-47ae-ab3a-c8c66bfd1811
spec: {}
status:
  description: Kubebb Core provides core implementations on Component Lifecycle Management.Our
    design and development follows operator pattern which extends kubernetes APIs.
  displayName: 内核升级版
  icon: https://avatars.githubusercontent.com/u/85277200
  keywords:
  - repository
  - helm
  - lifecycle-management
  maintainers:
  - name: bjwswang
    url: https://github.com/bjwswang
  - name: Abirdcfly
    url: https://github.com/Abirdcfly
  - name: 0xff-dev
    url: https://github.com/0xff-dev
  name: core
  repository:
    apiVersion: core.kubebb.k8s.com.cn/v1alpha1
    kind: Repository
    name: chartmuseum
    namespace: kubebb-system
    uid: dde61679-dac8-4b20-8702-5818ceb749dc
  sources:
  - https://github.com/kubebb/core
  versions:
  - annotations:
      core.kubebb.k8s.com.cn/displayname: 内核升级版
    appVersion: v0.1.4
    createdAt: "2023-08-28T02:48:14Z"
    deprecated: false
    digest: 3e8c9fa7f6ce5c25c0f76536e93c06732051a35f109469f71f3d1e57e6f593c6
    updatedAt: "2023-08-28T02:49:37Z"
    version: v0.1.12
  - annotations:
      core.kubebb.k8s.com.cn/displayname: 内核
    appVersion: v0.1.4
    createdAt: "2023-08-28T02:30:31Z"
    deprecated: false
    digest: c79d061434011b6815c8c8cb4013bc16233ebb6c58c0fd3ec59cee13cf7eaa4c
    updatedAt: "2023-08-28T02:49:37Z"
    version: v0.1.11
codecov[bot] commented 1 year ago

Codecov Report

Merging #301 (c76e21e) into main (a1e26aa) will not change coverage. The diff coverage is n/a.

@@           Coverage Diff           @@
##             main     #301   +/-   ##
=======================================
  Coverage   25.92%   25.92%           
=======================================
  Files          35       35           
  Lines        3144     3144           
=======================================
  Hits          815      815           
  Misses       2277     2277           
  Partials       52       52           
Files Changed Coverage Δ
api/v1alpha1/common.go 71.95% <ø> (ø)
api/v1alpha1/component_types.go 100.00% <ø> (ø)

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

bjwswang commented 1 year ago

OCI not tested yet

bjwswang commented 1 year ago

@Abirdcfly @0xff-dev pls review. OCI repo do not support upgrade yet,so I can't test this casedisplayName update upon different version