Documentation ¶
Overview ¶
Package to keep track of API Versions that can be registered and are enabled in api.Scheme.
Index ¶
- Variables
- type APIRegistrationManager
- func (m *APIRegistrationManager) AddThirdPartyAPIGroupVersions(gvs ...unversioned.GroupVersion) []unversioned.GroupVersion
- func (m *APIRegistrationManager) AllPreferredGroupVersions() string
- func (m *APIRegistrationManager) EnableVersions(versions ...unversioned.GroupVersion) error
- func (m *APIRegistrationManager) EnabledVersions() []unversioned.GroupVersion
- func (m *APIRegistrationManager) EnabledVersionsForGroup(group string) []unversioned.GroupVersion
- func (m *APIRegistrationManager) Group(group string) (*apimachinery.GroupMeta, error)
- func (m *APIRegistrationManager) GroupOrDie(group string) *apimachinery.GroupMeta
- func (m *APIRegistrationManager) InterfacesFor(version unversioned.GroupVersion) (*meta.VersionInterfaces, error)
- func (m *APIRegistrationManager) IsAllowedVersion(v unversioned.GroupVersion) bool
- func (m *APIRegistrationManager) IsEnabledVersion(v unversioned.GroupVersion) bool
- func (m *APIRegistrationManager) IsRegistered(group string) bool
- func (m *APIRegistrationManager) IsRegisteredVersion(v unversioned.GroupVersion) bool
- func (m *APIRegistrationManager) IsThirdPartyAPIGroupVersion(gv unversioned.GroupVersion) bool
- func (m *APIRegistrationManager) RESTMapper(versionPatterns ...unversioned.GroupVersion) meta.RESTMapper
- func (m *APIRegistrationManager) RegisterGroup(groupMeta apimachinery.GroupMeta) error
- func (m *APIRegistrationManager) RegisterVersions(availableVersions []unversioned.GroupVersion)
- func (m *APIRegistrationManager) RegisteredGroupVersions() []unversioned.GroupVersion
- func (m *APIRegistrationManager) ValidateEnvRequestedVersions() []unversioned.GroupVersion
Constants ¶
This section is empty.
Variables ¶
var ( ValidateEnvRequestedVersions = DefaultAPIRegistrationManager.ValidateEnvRequestedVersions AllPreferredGroupVersions = DefaultAPIRegistrationManager.AllPreferredGroupVersions RESTMapper = DefaultAPIRegistrationManager.RESTMapper GroupOrDie = DefaultAPIRegistrationManager.GroupOrDie AddThirdPartyAPIGroupVersions = DefaultAPIRegistrationManager.AddThirdPartyAPIGroupVersions IsThirdPartyAPIGroupVersion = DefaultAPIRegistrationManager.IsThirdPartyAPIGroupVersion RegisteredGroupVersions = DefaultAPIRegistrationManager.RegisteredGroupVersions IsRegisteredVersion = DefaultAPIRegistrationManager.IsRegisteredVersion IsRegistered = DefaultAPIRegistrationManager.IsRegistered Group = DefaultAPIRegistrationManager.Group EnabledVersionsForGroup = DefaultAPIRegistrationManager.EnabledVersionsForGroup EnabledVersions = DefaultAPIRegistrationManager.EnabledVersions IsEnabledVersion = DefaultAPIRegistrationManager.IsEnabledVersion IsAllowedVersion = DefaultAPIRegistrationManager.IsAllowedVersion EnableVersions = DefaultAPIRegistrationManager.EnableVersions RegisterGroup = DefaultAPIRegistrationManager.RegisterGroup RegisterVersions = DefaultAPIRegistrationManager.RegisterVersions InterfacesFor = DefaultAPIRegistrationManager.InterfacesFor )
People are calling global functions. Let them continue to do that (for now).
var (
DefaultAPIRegistrationManager = NewOrDie(os.Getenv("KUBE_API_VERSIONS"))
)
Functions ¶
This section is empty.
Types ¶
type APIRegistrationManager ¶ added in v1.4.0
type APIRegistrationManager struct {
// contains filtered or unexported fields
}
APIRegistrationManager provides the concept of what API groups are enabled.
TODO: currently, it also provides a "registered" concept. But it's wrong to have both concepts in the same object. Therefore the "announced" package is going to take over the registered concept. After all the install packages are switched to using the announce package instead of this package, then we can combine the registered/enabled concepts in this object. Simplifying this isn't easy right now because there are so many callers of this package.
func NewAPIRegistrationManager ¶ added in v1.4.0
func NewAPIRegistrationManager(kubeAPIVersions string) (*APIRegistrationManager, error)
NewAPIRegistrationManager constructs a new manager. The argument ought to be the value of the KUBE_API_VERSIONS env var, or a value of this which you wish to test.
func NewOrDie ¶ added in v1.4.0
func NewOrDie(kubeAPIVersions string) *APIRegistrationManager
func (*APIRegistrationManager) AddThirdPartyAPIGroupVersions ¶ added in v1.4.0
func (m *APIRegistrationManager) AddThirdPartyAPIGroupVersions(gvs ...unversioned.GroupVersion) []unversioned.GroupVersion
AddThirdPartyAPIGroupVersions sets the list of third party versions, registers them in the API machinery and enables them. Skips GroupVersions that are already registered. Returns the list of GroupVersions that were skipped.
func (*APIRegistrationManager) AllPreferredGroupVersions ¶ added in v1.4.0
func (m *APIRegistrationManager) AllPreferredGroupVersions() string
AllPreferredGroupVersions returns the preferred versions of all registered groups in the form of "group1/version1,group2/version2,..."
func (*APIRegistrationManager) EnableVersions ¶ added in v1.4.0
func (m *APIRegistrationManager) EnableVersions(versions ...unversioned.GroupVersion) error
EnableVersions adds the versions for the given group to the list of enabled versions. Note that the caller should call RegisterGroup before calling this method. The caller of this function is responsible to add the versions to scheme and RESTMapper.
func (*APIRegistrationManager) EnabledVersions ¶ added in v1.4.0
func (m *APIRegistrationManager) EnabledVersions() []unversioned.GroupVersion
EnabledVersions returns all enabled versions. Groups are randomly ordered, but versions within groups are priority order from best to worst
func (*APIRegistrationManager) EnabledVersionsForGroup ¶ added in v1.4.0
func (m *APIRegistrationManager) EnabledVersionsForGroup(group string) []unversioned.GroupVersion
EnabledVersionsForGroup returns all enabled versions for a group in order of best to worst
func (*APIRegistrationManager) Group ¶ added in v1.4.0
func (m *APIRegistrationManager) Group(group string) (*apimachinery.GroupMeta, error)
Group returns the metadata of a group if the group is registered, otherwise an error is returned.
func (*APIRegistrationManager) GroupOrDie ¶ added in v1.4.0
func (m *APIRegistrationManager) GroupOrDie(group string) *apimachinery.GroupMeta
TODO: This is an expedient function, because we don't check if a Group is supported throughout the code base. We will abandon this function and checking the error returned by the Group() function.
func (*APIRegistrationManager) InterfacesFor ¶
func (m *APIRegistrationManager) InterfacesFor(version unversioned.GroupVersion) (*meta.VersionInterfaces, error)
InterfacesFor is a union meta.VersionInterfacesFunc func for all registered types
func (*APIRegistrationManager) IsAllowedVersion ¶ added in v1.4.0
func (m *APIRegistrationManager) IsAllowedVersion(v unversioned.GroupVersion) bool
IsAllowedVersion returns if the version is allowed by the KUBE_API_VERSIONS environment variable. If the environment variable is empty, then it always returns true.
func (*APIRegistrationManager) IsEnabledVersion ¶ added in v1.4.0
func (m *APIRegistrationManager) IsEnabledVersion(v unversioned.GroupVersion) bool
IsEnabledVersion returns if a version is enabled.
func (*APIRegistrationManager) IsRegistered ¶ added in v1.4.0
func (m *APIRegistrationManager) IsRegistered(group string) bool
IsRegistered takes a string and determines if it's one of the registered groups
func (*APIRegistrationManager) IsRegisteredVersion ¶ added in v1.4.0
func (m *APIRegistrationManager) IsRegisteredVersion(v unversioned.GroupVersion) bool
IsRegisteredVersion returns if a version is registered.
func (*APIRegistrationManager) IsThirdPartyAPIGroupVersion ¶ added in v1.4.0
func (m *APIRegistrationManager) IsThirdPartyAPIGroupVersion(gv unversioned.GroupVersion) bool
IsThirdPartyAPIGroupVersion returns true if the api version is a user-registered group/version.
func (*APIRegistrationManager) RESTMapper ¶ added in v1.4.0
func (m *APIRegistrationManager) RESTMapper(versionPatterns ...unversioned.GroupVersion) meta.RESTMapper
RESTMapper returns a union RESTMapper of all known types with priorities chosen in the following order:
- if KUBE_API_VERSIONS is specified, then KUBE_API_VERSIONS in order, OR
- legacy kube group preferred version, extensions preferred version, metrics perferred version, legacy kube any version, extensions any version, metrics any version, all other groups alphabetical preferred version, all other groups alphabetical.
func (*APIRegistrationManager) RegisterGroup ¶ added in v1.4.0
func (m *APIRegistrationManager) RegisterGroup(groupMeta apimachinery.GroupMeta) error
RegisterGroup adds the given group to the list of registered groups.
func (*APIRegistrationManager) RegisterVersions ¶ added in v1.4.0
func (m *APIRegistrationManager) RegisterVersions(availableVersions []unversioned.GroupVersion)
RegisterVersions adds the given group versions to the list of registered group versions.
func (*APIRegistrationManager) RegisteredGroupVersions ¶ added in v1.4.0
func (m *APIRegistrationManager) RegisteredGroupVersions() []unversioned.GroupVersion
RegisteredGroupVersions returns all registered group versions.
func (*APIRegistrationManager) ValidateEnvRequestedVersions ¶ added in v1.4.0
func (m *APIRegistrationManager) ValidateEnvRequestedVersions() []unversioned.GroupVersion
ValidateEnvRequestedVersions returns a list of versions that are requested in the KUBE_API_VERSIONS environment variable, but not enabled.