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

GitLab runner not passing control plane cidr #32

Open
p1-repo-sync-bot bot opened this issue Feb 6, 2024 · 0 comments
Open

GitLab runner not passing control plane cidr #32

p1-repo-sync-bot bot opened this issue Feb 6, 2024 · 0 comments

Comments

@p1-repo-sync-bot
Copy link

Bug

Description

The BB level value of networkPolicies.controlPlaneCidr passes down to app netpols via default values per app in their respective BB template subdirectories, but gitlab-runner is missing this default value here.

This is easy to mitigate in the meantime with addons.gitlabRunner.values.networkPolicies.controlPlaneCidr, but still a minor bug:

addons:
  gitlabRunner:
    enabled: true
    values:
      networkPolicies:
        controlPlaneCidr: 172.18.0.0/24

Also, the associated network policy includes a rule to allow all traffic to the gitlab namespace, but all other applications have a dedicated kube-api egress and this one should as well, as the current multi-element rule allows all traffic to the gitlab namespace or the default cidr (0.0.0.0/0 if not configured directly in the gitlab runner values).

Suggested action is to fix the gitlab runner BB level values, break the netpol into its own dedicated kube api netpol and create a new netpol for gitlab-runner > gitlab communication. Below was tested and worked fine for us:

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  annotations:
    meta.helm.sh/release-name: gitlab-runner
    meta.helm.sh/release-namespace: gitlab-runner
  labels:
    app.kubernetes.io/managed-by: Helm
    helm.toolkit.fluxcd.io/name: gitlab-runner
    helm.toolkit.fluxcd.io/namespace: bigbang
  name: egress-runner-to-webservice
  namespace: gitlab-runner
spec:
  egress:
  - to:
    - namespaceSelector:
        matchLabels:
          app.kubernetes.io/name: gitlab
      podSelector:
        matchLabels:
          app: webservice
  podSelector:
    matchLabels:
      app: gitlab-runner
  policyTypes:
  - Egress

This policy enforces traffic to be destined to the gitlab namespace and pods with the app: webservice label which I believe is all gitlab-runner needs.

BigBang Version

2.19.2 but likely an issue since the migration of gitlab-runner to its own namespace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

0 participants