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
733ca42b
Commit
733ca42b
authored
Jun 30, 2021
by
Chris Kim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
go mod vendor
Signed-off-by:
Chris Kim
<
oats87g@gmail.com
>
parent
9863b92e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
9 deletions
+46
-9
types.go
...3s-io/helm-controller/pkg/apis/helm.cattle.io/v1/types.go
+1
-0
zz_generated_deepcopy.go
...oller/pkg/apis/helm.cattle.io/v1/zz_generated_deepcopy.go
+6
-0
controller.go
.../github.com/k3s-io/helm-controller/pkg/helm/controller.go
+38
-8
modules.txt
vendor/modules.txt
+1
-1
No files found.
vendor/github.com/k3s-io/helm-controller/pkg/apis/helm.cattle.io/v1/types.go
View file @
733ca42b
...
...
@@ -27,6 +27,7 @@ type HelmChartSpec struct {
Bootstrap
bool
`json:"bootstrap,omitempty"`
ChartContent
string
`json:"chartContent,omitempty"`
JobImage
string
`json:"jobImage,omitempty"`
Timeout
*
metav1
.
Duration
`json:"timeout,omitempty"`
}
type
HelmChartStatus
struct
{
...
...
vendor/github.com/k3s-io/helm-controller/pkg/apis/helm.cattle.io/v1/zz_generated_deepcopy.go
View file @
733ca42b
...
...
@@ -21,6 +21,7 @@ limitations under the License.
package
v1
import
(
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
runtime
"k8s.io/apimachinery/pkg/runtime"
intstr
"k8s.io/apimachinery/pkg/util/intstr"
)
...
...
@@ -172,6 +173,11 @@ func (in *HelmChartSpec) DeepCopyInto(out *HelmChartSpec) {
(
*
out
)[
key
]
=
val
}
}
if
in
.
Timeout
!=
nil
{
in
,
out
:=
&
in
.
Timeout
,
&
out
.
Timeout
*
out
=
new
(
metav1
.
Duration
)
**
out
=
**
in
}
return
}
...
...
vendor/github.com/k3s-io/helm-controller/pkg/helm/controller.go
View file @
733ca42b
...
...
@@ -30,7 +30,7 @@ import (
var
(
trueVal
=
true
commaRE
=
regexp
.
MustCompile
(
`\\*,`
)
DefaultJobImage
=
"rancher/klipper-helm:v0.
5.0-build20210505
"
DefaultJobImage
=
"rancher/klipper-helm:v0.
6.1-build20210616
"
)
type
Controller
struct
{
...
...
@@ -272,23 +272,40 @@ func job(chart *helmv1.HelmChart) (*batch.Job, *core.ConfigMap, *core.ConfigMap)
},
}
if
chart
.
Spec
.
Timeout
!=
nil
{
job
.
Spec
.
Template
.
Spec
.
Containers
[
0
]
.
Env
=
append
(
job
.
Spec
.
Template
.
Spec
.
Containers
[
0
]
.
Env
,
core
.
EnvVar
{
Name
:
"TIMEOUT"
,
Value
:
chart
.
Spec
.
Timeout
.
String
(),
})
}
if
chart
.
Spec
.
Bootstrap
{
job
.
Spec
.
Template
.
Spec
.
HostNetwork
=
true
job
.
Spec
.
Template
.
Spec
.
Tolerations
=
[]
core
.
Toleration
{
{
Key
:
"node.kubernetes.io/not-ready"
,
Effect
:
"NoSchedule"
,
Effect
:
core
.
TaintEffectNoSchedule
,
},
{
Key
:
"node.cloudprovider.kubernetes.io/uninitialized"
,
Operator
:
core
.
TolerationOpEqual
,
Value
:
"true"
,
Effect
:
"NoSchedule"
,
Effect
:
core
.
TaintEffectNoSchedule
,
},
{
Key
:
"CriticalAddonsOnly"
,
Operator
:
core
.
TolerationOpExists
,
},
{
Key
:
"node-role.kubernetes.io/etcd"
,
Operator
:
core
.
TolerationOpExists
,
Effect
:
core
.
TaintEffectNoExecute
,
},
{
Key
:
"node-role.kubernetes.io/control-plane"
,
Operator
:
core
.
TolerationOpExists
,
Effect
:
core
.
TaintEffectNoSchedule
,
},
}
job
.
Spec
.
Template
.
Spec
.
Containers
[
0
]
.
Env
=
append
(
job
.
Spec
.
Template
.
Spec
.
Containers
[
0
]
.
Env
,
[]
core
.
EnvVar
{
{
...
...
@@ -399,12 +416,10 @@ func args(chart *helmv1.HelmChart) []string {
for
_
,
k
:=
range
keys
(
spec
.
Set
)
{
val
:=
spec
.
Set
[
k
]
if
val
.
StrVal
==
"false"
||
val
.
StrVal
==
"true"
{
args
=
append
(
args
,
"--set"
,
fmt
.
Sprintf
(
"%s=%s"
,
k
,
val
.
StrVal
))
}
else
if
val
.
StrVal
!=
""
{
args
=
append
(
args
,
"--set-string"
,
fmt
.
Sprintf
(
"%s=%s"
,
k
,
commaRE
.
ReplaceAllStringFunc
(
val
.
StrVal
,
escapeComma
)))
if
typedVal
(
val
)
{
args
=
append
(
args
,
"--set"
,
fmt
.
Sprintf
(
"%s=%s"
,
k
,
val
.
String
()))
}
else
{
args
=
append
(
args
,
"--set
"
,
fmt
.
Sprintf
(
"%s=%d"
,
k
,
val
.
IntVal
))
args
=
append
(
args
,
"--set
-string"
,
fmt
.
Sprintf
(
"%s=%s"
,
k
,
commaRE
.
ReplaceAllStringFunc
(
val
.
String
(),
escapeComma
)
))
}
}
...
...
@@ -420,6 +435,21 @@ func keys(val map[string]intstr.IntOrString) []string {
return
keys
}
// typedVal is a modified version of helm's typedVal function that operates on kubernetes IntOrString types.
// Things that look like an integer, boolean, or null should use --set; everything else should use --set-string.
// Ref: https://github.com/helm/helm/blob/v3.5.4/pkg/strvals/parser.go#L415
func
typedVal
(
val
intstr
.
IntOrString
)
bool
{
if
intstr
.
Int
==
val
.
Type
{
return
true
}
switch
strings
.
ToLower
(
val
.
StrVal
)
{
case
"true"
,
"false"
,
"null"
:
return
true
default
:
return
false
}
}
// escapeComma should be passed a string consisting of zero or more backslashes, followed by a comma.
// If there are an even number of characters (such as `\,` or `\\\,`) then the comma is escaped.
// If there are an uneven number of characters (such as `,` or `\\,` then the comma is not escaped,
...
...
vendor/modules.txt
View file @
733ca42b
...
...
@@ -692,7 +692,7 @@ github.com/jmespath/go-jmespath
github.com/jonboulle/clockwork
# github.com/json-iterator/go v1.1.10
github.com/json-iterator/go
# github.com/k3s-io/helm-controller v0.
9
.1
# github.com/k3s-io/helm-controller v0.
10
.1
## explicit
github.com/k3s-io/helm-controller/pkg/apis/helm.cattle.io
github.com/k3s-io/helm-controller/pkg/apis/helm.cattle.io/v1
...
...
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