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

Add settings.RECEPTOR_LOG_LEVEL, update work signing key path #14098

Merged
merged 1 commit into from
Jul 6, 2023

Conversation

fosterseth
Copy link
Member

@fosterseth fosterseth commented Jun 8, 2023

SUMMARY

Offers ability to set log level of receptor (k8s only)

Intended to be paired with ansible/awx-operator#1444

Should be backwards compatible with older operators too.

Instead of hard-coding part of the receptor config file, we can just read the current file (and pop the -peers and -listeners off)

ISSUE TYPE
  • New or Enhanced Feature
COMPONENT NAME
  • API
AWX VERSION
awx: 22.3.1.dev34+g07034cfa95

@fosterseth fosterseth force-pushed the receptor_log_level branch 2 times, most recently from 7f531e1 to 31d94e9 Compare June 8, 2023 17:33
@fosterseth fosterseth force-pushed the receptor_log_level branch from 9c36f5d to 4b3cdf1 Compare June 15, 2023 19:06
@task()
def write_receptor_config():
current_config = read_receptor_config() # this grabs lock
Copy link
Member

Choose a reason for hiding this comment

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

Isn't this dangerous? By using the current config as a starter, aren't you kind of cargo-culting the config in an automated way? That could create some weird problems of config drift down the line.

Also, I'd like to move in the direction of generating receptor_config in a separate method so that we can test it. Before this, it looked like all we needed to test it was the Instance and InstanceLink objects in the database. We can still test this after your restructuring here, but that just means moving the "starter config" to the tests.

Copy link
Member

Choose a reason for hiding this comment

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

Looking down at the line receptor_config.append(peer), I can see this not working at all since you're not checking in advance whether the link already exists in the config, so it could end up adding it every time it rewrites the config.

Copy link
Member

Choose a reason for hiding this comment

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

cargo culting (uncountable) (chiefly computing) An approach that copies an existing successful approach without properly analysing and understanding it.

Copy link
Member Author

Choose a reason for hiding this comment

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

The logic here strips out any "peer" entry, and we simply readd them later. So in a way we are starting "fresh" without having the hard coded template.

I think I will just revert this part back for now and we can figure out a better solution later.

@TheRealHaoLiu
Copy link
Member

@fosterseth i think the safer approach is to just go ahead and use the old method of templating out the receptor config file and add the ability to config log level instead of trying to rewrite the way that we generate the receptor config file

I understand that there's currently a PITA that when u change the file names you need to change in both awx and awx-operator we can address this separately if desired.

@fosterseth fosterseth force-pushed the receptor_log_level branch from 4b3cdf1 to 3875656 Compare June 29, 2023 21:21
{'node': {'firewallrules': [{'action': 'reject', 'tonode': settings.CLUSTER_HOST_ID, 'toservice': 'control'}]}},
{'control-service': {'service': 'control', 'filename': '/var/run/receptor/receptor.sock', 'permissions': '0660'}},
{'work-command': {'worktype': 'local', 'command': 'ansible-runner', 'params': 'worker', 'allowruntimeparams': True}},
{'work-signing': {'privatekey': '/etc/receptor/signing/work-private-key.pem', 'tokenexpiration': '1m'}},
{'work-signing': {'privatekey': '/etc/receptor/work_private_key.pem', 'tokenexpiration': '1m'}},
Copy link
Member

Choose a reason for hiding this comment

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

Is this change to be paired with ansible/awx-operator#1442?

The new location looks like it's the correct one, I agree with the change, but I'd like a little bit better linking and description of the changes here, since it's not all all that this should happen from the title of this PR, and the associated changes & issue are not immediately discoverable.

Copy link
Member

Choose a reason for hiding this comment

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

Never mind my prior comments, this was rendered defunct by #14151, but did not show due to a git issue. This line is not actually changed with this merge.

@AlanCoding AlanCoding changed the title Add settings.RECEPTOR_LOG_LEVEL Add settings.RECEPTOR_LOG_LEVEL, update work signing key path Jul 6, 2023
@AlanCoding
Copy link
Member

I'm going to merge this myself because of the stated compatibility concerns, and because Seth isn't around right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants