ARTIFACTORY: How to apply user plugins to Helm installation of Artifactory
User Plugins enable users to extend the functionality of Artifactory by adding new features or modifying existing ones. One way of applying user plugins is creating a Kubernetes secret. Let's explore the first method.
Applying plugins using secretsTo create a secret with a single user plugin, run the following command:
kubectl create secret generic archive-old-artifacts --from-file=archiveOldArtifacts.groovy --namespace=artifactory
To create a secret with a single user plugin with a configuration file, run the following command:
kubectl create secret generic webhook --from-file=webhook.groovy --from-file=webhook.config.json.sample --namespace=artifactory
Once you have created the secrets, you can use them in Artifactory. To do this, you need to create a plugin-values.yaml file that contains the plugin secret names and other required information. Here is an example:
artifactory: userPluginSecrets: - archive-old-artifacts - webhook - cleanup copyOnEveryStartup: - source: /artifactory_bootstrap/plugins/* target: etc/artifactory/plugins/
The userPluginSecrets section lists the names of the secrets that you created earlier. The copyOnEveryStartup section specifies the files that should be copied over to the appropriate directory every time the Artifactory pod is restarted.
You can now pass the plugins.yaml file you created to the Helm install command to deploy Artifactory with user plugins as follows.
helm upgrade --install artifactory jfrog/artifactory --namespace artifactory -f plugin-values.yaml
Applying plugins without secrets
When using Artifactory User Plugins, secrets are typically used to load plugin files onto the pod. This is because plugins usually do not exceed the maximum secret size, making it an easy way to transfer files.
However, if a file does exceed the maximum size with the error "error: failed to create secret Request entity too large: limit is 3145728", you can load it onto the pod using the "kubectl cp" command from your local environment.
From your local environment where the file exists, run "kubectl cp <path-to-file-locally> <path-to-file-pod>"
kubectl cp /tmp/foo <some-namespace>/<some-pod>:/tmp/bar
Once the file is in the pod,
- place it under $JFROG_HOME/artifactory/var/etc/artifactory/plugins directory
- run the Reload Plugins API call to apply the plugin to Artifactory.
Following these steps for all plugin files should result in successful plugin functionality.