Skip to content

Commit

Permalink
controller: also update stub ign config to spec 3
Browse files Browse the repository at this point in the history
This will allow us to manage a secret to scale up nodes with
ignition v2 binary installed.

Signed-off-by: Yu Qi Zhang <[email protected]>
  • Loading branch information
yuqi-zhang committed Jul 10, 2020
1 parent 12668c0 commit 22b8b24
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions pkg/controller/common/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func MergeMachineConfigs(configs []*mcfgv1.MachineConfig, osImageURL string) (*m
// PointerConfig generates the stub ignition for the machine to boot properly
// NOTE: If you change this, you also need to change the pointer configuration in openshift/installer, see
// https://github.com/openshift/installer/blob/master/pkg/asset/ignition/machine/node.go#L20
func PointerConfig(ignitionHost string, rootCA []byte) (ign2types.Config, error) {
func PointerConfig(ignitionHost string, rootCA []byte) (ign3types.Config, error) {
configSourceURL := &url.URL{
Scheme: "https",
Host: ignitionHost,
Expand All @@ -128,20 +128,21 @@ func PointerConfig(ignitionHost string, rootCA []byte) (ign2types.Config, error)
// we do decoding here as curly brackets are escaped to %7B and breaks golang's templates
ignitionHostTmpl, err := url.QueryUnescape(configSourceURL.String())
if err != nil {
return ign2types.Config{}, err
}
return ign2types.Config{
Ignition: ign2types.Ignition{
Version: ign2types.MaxVersion.String(),
Config: ign2types.IgnitionConfig{
Append: []ign2types.ConfigReference{{
Source: ignitionHostTmpl,
return ign3types.Config{}, err
}
CASource := dataurl.EncodeBytes(rootCA)
return ign3types.Config{
Ignition: ign3types.Ignition{
Version: ign3types.MaxVersion.String(),
Config: ign3types.IgnitionConfig{
Merge: []ign3types.Resource{{
Source: &ignitionHostTmpl,
}},
},
Security: ign2types.Security{
TLS: ign2types.TLS{
CertificateAuthorities: []ign2types.CaReference{{
Source: dataurl.EncodeBytes(rootCA),
Security: ign3types.Security{
TLS: ign3types.TLS{
CertificateAuthorities: []ign3types.Resource{{
Source: &CASource,
}},
},
},
Expand Down

0 comments on commit 22b8b24

Please sign in to comment.