Documentation

Overview

    Package announced contains tools for announcing API group factories. This is distinct from registration (in the 'registered' package) in that it's safe to announce every possible group linked in, but only groups requested at runtime should be registered. This package contains both a registry, and factory code (which was formerly copy-pasta in every install package).

    Index

    Constants

    This section is empty.

    Variables

    This section is empty.

    Functions

    This section is empty.

    Types

    type APIGroupFactoryRegistry

    type APIGroupFactoryRegistry map[string]*GroupMetaFactory

      APIGroupFactoryRegistry allows for groups and versions to announce themselves, which simply makes them available and doesn't take other actions. Later, users of the registry can select which groups and versions they'd actually like to register with an APIRegistrationManager.

      (Right now APIRegistrationManager has separate 'registration' and 'enabled' concepts-- APIGroupFactory is going to take over the former function; they will overlap until the refactoring is finished.)

      The key is the group name. After initialization, this should be treated as read-only. It is implemented as a map from group name to group factory, and it is safe to use this knowledge to manually pick out groups to register (e.g., for testing).

      func (APIGroupFactoryRegistry) AnnounceGroup

      func (gar APIGroupFactoryRegistry) AnnounceGroup(args *GroupMetaFactoryArgs) error

        AnnounceGroup adds the group-wide arguments to the group factory.

        func (APIGroupFactoryRegistry) AnnounceGroupVersion

        func (gar APIGroupFactoryRegistry) AnnounceGroupVersion(gvf *GroupVersionFactoryArgs) error

          AnnounceGroupVersion adds the particular arguments for this group version to the group factory.

          func (APIGroupFactoryRegistry) AnnouncePreconstructedFactory

          func (gar APIGroupFactoryRegistry) AnnouncePreconstructedFactory(gmf *GroupMetaFactory) error

            AnnouncePreconstructedFactory announces a factory which you've manually assembled. You may call this instead of calling AnnounceGroup and AnnounceGroupVersion.

            func (APIGroupFactoryRegistry) RegisterAndEnableAll

            func (gar APIGroupFactoryRegistry) RegisterAndEnableAll(m *registered.APIRegistrationManager, scheme *runtime.Scheme) error

              RegisterAndEnableAll throws every factory at the specified API registration manager, and lets it decide which to register. (If you want to do this a la cart, you may look through gar itself-- it's just a map.)

              type GroupMetaFactory

              type GroupMetaFactory struct {
              	GroupArgs *GroupMetaFactoryArgs
              	// map of version name to version factory
              	VersionArgs map[string]*GroupVersionFactoryArgs
              	// contains filtered or unexported fields
              }

                GroupMetaFactory has the logic for actually assembling and registering a group.

                There are two ways of obtaining one of these. 1. You can announce your group and versions separately, and then let the

                GroupFactoryRegistry assemble this object for you. (This allows group and
                versions to be imported separately, without referencing each other, to
                keep import trees small.)
                

                2. You can call NewGroupMetaFactory(), which is mostly a drop-in replacement

                for the old, bad way of doing things. You can then call .Announce() to
                announce your constructed factory to any code that would like to do
                things the new, better way.
                

                Note that GroupMetaFactory actually does construct GroupMeta objects, but currently it does so in a way that's very entangled with an APIRegistrationManager. It's a TODO item to cleanly separate that interface.

                func NewGroupMetaFactory

                func NewGroupMetaFactory(groupArgs *GroupMetaFactoryArgs, versions VersionToSchemeFunc) *GroupMetaFactory

                  NewGroupMetaFactory builds the args for you. This is for if you're constructing a factory all at once and not using the registry.

                  func (*GroupMetaFactory) Announce

                  func (gmf *GroupMetaFactory) Announce(groupFactoryRegistry APIGroupFactoryRegistry) *GroupMetaFactory

                    Announce adds this Group factory to the global factory registry. It should only be called if you constructed the GroupMetaFactory yourself via NewGroupMetaFactory. Note that this will panic on an error, since it's expected that you'll be calling this at initialization time and any error is a result of a programmer importing the wrong set of packages. If this assumption doesn't work for you, just call DefaultGroupFactoryRegistry.AnnouncePreconstructedFactory yourself.

                    func (*GroupMetaFactory) Enable

                      Enable enables group versions that are allowed, adds methods to the scheme, etc.

                      func (*GroupMetaFactory) Register

                        Register constructs the finalized prioritized version list and sanity checks the announced group & versions. Then it calls register.

                        func (*GroupMetaFactory) RegisterAndEnable

                        func (gmf *GroupMetaFactory) RegisterAndEnable(registry *registered.APIRegistrationManager, scheme *runtime.Scheme) error

                          RegisterAndEnable is provided only to allow this code to get added in multiple steps. It's really bad that this is called in init() methods, but supporting this temporarily lets us do the change incrementally.

                          type GroupMetaFactoryArgs

                          type GroupMetaFactoryArgs struct {
                          	// GroupName is the name of the API-Group
                          	//
                          	// example: 'servicecatalog.k8s.io'
                          	GroupName              string
                          	VersionPreferenceOrder []string
                          	// RootScopedKinds are resources that are not namespaced.
                          	RootScopedKinds sets.String // nil is allowed
                          	IgnoredKinds    sets.String // nil is allowed
                          
                          	// May be nil if there are no internal objects.
                          	AddInternalObjectsToScheme SchemeFunc
                          }

                            GroupMetaFactoryArgs contains the group-level args of a GroupMetaFactory.

                            type GroupVersionFactoryArgs

                            type GroupVersionFactoryArgs struct {
                            	GroupName   string
                            	VersionName string
                            
                            	AddToScheme SchemeFunc
                            }

                              GroupVersionFactoryArgs contains all the per-version parts of a GroupMetaFactory.

                              type SchemeFunc

                              type SchemeFunc func(*runtime.Scheme) error

                              type VersionToSchemeFunc

                              type VersionToSchemeFunc map[string]SchemeFunc