Skip to content

Conversation

kksudo
Copy link
Contributor

@kksudo kksudo commented Jun 22, 2025

@kksudo kksudo force-pushed the feat/improve_readme branch from 8c367f2 to 6956588 Compare June 22, 2025 20:11
@illume illume changed the title Improve documentation flux: Readme: Improve documentation Jun 23, 2025
@illume illume added the flux flux plugin related issues label Jun 23, 2025
@illume
Copy link
Contributor

illume commented Jun 24, 2025

Thanks! It looks good to me... but the main maintainer of the flux plugin is away this week, so I'll wait till they are back to review/merge.

Would you mind updating the commit messages to follow the commit format we use?

flux: Update the docs to use ephemeral dirs

@illume illume requested a review from ashu8912 June 24, 2025 16:32
@kksudo kksudo force-pushed the feat/improve_readme branch from 6956588 to 22ba9d1 Compare June 24, 2025 18:00
@kksudo kksudo force-pushed the feat/improve_readme branch from 22ba9d1 to f617c23 Compare June 24, 2025 18:01
@kksudo
Copy link
Contributor Author

kksudo commented Jun 24, 2025

Would you mind updating the commit messages to follow the commit format we use?

Done

@kksudo kksudo mentioned this pull request Jun 25, 2025
Copy link
Contributor

@skoeva skoeva left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@ashu8912 ashu8912 left a comment

Choose a reason for hiding this comment

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

can you please explain this change, is this an issue?? Why would we have a permission issue here???

@kksudo
Copy link
Contributor Author

kksudo commented Jul 2, 2025

The security context is mandatory to copy changes, without it, you will get an error: cp: can't create directory '/build/plugins/flux': Permission denied

Also, there is no statefulset app, that is why use the PV with PVC is not correct, as the alternative I added an option to use an empty dir.

can you please explain this change, is this an issue?? Why would we have a permission issue here???

@kksudo
Copy link
Contributor Author

kksudo commented Jul 2, 2025

This PR resolve issue #214
Issue here.
image

- /bin/sh
- -c
- mkdir -p /build/plugins && cp -r /plugins/* /build/plugins/
- mkdir -p /build/plugins && cp -r /plugins/* /build/plugins/ && chown -R 100:101 /build
Copy link
Contributor

@illume illume Jul 3, 2025

Choose a reason for hiding this comment

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

Oh... I just realised the 100:101 here is the headlamp user and group from the alpine headlamp Dockerfile container?

Can we use chown -R headlamp:headlamp /build here instead?

How about a comment explaining why the chown is necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh... I just realised the 100:101 here is the headlamp user and group from the alpine headlamp Dockerfile container?

Yes
https://github.com/headlamp-k8s/plugins/blob/main/Dockerfile#L45
Actually we can improve also this line, to define exactly the number of the group to be more clear.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can we use chown -R headlamp:headlamp /build here instead?

yes, but it's not a true way, because from image to image the number of the headlamp group could be diff.
It's a better to update the Dockerfile to set up a static number, smth like:

# Create a group with specific GID and user with specific UID
RUN addgroup -g 101 -S headlamp && \
    adduser -u 100 -S -G headlamp headlamp

I can update it, WDYT ?

Copy link
Contributor

@illume illume Jul 7, 2025

Choose a reason for hiding this comment

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

Thanks. I understand I think... so if someone uses headlamp:headlamp in say their own custom Debian image maybe it's different from an alpine image?

Yeah, I think it's a good change to make.

image: ghcr.io/headlamp-k8s/headlamp-plugin-flux:latest
imagePullPolicy: Always
name: headlamp-plugins
securityContext:
Copy link
Contributor

@illume illume Jul 3, 2025

Choose a reason for hiding this comment

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

This part here is required because of the chown used above? Or is it for something else?

Could you please add a comment to there explaining why it's necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The securityContext overwrite the USER headlamp non root user.
Without it, we don't have enough permissions to do the dirs with non headlamp owner.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, that makes sense now. Thanks.

Could you please add a comment about that in there for future readers?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, that makes sense now. Thanks.

Could you please add a comment about that in there for future readers?

I can, it's not a big deal.
But, are you sure if it's necessary? Because it's a pretty simple setting. Moreover, we can't annotate every line. We should do it, only if it's some exception or TODO or workaround.

WDYT?

Copy link
Member

Choose a reason for hiding this comment

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

Umm i don't understand this change we already did chwon above so we would not want to run this as root right??

maybe this is what we need here

securityContext:
  runAsNonRoot: true
  runAsUser: 100
  runAsGroup: 101
  privileged: false

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it's true. What is the user who run this cmd?
Without it, you will fail.
Btw, you can try to run without these changes to check it.

Copy link
Contributor Author

@kksudo kksudo Jul 7, 2025

Choose a reason for hiding this comment

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

Umm i don't understand this change we already did chwon above so we would not want to run this as root right??

maybe this is what we need here

securityContext:
  runAsNonRoot: true
  runAsUser: 100
  runAsGroup: 101
  privileged: false

@ashu8912
Again, did you check the root cause of these changes here ?

image

@illume
Copy link
Contributor

illume commented Jul 3, 2025

@ashu8912 @kksudo I added a few notes/questions at points where I think we can add comments to make this a bit easier to understand. Please check them to see what you think?

@illume
Copy link
Contributor

illume commented Jul 3, 2025

Added "Fixes #214" to PR description.

@kksudo
Copy link
Contributor Author

kksudo commented Jul 3, 2025

@ashu8912 @kksudo I added a few notes/questions at points where I think we can add comments to make this a bit easier to understand. Please check them to see what you think?

Answered

@illume illume requested a review from ashu8912 July 7, 2025 11:14
image: ghcr.io/headlamp-k8s/headlamp-plugin-flux:latest
imagePullPolicy: Always
name: headlamp-plugins
securityContext:
Copy link
Member

Choose a reason for hiding this comment

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

Umm i don't understand this change we already did chwon above so we would not want to run this as root right??

maybe this is what we need here

securityContext:
  runAsNonRoot: true
  runAsUser: 100
  runAsGroup: 101
  privileged: false

Copy link
Member

@ashu8912 ashu8912 left a comment

Choose a reason for hiding this comment

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

I think i finally understand the changes here.

@ashu8912 ashu8912 merged commit a236a5c into headlamp-k8s:main Jul 28, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flux flux plugin related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Flux: v0.2.0 can't create plugins/flux directory
4 participants