Skip to content

Commit 70c853f

Browse files
committed
godoc
1 parent e3b6336 commit 70c853f

File tree

16 files changed

+56
-2
lines changed

16 files changed

+56
-2
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
![GitHub](https://img.shields.io/github/license/arttor/helmify)
55
![GitHub release (latest by date)](https://img.shields.io/github/v/release/arttor/helmify)
66
[![Go Report Card](https://goreportcard.com/badge/github.com/arttor/helmify)](https://goreportcard.com/report/github.com/arttor/helmify)
7+
[![GoDoc](https://godoc.org/github.com/arttor/helmify?status.svg)](https://pkg.go.dev/github.com/arttor/helmify?tab=doc)
8+
[![Maintainability](https://api.codeclimate.com/v1/badges/2ee755bb948d363207bb/maintainability)](https://codeclimate.com/github/arttor/helmify/maintainability)
9+
[![Test Coverage](https://api.codeclimate.com/v1/badges/2ee755bb948d363207bb/test_coverage)](https://codeclimate.com/github/arttor/helmify/test_coverage)
710
![Works](https://img.shields.io/badge/works-on--my--machine-blueviolet)
811

912
Helmify reads kubernetes resources from std.in and produces a [Helm](https://github.com/helm/helm) chart.
@@ -29,7 +32,7 @@ Tested with operator-sdk version: "v1.8.0".
2932
```makefile
3033
HELMIFY = $(shell pwd)/bin/helmify
3134
helmify:
32-
$(call go-get-tool,$(HELMIFY),github.com/arttor/helmify/cmd/[email protected].0)
35+
$(call go-get-tool,$(HELMIFY),github.com/arttor/helmify/cmd/[email protected].2)
3336

3437
helm: manifests kustomize helmify
3538
$(KUSTOMIZE) build config/default | $(HELMIFY)

internal/test_utils.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ metadata:
1717

1818
var TestNs = GenerateObj(nsYaml)
1919

20+
// GenerateObj generates unstructured form yaml string.
2021
func GenerateObj(objYaml string) *unstructured.Unstructured {
2122
obj := unstructured.Unstructured{}
2223
dec := yaml.NewDecodingSerializer(unstructured.UnstructuredJSONScheme)

pkg/app/app.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"syscall"
2121
)
2222

23-
// Start point for application to process input to a Helm chart.
23+
// Start - application entrypoint for processing input to a Helm chart.
2424
func Start(input io.Reader, config config.Config) error {
2525
setLogLevel(config)
2626
ctx, cancelFunc := context.WithCancel(context.Background())

pkg/flags/flags.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Usage:
1919
Flags:
2020
`
2121

22+
// Read command-line flags into app config.
2223
func Read() config.Config {
2324
result := config.Config{}
2425
var h, help bool

pkg/helm/doc.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// Package helm contains code for writing templates to a filesystem as Helm chart.
2+
package helm

pkg/helmify/context.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,20 @@ type Context struct {
1717
objects []*unstructured.Unstructured
1818
}
1919

20+
// WithOutput returns context with output set.
2021
func (c *Context) WithOutput(output Output) *Context {
2122
c.output = output
2223
return c
2324
}
2425

26+
// WithConfig returns context with config set.
2527
func (c *Context) WithConfig(config config.Config) *Context {
2628
c.config = config
2729
c.info.ChartName = config.ChartName
2830
return c
2931
}
3032

33+
// WithProcessors add processors to the context and returns it.
3134
func (c *Context) WithProcessors(processors ...Processor) *Context {
3235
c.processors = append(c.processors, processors...)
3336
return c

pkg/processor/configmap/configmap.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,15 @@ var (
3737
}
3838
)
3939

40+
// New creates processor for k8s ConfigMap resource.
4041
func New() helmify.Processor {
4142
return &configMap{}
4243
}
4344

4445
type configMap struct {
4546
}
4647

48+
// Process k8s ConfigMap object into template. Returns false if not capable of processing given resource type.
4749
func (d configMap) Process(info helmify.ChartInfo, obj *unstructured.Unstructured) (bool, helmify.Template, error) {
4850
if obj.GroupVersionKind() != configMapGVC {
4951
return false, nil, nil

pkg/processor/crd/crd.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,15 @@ var crdGVC = schema.GroupVersionKind{
3535
Kind: "CustomResourceDefinition",
3636
}
3737

38+
// New creates processor for k8s CustomResourceDefinition resource.
3839
func New() helmify.Processor {
3940
return &crd{}
4041
}
4142

4243
type crd struct {
4344
}
4445

46+
// Process k8s CustomResourceDefinition object into template. Returns false if not capable of processing given resource type.
4547
func (c crd) Process(info helmify.ChartInfo, obj *unstructured.Unstructured) (bool, helmify.Template, error) {
4648
if obj.GroupVersionKind() != crdGVC {
4749
return false, nil, nil

pkg/processor/deployment/deployment.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,15 @@ spec:
4949
spec:
5050
%[2]s`
5151

52+
// New creates processor for k8s Deployment resource.
5253
func New() helmify.Processor {
5354
return &deployment{}
5455
}
5556

5657
type deployment struct {
5758
}
5859

60+
// Process k8s Deployment object into template. Returns false if not capable of processing given resource type.
5961
func (d deployment) Process(info helmify.ChartInfo, obj *unstructured.Unstructured) (bool, helmify.Template, error) {
6062
if obj.GroupVersionKind() != deploymentGVC {
6163
return false, nil, nil

pkg/processor/deployment/deployment_test.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,21 @@ spec:
2626
control-plane: controller-manager
2727
spec:
2828
containers:
29+
- args:
30+
- --secure-listen-address=0.0.0.0:8443
31+
- --upstream=http://127.0.0.1:8080/
32+
- --logtostderr=true
33+
- --v=10
34+
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.8.0
35+
name: kube-rbac-proxy
36+
ports:
37+
- containerPort: 8443
38+
name: https
2939
- args:
3040
- --health-probe-bind-address=:8081
41+
- --metrics-bind-address=127.0.0.1:8080
42+
- --leader-elect
43+
command:
3144
- /manager
3245
volumeMounts:
3346
- mountPath: /controller_manager_config.yaml
@@ -42,6 +55,19 @@ spec:
4255
name: my-operator-secret-vars
4356
key: VAR1
4457
image: controller:latest
58+
livenessProbe:
59+
httpGet:
60+
path: /healthz
61+
port: 8081
62+
initialDelaySeconds: 15
63+
periodSeconds: 20
64+
name: manager
65+
readinessProbe:
66+
httpGet:
67+
path: /readyz
68+
port: 8081
69+
initialDelaySeconds: 5
70+
periodSeconds: 10
4571
resources:
4672
limits:
4773
cpu: 100m

0 commit comments

Comments
 (0)