Skip to content

Commit

Permalink
creating new KRM version
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathan S. Martins committed Jun 12, 2023
1 parent fe8a7aa commit 6489f0e
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 15 deletions.
1 change: 1 addition & 0 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MD013: false
40 changes: 40 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
extends: default

ignore: |
*.enc.*
._*
*.env
*.sh
*.conf
*.lua

rules:
# Forbid `---` at the beginning of each file
document-start:
present: false

# Disable line lenght, too annoying with third-party configs
line-length: disable

# Max 1 space after a hyphen `-`
hyphens:
max-spaces-after: 1

indentation:
# Requirement not to additionaly indent sequences. `-` is indentation!
#
# Accepted:
# sequence:
# - one
# - two
# - three
#
# Rejected:
# sequence:
# - one
# - two
# - three
indent-sequences: false

# Indentation must be 2 spaces
spaces: 2
16 changes: 2 additions & 14 deletions cmd/ksops/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"go.mozilla.org/sops/v3/cmd/sops/formats"
"go.mozilla.org/sops/v3/decrypt"
"os"
"path/filepath"
"sigs.k8s.io/kustomize/kyaml/fn/framework"
"sigs.k8s.io/kustomize/kyaml/fn/framework/command"
"sigs.k8s.io/kustomize/kyaml/kio"
Expand Down Expand Up @@ -48,19 +47,6 @@ func main() {

b, err = os.ReadFile(file)

// Current working dir bug
// see https://github.com/kubernetes-sigs/kustomize/issues/4347
// see https://github.com/kubernetes-sigs/kustomize/pull/4654
if err != nil {
cwd, _ := os.Getwd()
parent := filepath.Join(cwd, "..")
file = filepath.Join(parent, file)
b, err = os.ReadFile(file)
if err != nil {
return nil, fmt.Errorf("error opening file for decryption %s: \n\n%w\n\ncwd: %s - file: %s\n", file, err, cwd, file)
}
}

if ksopsGenerateDummySecrets {
secret, err = dummy.GenerateDummySecret(b)
if err != nil {
Expand Down Expand Up @@ -96,6 +82,8 @@ func main() {

p := framework.VersionedAPIProcessor{FilterProvider: api}
cmd := command.Build(&p, command.StandaloneDisabled, false)
cmd.Version = "v1.0.4"
cmd.SetVersionTemplate("{{.Version}}\n")
command.AddGenerateDockerfile(cmd)
if err = cmd.Execute(); err != nil {
fmt.Printf("\nerror: %s\n", err)
Expand Down
2 changes: 1 addition & 1 deletion example/secret-generator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: ksops
metadata:
name: secret-generator
annotations:
config.kubernetes.io/function: |
config.kubernetes.io/function: |2-
exec:
path: ksops
fail-silently: false
Expand Down

0 comments on commit 6489f0e

Please sign in to comment.