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 kustomize-hash-annotator to toolbox image #80

Merged
merged 1 commit into from
Jul 18, 2022

Conversation

accorvin
Copy link
Member

@accorvin accorvin commented Jul 8, 2022

Related Issues and Dependencies

This introduces a breaking change

  • Yes
  • No

This Pull Request implements

Add the kustomize-hash-annotator kustomize plugin

Description

This adds the kustomize-hash-annotator 1 kustomize plugin to the
toolbox image. This plugin allows for dynamically annotating an object
with the hash of the contents of a configmap or secret, allowing for,
among other things, automatic rollouts of deployments based on updates
to configmaps and secrets.

@sesheta sesheta added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Jul 8, 2022
@HumairAK
Copy link
Member

hmm did this work for you when you tried using it with the toolbox? I get the following using the example in their readme:

hash-annotatotor $ toolbox enter toolbox-v0.9.0
bash: /usr/share/fzf/shell/key-bindings.bash: No such file or directory
bash: goenv: command not found
hash-annotatotor $ tree
.
├── configmap.yaml
├── deployment.yaml
├── hashannotator.yaml
└── kustomization.yaml

0 directories, 4 files
hash-annotatotor $ kustomize build . --enable-alpha-plugins
Error: expected file with Go object code at: /home/hukhan/.config/kustomize/plugin/pcjun97/v1/hashannotator/HashAnnotator.so
hash-annotatotor $ 

(Not sure what's going on with the bash errors, but I don't think it's related).

@accorvin
Copy link
Member Author

@HumairAK I just updated this to use the environment variable for the kustomize plugin path rather than the hardcoded path. I'm not sure that that will change anything for you, but it's definitely better practice.

I admittedly did not try using this with toolbox - I was primarily focused on the use case of getting the aicoe-ci tests passing. Does ksops work for you? I'm trying to understand what kustomize plugin path is used.

@HumairAK
Copy link
Member

@accorvin I was able to get it working by renaming the kind: HashAnnotator to kind hashannotator and setting XDG_CONFIG_HOME=/usr/share/.config

hash-annotatotor $ toolbox enter opf-toolbox-v0.9.0
hash-annotatotor $ XDG_CONFIG_HOME=/usr/share/.config
hash-annotatotor $ echo $KUSTOMIZE_PLUGIN_PATH
/usr/share/.config/kustomize/plugin/

hash-annotatotor $ kustomize build . -o build.yaml
Error: external plugins disabled; unable to load external plugin 'hashannotator'

hash-annotatotor $ kustomize build . -o build.yaml --enable-alpha-plugins
hash-annotatotor $ yq e .kind hashannotator.yaml 
hashannotator

hash-annotatotor $ 

I think the file at: $KUSTOMIZE_PLUGIN_PATH/pcjun97/v1/hashannotator/ needs to match what we put in kind:

This adds the kustomize-hash-annotator [1] kustomize plugin to the
toolbox image. This plugin allows for dynamically annotating an object
with the hash of the contents of a configmap or secret, allowing for,
among other things, automatic rollouts of deployments based on updates
to configmaps and secrets.

[1]: https://github.com/pcjun97/kustomize-hash-annotator
@accorvin
Copy link
Member Author

@HumairAK I got this fixed in the upstream hashannotator plugin code so the file name should be correct now.

@HumairAK
Copy link
Member

/lgtm
/approve

Thanks @accorvin !!

@sesheta sesheta added the lgtm Indicates that a PR is ready to be merged. label Jul 18, 2022
@sesheta
Copy link
Member

sesheta commented Jul 18, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: HumairAK

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

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@sesheta sesheta added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 18, 2022
@sesheta sesheta merged commit e752d23 into operate-first:master Jul 18, 2022
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. lgtm Indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants