// Generate generates the ignition config for the Bootstrap asset.
Generate generates the ignition config for the Bootstrap asset.
// Generate generates the ignition config for the Bootstrap asset .
func (a *Bootstrap) Generate(dependencies asset.Parents) error {
	installConfig := &installconfig.InstallConfig{}
	dependencies.Get(installConfig)
	templateData, err := a.getTemplateData(installConfig.Config)
	if err != nil {
		return errors.Wrap(err, "failed to get bootstrap templates")
	}
	a.config = &igntypes.Config{
		Ignition: igntypes.Ignition{
			Version: igntypes.MaxVersion.String(),
		},
	}
	a.addBootstrapFiles(dependencies)
	a.addBootkubeFiles(dependencies, templateData)
	a.addTectonicFiles(dependencies, templateData)
	a.addTLSCertFiles(dependencies)
	a.config.Systemd.Units = append(
		a.config.Systemd.Units,
		igntypes.Unit{Name: "bootkube.service", Contents: content.BootkubeSystemdContents},
		igntypes.Unit{Name: "tectonic.service", Contents: content.TectonicSystemdContents, Enabled: util.BoolToPtr(true)},
		igntypes.Unit{Name: "kubelet.service", Contents: applyTemplateData(content.KubeletSystemdTemplate, templateData), Enabled: util.BoolToPtr(true)},
	)
	a.config.Passwd.Users = append(
		a.config.Passwd.Users,
		igntypes.PasswdUser{Name: "core", SSHAuthorizedKeys: []igntypes.SSHAuthorizedKey{igntypes.SSHAuthorizedKey(installConfig.Config.Admin.SSHKey)}},
	)
	data, err := json.Marshal(a.config)
	if err != nil {
		return errors.Wrap(err, "failed to Marshal Ignition config")
	}
	a.file = &asset.File{
		Filename: "bootstrap.ign",
		Data:     data,
	}
	return nil
}
func ( a * Bootstrap ) Generate ( dependencies asset . Parents ) error { installConfig := & installconfig . InstallConfig { } dependencies . Get ( installConfig ) templateData , err := a . getTemplateData ( installConfig . Config ) if err != nil { return errors . Wrap ( err , " " ) } a . config = & igntypes . Config { Ignition : igntypes . Ignition { Version : igntypes . MaxVersion . String ( ) , } , } a . addBootstrapFiles ( dependencies ) a . addBootkubeFiles ( dependencies , templateData ) a . addTectonicFiles ( dependencies , templateData ) a . addTLSCertFiles ( dependencies ) a . config . Systemd . Units = append ( a . config . Systemd . Units , igntypes . Unit { Name : " " , Contents : content . BootkubeSystemdContents } , igntypes . Unit { Name : " " , Contents : content . TectonicSystemdContents , Enabled : util . BoolToPtr ( true ) } , igntypes . Unit { Name : " " , Contents : applyTemplateData ( content . KubeletSystemdTemplate , templateData ) , Enabled : util . BoolToPtr ( true ) } , ) a . config . Passwd . Users = append ( a . config . Passwd . Users , igntypes . PasswdUser { Name : " " , SSHAuthorizedKeys : [ ] igntypes . SSHAuthorizedKey { igntypes . SSHAuthorizedKey ( installConfig . Config . Admin . SSHKey ) } } , ) data , err := json . Marshal ( a . config ) if err != nil { return errors . Wrap ( err , " " ) } a . file = & asset . File { Filename : " " , Data : data , } return nil }
Generate generates the ignition config for the Bootstrap asset.
Generate generates the ignition config for the Bootstrap asset .