reposilite

by volker.raschek

Helm chartv1.0.1App 3.6.3MITVerified publisher

Lightweight and easy-to-use repository management software dedicated for the Maven based artifacts in the JVM ecosystem

About this chart

Reposilite

[!NOTE] This is not the official helm chart of Reposilite. If you are looking for the official helm chart, checkout the GitHub project reposilite-playground.

This helm chart enables the deployment of Reposilite, a lightweight and easy-to-use repository management software dedicated for the Maven-based artifacts in the JVM ecosystem.

The helm chart supports the individual configuration of additional containers/initContainers, mounting of volumes, defining additional environment variables and much more.

Chapter configuration and installation describes the basics how to configure helm and use it to deploy the exporter. It also contains further configuration examples.

Furthermore, this helm chart contains unit tests to detect regressions and stabilize the deployment. Additionally, this helm chart is tested for deployment scenarios with ArgoCD.

Helm: configuration and installation

  1. A helm chart repository must be configured, to pull the helm charts from.
  2. All available parameters are documented in detail below. The parameters can be defined via the helm --set flag or directly as part of a values.yaml file. The following example defines the reposilite repository and use the --set flag for a basic deployment.
helm repo add volker.raschek https://charts.cryptic.systems/volker.raschek
helm repo update
helm install reposilite volker.raschek/reposilite

Instead of passing all parameters via the set flag, it is also possible to define them as part of the values.yaml. The following command downloads the values.yaml for a specific version of this chart. Please keep in mind, that the version of the chart must be in sync with the values.yaml. Newer minor versions can have new features. New major versions can break something!

CHART_VERSION=1.0.1
helm show values volker.raschek/reposilite --version "${CHART_VERSION}" > values.yaml

A complete list of available helm chart versions can be displayed via the following command:

helm search repo reposilite --versions

The helm chart also contains a persistent volume claim definition. It persistent volume claim is not enabled by default. Use the --set argument to persist your data.

CHART_VERSION=1.0.1
helm install --version "${CHART_VERSION}" reposilite volker.raschek/reposilite \
  persistentVolumeClaim.enabled=true

Examples

The following examples serve as individual configurations and as inspiration for how deployment problems can be solved.

TLS encryption

The example describe how to deploy Reposilite with TLS encryption. If Reposilite is deployed behind reverse proxy, for example an ingress nginx controller, please instruct the ingress to establish an TLS encrypted connection to avoid connection problems.

[!WARNING] The secret reposilite-tls containing the TLS certificate is already present. The keys ca.crt, tls.key and tls.crt must be renamed matching the file extension .pem. Otherwise throws the used TLS library of Reposilite and error.

CHART_VERSION=1.0.1
helm install --version "${CHART_VERSION}" reposilite volker.raschek/reposilite \
  --set 'deployment.reposilite.env[1].name=REPOSILITE_LOCAL_SSLENABLED' \
  --set 'deployment.reposilite.env[1].value="true"' \
  --set 'deployment.reposilite.env[2].name=REPOSILITE_LOCAL_SSLPORT' \
  --set 'deployment.reposilite.env[2].value=8443' \
  --set 'deployment.reposilite.env[3].name=REPOSILITE_LOCAL_KEYPATH' \
  --set 'deployment.reposilite.env[3].value="/etc/reposilite/tls/cert.pem /etc/reposilite/tls/priv-key.pem"' \
  --set 'deployment.reposilite.volumeMounts[0].name=tls' \
  --set 'deployment.reposilite.volumeMounts[0].mountPath=/etc/reposilite/tls' \
  --set 'deployment.reposilite.volumeMounts[0].readOnly=true' \
  --set 'deployment.volumes[0].name=tls' \
  --set 'deployment.volumes[0].items[0].key=ca.crt' \
  --set 'deployment.volumes[0].items[0].path=ca.pem' \
  --set 'deployment.volumes[0].items[1].key=tls.crt' \
  --set 'deployment.volumes[0].items[1].path=cert.pem' \
  --set 'deployment.volumes[0].items[2].key=tls.key' \
  --set 'deployment.volumes[0].items[2].path=priv-key.pem' \
  --set 'deployment.volumes[0].secret.secretName=reposilite-tls' \
  --set 'service.port=8443'

TLS certificate rotation

If Reposilite uses TLS certificates that are mounted as a secret in the container file system like the example above, Reposilite will not automatically apply them when the TLS certificates are rotated. Such a rotation can be for example triggered, when the cert-manager issues new TLS certificates before expiring.

Until Reposilite does not support rotating TLS certificate a workaround can be applied. For example stakater's reloader controller can be used to trigger a rolling update. The following annotation must be added to instruct the reloader controller to trigger a rolling update, when the mounted secret has been changed.

[!IMPORTANT] The Helm chart already adds annotations to trigger a rolling release. Helm describes this approach under Automatically Roll Deployments. For this reason, only external configMaps or secrets need to be monitored by reloader.

deployment:
  annotations:
    secret.reloader.stakater.com/reload: "reposilite-tls"

