Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1294 from makkes/distinguish-core-resources
Browse files Browse the repository at this point in the history
fix: prefer core resources when enabling a type
  • Loading branch information
k8s-ci-robot authored Oct 14, 2020
2 parents ae370ed + 179040a commit 2c002f9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/userguide.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ The `<target kubernetes API type>` can be any of the following

for the intended target API type.

**NOTE:** To specifically target a type of a certain API group, you can append the group's name as in `deployment.apps`.
For core Kubernetes types such as `Pod` or `Service` this is not possible because they have no specific API group assigned
to them. Therefore, core types always take precendence over other types of the same name from another API group. Please
see the [Enabling an API type with a non-default API group](#enabling-an-api-type-with-a-non-default-api-group) section
for more information on the impact of possible naming conflicts.

The `kubefedctl` command will create
- a CRD for the federated type named `Federated<Kind>`
- a `FederatedTypeConfig` in the KubeFed system namespace with the group-qualified plural name of the target type.
Expand Down
7 changes: 7 additions & 0 deletions pkg/kubefedctl/enable/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,13 @@ func LookupAPIResource(config *rest.Config, key, targetVersion string) (*metav1.
targetResource = resource.DeepCopy()
targetResource.Group = group
targetResource.Version = gv.Version
// a resource from the 'core' group matches the 'key', so we prefer
// that one over any other because otherwise there would be no way
// for the user to signify that he wants to enable federation of
// a specific core group resource.
if targetResource.Group == "" {
return targetResource, nil
}
}
matchedResources = append(matchedResources, groupQualifiedName(resource.Name, gv.Group))
}
Expand Down

0 comments on commit 2c002f9

Please sign in to comment.