Skip to content

Commit

Permalink
Fix dynamic-config apply command
Browse files Browse the repository at this point in the history
  • Loading branch information
hasit committed Oct 12, 2023
1 parent 9896e10 commit 6360c96
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
8 changes: 4 additions & 4 deletions cmd/aperturectl/cmd/dynamicconfig/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func init() {

// ApplyCmd is the command to apply DynamicConfig to a Policy.
var ApplyCmd = &cobra.Command{
Use: "dynamic-config",
Use: "apply",
Short: "Apply Aperture DynamicConfig to a Policy",
Long: `Use this command to apply the Aperture DynamicConfig to a Policy.`,
SilenceErrors: true,
Expand All @@ -56,17 +56,17 @@ var ApplyCmd = &cobra.Command{
return fmt.Errorf("failed to parse DynamicConfig YAML: %w", err)
}

if Controller.IsKube() {
if controller.IsKube() {
var kubeClient k8sclient.Client
kubeClient, err = k8sclient.New(Controller.GetKubeRestConfig(), k8sclient.Options{
kubeClient, err = k8sclient.New(controller.GetKubeRestConfig(), k8sclient.Options{
Scheme: scheme.Scheme,
})
if err != nil {
return fmt.Errorf("failed to create Kubernetes client: %w", err)
}

var deployment *appsv1.Deployment
deployment, err = utils.GetControllerDeployment(Controller.GetKubeRestConfig(), controllerNs)
deployment, err = utils.GetControllerDeployment(controller.GetKubeRestConfig(), controllerNs)
if err != nil {
return err
}
Expand Down
10 changes: 5 additions & 5 deletions cmd/aperturectl/cmd/dynamicconfig/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import (
)

var (
Controller utils.ControllerConn
controller utils.ControllerConn
client utils.PolicyClient
controllerNs string
)

func init() {
Controller.InitFlags(DynamicConfigCmd.PersistentFlags())
controller.InitFlags(DynamicConfigCmd.PersistentFlags())

DynamicConfigCmd.AddCommand(ApplyCmd)
}
Expand All @@ -29,19 +29,19 @@ Use this command to manage the DynamicConfig of the Aperture Policies to the Con
SilenceErrors: true,
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
var err error
err = Controller.PreRunE(cmd, args)
err = controller.PreRunE(cmd, args)
if err != nil {
return fmt.Errorf("failed to run controller pre-run: %w", err)
}

controllerNs = utils.GetControllerNs()

client, err = Controller.PolicyClient()
client, err = controller.PolicyClient()
if err != nil {
return fmt.Errorf("failed to get controller client: %w", err)
}

return nil
},
PersistentPostRun: Controller.PostRun,
PersistentPostRun: controller.PostRun,
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
---
sidebar_label: Dynamic-Config
sidebar_label: Apply
hide_title: true
keywords:
- aperturectl
- aperturectl_dynamic-config_dynamic-config
- aperturectl_dynamic-config_apply
---

<!-- markdownlint-disable -->

## aperturectl dynamic-config dynamic-config
## aperturectl dynamic-config apply

Apply Aperture DynamicConfig to a Policy

Expand All @@ -17,7 +17,7 @@ Apply Aperture DynamicConfig to a Policy
Use this command to apply the Aperture DynamicConfig to a Policy.

```
aperturectl dynamic-config dynamic-config [flags]
aperturectl dynamic-config apply [flags]
```

### Examples
Expand All @@ -30,7 +30,7 @@ aperturectl dynamic-config apply --policy=rate-limiting --file=dynamic-config.ya

```
--file string Path to the dynamic config file
-h, --help help for dynamic-config
-h, --help help for apply
--policy string Name of the Policy to apply the DynamicConfig to
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ Use this command to manage the DynamicConfig of the Aperture Policies to the Con
### SEE ALSO

- [aperturectl](/reference/aperturectl/aperturectl.md) - aperturectl - CLI tool to interact with Aperture
- [aperturectl dynamic-config dynamic-config](/reference/aperturectl/dynamic-config/dynamic-config/dynamic-config.md) - Apply Aperture DynamicConfig to a Policy
- [aperturectl dynamic-config apply](/reference/aperturectl/dynamic-config/apply/apply.md) - Apply Aperture DynamicConfig to a Policy

0 comments on commit 6360c96

Please sign in to comment.