Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set-log-severity-for-managed-cluster-components #154

Open
wants to merge 86 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
017229e
Modifying set method to use optional flags.
AdamSadek Sep 3, 2023
8ec0f7f
Removed instance and DC creation.
AdamSadek Sep 3, 2023
5b42fd7
Removed instance and DC creation.
AdamSadek Sep 3, 2023
9537858
Forgot to check for clusterType
AdamSadek Sep 3, 2023
995be6c
Fixing name of func and adding clusterType to function arguments
AdamSadek Sep 3, 2023
598dfe7
removing instance as it will now use the passed in dc
AdamSadek Sep 3, 2023
16abd0c
experimenting
AdamSadek Sep 3, 2023
9f8f9f2
Making adjustments
AdamSadek Sep 3, 2023
2ba0495
importing apierrors & metav1
AdamSadek Sep 3, 2023
f73620a
fixing managed dc
AdamSadek Sep 3, 2023
750c904
directly setting ClusterName and ClusterType?
AdamSadek Sep 3, 2023
5c39607
Resolving syntax errors
AdamSadek Sep 3, 2023
6efdf61
removing comma
AdamSadek Sep 3, 2023
5c39df1
extended log command to set severity for components in managed clusters
AdamSadek May 14, 2024
0c3d7be
handle log-level command for managed clusters
AdamSadek May 14, 2024
0dc3153
argument mismatch fix, undefined instance fix, correct GetClientForMa…
AdamSadek May 14, 2024
6125cb6
error handling in set function, logical check in update operations.
AdamSadek May 14, 2024
06e8bf0
new approach
AdamSadek May 14, 2024
d3d660a
not enough arguments fix attempt
AdamSadek May 14, 2024
5dcaaf5
dealing with some errors
AdamSadek May 14, 2024
fdfb95b
adding new params to test
AdamSadek May 14, 2024
5a2d36a
creating GetDebuggingConfiguration and adding dynamic switching of cl…
AdamSadek May 14, 2024
5e1ff66
reverting changes in client.go as I misunderstood a part and maing ch…
AdamSadek May 14, 2024
a5132fa
update params in test files
AdamSadek May 14, 2024
e730eaa
I thought there was a typo
AdamSadek May 14, 2024
ac3bb5f
unset missing the new params!
AdamSadek May 14, 2024
9712df2
lint erros
AdamSadek May 14, 2024
8bc2162
new approach in utils.go
AdamSadek May 14, 2024
6ccb751
param order fix
AdamSadek May 14, 2024
a46aec7
reducing errors
AdamSadek May 14, 2024
0ce8928
removing extra params
AdamSadek May 15, 2024
5066560
removing nil return from collectlogconfig
AdamSadek May 15, 2024
d9704be
trying a new fix
AdamSadek May 15, 2024
5b1ce98
i dont think theres a point in returning the namespace and clusternam…
AdamSadek May 15, 2024
2133af0
tried a new approach. should be better
AdamSadek May 15, 2024
dad3bf1
making change sin debuggingconfig.go file
AdamSadek May 15, 2024
a96ff4d
making the changes in the debbuging config test file
AdamSadek May 15, 2024
49d4d85
should fix the failing tests
AdamSadek May 15, 2024
4a5d469
mispell is on purpose, i keep forgetting!
AdamSadek May 15, 2024
c419f19
fixing lint errors to make test vars constants
AdamSadek May 15, 2024
1bc1242
forgot to add change in utils.go debug config section
AdamSadek May 21, 2024
ef9f552
reverting change
AdamSadek May 21, 2024
7698b4e
adding clusterType and making additional changes
AdamSadek May 21, 2024
41691bb
clusterproxy.GetSveltosKubernetesClient to get the client pointing to…
AdamSadek May 21, 2024
3ac6ae0
might be an issue with k8sAccess redeclaration
AdamSadek May 21, 2024
8072557
Misunderstanding. This should be better
AdamSadek May 21, 2024
ad11e2e
adding cluster type to req object
AdamSadek May 21, 2024
357325c
resolving some errors
AdamSadek May 21, 2024
e3d1705
adding logger as param
AdamSadek May 21, 2024
8de4274
getting logger in a different way
AdamSadek May 21, 2024
a6b903f
logger is being tedious. debugging
AdamSadek May 21, 2024
37fe863
fixing logger
AdamSadek May 21, 2024
0d753db
new approach to get logger
AdamSadek May 22, 2024
b49c5de
getting logger new approach
AdamSadek May 22, 2024
07ee55d
new approach for logger
AdamSadek May 22, 2024
4d02c06
Passing it as a parameter
AdamSadek May 22, 2024
ed38a59
using correct GetKubernetesClient
AdamSadek May 23, 2024
5cd4d0c
getting logger
AdamSadek May 23, 2024
5563d1a
adding defaultInstanceName back
AdamSadek May 23, 2024
bbeb6f0
attempting to resolve error in test for debuggingconfig
AdamSadek May 23, 2024
96b52dd
attempt to fix test, different approach
AdamSadek May 23, 2024
305b122
reverting change
AdamSadek May 23, 2024
45fc960
adding values instead of empty
AdamSadek May 23, 2024
7e8b584
testing fix
AdamSadek May 23, 2024
5f185c4
testing dc name
AdamSadek May 23, 2024
180f8d8
no need for addition in set_test
AdamSadek May 23, 2024
bae30c2
adding cluster type and namespace to DC
AdamSadek May 23, 2024
5be7ef7
adding type and namespace to DC
AdamSadek May 23, 2024
2bef532
Testing new approach for debuggingconfiguratgions
AdamSadek May 23, 2024
5437374
removing Type
AdamSadek May 23, 2024
ed6fc77
new fixes
AdamSadek May 23, 2024
6c0bf2f
reveritng back to previous change.
AdamSadek May 23, 2024
3f06b1b
reverting back to previous version
AdamSadek May 23, 2024
cc8b535
Changing expect test from Namespace to Name
AdamSadek May 23, 2024
080546c
Reading optional arguments correctly.
AdamSadek May 28, 2024
3470592
Syntax fix
AdamSadek May 28, 2024
ffb9a94
Reading optional arguments correctly for show.go
AdamSadek May 28, 2024
2bfff86
Register cluster
Dec 3, 2024
face760
(feat) dryRun message for helm charts
Dec 5, 2024
f24c9e7
Prepare for release v0.44.0
Dec 8, 2024
2ba58a4
Set tag
Dec 8, 2024
c5a69aa
Update actions/setup-go action to v5.2.0
renovate[bot] Dec 21, 2024
11f5d20
(feat) remove techsupport
Jan 2, 2025
2aa3b11
(chore) Prepare for release v0.45.0
Jan 10, 2025
e4340d7
Modifying set method to use optional flags.
AdamSadek Sep 3, 2023
96f96e0
Merge branch 'set-log-severity-for-managed-cluster-components' of htt…
AdamSadek Jan 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # tag=v4.1.5
- name: Set up Go
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
go-version: 1.22.7
go-version: 1.23.4
- name: Build
run: make build
- name: FMT
Expand All @@ -33,11 +33,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # tag=v4.1.5
- name: Set up Go
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
go-version: 1.22.7
go-version: 1.23.4
- name: ut
run: make test
env:
Expand Down
2 changes: 1 addition & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ linters-settings:
min-complexity: 20
goimports:
local-prefixes: github.com/projectsveltos
mnd:
gomnd:
checks: argument,case,condition,return
gomodguard:
# Although this is almost empty, we will evolve the list below with the
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.22.7 AS builder
FROM golang:1.23.4 AS builder

ARG ARCH
ARG GIT_VERSION=unknown
Expand Down
23 changes: 5 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ KUBECTL := $(TOOLS_BIN_DIR)/kubectl
SETUP_ENVTEST := $(TOOLS_BIN_DIR)/setup_envs
CONTROLLER_GEN := $(TOOLS_BIN_DIR)/controller-gen

GOLANGCI_LINT_VERSION := "v1.61.0"
GOLANGCI_LINT_VERSION := "v1.62.2"

KUSTOMIZE_VER := v5.3.0
KUSTOMIZE_VER := v4.5.2
KUSTOMIZE_BIN := kustomize
KUSTOMIZE := $(abspath $(TOOLS_BIN_DIR)/$(KUSTOMIZE_BIN)-$(KUSTOMIZE_VER))
KUSTOMIZE_PKG := sigs.k8s.io/kustomize/kustomize/v5
KUSTOMIZE_PKG := sigs.k8s.io/kustomize/kustomize/v4
$(KUSTOMIZE): # Build kustomize from tools folder.
CGO_ENABLED=0 GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) $(KUSTOMIZE_PKG) $(KUSTOMIZE_BIN) $(KUSTOMIZE_VER)

CONVERSION_GEN_VER := v0.31.0
CONVERSION_GEN_VER := v0.32.0
CONVERSION_GEN_BIN := conversion-gen
# We are intentionally using the binary without version suffix, to avoid the version
# in generated files.
Expand Down Expand Up @@ -120,25 +120,12 @@ generate: ## Run all generate-manifests-*, generate-go-deepcopy-*
echo "---" >> manifest/manifest.yaml
cat tmp/apiextensions.k8s.io_v1_customresourcedefinition_snapshots.utils.projectsveltos.io.yaml >> manifest/manifest.yaml
echo "---" >> manifest/manifest.yaml
cat tmp/apiextensions.k8s.io_v1_customresourcedefinition_techsupports.utils.projectsveltos.io.yaml >> manifest/manifest.yaml
rm -rf tmp
MANIFEST_IMG=$(SVELTOSCTL_IMG) MANIFEST_TAG=$(TAG) $(MAKE) set-manifest-image
$(MAKE) fmt

