Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
95f5b65
watch and multiproc implementation
ganga1980 Jan 3, 2022
30decbb
fix weird bug
ganga1980 Jan 4, 2022
540ca90
multiproc support for fluentd
ganga1980 Jan 5, 2022
be3436e
working
ganga1980 Jan 5, 2022
c8ca6e5
fix log lines
ganga1980 Jan 5, 2022
6bee954
refactor code
ganga1980 Jan 6, 2022
0593d02
cache telemetry
ganga1980 Jan 7, 2022
3f11a27
nodecount telemetry
ganga1980 Jan 8, 2022
3752459
bug fix
ganga1980 Jan 8, 2022
694bbc0
further optimize
ganga1980 Jan 9, 2022
ac88379
bugfix related typo
ganga1980 Jan 10, 2022
5835f42
node allocatable cache
ganga1980 Jan 11, 2022
12f9754
wincontainerinventory in multiproc
ganga1980 Jan 12, 2022
5da266f
disable health
ganga1980 Jan 15, 2022
658a440
config events on different core
ganga1980 Jan 17, 2022
b8b8d18
add ts to logs
ganga1980 Jan 17, 2022
6cf9c11
move kube perf records to separate plugin
ganga1980 Jan 18, 2022
9f08cb0
refactor
ganga1980 Jan 19, 2022
056ea8b
minor update
ganga1980 Jan 19, 2022
b62cf5c
merge latest ci_dev changes
ganga1980 Feb 2, 2022
b940e45
remove commented code
ganga1980 Feb 2, 2022
cf5495d
Merge branch 'ci_dev' into gangams/rs-hyper-scale-2022
ganga1980 Feb 3, 2022
3a0cff2
mdm state file
ganga1980 Feb 5, 2022
a0e4498
mdm state file
ganga1980 Feb 6, 2022
de4f4b5
podmdm to separate plugin
ganga1980 Feb 6, 2022
4ea1d69
bug fixes
ganga1980 Feb 7, 2022
45d3e03
bug fixes
ganga1980 Feb 7, 2022
5481e48
bug fixes
ganga1980 Feb 7, 2022
1ea9366
podmdm plugin
ganga1980 Feb 8, 2022
a12e535
bug fixes
ganga1980 Feb 8, 2022
03e0b43
bug fixes
ganga1980 Feb 8, 2022
ab27436
remove unneeded log lines
ganga1980 Feb 8, 2022
541e50d
more improvements
ganga1980 Feb 9, 2022
589b69a
clean up
ganga1980 Feb 9, 2022
37d67b8
clean up
ganga1980 Feb 10, 2022
886557b
add requestId header for mdm metrics
ganga1980 Feb 11, 2022
c594c5a
latest mdsd and fix for threading issue in out mdm
ganga1980 Feb 17, 2022
0297f7b
rs specific config for large cluster
ganga1980 Feb 18, 2022
89a96da
optimize out mdm
ganga1980 Feb 22, 2022
a6d04c5
bug fix
ganga1980 Feb 22, 2022
4c4d2e6
use large queue limit for kube perf
ganga1980 Feb 23, 2022
333cd80
5k preview rs limits
ganga1980 Feb 23, 2022
fb57c3c
handle resourceversion empty or 0 scenrio
ganga1980 Feb 24, 2022
86f088e
handle pagination api call failures
ganga1980 Feb 25, 2022
351f0ff
fix bug
ganga1980 Feb 25, 2022
497bce4
preview image for internal customer validation
ganga1980 Mar 2, 2022
911be7e
preview image
ganga1980 Mar 5, 2022
cec11dd
wip
ganga1980 Mar 7, 2022
3d092c8
wip
ganga1980 Mar 7, 2022
933f2a3
fix trailing whitespaces
ganga1980 Apr 5, 2022
223fab2
merge latest ci_dev changes
ganga1980 Apr 18, 2022
3047e76
fix bug
ganga1980 Apr 21, 2022
e706fee
remove unused envvars in yaml
ganga1980 Apr 21, 2022
1ac6672
revert minor things
ganga1980 Apr 22, 2022
4bb069e
telemetry tags for preview release
ganga1980 Apr 22, 2022
71b56e1
Merge branch 'ci_dev' into gangams/rs-hyper-scale-2022-ready
ganga1980 Apr 29, 2022
1262c8a
revert preview image tags
ganga1980 Apr 29, 2022
5a67c0c
revert unintended change
ganga1980 May 1, 2022
f019779
merge latest dev changes
ganga1980 May 7, 2022
c2b341f
Merge branch 'ci_dev' into gangams/rs-hyper-scale-2022-ready
ganga1980 May 10, 2022
3f2e05f
fix bug
ganga1980 May 11, 2022
7dad848
use same batchtime for both mdm & podinventory records
ganga1980 May 13, 2022
f49dffd
use same batchtime for both mdm & podinventory records
ganga1980 May 13, 2022
f4824b2
use same batchtime for both mdm & podinventory records
ganga1980 May 14, 2022
ab3b042
use same batchtime for both mdm & podinventory records
ganga1980 May 15, 2022
b8b0732
Merge branch 'ci_dev' into gangams/rs-hyper-scale-2022-ready
ganga1980 May 20, 2022
e39a120
preview image tag with latest ci_dev changes
ganga1980 May 20, 2022
d7d4402
merge latest ci_dev changes
ganga1980 Jun 2, 2022
76f2165
Merge branch 'ci_dev' into gangams/rs-hyper-scale-2022-ready
ganga1980 Jun 3, 2022
484ba94
Merge branch 'ci_dev' into gangams/rs-hyper-scale-2022-ready
ganga1980 Jun 9, 2022
cae999b
change back to use prod image in docker files
ganga1980 Jun 9, 2022
b4e5427
fix unit test failures
ganga1980 Jun 11, 2022
81eec6e
exclude unfixed cve until this get fixed
ganga1980 Jun 11, 2022
1a3fa0e
fix minor issue
ganga1980 Jun 13, 2022
e4ca00a
Merge branch 'ci_dev' into gangams/rs-hyper-scale-2022-ready
ganga1980 Jun 13, 2022
7f3372a
increase retries to handle transient errors
ganga1980 Jun 14, 2022
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
378 changes: 214 additions & 164 deletions build/linux/installer/conf/kube.conf

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions build/linux/installer/datafiles/base_container.data
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ MAINTAINER: 'Microsoft Corporation'
/etc/fluent/plugin/in_containerinventory.rb; source/plugins/ruby/in_containerinventory.rb; 644; root; root
/etc/fluent/plugin/in_kube_nodes.rb; source/plugins/ruby/in_kube_nodes.rb; 644; root; root
/etc/fluent/plugin/in_kube_podinventory.rb; source/plugins/ruby/in_kube_podinventory.rb; 644; root; root
/etc/fluent/plugin/in_kube_podmdminventory.rb; source/plugins/ruby/in_kube_podmdminventory.rb; 644; root; root
/etc/fluent/plugin/in_kube_perfinventory.rb; source/plugins/ruby/in_kube_perfinventory.rb; 644; root; root
/etc/fluent/plugin/KubernetesApiClient.rb; source/plugins/ruby/KubernetesApiClient.rb; 644; root; root
/etc/fluent/plugin/in_kube_events.rb; source/plugins/ruby/in_kube_events.rb; 644; root; root
/etc/fluent/plugin/in_kube_pvinventory.rb; source/plugins/ruby/in_kube_pvinventory.rb; 644; root; root
Expand All @@ -143,6 +145,7 @@ MAINTAINER: 'Microsoft Corporation'
/etc/fluent/plugin/filter_telegraf2mdm.rb; source/plugins/ruby/filter_telegraf2mdm.rb; 644; root; root

/etc/fluent/plugin/out_mdm.rb; source/plugins/ruby/out_mdm.rb; 644; root; root
/etc/fluent/plugin/WatchStream.rb; source/plugins/ruby/WatchStream.rb; 644; root; root



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ spec:
resources:
{{ toYaml .Values.omsagent.resources.deployment | indent 9 }}
env:
- name: NUM_OF_FLUENTD_WORKERS
valueFrom:
resourceFieldRef:
containerName: omsagent
resource: limits.cpu
{{- if ne .Values.omsagent.env.clusterId "<your_cluster_id>" }}
- name: AKS_RESOURCE_ID
value: {{ .Values.omsagent.env.clusterId | quote }}
Expand Down
340 changes: 218 additions & 122 deletions kubernetes/linux/main.sh

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions kubernetes/omsagent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,8 @@ spec:
# this used for e2e test and setting this just emits some additional log statements which used for the e2e tests
- name: ISTEST
value: "true"
- name: EMIT_CACHE_TELEMETRY
value: "false"
#Uncomment below two lines for ACS clusters and set the cluster names manually. Also comment out the above two lines for ACS clusters
#- name: ACS_RESOURCE_NAME
# value: "my_acs_cluster_name"
Expand Down Expand Up @@ -661,6 +663,13 @@ spec:
cpu: 150m
memory: 250Mi
env:
- name: NUM_OF_FLUENTD_WORKERS
valueFrom:
resourceFieldRef:
containerName: omsagent
resource: limits.cpu
- name: EMIT_CACHE_TELEMETRY
value: "false" # enable only debug or test purpose and disable for prod
- name: AKS_RESOURCE_ID
value: "VALUE_AKS_RESOURCE_ID_VALUE"
- name: AKS_REGION
Expand Down
666 changes: 621 additions & 45 deletions source/plugins/ruby/KubernetesApiClient.rb

Large diffs are not rendered by default.

70 changes: 70 additions & 0 deletions source/plugins/ruby/WatchStream.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#!/usr/local/bin/ruby
# frozen_string_literal: true

require "net/http"
require "net/https"
require "yajl/json_gem"
require "logger"
require "time"

WATCH_ARGUMENTS = {
"labelSelector" => :label_selector,
"fieldSelector" => :field_selector,
"resourceVersion" => :resource_version,
"allowWatchBookmarks" => :allow_watch_bookmarks,
"timeoutSeconds" => :timeout_seconds,
}.freeze

# HTTP Stream used to watch changes on entities
class WatchStream
def initialize(uri, http_options, http_headers, logger)
@uri = uri
@http_client = nil
@http_options = http_options
@http_headers = http_headers
@logger = logger
@path = ""
@logger.info "WatchStream::initialize @ #{Time.now.utc.iso8601}"
end

def each
@finished = false
buffer = +""
@logger.info "WatchStream::each:Opening TCP session @ #{Time.now.utc.iso8601}"
@http_client = Net::HTTP.start(@uri.host, @uri.port, @http_options)
if @http_client.nil?
raise "WatchStream::each:Failed to create HTTPClient object @ #{Time.now.utc.iso8601}"
end
@path = @uri.path
if @path.nil? || @path.empty?
raise "WatchStream::each:URI path should not be empty or nil @ #{Time.now.utc.iso8601}"
end
if !@uri.query.nil? && !@uri.query.empty?
@path += "?" + @uri.query
end
@logger.info "WatchStream::each:Making GET API call for Watch with path: #{@path} @ #{Time.now.utc.iso8601}"
@http_client.request_get(@path, @http_headers) do |response|
if !response.nil? && response.code.to_i > 300
raise "WatchStream::each:Watch connection of the path: #{@path} failed with an http status code: #{response.code} @ #{Time.now.utc.iso8601}"
end
response.read_body do |chunk|
buffer << chunk
while (line = buffer.slice!(/.+\n/))
yield(Yajl::Parser.parse(StringIO.new(line.chomp)))
end
end
end
rescue => e
raise e
end

def finish
begin
@finished = true
@logger.info "WatchStream::finish:Closing HTTP session of the path:#{@path} @ #{Time.now.utc.iso8601}"
@http_client.finish if !@http_client.nil? && @http_client.started?
rescue => error
@logger.warn "WatchStream::finish:Closing of HTTP session of the path: #{@path} failed with an error: #{error} @ #{Time.now.utc.iso8601}"
end
end
end
6 changes: 6 additions & 0 deletions source/plugins/ruby/constants.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@ class Constants
#To evaluate switching to Windows AMA 64KB impacts any existing customers
MAX_RECORD_OR_FIELD_SIZE_FOR_TELEMETRY = 65536

# FileName for MDM POD Inventory state
MDM_POD_INVENTORY_STATE_FILE = "/var/opt/microsoft/docker-cimprov/state/MDMPodInventoryState.json"
# FileName for NodeAllocatable Records state
NODE_ALLOCATABLE_RECORDS_STATE_FILE = "/var/opt/microsoft/docker-cimprov/state/NodeAllocatableRecords.json"
# Emit Stream size for Pod MDM metric
POD_MDM_EMIT_STREAM_BATCH_SIZE = 5000 # each record is 200 bytes, 5k records ~2MB
# only used in windows in AAD MSI auth mode
IMDS_TOKEN_PATH_FOR_WINDOWS = "c:/etc/imds-access-token/token"
end
Loading