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

Fix setting resources in fluentd-gcp plugin #55950

Conversation

crassirostris
Copy link

@crassirostris crassirostris commented Nov 17, 2017

Currently if some of the variables are not set, scripts prints error, which is not critical, since the function is executed in a separate process, but it leads to the wrong resulting values

fluentd-gcp addon: Fix fluentd deployment on GCP when custom resources are set.

/cc @piosz @x13n
/assign @roberthbailey @mikedanese
Could you please approve?

@crassirostris crassirostris added area/logging kind/bug Categorizes issue or PR as related to a bug. sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation. labels Nov 17, 2017
@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 17, 2017
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Nov 17, 2017
@crassirostris crassirostris requested review from cheftako, piosz and x13n and removed request for piosz and cheftako November 17, 2017 16:31
@crassirostris crassirostris force-pushed the fluentd-gcp-setting-resources-fix branch from dd9096b to 9da2d25 Compare November 17, 2017 17:28
@mikedanese
Copy link
Member

/approve no-issue

I can't review until later.

@k8s-github-robot k8s-github-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 17, 2017
--containers=fluentd-gcp -o yaml > ${temp_fluentd_gcp_yaml}; then
mv ${temp_fluentd_gcp_yaml} ${fluentd_gcp_yaml}
else
rm ${temp_fluentd_gcp_yaml}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe keep this file for debugging purposes? Also, how about logging to stderr that setting fluentd resources failed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe keep this file for debugging purposes?

I don't want to leave this file in the same directory, to avoid addon-manager picking it up accidentally

Also, how about logging to stderr that setting fluentd resources failed?

Makes sense, done

if [[ -n "${request_resources}" ]]; then
request_resources="${request_resources},"
fi
request_resources="memory=${FLUENTD_GCP_MEMORY_LIMIT}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be REQUEST?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, thanks

fi
local request_resources=""
if [[ -n "${FLUENTD_GCP_CPU_REQUEST:-}" ]]; then
request_resources="cpu=${FLUENTD_GCP_MEMORY_LIMIT}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FLUENTD_GCP_CPU_REQUEST?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, thanks

@crassirostris
Copy link
Author

@x13n Thanks! PTAL

fi
request_resources="memory=${FLUENTD_GCP_MEMORY_REQUEST}"
fi
if [[ -n "${request_resources}" ]]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be always set to true, since this var is set in line 1951. Maybe use -z instead of -n? Same in similar condition above.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, [[ -n "" ]] evaluates to false

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, you're right :-)

--containers=fluentd-gcp -o yaml > ${temp_fluentd_gcp_yaml}; then
mv ${temp_fluentd_gcp_yaml} ${fluentd_gcp_yaml}
else
echo "Failed to update fluentd resources"
Copy link
Member

@x13n x13n Nov 22, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add ">&2" to use stderr instead of stdout? Also, if the yaml file is going to be deleted, maybe just print its contents as well? It will be easier to figure out what went wrong if this fails.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SG, thanks

Signed-off-by: Mik Vyatskov <vmik@google.com>
@crassirostris crassirostris force-pushed the fluentd-gcp-setting-resources-fix branch from 375cef1 to e9322b9 Compare November 22, 2017 11:41
@x13n
Copy link
Member

x13n commented Nov 22, 2017

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 22, 2017
@k8s-github-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: crassirostris, mikedanese, x13n

Associated issue requirement bypassed by: mikedanese

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@k8s-github-robot
Copy link

[MILESTONENOTIFIER] Milestone Pull Request Current

@crassirostris @mikedanese @roberthbailey @x13n

Note: This pull request is marked as priority/critical-urgent, and must be updated every 3 days during code slush.

Example update:

ACK.  In progress
ETA: DD/MM/YYYY
Risks: Complicated fix required
Pull Request Labels
  • sig/instrumentation: Pull Request will be escalated to these SIGs if needed.
  • priority/critical-urgent: Never automatically move pull request out of a release milestone; continually escalate to contributor and SIG through all available channels.
  • kind/bug: Fixes a bug discovered during the current release.
Help

@k8s-github-robot
Copy link

Automatic merge from submit-queue (batch tested with PRs 56207, 55950). If you want to cherry-pick this change to another branch, please follow the instructions here.

@k8s-github-robot k8s-github-robot merged commit f85649c into kubernetes:master Nov 22, 2017
@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesn't merit a release note. labels Nov 24, 2017
k8s-github-robot pushed a commit that referenced this pull request Nov 27, 2017
…-#55950-upstream-release-1.8

Automatic merge from submit-queue.

Automated cherry pick of #55950

Cherry pick of #55950 on release-1.8.

#55950: Fix setting resources in fluentd-gcp plugin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/logging cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants