Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
34e7af7e
Commit
34e7af7e
authored
Jan 16, 2019
by
Jordan Liggitt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add docs around importing auth plugins
parent
0713f29c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
2 deletions
+44
-2
README.md
staging/src/k8s.io/client-go/examples/README.md
+19
-0
main.go
...lient-go/examples/create-update-delete-deployment/main.go
+8
-1
main.go
...lient-go/examples/in-cluster-client-configuration/main.go
+9
-0
main.go
...t-go/examples/out-of-cluster-client-configuration/main.go
+8
-1
No files found.
staging/src/k8s.io/client-go/examples/README.md
View file @
34e7af7e
...
...
@@ -3,6 +3,25 @@
This directory contains examples that cover various use cases and functionality
for client-go.
### Auth plugins
Client configuration is typically loaded from kubeconfig files containing server and credential configuration.
Several plugins for obtaining credentials from external sources are available, but are not loaded by default.
To enable these plugins in your program, import them in your main package.
You can load all auth plugins:
```
go
import
_
"k8s.io/client-go/plugin/pkg/client/auth
```
Or you can load specific auth plugins:
```
go
import
_
"k8s.io/client-go/plugin/pkg/client/auth/azure"
import
_
"k8s.io/client-go/plugin/pkg/client/auth/gcp"
import
_
"k8s.io/client-go/plugin/pkg/client/auth/oidc"
import
_
"k8s.io/client-go/plugin/pkg/client/auth/openstack"
```
### Configuration
-
[
**Authenticate in cluster**
](
./in-cluster-client-configuration
)
: Configure a
...
...
staging/src/k8s.io/client-go/examples/create-update-delete-deployment/main.go
View file @
34e7af7e
...
...
@@ -31,8 +31,15 @@ import (
"k8s.io/client-go/tools/clientcmd"
"k8s.io/client-go/util/homedir"
"k8s.io/client-go/util/retry"
// Uncomment the following line to load the gcp plugin (only required to authenticate against GKE clusters).
//
// Uncomment to load all auth plugins
// _ "k8s.io/client-go/plugin/pkg/client/auth
//
// Or uncomment to load specific auth plugins
// _ "k8s.io/client-go/plugin/pkg/client/auth/azure"
// _ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
// _ "k8s.io/client-go/plugin/pkg/client/auth/oidc"
// _ "k8s.io/client-go/plugin/pkg/client/auth/openstack"
)
func
main
()
{
...
...
staging/src/k8s.io/client-go/examples/in-cluster-client-configuration/main.go
View file @
34e7af7e
...
...
@@ -25,6 +25,15 @@ import (
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
//
// Uncomment to load all auth plugins
// _ "k8s.io/client-go/plugin/pkg/client/auth
//
// Or uncomment to load specific auth plugins
// _ "k8s.io/client-go/plugin/pkg/client/auth/azure"
// _ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
// _ "k8s.io/client-go/plugin/pkg/client/auth/oidc"
// _ "k8s.io/client-go/plugin/pkg/client/auth/openstack"
)
func
main
()
{
...
...
staging/src/k8s.io/client-go/examples/out-of-cluster-client-configuration/main.go
View file @
34e7af7e
...
...
@@ -28,8 +28,15 @@ import (
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/clientcmd"
// Uncomment the following line to load the gcp plugin (only required to authenticate against GKE clusters).
//
// Uncomment to load all auth plugins
// _ "k8s.io/client-go/plugin/pkg/client/auth
//
// Or uncomment to load specific auth plugins
// _ "k8s.io/client-go/plugin/pkg/client/auth/azure"
// _ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
// _ "k8s.io/client-go/plugin/pkg/client/auth/oidc"
// _ "k8s.io/client-go/plugin/pkg/client/auth/openstack"
)
func
main
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment