gitlab-agent-permissioned

by mlohr

Helm chartv1.80.0App 19.6.2Apache-2.0Verified publisher

A Helm Chart for the GitLab Agent (agentk) with a permissioned deployment by default

About this chart

GitLab Agent (agentk) Permissioned Helm Chart

This repository contains a Helm Chart to deploy the GitLab Agent (agentk) permissioned by default in contrast to the Helm Chart provided by the GitLab.org Team, which grants cluster-admin privileges by default.

Please note: This project is a community helm chart from GitLab users to GitLab users. This chart is not officially supported by the GitLab company.

Project Purpose

The official Helm Chart for the GitLab Kubernetes Agent (agentk) by default grants cluster-admin privileges to the agent. While this can be disabled, there is no simple feature (yet?) in the official chart to limit access to certain namespaces. For this, manual manifests have to be written.

This chart solves the problem by allowing to define namespaces to which the agent should have access to, using Roles and RoleBindings.

Installation

Add Helm Repository

helm repo add mlohr https://helm-charts.mlohr.com/
helm repo update

Install to Kubernetes

Quick installation:

helm upgrade --install gitlab-agent-permissioned mlohr/gitlab-agent-permissioned \
    --set config.token="<YOUR GITLAB.COM AGENT TOKEN>"

Define RBAC rules for two namespaces:

# custom values.yaml
rbac:
  namespaces:
    # Only allow read access to Pods in the `namespace1` namespace
    - name: namespace1
      rules:
        - apiGroups: [""]
          resources: ["pods"]
          verbs: ["get", "watch", "list"]

    # Allow read/write access in namespace `namespace2`
    - name: namespace2
      rules:
        - apiGroups: ["", "extentions", "apps", "batch", "networking.k8s.io"]
          resources: ["*"]
          verbs: ["*"]

For a documentation of all configuration possibilities check values.yaml.

License

This project is published under the Apache License, Version 2.0. See LICENSE.md for more information.

Copyright (c) by Matthias Lohr <[email protected]>

Deploy gitlab-agent-permissioned with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has gitlab-agent-permissioned 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 chartgitlab-agent-permissioned is pinned at v1.80.0 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