Version

Kubernetes的资源版本控制可以分为3中:Alpha,Beta,Stable。迭代顺序为:Alpha >> Beta >> Stable。

  • Alpha版本:内部测试版本,用于开发者内部测试,该版本不稳定,可能被删除,可能存在很多缺陷和漏洞。默认情况,Alpha版本的功能会被禁用。一般名称为v1alpha1、v1alpha2、v2alpha1等。
  • Beta版本:相对稳定的版本,经过官方和社区很多次测试,该版本可能会有较小的改变,但不会被删除。默认情况下开启。一般名称为v1beta1,v1beta2,v2beta1等。
  • Stable:正式发布版本,该版本不会被删除。默认情况下,功能全部开启。一般命名为v1、v2、v3。

资源版本代码数据结构如下:
代码路径:vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types.go

  1. // APIVersions lists the versions that are available, to allow clients to
  2. // discover the API at /api, which is the root path of the legacy v1 API.
  3. //
  4. // +protobuf.options.(gogoproto.goproto_stringer)=false
  5. // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
  6. type APIVersions struct {
  7. TypeMeta `json:",inline"`
  8. // versions are the api versions that are available.
  9. Versions []string `json:"versions" protobuf:"bytes,1,rep,name=versions"`
  10. // a map of client CIDR to server address that is serving this group.
  11. // This is to help clients reach servers in the most network-efficient way possible.
  12. // Clients can use the appropriate server address as per the CIDR that they match.
  13. // In case of multiple matches, clients should use the longest matching CIDR.
  14. // The server returns only those CIDRs that it thinks that the client can match.
  15. // For example: the master will return an internal IP CIDR only, if the client reaches the server using an internal IP.
  16. // Server looks at X-Forwarded-For header or X-Real-Ip header or request.RemoteAddr (in that order) to get the client IP.
  17. ServerAddressByClientCIDRs []ServerAddressByClientCIDR `json:"serverAddressByClientCIDRs" protobuf:"bytes,2,rep,name=serverAddressByClientCIDRs"`
  18. }