Skip to content

Commit

Permalink
FIX: namespaced condition for api resource
Browse files Browse the repository at this point in the history
The current code checks if the api resource is namespaced or not by a faulty condition,

	`apiResource.Namespaced = targetResource.GetNamespace() == ""`

If the input kubernetes api-resource has a namespace, the above condition makes the federatedapi-resource not namespaced, due to which the namespaces are not populated in the federatedapi-resource.

Changing the above condition to

	`apiResource.Namespaced = targetResource.GetNamespace() != ""`

makes the federated-api-resource as namespaced and sets the namespace as well.

Read more on [issue#1181](kubernetes-retired#1181)
  • Loading branch information
binkkatal committed Mar 7, 2020
1 parent 613396d commit 7819ab5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/kubefedctl/federate/federate.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ func FederateResources(resources []*unstructured.Unstructured) ([]*unstructured.
Version: gvk.Version,
Kind: gvk.Kind,
}
apiResource.Namespaced = targetResource.GetNamespace() == ""
apiResource.Namespaced = targetResource.GetNamespace() != ""

qualifiedName := ctlutil.NewQualifiedName(targetResource)
typeConfig := enable.GenerateTypeConfigForTarget(apiResource, enable.NewEnableTypeDirective())
Expand Down

0 comments on commit 7819ab5

Please sign in to comment.