If the application is rolled out using ArgoCD, a rolling update from stakater's reloader can lead to a drift. ArgoCD will attempt to restore the original state with a rolling update. To avoid this, instead of a rolling update triggered by the reloader, a restart of the pod can be initiated. Further information are available in the official README of stakater's reloader.

  deployment:
    annotations:
+     reloader.stakater.com/rollout-strategy: "restart"
      secret.reloader.stakater.com/reload: "reposilite-tls"

Network policies

Network policies can only take effect, when the used CNI plugin support network policies. The chart supports no custom network policy implementation of CNI plugins. It's support only the official API resource of networking.k8s.io/v1.

The example below is an excerpt of the values.yaml file. The network policy contains ingress rules to allow incoming traffic from an ingress controller. Additionally two egress rules are defined. The first one to allow the application outgoing access to the internal running DNS server core-dns. The second rule to be able to access the Apache Maven Central repository via HTTPS.

[!IMPORTANT] Please keep in mind, that the namespace and pod selector labels can be different from environment to environment. For this reason, there is are not default network policy rules defined.

networkPolicies:
  enabled: true
  annotations: {}
  labels: {}
  policyTypes:
  - Egress
  - Ingress
  egress:
  - to:
    - namespaceSelector:
        matchLabels:
          kubernetes.io/metadata.name: kube-system
      podSelector:
        matchLabels:
          k8s-app: kube-dns
    ports:
    - port: 53
      protocol: TCP
    - port: 53
      protocol: UDP
  - ports:
    - port: 443
      protocol: TCP

  ingress:
  - from:
    - namespaceSelector:
        matchLabels:
          kubernetes.io/metadata.name: ingress-nginx
      podSelector:
        matchLabels:
          app.kubernetes.io/name: ingress-nginx
    ports:
    - port: http
      protocol: TCP

Prometheus

Reposilite is not able to expose metrics by default. Reposilite requires an additional plugin to expose the metrics via /metrics. The plugin will be downloaded from Apache Maven Central, when the plugin is enabled directly or the Prometheus feature has been enabled. The plugin is a simple JAR file, which will be stored in /app/data/plugins.

Furthermore, Reposilite will not expose the metrics without protection. For this reason must be defined basic auth credentials. By default generate the helm chart a random username and password for basic auth. For debugging propose can be set the credentials manually.

The following example enable Prometheus metrics with custom basic auth credentials:

CHART_VERSION=1.0.1
helm install --version "${CHART_VERSION}" reposilite volker.raschek/reposilite \
  --set 'prometheus.metrics.enabled=true' \
  --set 'prometheus.metrics.basicAuthUsername=my-username' \
  --set 'prometheus.metrics.basicAuthUsername=my-password'

ArgoCD

Example Application

An application resource for the Helm chart is defined below. It serves as an example for your own deployment.

apiVersion: argoproj.io/v1alpha1
kind: Application
spec:
  destination:
    server: https://kubernetes.default.svc
    namespace: reposilite
  ignoreDifferences:
  - group: apps
    kind: Deployment
    jqPathExpressions:
    # When HPA is enabled, ensure that a modification of the replicas does not lead to a
    # drift.
      - '.spec.replicas'
    # Ensure that changes of the annotations or environment variables added or modified by
    # stakater's reloader does not lead to a drift.
    - '.spec.template.metadata.annotations | with_entries(select(.key | startswith("reloader")))'
    - '.spec.template.spec.containers[].env[] | select(.name | startswith("STAKATER_"))'
  sources:
  - repoURL: https://charts.cryptic.systems/volker.raschek
    chart: reposilite
    targetRevision: '0.*'
    helm:
      valueFiles:
      - $values/values.yaml
      releaseName: reposilite
  syncPolicy:
    automated:
      prune: true
      selfHeal: true
    managedNamespaceMetadata:
      annotations: {}
      labels: {}
    syncOptions:
    - ApplyOutOfSyncOnly=true
    - CreateNamespace=true
    - FailOnSharedResource=false
    - Replace=false
    - RespectIgnoreDifferences=false
    - ServerSideApply=true
    - Validate=true

Parameters

Global

NameDescriptionValue
nameOverrideIndividual release name suffix.""
fullnameOverrideOverride the complete release name logic.""

Config

NameDescriptionValue
config.plugins.prometheus.enabledDownload the Prometheus plugin via an additional init container. The Prometheus plugin will automatically enabled, when Prometheus is enabled.false
config.plugins.prometheus.urlURL to download the plugin.https://maven.reposilite.com/releases/com/reposilite/plugin/prometheus-plugin/{{ .Chart.AppVersion }}/prometheus-plugin-{{ .Chart.AppVersion }}-all.jar

Deployment

NameDescriptionValue
deployment.annotationsAdditional deployment annotations.{}
deployment.labelsAdditional deployment labels.{}
deployment.additionalContainersList of additional containers.[]
deployment.affinityAffinity for the Reposilite deployment.{}
deployment.initContainersList of additional init containers.[]
deployment.dnsConfigdnsConfig of the Reposilite deployment.{}
deployment.dnsPolicydnsPolicy of the Reposilite deployment.

Deploy reposilite with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has reposilite on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartreposilite is pinned at v1.0.1 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply