Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Dapr
提交
e45ed8b3
D
Dapr
项目概览
int
/
Dapr
11 个月 前同步成功
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Dapr
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
e45ed8b3
编写于
6月 26, 2019
作者:
Y
Yaron Schneider
提交者:
GitHub
6月 26, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
added image pull secret to controller config (#63)
上级
c02f6ad7
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
30 addition
and
22 deletion
+30
-22
pkg/controller/config.go
pkg/controller/config.go
+1
-0
pkg/controller/controller.go
pkg/controller/controller.go
+1
-1
pkg/handlers/actions_handler.go
pkg/handlers/actions_handler.go
+28
-21
未找到文件。
pkg/controller/config.go
浏览文件 @
e45ed8b3
...
...
@@ -4,6 +4,7 @@ import "github.com/kelseyhightower/envconfig"
type
Config
struct
{
ActionsRuntimeImage
string
`envconfig:"RUNTIME_IMAGE" required:"true"`
ImagePullSecretName
string
`envconfig:"IMAGE_PULL_SECRET_NAME" required:"false"`
}
func
GetConfigFromEnvironment
()
(
Config
,
error
)
{
...
...
pkg/controller/controller.go
浏览文件 @
e45ed8b3
...
...
@@ -43,7 +43,7 @@ func NewController(kubeClient kubernetes.Interface, actionsClient scheme.Interfa
nil
,
nil
,
),
ActionsHandler
:
handlers
.
NewActionsHandler
(
actionsClient
,
handlers
.
ActionsHandlerConfig
{
RuntimeImage
:
config
.
ActionsRuntimeImage
}),
ActionsHandler
:
handlers
.
NewActionsHandler
(
actionsClient
,
handlers
.
ActionsHandlerConfig
{
RuntimeImage
:
config
.
ActionsRuntimeImage
,
ImagePullSecretName
:
config
.
ImagePullSecretName
}),
EventSourcesHandler
:
handlers
.
NewEventSourcesHandler
(
kubeClient
),
}
...
...
pkg/handlers/actions_handler.go
浏览文件 @
e45ed8b3
...
...
@@ -40,7 +40,8 @@ type ActionsHandler struct {
}
type
ActionsHandlerConfig
struct
{
RuntimeImage
string
RuntimeImage
string
ImagePullSecretName
string
}
func
NewActionsHandler
(
client
scheme
.
Interface
,
config
ActionsHandlerConfig
)
*
ActionsHandler
{
...
...
@@ -150,26 +151,6 @@ func (r *ActionsHandler) GetAppProtocol(deployment *appsv1.Deployment) string {
return
string
(
HTTPProtocol
)
}
func
(
r
*
ActionsHandler
)
EnableAction
(
deployment
*
appsv1
.
Deployment
)
error
{
appPort
:=
r
.
GetApplicationPort
(
deployment
.
Spec
.
Template
.
Spec
.
Containers
)
appProtocol
:=
r
.
GetAppProtocol
(
deployment
)
actionName
:=
r
.
GetActionName
(
deployment
)
sidecar
:=
r
.
GetEventingSidecar
(
appPort
,
appProtocol
,
actionName
,
r
.
Config
.
RuntimeImage
)
deployment
.
Spec
.
Template
.
Spec
.
Containers
=
append
(
deployment
.
Spec
.
Template
.
Spec
.
Containers
,
sidecar
)
err
:=
r
.
CreateEventingService
(
actionName
,
deployment
)
if
err
!=
nil
{
return
err
}
err
=
kubernetes
.
UpdateDeployment
(
deployment
)
if
err
!=
nil
{
return
err
}
return
nil
}
func
(
r
*
ActionsHandler
)
IsAnnotatedForActions
(
deployment
*
appsv1
.
Deployment
)
bool
{
annotations
:=
deployment
.
ObjectMeta
.
Annotations
if
annotations
!=
nil
{
...
...
@@ -191,6 +172,32 @@ func (r *ActionsHandler) ActionEnabled(deployment *appsv1.Deployment) bool {
return
false
}
func
(
r
*
ActionsHandler
)
EnableAction
(
deployment
*
appsv1
.
Deployment
)
error
{
appPort
:=
r
.
GetApplicationPort
(
deployment
.
Spec
.
Template
.
Spec
.
Containers
)
appProtocol
:=
r
.
GetAppProtocol
(
deployment
)
actionName
:=
r
.
GetActionName
(
deployment
)
sidecar
:=
r
.
GetEventingSidecar
(
appPort
,
appProtocol
,
actionName
,
r
.
Config
.
RuntimeImage
)
deployment
.
Spec
.
Template
.
Spec
.
Containers
=
append
(
deployment
.
Spec
.
Template
.
Spec
.
Containers
,
sidecar
)
if
r
.
Config
.
ImagePullSecretName
!=
""
{
deployment
.
Spec
.
Template
.
Spec
.
ImagePullSecrets
=
append
(
deployment
.
Spec
.
Template
.
Spec
.
ImagePullSecrets
,
corev1
.
LocalObjectReference
{
Name
:
r
.
Config
.
ImagePullSecretName
,
})
}
err
:=
r
.
CreateEventingService
(
actionName
,
deployment
)
if
err
!=
nil
{
return
err
}
err
=
kubernetes
.
UpdateDeployment
(
deployment
)
if
err
!=
nil
{
return
err
}
return
nil
}
func
(
r
*
ActionsHandler
)
RemoveActionFromDeployment
(
deployment
*
appsv1
.
Deployment
)
error
{
for
i
:=
len
(
deployment
.
Spec
.
Template
.
Spec
.
Containers
)
-
1
;
i
>=
0
;
i
--
{
if
deployment
.
Spec
.
Template
.
Spec
.
Containers
[
i
]
.
Name
==
actionSidecarContainerName
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录