forked from Azure/fleet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add event recorder to all reconcilers (Azure#26)
- Loading branch information
Showing
7 changed files
with
47 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 0 additions & 21 deletions
21
pkg/controllers/memberinternalmembercluster/utils/config.go
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,26 @@ | ||
package utils | ||
|
||
import ( | ||
"github.com/pkg/errors" | ||
v1 "k8s.io/api/core/v1" | ||
"k8s.io/client-go/rest" | ||
"k8s.io/client-go/tools/clientcmd" | ||
) | ||
|
||
const ( | ||
NamespaceNameFormat = "fleet-%s" | ||
) | ||
|
||
// GetConfigWithSecret gets the cluster config from kubernetes secret | ||
func GetConfigWithSecret(secret v1.Secret) (rest.Config, error) { | ||
kubeConfig, ok := secret.Data["kubeconfig"] | ||
if !ok || len(kubeConfig) == 0 { | ||
return rest.Config{}, errors.New("secret does not contain kubeconfig") | ||
} | ||
restConfig, err := clientcmd.RESTConfigFromKubeConfig(kubeConfig) | ||
if err != nil { | ||
return rest.Config{}, err | ||
} | ||
|
||
return *(restConfig), nil | ||
} |