-
Notifications
You must be signed in to change notification settings - Fork 339
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(*) make kumactl install control plane leverage the Helm Charts #989
Conversation
82036d4
to
1553876
Compare
Signed-off-by: Nikolay Nikolaev <nikolay.nikolaev@konghq.com>
Signed-off-by: Nikolay Nikolaev <nikolay.nikolaev@konghq.com>
Signed-off-by: Nikolay Nikolaev <nikolay.nikolaev@konghq.com>
Signed-off-by: Nikolay Nikolaev <nikolay.nikolaev@konghq.com>
Signed-off-by: Nikolay Nikolaev <nikolay.nikolaev@konghq.com>
Signed-off-by: Nikolay Nikolaev <nikolay.nikolaev@konghq.com>
Signed-off-by: Nikolay Nikolaev <nikolay.nikolaev@konghq.com>
Signed-off-by: Nikolay Nikolaev <nikolay.nikolaev@konghq.com>
Signed-off-by: Nikolay Nikolaev <nikolay.nikolaev@konghq.com>
Signed-off-by: Nikolay Nikolaev <nikolay.nikolaev@konghq.com>
Signed-off-by: Nikolay Nikolaev <nikolay.nikolaev@konghq.com>
Signed-off-by: Nikolay Nikolaev <nikolay.nikolaev@konghq.com>
1553876
to
0b14db1
Compare
Signed-off-by: Nikolay Nikolaev <nikolay.nikolaev@konghq.com>
Signed-off-by: Nikolay Nikolaev <nikolay.nikolaev@konghq.com>
d52ac67
to
04ee5f7
Compare
@austince please check this one |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall looks great, a few nits, ideas, and suggestions
@@ -5472,7 +5513,7 @@ spec: | |||
terminationGracePeriodSeconds: 5 | |||
containers: | |||
- name: install-cni | |||
image: lobkovilya/install-cni:0.0.1 | |||
image: kong-docker-kuma-docker.bintray.io/lobkovilya/install-cni:0.0.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this will be fixed with the "kuma.formatImage"
comment below
test/framework/constants.go
Outdated
//kumaCPImage = kumaImageRegistry + "/" + kumaCPImageRepo | ||
kumaDPImageRepo = "kuma-dp" | ||
kumaDPImage = kumaImageRegistry + "/" + kumaDPImageRepo | ||
kumaInitImageRepo = "kuma-init" | ||
kumaInitImage = kumaImageRegistry + "/" + kumaInitImageRepo | ||
//kumaInitImage = kumaImageRegistry + "/" + kumaInitImageRepo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these comments be removed?
|
||
// strip Helm Chart specific labels | ||
for _, label := range stripLabels { | ||
re := regexp.MustCompile("(?m)[\r\n]+^.*" + label + ".*$") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit - might want to compile these all ahead of time instead of for each file.
func labelRegex(label string) *regexp.Regexp {
return regexp.MustCompile("(?m)[\r\n]+^.*" + label + ".*$")
}
var stripLabelsRegexps = []*regexp.Regexp{
labelRegex("app.kubernetes.io/managed-by"),
labelRegex("helm.sh/chart"),
labelRegex("app.kubernetes.io/version"),
}
for _, t := range loadedTemplates { | ||
if !strings.HasPrefix(t.Name, "templates/pre-") { | ||
loadedChart.Templates = append(loadedChart.Templates, &chart.File{ | ||
Name: t.Name, | ||
Data: t.Data, | ||
}) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes a lot of sense, though we might want to document the pre-
convention for hooks. What about post
hooks?
value := v.FieldByName(name).Interface() | ||
|
||
splitName := strings.Split(name, "_") | ||
len := len(splitName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
len := len(splitName) | |
nameLen := len(splitName) |
nit to avoid conflict w/ len()
builtin
for i := 1; i < len-1; i++ { | ||
n := splitName[i] | ||
|
||
if _, ok := root[n]; !ok { | ||
root[n] = map[string]interface{}{} | ||
} | ||
root = root[n].(map[string]interface{}) | ||
} | ||
root[splitName[len-1]] = value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find this map generation a bit hard to follow. Not surehow difficult something like this would be to implement, but would be nicer to have the arg-to-helm-value mapping tagged on the struct fields instead of using reflection.
type InstallControlPlaneArgs struct {
controlPlaneImagePullPolicy string `helm:"controlPlane.image.pullPolicy"`
// ...
Co-authored-by: Austin Cawley-Edwards <austin.cawley@gmail.com>
…ore/kumactl_with_helm
Co-authored-by: Austin Cawley-Edwards <austin.cawley@gmail.com> Signed-off-by: Nikolay Nikolaev <nikolay.nikolaev@konghq.com>
Signed-off-by: Nikolay Nikolaev <nikolay.nikolaev@konghq.com>
@@ -5499,7 +5548,7 @@ webhooks: | |||
- meshes | |||
sideEffects: None | |||
- name: owner-reference.kuma-admission.kuma.io | |||
failurePolicy: Fail | |||
failurePolicy: Ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should stay as Fail
. This helps us set owner references to resources. Without this, if we add TrafficPermission to some Mesh and we delete this some Mesh, TrafficPermission won't be deleted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh this probably means the Helm charts are wrong.
} | ||
|
||
func renderHelmFiles(templates []data.File, args interface{}) ([]data.File, error) { | ||
loadedChart, err := loadCharts(templates) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: loadedChart, err := loadCharts(templates)
-> chart, err := loadChart(templates)
## Note to Chart developers | ||
|
||
The charts are used internally in `kumactl install`, therefore the following rules apply when developing new chat features: | ||
* all templates that start with `pre-` and `post-` are omitted when processing in `kumactl install` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a note that you need to run make generate...
to have consistent HELM and kumactl install?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, but I think there is still this verification part of make test
Signed-off-by: Nikolay Nikolaev <nikolay.nikolaev@konghq.com>
Signed-off-by: Nikolay Nikolaev <nikolay.nikolaev@konghq.com>
Signed-off-by: Nikolay Nikolaev <nikolay.nikolaev@konghq.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks great to me too!
Signed-off-by: Nikolay Nikolaev <nikolay.nikolaev@konghq.com>
Summary
Make the
kumactl instal control-plane
generate the manifests based in rendering the Helm Charts.Documentation
Internal