@@ -236,27 +236,9 @@ func waitForK0s(ctx context.Context) error {
236236 return nil
237237}
238238
239- // runK0sKubeconfig generates a new kubeconfig file with admin privileges.
240- func runK0sKubeconfig (ctx context.Context ) error {
241- stdout , err := runCommand (defaults .K0sBinaryPath (), "kubeconfig" , "admin" )
242- if err != nil {
243- return fmt .Errorf ("unable to generate kubeconfig: %w" , err )
244- }
245- kpath := defaults .PathToConfig ("kubeconfig" )
246- fp , err := os .OpenFile (kpath , os .O_RDWR | os .O_CREATE | os .O_TRUNC , 0600 )
247- if err != nil {
248- return fmt .Errorf ("unable to open kubeconfig: %w" , err )
249- }
250- defer fp .Close ()
251- if _ , err := fp .WriteString (stdout ); err != nil {
252- return fmt .Errorf ("unable to write kubeconfig: %w" , err )
253- }
254- return nil
255- }
256-
257239// runOutro calls Outro() in all enabled addons by means of Applier.
258240func runOutro (c * cli.Context ) error {
259- os .Setenv ("KUBECONFIG" , defaults .PathToConfig ( "kubeconfig" ))
241+ os .Setenv ("KUBECONFIG" , defaults .PathToKubeConfig ( ))
260242 opts := []addons.Option {}
261243 if c .String ("license" ) != "" {
262244 license , err := helpers .ParseLicense (c .String ("license" ))
@@ -352,12 +334,6 @@ var installCommand = &cli.Command{
352334 metrics .ReportApplyFinished (c , err )
353335 return err
354336 }
355- logrus .Debugf ("reading k0s kubeconfig" )
356- if err := runK0sKubeconfig (c .Context ); err != nil {
357- err := fmt .Errorf ("unable to get kubeconfig: %w" , err )
358- metrics .ReportApplyFinished (c , err )
359- return err
360- }
361337 logrus .Debugf ("running outro" )
362338 if err := runOutro (c ); err != nil {
363339 metrics .ReportApplyFinished (c , err )
0 commit comments