sveltosctl
sveltosctl copied to clipboard
set-log-severity-for-managed-cluster-components
Enhancement for: https://github.com/projectsveltos/sveltosctl/issues/41
Description
Enhanced the sveltosctl log-settings command to allow users to set log severity levels for components running in managed clusters. The user must specify the cluster namespace and name to apply the changes.
Changes
- Updated log-settings command to support managed cluster components.
- Modified logic to request cluster namespace and name from the user.
- Added necessary error handling and parameter validation.
Testing
I ensured I can see the cluster name after setting the log-level set to contain the cluster name
┌──(sdk㉿sdk)-[~/sveltos/sveltosctl]
└─$ ./bin/sveltosctl log-level set --component=AddonManager --namespace=namespace-test --cluster=cluster-name-test --debug
┌──(sdk㉿sdk)-[~/sveltos/sveltosctl]
└─$ cd ../addon-controller
┌──(sdk㉿sdk)-[~/sveltos/addon-controller]
└─$ export KUBECONFIG=$(pwd)/test/fv/workload_kubeconfig && kubectl get debuggingconfiguration -o yaml
apiVersion: v1
items:
- apiVersion: lib.projectsveltos.io/v1alpha1
kind: DebuggingConfiguration
metadata:
creationTimestamp: "2024-05-21T11:26:08Z"
generation: 1
managedFields:
- apiVersion: lib.projectsveltos.io/v1alpha1
fieldsType: FieldsV1
fieldsV1:
f:spec:
.: {}
f:configuration: {}
manager: sveltosctl
operation: Update
time: "2024-05-21T11:26:08Z"
name: cluster-name-test
resourceVersion: "1784"
uid: 8fbd859c-2371-4711-a8ac-135c6f6a745f
spec:
configuration:
- component: AddonManager
logLevel: LogLevelDebug
kind: List
metadata:
resourceVersion: ""
selfLink: ""