• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

NVIDIA / skyhook / 20174212535

12 Dec 2025 05:08PM UTC coverage: 76.44%. First build
20174212535

Pull #127

github

t0mmylam
feat(cli): Add lifecycle management commands (pause, resume, disable, enable)
Pull Request #127: feat(cli): Add lifecycle management commands (pause, resume, disable, enable)

1159 of 1462 new or added lines in 17 files covered. (79.27%)

5798 of 7585 relevant lines covered (76.44%)

0.87 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

50.0
/operator/internal/cli/enable.go
1
/*
2
 * SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
 * SPDX-License-Identifier: Apache-2.0
4
 *
5
 *
6
 * Licensed under the Apache License, Version 2.0 (the "License");
7
 * you may not use this file except in compliance with the License.
8
 * You may obtain a copy of the License at
9
 *
10
 * http://www.apache.org/licenses/LICENSE-2.0
11
 *
12
 * Unless required by applicable law or agreed to in writing, software
13
 * distributed under the License is distributed on an "AS IS" BASIS,
14
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
 * See the License for the specific language governing permissions and
16
 * limitations under the License.
17
 */
18

19
package cli
20

21
import (
22
        "fmt"
23

24
        "github.com/spf13/cobra"
25

26
        "github.com/NVIDIA/skyhook/operator/internal/cli/client"
27
        cliContext "github.com/NVIDIA/skyhook/operator/internal/cli/context"
28
        "github.com/NVIDIA/skyhook/operator/internal/cli/utils"
29
)
30

31
// NewEnableCmd creates the enable command
32
func NewEnableCmd(ctx *cliContext.CLIContext) *cobra.Command {
1✔
33
        cmd := &cobra.Command{
1✔
34
                Use:   "enable <skyhook-name>",
1✔
35
                Short: "Enable a disabled Skyhook",
1✔
36
                Long: `Enable a disabled Skyhook by removing the disable annotation.
1✔
37

1✔
38
The operator will resume normal processing after this command.`,
1✔
39
                Example: `  # Enable a disabled Skyhook
1✔
40
  kubectl skyhook enable gpu-init`,
1✔
41
                Args: cobra.ExactArgs(1),
1✔
42
                RunE: func(cmd *cobra.Command, args []string) error {
1✔
NEW
43
                        skyhookName := args[0]
×
NEW
44

×
NEW
45
                        clientFactory := client.NewFactory(ctx.GlobalFlags.ConfigFlags)
×
NEW
46
                        kubeClient, err := clientFactory.Client()
×
NEW
47
                        if err != nil {
×
NEW
48
                                return fmt.Errorf("initializing kubernetes client: %w", err)
×
NEW
49
                        }
×
50

NEW
51
                        if err := utils.RemoveSkyhookAnnotation(cmd.Context(), kubeClient.Dynamic(), skyhookName, utils.DisableAnnotation); err != nil {
×
NEW
52
                                return err
×
NEW
53
                        }
×
NEW
54
                        _, _ = fmt.Fprintf(cmd.OutOrStdout(), "Skyhook %q enabled\n", skyhookName)
×
NEW
55
                        return nil
×
56
                },
57
        }
58

59
        return cmd
1✔
60
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc