Skip to content
This repository was archived by the owner on Jan 16, 2023. It is now read-only.

Dev vk travis test #160

Open
wants to merge 406 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
406 commits
Select commit Hold shift + click to select a range
edd79ad
DEV-55114 Argus shouldn't overwrite system.categories values
Nov 11, 2019
6425fd6
DEV-55114 Argus shouldn't overwrite system.categories values
Nov 12, 2019
2b299cf
Merge pull request #42 in DEV/k8s-argus from DEV-55114-argus-shouldn-…
Nov 14, 2019
648acbc
Dev 55114 argus shouldn t overwrite system.categories values (#116)
JeremyTangCD Dec 13, 2019
d65944a
Merge branch 'master' into develop
Dec 13, 2019
b628107
feature/upgrade: updated k8s sdk to 1.17 and client-go library to 14.0.
lmvaibhavk Mar 6, 2020
753ff7a
DEV-58267: updated v1betv2 client to v1 for deployment watcher.
lmvaibhavk Apr 3, 2020
47b4945
Merge pull request #43 in DEV/k8s-argus from DEV-58267-change-deploym…
lmvaibhavk Apr 6, 2020
89a0cbd
Updated Golang sdk version to 1.14.1
prathameshmahajan28 Apr 6, 2020
c1c9119
Merge pull request #44 in DEV/k8s-argus from DEV-55196-update-k8s-sdk…
prathameshmahajan28 Apr 6, 2020
8bb8955
Merge pull request #45 in DEV/k8s-argus from feature/upgrade to develop
lmvaibhavk Apr 14, 2020
622a387
DEV-58755: Updated image tag to new series i.e. v2latest
lmvaibhavk Apr 17, 2020
3665b6b
Merge pull request #46 in DEV/k8s-argus from DEV-58756-update-argus-i…
lmvaibhavk Apr 17, 2020
72fc2d2
Adding support for k8s 1.167+ (#124)
vkumbhar94 Apr 21, 2020
0a19c59
Merge branch 'master' into develop
vkumbhar94 Apr 21, 2020
e1c57b8
DEV-59276: Created dev profile dockerfile and updated makefile with dev
lmvaibhavk Apr 29, 2020
cde9d91
add support for horizontalpodautoscaler resource
kaladaLM18 May 11, 2020
9657282
add HorizontalPodAutoscalerDeviceGroupName to device tree
kaladaLM18 May 11, 2020
1474c08
use autoscaling/v1
kaladaLM18 May 11, 2020
5bfecc6
fix linter issue
kaladaLM18 May 11, 2020
9aeafcd
update remove unneeded param, change func name to initSyncHPA
kaladaLM18 May 11, 2020
d920238
Update comment for HasHorizontalPodAutoscalerPermissions
kaladaLM18 May 11, 2020
2bce9b2
DEV-59446 fixed deleted namespaces present on portal issue
pranay-lonkar-logicmonitor May 22, 2020
8667918
DEV-59446 delete namespace code refactored
pranay-lonkar-logicmonitor May 27, 2020
1df4259
add dupl comments
kaladaLM18 May 27, 2020
d0fb538
DEV-59446 delete namespace code refactored
pranay-lonkar-logicmonitor May 28, 2020
21657de
Merge pull request #49 in DEV/k8s-argus from bugfix/DEV-59446-deleted…
pranay-lonkar-logicmonitor May 29, 2020
a962109
Merge pull request #47 in DEV/k8s-argus from DEV-59276-argus-dev-prof…
lmvaibhavk Jun 2, 2020
f27fb33
Milestone 3.0.1 Changes (#135)
vkumbhar94 Jun 4, 2020
a1946a8
Merge branch 'master' into develop
vkumbhar94 Jun 4, 2020
da54e29
DEV-60985 argus failed to add device for collectorset-controller when…
pranay-lonkar-logicmonitor Jun 16, 2020
ecdfe56
DEV-61833: DEV-61833: Gosec scan fixes - avoiding taking reference o…
lmvaibhavk Jun 25, 2020
0e868bd
Merge pull request #52 in DEV/k8s-argus from DEV-61833-gosec-fixes-2 …
lmvaibhavk Jun 29, 2020
a1f384a
Gosec fixes (#138)
vkumbhar94 Jun 30, 2020
7165c1e
Merge branch 'master' into develop
vkumbhar94 Jul 1, 2020
3fc040c
Merge branch 'develop' into bugfix/DEV-60985-collector-controller-set…
pranay-lonkar-logicmonitor Jul 2, 2020
bd96157
DEV-60985 added following changes to fix csc restart issue
pranay-lonkar-logicmonitor Jul 6, 2020
8ee026a
DEV-55576: Implemented periodic discovery having 5 min resync period,
lmvaibhavk Jul 7, 2020
edd8d54
DEV-60985 argus failed to add device for collectorset-controller when…
pranay-lonkar-logicmonitor Jul 7, 2020
d46071c
added unit test cases for functions
pranay-lonkar-logicmonitor Jul 8, 2020
0700c9f
DEV-60985 refactored code - argus failed to add device for collectors…
pranay-lonkar-logicmonitor Jul 9, 2020
9dc837c
DEV-55576: changes cache run signature
lmvaibhavk Jul 13, 2020
fbb0286
Merge pull request #53 in DEV/k8s-argus from DEV-55576-periodic-disco…
lmvaibhavk Jul 15, 2020
bc6251d
DEV-60985 retry logic for gRPC connection
pranay-lonkar-logicmonitor Jul 15, 2020
34f7afa
Merge branch 'develop' into bugfix/DEV-60985-collector-controller-set…
pranay-lonkar-logicmonitor Jul 15, 2020
dbf21f5
DEV-60985 retry logic for gRPC connection
pranay-lonkar-logicmonitor Jul 15, 2020
28541ed
DEV-60985 refactored code - argus failed to add device for collectors…
pranay-lonkar-logicmonitor Jul 20, 2020
6a98f3a
DEV-60985 added cron job to handle gRPC connection
pranay-lonkar-logicmonitor Jul 22, 2020
7cfe0e4
DEV-60985 moved connection cron job to connection package
pranay-lonkar-logicmonitor Jul 23, 2020
fc1c9db
unit tests added for device and builder files.
lmshubhashri Jul 27, 2020
090bd71
DEV-60985 removed cron job and added go routine
pranay-lonkar-logicmonitor Jul 27, 2020
0a21ccc
DEV-61404- refactor
lmshubhashri Jul 28, 2020
e68a7b8
DEV-61404- fixed build failure
lmshubhashri Jul 28, 2020
f352663
Merge pull request #51 in DEV/k8s-argus from bugfix/DEV-60985-collect…
pranay-lonkar-logicmonitor Jul 29, 2020
17bf2d1
Merge branch 'develop' into DEV-61404-argus-golang-unit-testing
lmshubhashri Jul 29, 2020
5b50470
DEV-61404- removed newly added test files and added them to separate PR.
lmshubhashri Jul 29, 2020
32a5986
DEV-61404- added unit test cases for device,builder,utilities and nam…
lmshubhashri Jul 29, 2020
593e048
DEV-61404- Added testCase names in failure error strings.
lmshubhashri Jul 30, 2020
c7721ca
Argus 3.1.0 dev (#140)
vkumbhar94 Aug 3, 2020
9cefcfd
DEV-61404- removed unwanted file from commit
lmshubhashri Aug 4, 2020
90716bf
DEV-61404- correct key name for propertymap
lmshubhashri Aug 4, 2020
da37a8c
DEV-61404-removed commented code
lmshubhashri Aug 4, 2020
e32030e
DEV-62227: Refactored code in worker model way.
lmvaibhavk Aug 6, 2020
f3ae7c5
DEV-62227: removing unused code
lmvaibhavk Aug 6, 2020
9749730
DEV-62227: replaced struct to interface
lmvaibhavk Aug 6, 2020
8b63752
DEV-62227: replaced worker config with interface references
lmvaibhavk Aug 6, 2020
bc3a6dc
Merge pull request #54 in DEV/k8s-argus from DEV-61404-argus-golang-u…
lmshubhashri Aug 7, 2020
7e4d77f
Merge branch 'develop' into DEV-61404-argus-unitTests-part2
lmshubhashri Aug 7, 2020
0cac79e
Merge pull request #55 in DEV/k8s-argus from DEV-61404-argus-unitTest…
lmshubhashri Aug 7, 2020
61094e2
DEV-62227: moved log methods of lmcontext to log package, moved confi…
lmvaibhavk Aug 10, 2020
d2373d0
DEV-62227: added package comment and moved log context update to log
lmvaibhavk Aug 10, 2020
363e19d
DEV-62227: renamed method name to new
lmvaibhavk Aug 10, 2020
66bdcc8
Merge pull request #56 in DEV/k8s-argus from DEV-62227-worker-model t…
lmvaibhavk Aug 11, 2020
1a9ae51
Merge branch 'develop' into feature/rate-limiter-handling
lmvaibhavk Aug 11, 2020
f03fddd
DEV-62229: Unit test fixes
lmvaibhavk Aug 11, 2020
0d8e742
DEV-62229: lm sdk modified to return rate limit headers
lmvaibhavk Aug 11, 2020
71a2733
DEV-62229: rate limiter handling implemented
lmvaibhavk Aug 27, 2020
bba12e5
DEV-62229: method name changed
lmvaibhavk Aug 28, 2020
71d75d6
DEV-62229: incorporated review comments
lmvaibhavk Aug 31, 2020
89c7a64
DEV-62229: incorporated review comments, restructured rate limit manager
lmvaibhavk Sep 1, 2020
e657185
DEV-62229: updated 429 error with http status code constant
lmvaibhavk Sep 2, 2020
76519b2
Merge pull request #57 in DEV/k8s-argus from DEV-62229-rate-limit-han…
lmvaibhavk Sep 2, 2020
dfdd7ef
Merge pull request #58 in DEV/k8s-argus from feature/rate-limiter-han…
lmvaibhavk Sep 2, 2020
7721cfb
DEV-63522: Changed node applies to function to use labels
lmvaibhavk Sep 3, 2020
e8788e7
Merge pull request #59 in DEV/k8s-argus from DEV-63522-node-groups to…
lmvaibhavk Sep 3, 2020
72138e0
DEV-63522: updated deleted device group applies to also
lmvaibhavk Sep 3, 2020
26c38c4
Merge pull request #60 in DEV/k8s-argus from DEV-63522-node-groups to…
lmvaibhavk Sep 3, 2020
1ebdce3
DEV-63945-implementation of discovery filtering.
lmshubhashri Sep 4, 2020
770351e
DEV-63945-logging type modifications.
lmshubhashri Sep 4, 2020
062d411
DEV-63845- fixed build failures.
lmshubhashri Sep 7, 2020
3093293
DEV-63945- implemented update filter scenario.
lmshubhashri Sep 7, 2020
04fa981
DEV-63945- added unit test cases and address review comments.
lmshubhashri Sep 8, 2020
27710c8
DEV-63945- toml file changes.
lmshubhashri Sep 8, 2020
a781707
DEV-63945- review comments.
lmshubhashri Sep 8, 2020
bfb8e65
DEV-63945-review comments addressed.
lmshubhashri Sep 9, 2020
a480498
DEV-63945- reverted incorrect changes from lm-sdk.
lmshubhashri Sep 9, 2020
ad9bf96
Merge pull request #61 in DEV/k8s-argus from feature/DEV-63945-discov…
lmshubhashri Sep 9, 2020
97da650
V4.0.0 changes 2 (#143)
vkumbhar94 Sep 11, 2020
836c58e
Merge branch 'master' into develop
vkumbhar94 Sep 11, 2020
912c55c
DEV-63945- fixed issue with invalid keys in expression.
lmshubhashri Sep 11, 2020
29b823f
removed uncaught conflict
vkumbhar94 Sep 11, 2020
6dbc974
DEV-63945-unit test for back slash.
lmshubhashri Sep 11, 2020
598c1c3
DEV-63945-formatting.
lmshubhashri Sep 11, 2020
c3f7cff
Merge pull request #63 in DEV/k8s-argus from feature/DEV-63945-discov…
lmshubhashri Sep 11, 2020
03c1287
DEV-64472- handled back slash value in labelKey for evaluating filter…
lmshubhashri Sep 12, 2020
8d6e154
DEV-64472-handled characters which are not supported by govaluate lib…
lmshubhashri Sep 16, 2020
5be9088
DEV-64472-corrected typo.
lmshubhashri Sep 16, 2020
8f36ee1
Merge pull request #64 in DEV/k8s-argus from bugfix/DEV-64472-handle-…
lmshubhashri Sep 17, 2020
687c384
DEV-64223-implemented periodic delete for dangling resources.
lmshubhashri Sep 17, 2020
ec299ec
Merge pull request #48 in DEV/k8s-argus from TECHOPS-39286-argus-shou…
kaladaLM18 Sep 17, 2020
da9dc08
Merge branch 'develop' into feature/DEV-64223-periodic-delete
lmshubhashri Sep 18, 2020
8499bc7
DEV-64911: Handling regex error parse
lmvaibhavk Sep 18, 2020
7d30e3c
DEV-64908-fixed hpa implementation as per new code structure.
lmshubhashri Sep 18, 2020
d5129b9
feature/DEV-64908: added worker channel for hpa
lmvaibhavk Sep 19, 2020
9933593
Merge pull request #67 in DEV/k8s-argus from feature/DEV-64908-fix-HP…
lmvaibhavk Sep 20, 2020
99d69f6
go-mod: migrate repository to go mod
lmvaibhavk Sep 20, 2020
968d366
go-mod: recreate vendor with go.mod
lmvaibhavk Sep 20, 2020
0c6c188
go-mod: Update vendor
lmvaibhavk Sep 20, 2020
ee8c356
go-mod: run tidy and recreate go.sum
lmvaibhavk Sep 20, 2020
0b7d2c7
Merge pull request #66 in DEV/k8s-argus from DEV-64911-regex-error to…
lmvaibhavk Sep 21, 2020
ce6663b
Merge branch 'develop' into feature/DEV-64223-periodic-delete
lmshubhashri Sep 21, 2020
efbe1c2
DEV-64395 log k8s version and helm chart details in clsuter device group
pranay-lonkar-logicmonitor Sep 21, 2020
57783a4
DEV-64395 cron job run at midnight
pranay-lonkar-logicmonitor Sep 21, 2020
4a5894f
DEV-64395 moved GetNamespaceList to namespce file
pranay-lonkar-logicmonitor Sep 21, 2020
153c81a
index-bound: Merge pull request #66 in DEV/k8s-argus from DEV-64911-…
vkumbhar94 Sep 21, 2020
39f970e
Merge branch 'master' into develop
vkumbhar94 Sep 21, 2020
1dba28b
Merge pull request #68 in DEV/k8s-argus from go-mod-migration to develop
lmvaibhavk Sep 21, 2020
7d5deeb
DEV-64223- changed func name and context in logging.
lmshubhashri Sep 21, 2020
eda3a29
Merge pull request #65 in DEV/k8s-argus from feature/DEV-64223-period…
lmshubhashri Sep 21, 2020
f37e3c3
DEV-64395 refactored code and added some test cases
pranay-lonkar-logicmonitor Sep 21, 2020
304e358
Merge branch 'develop' into feature/DEV-64395-log-k8s-and-helm-versio…
pranay-lonkar-logicmonitor Sep 22, 2020
3b1807c
DEV-64395 refactored code
pranay-lonkar-logicmonitor Sep 22, 2020
c0024bf
Discovery filtering implementation (#148)
shubhashri12 Sep 23, 2020
79041a1
DEV-64395 read helm chart details from configmap annotations
pranay-lonkar-logicmonitor Sep 24, 2020
c40b374
DEV-64395 refatored cron job code
pranay-lonkar-logicmonitor Sep 24, 2020
720d38f
DEV-64395 refactored code
pranay-lonkar-logicmonitor Sep 25, 2020
c9d888b
DEV-53897- Updated displayName for Pods by appending respective names…
lmshubhashri Sep 28, 2020
2bf1008
DEV-64395 refactored code
pranay-lonkar-logicmonitor Sep 29, 2020
a79a064
Merge pull request #69 in DEV/k8s-argus from feature/DEV-64395-log-k8…
pranay-lonkar-logicmonitor Sep 29, 2020
3e0318b
Merge pull request #71 in DEV/k8s-argus from feature/DEV-53897-duplic…
lmshubhashri Sep 29, 2020
db685c9
DEV-65158: converted for kind of loop to do while
lmvaibhavk Sep 29, 2020
d7d2013
Merge pull request #72 in DEV/k8s-argus from DEV-65158-grpc-conn to d…
lmvaibhavk Sep 30, 2020
91c7e5a
DEVTS-9220 fixed system.ips property issue in add device functionality
pranay-lonkar-logicmonitor Oct 2, 2020
6332f30
DEVTS-9220 fixed system.ips property issue
pranay-lonkar-logicmonitor Oct 5, 2020
e300302
Merge pull request #73 in DEV/k8s-argus from bugfix/DEVTS-9220-discov…
pranay-lonkar-logicmonitor Oct 6, 2020
401f7fc
Release-4.2.0 (#150)
pranaylonkar19 Oct 8, 2020
28ac48a
Merge remote-tracking branch 'origin/master' into develop
vkumbhar94 Oct 8, 2020
fc4041b
DEV-65186: Fixed resource name and device name to displayname. Typically
lmvaibhavk Oct 17, 2020
2a14217
DEV-64397 updated docs
pranay-lonkar-logicmonitor Oct 19, 2020
2e62386
Merge pull request #75 in DEV/k8s-argus from DEV-65186-hpa-changes to…
lmvaibhavk Oct 19, 2020
c28b39e
DEV-64397 updated docs
pranay-lonkar-logicmonitor Oct 21, 2020
4181331
DEV-64397 updated docs
pranay-lonkar-logicmonitor Oct 22, 2020
bf85b67
DEV-64397 updated docs
pranay-lonkar-logicmonitor Oct 23, 2020
b92c8ee
DEV-64397 updated docs
pranay-lonkar-logicmonitor Oct 23, 2020
61fcde6
DEV-64397 updated docs
pranay-lonkar-logicmonitor Oct 23, 2020
e48b912
DEV-64397 updated docs
pranay-lonkar-logicmonitor Oct 23, 2020
da43bd3
DEV-64397 updated docs - added syntax highlighter
pranay-lonkar-logicmonitor Oct 23, 2020
fcf2ff8
DEV-64397 updated docs - removed roadmap and device tree, added all h…
pranay-lonkar-logicmonitor Oct 28, 2020
0bd6cb4
DEV-65186: added hpa discovery filtering
lmvaibhavk Oct 28, 2020
9b73445
Merge pull request #76 in DEV/k8s-argus from DEV-65186-hpa-disc-filte…
lmvaibhavk Oct 29, 2020
d2bf655
DEV-65186: Enable alerts on HPA
lmvaibhavk Oct 29, 2020
a3c24b2
Merge pull request #77 in DEV/k8s-argus from DEV-65186-hpa-disc-filte…
lmvaibhavk Oct 29, 2020
47a6c55
DEV-64397 updated docs
pranay-lonkar-logicmonitor Nov 4, 2020
811e142
Merge branch 'develop' into DEV-64397-update-github-docs
pranay-lonkar-logicmonitor Nov 4, 2020
0915ad2
DEV-64397 updated docs
pranay-lonkar-logicmonitor Nov 4, 2020
87d07ee
Merge pull request #74 in DEV/k8s-argus from DEV-64397-update-github-…
pranay-lonkar-logicmonitor Nov 9, 2020
8985de3
DEV-65940-Unique names for resources handling..
lmshubhashri Nov 18, 2020
667edd9
DEV-65940- updating device cache on check n update call.
lmshubhashri Nov 18, 2020
57160b2
DEV-66059 added support for AWS Fargate
pranay-lonkar-logicmonitor Nov 18, 2020
ff2ba76
dev-vk: use logicmonitor lm-sdk-go v2 release lib, since logicmonitor
lmvaibhavk Nov 23, 2020
08b20f7
DEV-65940- changed naming format to contain resourceType.
lmshubhashri Nov 23, 2020
d582b3d
DEVTS-9598-Added support for filtering by resource name containing sp…
lmshubhashri Nov 24, 2020
f86831f
dev-vk: format go files and imports
lmvaibhavk Nov 24, 2020
5eebd5d
DEV-65940- Fixed unit test cases, issue related to auto deletion of r…
lmshubhashri Nov 25, 2020
fffd0e0
DEV-65940- fixed build issue.
lmshubhashri Nov 25, 2020
7279a3b
DEV-65940-corrected resourcetype.
lmshubhashri Nov 25, 2020
4abde78
dev-vk: removed vkumbhar94 from go mod
lmvaibhavk Nov 25, 2020
fe41a50
Merge pull request #79 in DEV/k8s-argus from feature/DEV-66059-handle…
pranay-lonkar-logicmonitor Nov 26, 2020
4ea039d
DEV-66613 fixed delete devices issue
pranay-lonkar-logicmonitor Nov 27, 2020
d7475b4
DEV-65940-Handled multiple device conflict scenario and restricted re…
lmshubhashri Nov 27, 2020
1b02386
DEV-65940- code refactor and fixed build issue
lmshubhashri Nov 30, 2020
8d9561f
Merge pull request #80 in DEV/k8s-argus from dev-vk-lm-sdk-go to develop
lmvaibhavk Nov 30, 2020
04f902e
DEV-65940-golint issue fix.
lmshubhashri Dec 1, 2020
867fbed
DEV-65940- compile error resolved.
lmshubhashri Dec 1, 2020
40be233
Merge branch 'develop' into feature/DEV-65940-unique-naming-approach-…
lmshubhashri Dec 1, 2020
63a7e94
DEV-65940 - fixed lint issue.
lmshubhashri Dec 1, 2020
c81f6b9
DEV-65940-fixed issue with deployment type for same hostname
lmshubhashri Dec 1, 2020
837b78a
DEV-66613 removed unused method
pranay-lonkar-logicmonitor Dec 1, 2020
3e0a51f
Merge branch 'develop' into bugfix/DEV-66613-bug-argus-not-putting-de…
pranay-lonkar-logicmonitor Dec 1, 2020
7ce9af2
Merge pull request #81 in DEV/k8s-argus from bugfix/DEVTS-9598-filter…
lmshubhashri Dec 2, 2020
b99ce01
Merge branch 'develop' into bugfix/DEV-66613-bug-argus-not-putting-de…
pranay-lonkar-logicmonitor Dec 2, 2020
62db198
DEV-65940-fixed issue with node resource type.
lmshubhashri Dec 2, 2020
a688efb
DEV-65940- fixed build issue.
lmshubhashri Dec 3, 2020
6f2ee67
DEV-66613 placed resource deletion timestamp logic at central place
pranay-lonkar-logicmonitor Dec 3, 2020
c146211
DEV-65940- fixed issue with moving devices to conflicts group.
lmshubhashri Dec 3, 2020
a239f1e
DEV-66613 check if property exists with same value
pranay-lonkar-logicmonitor Dec 3, 2020
f018326
DEV-65940- review comments
lmshubhashri Dec 3, 2020
6e4c5bd
Merge branch 'develop' into feature/DEV-65940-unique-naming-approach-…
lmshubhashri Dec 3, 2020
ca998ed
DEV-65940-removed unused code.
lmshubhashri Dec 3, 2020
d060081
DEV-65940- fixed issue when fullname is enabled, existing conflicting…
lmshubhashri Dec 4, 2020
6997e52
dev-vk: Released custom lm-sdk-go version with rate limit header patch
lmvaibhavk Dec 7, 2020
310bdec
Merge pull request #83 in DEV/k8s-argus from dev-vk-lm-sdk-go to develop
lmvaibhavk Dec 7, 2020
0c5c31c
dev-patch: update lm-sdk-go to newer version v2.0.0-argus2 wherein
lmvaibhavk Dec 8, 2020
b29211f
Merge pull request #84 in DEV/k8s-argus from dev-patch-api-fix to dev…
lmvaibhavk Dec 8, 2020
7de9275
DEV-used update property api for updating system categories.
lmshubhashri Dec 8, 2020
464dd1d
DEV-65940- fixed build failure.
lmshubhashri Dec 8, 2020
588f9f4
DEV-65940- review comments fixed.
lmshubhashri Dec 9, 2020
7b0a2ad
Merge branch 'develop' into bugfix/DEV-66613-bug-argus-not-putting-de…
pranay-lonkar-logicmonitor Dec 9, 2020
033324b
DEV-65940- added rate limit headers in lm-sdk-go.
lmshubhashri Dec 9, 2020
0c67e1b
DEV-66613 added Patch API for device update
pranay-lonkar-logicmonitor Dec 9, 2020
f25031a
DEV-66613 added Patch API for device update
pranay-lonkar-logicmonitor Dec 9, 2020
a1288f2
DEV-65940- code refactor
lmshubhashri Dec 9, 2020
af7e245
Merge branch 'develop' into feature/DEV-65940-unique-naming-approach-…
lmshubhashri Dec 9, 2020
b95ebea
DEV-65940- updated lm-sdk reference.
lmshubhashri Dec 9, 2020
3519dca
Merge pull request #78 in DEV/k8s-argus from feature/DEV-65940-unique…
lmshubhashri Dec 10, 2020
2a000dd
Merge branch 'develop' into bugfix/DEV-66613-bug-argus-not-putting-de…
pranay-lonkar-logicmonitor Dec 10, 2020
ad07b23
DEV-66613 add resource deletion timestamp
pranay-lonkar-logicmonitor Dec 22, 2020
47e515f
DEV-66613 refactored delete devices code
pranay-lonkar-logicmonitor Dec 23, 2020
07a182f
DEV-66613 trim name before appending uuid
pranay-lonkar-logicmonitor Dec 30, 2020
cc0ad1b
DEV-66613 changed func name
pranay-lonkar-logicmonitor Jan 4, 2021
be47b90
DEV-66613 used Patch API to move deleted device
pranay-lonkar-logicmonitor Jan 11, 2021
acddc2d
DEV-66613 resolved rename issue for deleted device
pranay-lonkar-logicmonitor Jan 12, 2021
dcdb5bb
Merge pull request #82 in DEV/k8s-argus from bugfix/DEV-66613-bug-arg…
pranay-lonkar-logicmonitor Jan 13, 2021
5e5efb8
Dev 5.0.0 release (#152)
vkumbhar94 Jan 13, 2021
d12c3e0
Merge branch 'master' into develop
vkumbhar94 Jan 13, 2021
936662d
DEV-67526 default properties on device group
pranay-lonkar-logicmonitor Jan 15, 2021
57f338b
Merge pull request #88 in DEV/k8s-argus from feature/DEV-70008-add-ac…
lmshubhashri Jan 19, 2021
dd3a302
Merge pull request #88 in DEV/k8s-argus from feature/DEV-70008-add-ac…
shubhashri12 Jan 19, 2021
52896dd
Merge branch 'master' into develop
vkumbhar94 Jan 19, 2021
727d685
test(*): Add mockgen lib and update build configs. Implement sample t…
lmvaibhavk Jan 29, 2021
8c8b082
Merge branch 'develop' into feature/DEV-67526-configurable-terminatio…
pranay-lonkar-logicmonitor Feb 3, 2021
560936f
feat(watchers): generate SelfLink custom property on all devices
lmvaibhavk Feb 9, 2021
27a63c4
Merge branch 'develop' into feature/DEV-67526-configurable-terminatio…
pranay-lonkar-logicmonitor Feb 9, 2021
bd56b9c
DEV-67526 feat(deleteDevices) default properties
pranay-lonkar-logicmonitor Feb 12, 2021
cea4ee6
DEV-67526 feat(deleteDevices) default properties
pranay-lonkar-logicmonitor Feb 15, 2021
7510f55
Merge pull request #87 in DEV/k8s-argus from feature/DEV-67526-config…
pranay-lonkar-logicmonitor Feb 16, 2021
048d5ff
Merge pull request #90 in DEV/k8s-argus from DEV-68258-argus-local-de…
Feb 22, 2021
8a6a88f
Merge pull request #93 in DEV/k8s-argus from DEV-67526-configurable-t…
pranay-lonkar-logicmonitor Feb 24, 2021
4ae3e4e
Merge pull request #95 in DEV/k8s-argus from bugfix/DEV-72789-correct…
lmshubhashri Mar 3, 2021
efabf20
feat(headless-services): set hostname to "name-res-namespace"
lmvaibhavk Mar 8, 2021
94ffb73
feat(argus app version): log argus app version
pranay-lonkar-logicmonitor Mar 10, 2021
f56d223
feat(device-group-props): allow users to mention device group properties
Mar 15, 2021
831dac3
feat(externalized-intervals): Read periodic sync, periodic delete and…
lmshubhashri Mar 25, 2021
e3b9137
fix(hpa): set hostname in name-resource-namespace format for HPA
pranay-lonkar-logicmonitor Mar 30, 2021
c8a7677
fix(externalized-intervals): set default values for intervals
pranay-lonkar-logicmonitor Mar 31, 2021
d354854
Merge remote-tracking branch 'stash-dev/develop' into develop
lmshubhashri Apr 5, 2021
f9a0da6
cat source.list
vkumbhar94 Apr 14, 2021
5fd10a3
ls dir
vkumbhar94 Apr 14, 2021
118300b
delete sources.d
vkumbhar94 Apr 14, 2021
9dbdd91
added sudo
vkumbhar94 Apr 14, 2021
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
build
coverage.txt
coverage.html
pkg/mocks
**/gomock*
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ install:
- rsync -az ${TRAVIS_BUILD_DIR}/ $GOPATH/src/github.com/autonomy/conform/
- export TRAVIS_BUILD_DIR=$GOPATH/src/github.com/autonomy/conform
- cd $GOPATH/src/github.com/autonomy/conform
- cat /etc/apt/sources.list
- ls -l /etc/apt/sources.list.d
- sudo rm -rf /etc/apt/sources.list.d
- sudo apt-get -y remove docker docker-engine
- sudo apt-get -y update
- sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
Expand Down
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o /argus -ldflags "-X \"gith
FROM golang:1.14 as test
WORKDIR $GOPATH/src/github.com/logicmonitor/k8s-argus
RUN go get -u github.com/alecthomas/gometalinter
RUN go get github.com/golang/mock/mockgen
RUN gometalinter --install
COPY --from=build $GOPATH/src/github.com/logicmonitor/k8s-argus ./
RUN go generate ./...
RUN chmod +x ./scripts/test.sh; sync; ./scripts/test.sh
RUN cp coverage.txt /coverage.txt

Expand Down
31 changes: 24 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,31 @@
NAMESPACE := logicmonitor
REPOSITORY := argus
VERSION := 1.0.0
VERSION ?= $(shell git describe --tags --always --dirty)

all:
docker build --build-arg VERSION=$(VERSION) -t $(NAMESPACE)/$(REPOSITORY):v2latest .
docker tag $(NAMESPACE)/$(REPOSITORY):v2latest $(NAMESPACE)/$(REPOSITORY):$(VERSION)
default: build

lint:
ifeq ($(shell uname -s), Darwin)
find pkg/ -type f | grep go | egrep -v "mocks|gomock" | xargs gofmt -l -d -s -w
find pkg/ -type f | grep go | egrep -v "mocks|gomock" | xargs goimports -l -d -w
endif

build: lint

docker build --build-arg VERSION=$(VERSION) -t $(NAMESPACE)/$(REPOSITORY):$(VERSION) .

dev: lint
docker build --build-arg VERSION=$(VERSION) -t $(NAMESPACE)/$(REPOSITORY):$(VERSION) -f Dockerfile.dev .

mockgen:
go generate ./...
test: mockgen lint
go test ./... -v -coverprofile=coverage.txt -race
go tool cover -html=coverage.txt -o coverage.html

devsetup:
go get github.com/golang/mock/mockgen

dev:
docker build --build-arg VERSION=$(VERSION) -t $(NAMESPACE)/$(REPOSITORY):v2latest -f Dockerfile.dev .
docker tag $(NAMESPACE)/$(REPOSITORY):v2latest $(NAMESPACE)/$(REPOSITORY):$(VERSION)

.PHONY: docs
docs:
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ require (
github.com/coreos/etcd v3.3.13+incompatible
github.com/go-openapi/runtime v0.19.11
github.com/go-openapi/strfmt v0.19.4
github.com/golang/mock v1.4.4
github.com/golang/protobuf v1.4.2 // indirect
github.com/google/uuid v1.1.1
github.com/googleapis/gnostic v0.4.0 // indirect
Expand Down
13 changes: 5 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,10 @@ github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4er
github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef h1:veQD95Isof8w9/WXiA+pa3tz3fJXkt5B7QaRBrM62gk=
github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/mock v1.2.0 h1:28o5sBqPkBsMGnC6b4MvE2TzSr5/AT4c/1fLqVGIwlk=
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/mock v1.4.4 h1:l75CXGRSwbaYNpl/Z2X1XIIAMSCquvXgpVZDhwEIJsc=
github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4=
github.com/golang/protobuf v0.0.0-20161109072736-4bd1920723d7/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
Expand Down Expand Up @@ -220,14 +223,8 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/logicmonitor/k8s-collectorset-controller v2.0.0+incompatible h1:0zX0S8yYyxImnLCb22PZ9p21FGBlyAjH59KawhzrNTU=
github.com/logicmonitor/k8s-collectorset-controller v2.0.0+incompatible/go.mod h1:Lttrp2s4kBgrI+Bo3mzlURp/BGs7Op3ncCL1mIGegEU=
github.com/logicmonitor/lm-sdk-go v2.0.0-argus1+incompatible h1:/aHD5h0X5PxKVB7NBurv/UUyxR42fFIsJar/5t8ac0s=
github.com/logicmonitor/lm-sdk-go v2.0.0-argus1+incompatible/go.mod h1:gpLvWtDkb4lq+ezlvG79A953MZHoq/3XLTff4AIUF+M=
github.com/logicmonitor/lm-sdk-go v2.0.0-argus2+incompatible h1:BPoEW3DbfjtiBRgpygjOo1S0vj7+nWV7i+wprziuCxQ=
github.com/logicmonitor/lm-sdk-go v2.0.0-argus2+incompatible/go.mod h1:gpLvWtDkb4lq+ezlvG79A953MZHoq/3XLTff4AIUF+M=
github.com/logicmonitor/lm-sdk-go v2.0.0-argus3+incompatible h1:Z5LJO+g30WyL4rG8bOsu6X3dwUpO0pHWtP6ZoCJFQh0=
github.com/logicmonitor/lm-sdk-go v2.0.0-argus3+incompatible/go.mod h1:gpLvWtDkb4lq+ezlvG79A953MZHoq/3XLTff4AIUF+M=
github.com/logicmonitor/lm-sdk-go v2.0.0+incompatible h1:g/8iONuJKtUWGQ3MVdSRXhE5ovtxF2voi4OCZFwEDDM=
github.com/logicmonitor/lm-sdk-go v2.0.0+incompatible/go.mod h1:gpLvWtDkb4lq+ezlvG79A953MZHoq/3XLTff4AIUF+M=
github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY=
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
Expand Down Expand Up @@ -319,8 +316,6 @@ github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhV
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 h1:LnC5Kc/wtumK+WB441p7ynQJzVuNRJiqddSIE3IlSEQ=
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=
github.com/vkumbhar94/lm-sdk-go v2.0.1+incompatible h1:t1UbZZ1ju6wv6NRVf6lx9wu4hHEe/mneZxqYGwIq/O8=
github.com/vkumbhar94/lm-sdk-go v2.0.1+incompatible/go.mod h1:svWOa+F9+4aChOCrhd5m2pZt7V1zx2VUkmCkkdjw7Lg=
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 h1:eY9dn8+vbi4tKz5Qo6v2eYzo7kUS51QINcR5jNpbZS8=
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
Expand Down Expand Up @@ -409,8 +404,10 @@ golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGm
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190617190820-da514acc4774 h1:CQVOmarCBFzTx0kbOU0ru54Cvot8SdSrNYjZPhQl+gk=
golang.org/x/tools v0.0.0-20190617190820-da514acc4774/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down
42 changes: 26 additions & 16 deletions pkg/argus.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package argus
import (
"net/http"
"net/url"
"time"

httptransport "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
Expand Down Expand Up @@ -52,6 +51,10 @@ func newLMClient(argusConfig *config.Config) (*client.LMSdkGo, error) {
config.SetAccountDomain(&domain)
//config.UserAgent = constants.UserAgentBase + constants.Version
if argusConfig.ProxyURL == "" {
//return client.New(config), nil
if argusConfig.IgnoreSSL {
return newLMClientWithoutSSL(config)
}
return client.New(config), nil
}
return newLMClientWithProxy(config, argusConfig)
Expand Down Expand Up @@ -83,6 +86,22 @@ func newLMClientWithProxy(config *client.Config, argusConfig *config.Config) (*c
return client, nil
}

func newLMClientWithoutSSL(config *client.Config) (*client.LMSdkGo, error) {

var opts = httptransport.TLSClientOptions{InsecureSkipVerify: true}
var httpClient, err = httptransport.TLSClient(opts)

if err != nil {
return nil, err
}
transport := httptransport.NewWithClient(config.TransportCfg.Host, config.TransportCfg.BasePath, config.TransportCfg.Schemes, httpClient)
authInfo := client.LMv1Auth(*config.AccessID, *config.AccessKey)
cli := new(client.LMSdkGo)
cli.Transport = transport
cli.LM = lm.New(transport, strfmt.Default, authInfo)
return cli, nil
}

func newK8sClient() (*kubernetes.Clientset, error) {
config, err := rest.InClusterConfig()
if err != nil {
Expand Down Expand Up @@ -110,7 +129,7 @@ func NewArgus(base *types.Base) (*Argus, error) {
Base: base,
}

dcache := devicecache.NewDeviceCache(base, 5)
dcache := devicecache.NewDeviceCache(base, base.Config.GetCacheSyncInterval())
dcache.Run()

deviceManager := &device.Manager{
Expand Down Expand Up @@ -237,7 +256,9 @@ func NewArgus(base *types.Base) (*Argus, error) {

lctx := lmlog.NewLMContextWith(log.WithFields(log.Fields{"name": "init-sync"}))
initSyncer.InitSync(lctx, true)
initSyncer.RunPeriodicSync(10)

// periodically delete the non-exist resource devices through logicmonitor API based on specified time interval.
initSyncer.RunPeriodicSync(base.Config.GetPeriodicDeleteInterval())

if base.Config.EtcdDiscoveryToken != "" {
etcdController := etcd.Controller{
Expand Down Expand Up @@ -280,6 +301,7 @@ func NewBase(config *config.Config) (*types.Base, error) {

// Watch watches the API for events.
func (a *Argus) Watch() {
syncInterval := a.Base.Config.GetPeriodicSyncInterval()
log.Debugf("Starting watchers")
for _, w := range a.Watchers {
if !w.Enabled() {
Expand All @@ -290,7 +312,7 @@ func (a *Argus) Watch() {
_, controller := cache.NewInformer(
watchlist,
w.ObjType(),
time.Minute*10,
syncInterval,
cache.ResourceEventHandlerFuncs{
AddFunc: w.AddFunc(),
DeleteFunc: w.DeleteFunc(),
Expand All @@ -300,18 +322,6 @@ func (a *Argus) Watch() {
log.Debugf("Starting watcher of %v", w.Resource())
stop := make(chan struct{})
go controller.Run(stop)
// c := w.GetConfig()
// if c == nil {
// continue
// }
// wc := worker.NewWorker(c)
// b, err := a.Facade.RegisterWorker(w.Resource(), wc)
// if err != nil {
// log.Errorf("Failed to register worker for resource for: %s", w.Resource())
// }
// if b {
// wc.StartWorker()
// }
}
}

Expand Down
85 changes: 74 additions & 11 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,31 @@ package config

import (
"io/ioutil"
"time"

"github.com/kelseyhightower/envconfig"
"github.com/logicmonitor/k8s-argus/pkg/constants"
"gopkg.in/yaml.v2"
log "github.com/sirupsen/logrus"
yaml "gopkg.in/yaml.v2"
)

// Config represents the application's configuration file.
// nolint: maligned
type Config struct {
*Secrets
Address string `yaml:"address"`
ClusterCategory string `yaml:"cluster_category"`
ClusterName string `yaml:"cluster_name"`
Debug bool `yaml:"debug"`
DeleteDevices bool `yaml:"delete_devices"`
DisableAlerting bool `yaml:"disable_alerting"`
FullDisplayNameIncludeNamespace bool `yaml:"displayName_include_namespace"`
FullDisplayNameIncludeClusterName bool `yaml:"displayName_include_clustername"`
ClusterGroupID int32 `yaml:"cluster_group_id"`
ProxyURL string `yaml:"proxy_url"`
DeviceGroupProperties DeviceGroupProperties `yaml:"device_group_props"`
Intervals Intervals `yaml:"app_intervals"`
Address string `yaml:"address"`
ClusterCategory string `yaml:"cluster_category"`
ClusterName string `yaml:"cluster_name"`
Debug bool `yaml:"debug"`
DeleteDevices bool `yaml:"delete_devices"`
DisableAlerting bool `yaml:"disable_alerting"`
FullDisplayNameIncludeNamespace bool `yaml:"displayName_include_namespace"`
FullDisplayNameIncludeClusterName bool `yaml:"displayName_include_clustername"`
ClusterGroupID int32 `yaml:"cluster_group_id"`
ProxyURL string `yaml:"proxy_url"`
IgnoreSSL bool `yaml:"ignore_ssl"`
}

// Secrets represents the application's sensitive configuration file.
Expand All @@ -33,6 +39,27 @@ type Secrets struct {
ProxyPass string `envconfig:"PROXY_PASS"`
}

// DeviceGroupProperties represents the properties applied on device groups
type DeviceGroupProperties struct {
Cluster []map[string]interface{} `yaml:"cluster"`
Pods []map[string]interface{} `yaml:"pods"`
Services []map[string]interface{} `yaml:"services"`
Deployments []map[string]interface{} `yaml:"deployments"`
Nodes []map[string]interface{} `yaml:"nodes"`
ETCD []map[string]interface{} `yaml:"etcd"`
HPA []map[string]interface{} `yaml:"hpas"`
}

// Intervals represents default and min values for periodic sync, periodic delete and device cache sycn intervals
type Intervals struct {
PeriodicSyncInterval time.Duration `yaml:"periodic_sync_interval"`
PeriodicDeleteInterval time.Duration `yaml:"periodic_delete_interval"`
CacheSyncInterval time.Duration `yaml:"cache_sync_interval"`
PeriodicSyncMinInterval time.Duration `yaml:"periodic_sync_min_interval"`
PeriodicDeleteMinInterval time.Duration `yaml:"periodic_delete_min_interval"`
CacheSyncMinInterval time.Duration `yaml:"cache_sync_min_interval"`
}

// GetConfig returns the application configuration specified by the config file.
func GetConfig() (*Config, error) {
configBytes, err := ioutil.ReadFile(constants.ConfigPath)
Expand All @@ -53,3 +80,39 @@ func GetConfig() (*Config, error) {

return c, nil
}

// GetCacheSyncInterval gets cache resync interval
func (config Config) GetCacheSyncInterval() time.Duration {
cacheInterval := validateAndGetIntervalValue("cache_sync_interval", config.Intervals.CacheSyncInterval, config.Intervals.CacheSyncMinInterval, constants.DefaultCacheResyncInterval)
log.Debugf("cache_sync_interval - %v ", cacheInterval)
return cacheInterval
}

// GetPeriodicSyncInterval gets periodic sync interval
func (config Config) GetPeriodicSyncInterval() time.Duration {
periodicSyncInterval := validateAndGetIntervalValue("periodic_sync_interval", config.Intervals.PeriodicSyncInterval, config.Intervals.PeriodicSyncMinInterval, constants.DefaultPeriodicSyncInterval)
log.Debugf("periodic_sync_interval - %v ", periodicSyncInterval)
return periodicSyncInterval
}

// GetPeriodicDeleteInterval gets periodic delete interval
func (config Config) GetPeriodicDeleteInterval() time.Duration {
periodicDeleteInterval := validateAndGetIntervalValue("periodic_delete_interval", config.Intervals.PeriodicDeleteInterval, config.Intervals.PeriodicDeleteMinInterval, constants.DefaultPeriodicDeleteInterval)
log.Debugf("periodic_delete_interval - %v ", periodicDeleteInterval)
return periodicDeleteInterval
}

// ValidateAndGetIntervalValue parses given interval into duration format. Returns default value if any errors.
func validateAndGetIntervalValue(intervalName string, syncInterval, minInterval, defaultValue time.Duration) time.Duration {
if syncInterval < minInterval {
log.Warnf("Please provide valid value for %s. Since invalid value is configured, forcefully setting it to default %v. ", intervalName, defaultValue)
syncInterval = defaultValue
}

if syncInterval == 0 || minInterval == 0 {
log.Warnf("Looks like helm chart is of previous version than the current Argus expects. Please upgrade helm chart. Setting %s to its default : %v", intervalName, defaultValue)
syncInterval = defaultValue
}

return syncInterval
}
27 changes: 27 additions & 0 deletions pkg/constants/constants.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package constants

import "time"

var (
// Version is the Argus version and is set at build time.
Version string
Expand All @@ -15,6 +17,12 @@ const (
RootDeviceGroupID = 1
// CustomPropertiesFieldName is the field name for a device's custom properties.
CustomPropertiesFieldName = "customProperties"
// NameFieldName is the field name for a device's name.
NameFieldName = "name"
// DisplayNameFieldName is the field name for a device's display name.
DisplayNameFieldName = "displayName"
// MaxResourceLength is the max length of the resource name
MaxResourceLength = 244
)

const (
Expand Down Expand Up @@ -108,6 +116,12 @@ const (
K8sResourceNamePropertyKey = "auto.resourcename"
// K8sResourceCreatedOnPropertyKey is the key of the custom property used to record resource create timestamp
K8sResourceCreatedOnPropertyKey = "kubernetes.resourceCreatedOn"
// K8sResourceDeletedOnPropertyKey is the key of the custom property used to record resource deleted timestamp
K8sResourceDeletedOnPropertyKey = "kubernetes.resourceDeletedOn"
// K8sResourceDeleteAfterDurationPropertyKey is the key of the custom property used to delete resources from the portal after specified time
K8sResourceDeleteAfterDurationPropertyKey = "kubernetes.resourcedeleteafterduration"
// K8sResourceDeleteAfterDurationPropertyValue is the default value of the custom property used to delete resources from the portal after specified time
K8sResourceDeleteAfterDurationPropertyValue = "P1DT0H0M0S"
// K8sDeviceType is the type value of the k8s device
K8sDeviceType = 8
// K8sSystemCategoriesPropertyKey is the key of the unique custom property kubernetes system categories
Expand Down Expand Up @@ -148,6 +162,8 @@ const (
)

const (
// ArgusAppVersion is the key for Argus app version
ArgusAppVersion = "argus.app-version"
// HelmChart is the key for Argus & Collectoeset-controller label
HelmChart = "helm-chart"
// HelmRevision is the key for Argus & Collectoeset-controller label
Expand All @@ -172,3 +188,14 @@ const (
// IsPingDevice is the key used in watcher context to pass metadata
IsPingDevice = "ispingdevice"
)

const (
// DefaultPeriodicSyncInterval Default interval for Periodic Discovery.
DefaultPeriodicSyncInterval = time.Minute * 30

// DefaultPeriodicDeleteInterval Default interval for Periodic delete.
DefaultPeriodicDeleteInterval = time.Minute * 30

// DefaultCacheResyncInterval Default interval for cache resync.
DefaultCacheResyncInterval = time.Minute * 5
)
2 changes: 1 addition & 1 deletion pkg/cronjob/cronjob.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cronjob
import (
"github.com/logicmonitor/k8s-argus/pkg/lmctx"
lmlog "github.com/logicmonitor/k8s-argus/pkg/log"
"github.com/robfig/cron/v3"
cron "github.com/robfig/cron/v3"
)

var (
Expand Down
Loading