Skip to content

Commit

Permalink
Disable autologin in node templates (#941)
Browse files Browse the repository at this point in the history
  • Loading branch information
jknipper authored Sep 9, 2024
1 parent 975479c commit 6c14a4a
Show file tree
Hide file tree
Showing 14 changed files with 498 additions and 285 deletions.
28 changes: 14 additions & 14 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ require (
github.com/Masterminds/sprig/v3 v3.2.3
github.com/aokoli/goutils v1.1.1
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2
github.com/coreos/container-linux-config-transpiler v0.9.0
github.com/coreos/butane v0.21.0
github.com/coreos/go-oidc/v3 v3.10.0
github.com/coreos/ignition v0.35.0
github.com/coreos/vcontext v0.0.0-20231102161604-685dc7299dc5
github.com/databus23/goslo.policy v0.0.0-20210929125152-81bf2876dbdb
github.com/databus23/guttle v0.0.0-20210623071842-89102dbdfc85
github.com/databus23/keystone v0.0.0-20180111110916-350fd0e663cd
Expand All @@ -42,7 +42,7 @@ require (
github.com/rs/cors v1.11.0
github.com/satori/go.uuid v1.2.0
github.com/spf13/cobra v1.8.1
github.com/spf13/pflag v1.0.5
github.com/spf13/pflag v1.0.6-0.20210604193023-d5e0c0615ace
github.com/stretchr/testify v1.9.0
github.com/tredoe/osutil v1.5.0
github.com/zalando/go-keyring v0.2.5
Expand All @@ -68,18 +68,19 @@ require (
github.com/MakeNowJust/heredoc v1.0.0 // indirect
github.com/Masterminds/squirrel v1.5.4 // indirect
github.com/Microsoft/hcsshim v0.11.4 // indirect
github.com/ajeddeloh/go-json v0.0.0-00010101000000-000000000000 // indirect
github.com/ajeddeloh/yaml v0.0.0-20160722214022-1072abfea311 // indirect
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect
github.com/alessio/shellescape v1.4.1 // indirect
github.com/aws/aws-sdk-go v1.50.25 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cenkalti/backoff v2.2.1+incompatible // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/chai2010/gettext-go v1.0.2 // indirect
github.com/clarketm/json v1.17.1 // indirect
github.com/containerd/containerd v1.7.12 // indirect
github.com/containerd/log v0.1.0 // indirect
github.com/coreos/go-json v0.0.0-20230131223807-18775e0fb4fb // indirect
github.com/coreos/go-semver v0.3.1 // indirect
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e // indirect
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
github.com/coreos/ignition/v2 v2.18.0 // indirect
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
github.com/danieljoos/wincred v1.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
Expand All @@ -94,7 +95,7 @@ require (
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/felixge/httpsnoop v1.0.3 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/go-errors/errors v1.4.2 // indirect
github.com/go-gorp/gorp/v3 v3.1.0 // indirect
github.com/go-jose/go-jose/v4 v4.0.1 // indirect
Expand Down Expand Up @@ -166,24 +167,23 @@ require (
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/vincent-petithory/dataurl v0.0.0-20160330182126-9a301d65acbb // indirect
github.com/vincent-petithory/dataurl v1.0.0 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
github.com/xlab/treeprint v1.2.0 // indirect
go.mongodb.org/mongo-driver v1.14.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.45.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.48.0 // indirect
go.opentelemetry.io/otel v1.24.0 // indirect
go.opentelemetry.io/otel/metric v1.24.0 // indirect
go.opentelemetry.io/otel/trace v1.24.0 // indirect
go.starlark.net v0.0.0-20230525235612-a134d8f9ddca // indirect
go4.org v0.0.0-20230225012048-214862532bf5 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/term v0.21.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/time v0.3.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect
google.golang.org/grpc v1.58.3 // indirect
golang.org/x/time v0.5.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240213162025-012b6fc9bca9 // indirect
google.golang.org/grpc v1.61.1 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
176 changes: 29 additions & 147 deletions go.sum

Large diffs are not rendered by default.

28 changes: 8 additions & 20 deletions pkg/templates/ignition.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@ package templates

import (
"bytes"
"encoding/json"
"fmt"
"strings"
"text/template"

"github.com/Masterminds/sprig/v3"
"github.com/aokoli/goutils"
"github.com/coreos/container-linux-config-transpiler/config"
"github.com/coreos/container-linux-config-transpiler/config/platform"
"github.com/coreos/ignition/config/validate/report"
butaneConfig "github.com/coreos/butane/config"
"github.com/coreos/butane/config/common"
"github.com/coreos/vcontext/report"
"github.com/go-kit/log"
"github.com/tredoe/osutil/user/crypt/sha512_crypt"

Expand Down Expand Up @@ -233,24 +232,13 @@ func (i *ignition) GenerateNode(kluster *kubernikusv1.Kluster, pool *models.Node
return nil, err
}

ignitionConfig, ast, report := config.Parse(buffer.Bytes())
if len(report.Entries) > 0 {
if report.IsFatal() {
return nil, fmt.Errorf("Couldn't transpile ignition file: %v", report.String())
}
}

ignitionConfig3, report := config.Convert(ignitionConfig, platform.OpenStackMetadata, ast)
if len(report.Entries) > 0 {
if report.IsFatal() {
return nil, fmt.Errorf("Couldn't convert ignition config: %v", report.String())
}
}

dataOut, err = json.Marshal(&ignitionConfig3)
dataOut, report, err = butaneConfig.TranslateBytes(
buffer.Bytes(),
common.TranslateBytesOptions{Pretty: false, Raw: false},
)

if err != nil {
return nil, err
return nil, fmt.Errorf("Couldn't translate ignition file: %v", report.String())
}

return dataOut, nil
Expand Down
Loading

0 comments on commit 6c14a4a

Please sign in to comment.