FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
secureCodeBox/scbctl/pkg/client.go at main · secureCodeBox/secureCodeBox · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
secureCodeBox
/
secureCodeBox
Public
Notifications
You must be signed in to change notification settings
Fork
183
Star
985
Code
Issues
62
Pull requests
3
Discussions
Actions
Projects
Security and quality
1
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
secureCodeBox
/
scbctl
/
pkg
/
client.go
Copy path
More file actions
More file actions
Latest commit
History
History
History
62 lines (49 loc) · 1.64 KB
Breadcrumbs
secureCodeBox
/
scbctl
/
pkg
/
client.go
Copy path
File metadata and controls
62 lines (49 loc) · 1.64 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// SPDX-FileCopyrightText: the secureCodeBox authors
//
// SPDX-License-Identifier: Apache-2.0
package
client
import
(
"fmt"
cascadingv1
"github.com/secureCodeBox/secureCodeBox/operator/apis/cascading/v1"
executionv1
"github.com/secureCodeBox/secureCodeBox/operator/apis/execution/v1"
v1
"k8s.io/api/apps/v1"
batchv1
"k8s.io/api/batch/v1"
corev1
"k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
utilruntime
"k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/cli-runtime/pkg/genericclioptions"
"sigs.k8s.io/controller-runtime/pkg/client"
)
var
(
scheme
=
runtime
.
NewScheme
()
)
func
init
() {
utilruntime
.
Must
(
corev1
.
AddToScheme
(
scheme
))
utilruntime
.
Must
(
batchv1
.
AddToScheme
(
scheme
))
utilruntime
.
Must
(
executionv1
.
AddToScheme
(
scheme
))
utilruntime
.
Must
(
cascadingv1
.
AddToScheme
(
scheme
))
}
type
ClientProvider
interface
{
GetClient
(
flags
*
genericclioptions.
ConfigFlags
) (client.
Client
,
string
,
error
)
}
type
DefaultClientProvider
struct
{}
func
(
d
*
DefaultClientProvider
)
GetClient
(
flags
*
genericclioptions.
ConfigFlags
) (client.
Client
,
string
,
error
) {
return
GetClient
(
flags
)
}
func
GetClient
(
flags
*
genericclioptions.
ConfigFlags
) (client.
Client
,
string
,
error
) {
cnfLoader
:=
flags
.
ToRawKubeConfigLoader
()
cnf
,
err
:=
cnfLoader
.
ClientConfig
()
if
err
!=
nil
{
return
nil
,
""
,
fmt
.
Errorf
(
"failed to generate config from kubeconfig"
)
}
namespace
,
_
,
err
:=
cnfLoader
.
Namespace
()
if
err
!=
nil
{
return
nil
,
""
,
fmt
.
Errorf
(
"failed to read namespace from kubeconfig"
)
}
utilruntime
.
Must
(
v1
.
AddToScheme
(
scheme
))
client
,
err
:=
client
.
New
(
cnf
, client.
Options
{
Scheme
:
scheme
})
if
err
!=
nil
{
return
nil
,
""
,
err
}
return
client
,
namespace
,
nil
}
Back
|
FazBrowse Home
|
New Git URL