// Execute prepares the update.
Execute prepares the update.
// Execute prepares the update .
func (p *updatePhaseInit) Execute(context.Context) error {
	err := removeLegacyUpdateDirectory(p.FieldLogger)
	if err != nil {
		return trace.Wrap(err, "failed to remove legacy update directory")
	}
	if err := p.createAdminAgent(); err != nil {
		return trace.Wrap(err, "failed to create cluster admin agent")
	}
	if err := p.upsertServiceUser(); err != nil {
		return trace.Wrap(err, "failed to upsert service user")
	}
	if err := p.initRPCCredentials(); err != nil {
		return trace.Wrap(err, "failed to update RPC credentials")
	}
	if err := p.initTeleportAuthToken(); err != nil {
		return trace.Wrap(err, "failed to initialize Teleport auth token")
	}
	if err := p.updateClusterRoles(); err != nil {
		return trace.Wrap(err, "failed to update RPC credentials")
	}
	if err := p.updateClusterDNSConfig(); err != nil {
		return trace.Wrap(err, "failed to update DNS configuration")
	}
	if err := p.updateClusterInfoMap(); err != nil {
		return trace.Wrap(err, "failed to update cluster info config map")
	}
	if err := p.updateDockerConfig(); err != nil {
		return trace.Wrap(err, "failed to update Docker configuration")
	}
	for _, server := range p.Servers {
		if server.Runtime.Update != nil {
			if err := p.rotateSecrets(server); err != nil {
				return trace.Wrap(err, "failed to rotate secrets for %v", server)
			}
			if err := p.rotatePlanetConfig(server); err != nil {
				return trace.Wrap(err, "failed to rotate planet configuration for %v", server)
			}
		}
		if server.Teleport.Update != nil {
			if err := p.rotateTeleportConfig(server); err != nil {
				return trace.Wrap(err, "failed to rotate teleport configuration for %v", server)
			}
		}
	}
	return nil
}
func ( p * updatePhaseInit ) Execute ( context . Context ) error { err := removeLegacyUpdateDirectory ( p . FieldLogger ) if err != nil { return trace . Wrap ( err , " " ) } if err := p . createAdminAgent ( ) ; err != nil { return trace . Wrap ( err , " " ) } if err := p . upsertServiceUser ( ) ; err != nil { return trace . Wrap ( err , " " ) } if err := p . initRPCCredentials ( ) ; err != nil { return trace . Wrap ( err , " " ) } if err := p . initTeleportAuthToken ( ) ; err != nil { return trace . Wrap ( err , " " ) } if err := p . updateClusterRoles ( ) ; err != nil { return trace . Wrap ( err , " " ) } if err := p . updateClusterDNSConfig ( ) ; err != nil { return trace . Wrap ( err , " " ) } if err := p . updateClusterInfoMap ( ) ; err != nil { return trace . Wrap ( err , " " ) } if err := p . updateDockerConfig ( ) ; err != nil { return trace . Wrap ( err , " " ) } for _ , server := range p . Servers { if server . Runtime . Update != nil { if err := p . rotateSecrets ( server ) ; err != nil { return trace . Wrap ( err , " " , server ) } if err := p . rotatePlanetConfig ( server ) ; err != nil { return trace . Wrap ( err , " " , server ) } } if server . Teleport . Update != nil { if err := p . rotateTeleportConfig ( server ) ; err != nil { return trace . Wrap ( err , " " , server ) } } } return nil }
Execute prepares the update.
Execute prepares the update .