Code Monkey home page Code Monkey logo

clusterpedia's Issues

未来规划

Whatever You Want

0.4 中发布的新功能

  1. 多个 PediaCluster 引用相同的资源同步配置
  2. 自动发现多云平台纳管的集群,并且自动同步这些被管集群内的资源
  3. Any Collection Resources,用户可以通过传递 groups 和 resources 参数,来查询任意一组类型的资源

详情

  1. 多个 PediaCluster 使用相同的资源同步配置,修改同步的资源时只需要更新引用的 ClusterSyncResources 即可

已完成: clusterpedia-io#184

定义并创建 ClusterSyncResources

apiVersion: cluster.clusterpedia.io/v1alpha2
kind: ClusterSyncResources
metadata:
  name: base
spec:
  syncResources:
    - group: ""
      resources:
        - pods

在 PediaCluster 的 .spec.syncResourcesRefName 字段设置 ClusterSyncResources 的名字

apiVersion: cluster.clusterpedia.io/v1alpha2
kind: PediaCluster
metadata:
  name: cluster-example
spec:
  apiserver: "https://10.30.43.43:6443"
  caData:
  tokenData:
  certData:
  keyData:
  syncResourcesRefName: base
  1. 自动发现多云平台纳管的集群,并且自动同步这些被管集群内的资源

issue: clusterpedia-io#185

实现自动发现多云平台纳管的集群,核心就是将代表被纳管集群的 CR 转换为 PediaCluster

我们需要使用两个新的自定义资源:

ClusterImportPolicy 需要定义以下事情:

  • 需要转换为 PediaCluster 资源的 CR 类型
  • 转换过程中涉及到的其他资源
  • 创建(更新) PediaCluster 的模版
  • 什么时候触发创建(删除) PediaCluster
apiVersion: policy.clusterpedia.io/v1alpha1
kind: ClusterImportPolicy
metadata:
  name: karmada
spec:
  source:
    group: "cluster.karmada.io"
    versions: []
    resource: clusters
  references:
    - group: ""
      resource: secrets
      namespaceTemplate: "{{ .source.spec.secretRef.namespace }}"
      nameTemplate: "{{ .source.spec.secretRef.name }}"
      key: secret
  nameTemplate: 'karmada-{{ .source.metadata.name }}'
  template: |
    spec:
      apiserver: "{{ .source.spec.apiEndpoint }}"
      tokenData: "{{ .references.secret.data.token }}"
      caData: "{{ .references.secret.data.caBundle }}"
      syncResources:
        - group: ""
          resources:
            - "pods"
  creationCondition: |
    {{ if ne .source.spec.apiEndpoint "" }}
      {{ range .source.status.conditions }}
        {{ if eq .type "Ready" }}
          {{ if eq .status "True" }} true {{ end }}
        {{ end }}
      {{ end }}
    {{ end }}

模版字段额外支持 70 多种模版函数(通过 https://github.com/Masterminds/sprig)

  • .spec.source 中,定义了需要自动发现的资源类型
  • .spec.references 中,后面的项可以引用前面的项。
  • .spec.nameTemplate 定义创建的 PediaCluster 的名称模版
  • .spec.template 定义了 PediaCluster 创建和更新的资源模版,更新时只更新集群鉴权和认证相关的字段
  • .spec.createCondition 定义了什么时候可以创建 PediaCluster

[未实现] .spec.deletedCondition 定义了什么时候删除 PediaCluster,默认为 source 被删除后同步删除 PediaCluster

后续优化

  • 增加更多关于字段的校验
  • 更加友好的 kubectl get pediaclusterlifecycle and kubectl get clusterimportlifecycle printing
  • adminKubeConfigTemplate 功能,避免提供给 PediaCluster 过高的权限
  • UpdationTemplate 当前只会更新 PediaCluster 的认证鉴权相关字段,UpdationTemplate 允许定义更新模版
  • DeletionCondition 某些场景下,可能可以提前移除 PediaCluster (该功能需要更多讨论)
  1. Any Collection Resources 用户可以通过传递 groups 和 resources 参数,来查询任意一组类型的资源

关于 Collection Resources 的自定义查询有两个方案

  • 新增 Any Collection Resources,用户传递 groupsresources 参数指定一组查询的资源类型
  • 自定义 Collection Resources, kubectl edit collectionresources workloads 或者 kubectl create collectionresources 来修改或者新建 collectionresources
$ kubectl get collectionresources
NAME            RESOURCES
any             *
workloads       deployments.apps,daemonsets.apps,statefulsets.apps
kuberesources   *,*.admission.k8s.io,*.admissionregistration.k8s.io,*.apiextensions.k8s.io,*.apps,*.authentication.k8s.io,*.authorization.k8s.io,*.autoscaling,*.batch,*.certificates.k8s.io,*.coordination.k8s.io,*.discovery.k8s.io,*.events.k8s.io,*.extensions,*.flowcontrol.apiserver.k8s.io,*.imagepolicy.k8s.io,*.internal.apiserver.k8s.io,*.networking.k8s.io,*.node.k8s.io,*.policy,*.rbac.authorization.k8s.io,*.scheduling.k8s.io,*.storage.k8s.io

$ kubectl get --raw="/apis/clusterpedia.io/v1beta1/collectionresources/workloads?groups=apps,cert-manager.io/v1" | jq
  • groups 指定一组资源组,以 , 分隔,可以携带版本。 apps 或者 apps/v1 都可以,自定义资源建议携带组版本
  • resources 指定一组资源,以 , 分隔,可以携带版本,apps/v1/deployments 或者 apps/deployments 都可以,自定义资源建议携带版本

以下版本发布中除了新功能外还包括对已有功能的优化

0.5 中计划发布的主要新功能,预计 2022.09 初

  1. clusterpedia apiserver 内置多集群 metrics server

0.6 中计划发布的主要新功能,预计 2022.10

  1. Agent 模式的资源收集

clusterpedia 控制面中增加新的组件 clusterpedia-collector 模块,并且 collector 接口兼容 Kubernetes OpenAPI, Agent 直接使用 client-go 将资源发送给 collector, 减少开发成本

clusterpedia-collector 支持横向扩容

0.7 中计划发布的新功能,预计 2022.12 初

  1. Agent 模式下,通过 OpenTelemery 来提供多集群 metrics server

Agent 模式下,clusterpedia apiserver 无法访问到指定集群,所以通过对接 OpenTelemery 来提供多集群 metrics server

其他功能,根据优先级和需求度放置未来发布的版本中

  1. 自定义 Collection Resources
  2. 自定义 资源 printer columns,用户可以决定 kubectl get <resource type> 时显示那些字段,在 List 接口中同样可以通过 custom columns 来只获取想要的字段
  3. 增加对接 ES,图数据库等存储组件的存储层

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.