.PHONY: generate-go-conversions
generate-go-conversions: $(CONVERSION_GEN) ## Generate conversions go code for utils.projectsveltos.io api
$(MAKE) clean-generated-conversions SRC_DIRS="./api/v1alpha1"
$(CONVERSION_GEN) \
--output-file=zz_generated.conversion.go \
--go-header-file=./hack/boilerplate.generatego.txt \
./api/v1alpha1

.PHONY: clean-generated-conversions
clean-generated-conversions: ## Remove files generated by conversion-gen from the mentioned dirs. Example SRC_DIRS="./api/v1alpha4"
(IFS=','; for i in $(SRC_DIRS); do find $$i -type f -name 'zz_generated.conversion*' -exec rm -f {} \;; done)

set-manifest-image:
sed -i'' -e 's@image: .*@image: '"docker.io/${MANIFEST_IMG}:$(MANIFEST_TAG)"'@' ./manifest/manifest.yaml
sed -i'' -e 's@image: .*@image: '"${MANIFEST_IMG}:$(MANIFEST_TAG)"'@' ./manifest/manifest.yaml

.PHONY: generate-go-deepcopy
generate-go-deepcopy: $(CONTROLLER_GEN) ## Run all generate-go-deepcopy-* targets
Expand Down
53 changes: 0 additions & 53 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ You might also want to change the timezone of sveltosctl pod by using specific t
- [Multi-tenancy: display admin permissions](#multi-tenancy-display-admin-permissions)
- [Log severity settings](#log-severity-settings)
- [Display outcome of ClusterProfile/Profile in DryRun mode](#display-outcome-of-clusterprofile-in-dryrun-mode)
- [Techsupport](#techsupport)
- [list](#list)
- [Snapshot](#snapshot)
- [list](#list-1)
- [diff](#diff)
Expand Down Expand Up @@ -248,57 +246,6 @@ Usage:
--profile=<name> Show which Kubernetes addons would change because of this clusterprofile/profile. If not specified all clusterprofiles/profiles are considered.
```

## Techsupport

When running sveltosctl as pod in the management cluster, it can take collect techsupports (both logs and resources).

Define a Techsupport instance, following for instance will collect a techsupport every hour, collecting:

1. logs for all pods in kube-system namespace (last 10 minutes,i.e, 600 seconds, of logs);
2. All Secrets and Deployments

from all managed clusters matching cluster selectors __env=fv__

```
apiVersion: utils.projectsveltos.io/v1beta1
kind: Techsupport
metadata:
name: hourly
spec:
clusterSelector:
matchLabels:
env: fv
schedule: “00 * * * *”
storage: /techsupport
logs:
- namespace: kube-system
sinceSeconds: 600
resources:
- group: “”
version: v1
kind: Secret
- group: “”
version: v1
kind: Deployment
```

where field _schedule_ is defined in [Cron format](https://en.wikipedia.org/wiki/Cron).


### list

**techsupport list** can be used to display all collected techsupports:

```
kubectl exec -it -n projectsveltos sveltosctl-0 -- ./sveltosctl techsupport list --techsupport=hourly
+--------------------+---------------------+
| TECHSUPPORT POLICY | DATE |
+--------------------+---------------------+
| hourly | 2022-10-10:22:00:00 |
| hourly | 2022-10-10:23:00:00 |
+--------------------+---------------------+
```

## Snapshot

When running sveltosctl as pod in the management cluster, it can take configuration snapshot.
Expand Down
92 changes: 0 additions & 92 deletions api/v1alpha1/techsupport_conversion.go

This file was deleted.

Loading
Loading