helper-proj-onboarding

by tjungbauer

Helm chartv1.0.48Apache-2.0Verified publisher

This Chart shall deploy namespaces and their depending resources, like NetworkPolicies or Quotas etc.

About this chart

helper-proj-onboarding

Description

This Chart shall deploy namespaces and their depending resources, like NetworkPolicies or Quotas etc.

This Helm chart shall help to deploy all resources that are required for a custom workload. This might be a simple Namespace or ResourceQuotas or NetworkPolicies. The whole process is also described at Project onboarding using GitOps and Helm ... I am not copying the whole article here :)

Use case

The article describes the following use case:

  • I have two applications, my-main-app and my-second-app, that should be onboarded onto the cluster.
  • my-main-app is using two Namespaces, my-main-app-project-1 and my-main-app-project-2. Maybe Mona uses this for frontend and backend parts of the application.
  • Mona is the admin for both applications.
  • Peter can only manage my-main-app.
  • Mona and Peter request new projects (multiple) for the cluster, which will be prepared by the cluster-admin who will create a new folder and generate a values-file (Helm) for that project and the target cluster.
  • The cluster-admin synchronizes the project onboarding application in GitOps, which will create all required objects (Namespace, ResourceQuota, Network Policies, etc.).
  • Mona and Peter can then use an application-scoped GitOps instance (a second instance) to deploy their application accordingly using the allowed namespace, repositories, etc. (limited by GitOps RBAC rules).

(You can find all settings and discussions in the article.)

Resources

This chart has a huge values file and I tried to document all possible settings. To ease the creation of new Tenants it is possible to define so-called T-shirt sizes in a global values file and then simply refer to that size in your Tenant configuration. Still, you might overwrite certain settings. For example: The size "S" defined a quota of 2 CPUs, still a specific Tenant required 4 CPUs. This can be overwritten in the tenant-specific values file.

The following resources are currently managed:

  • Namespace (including lables)
  • ResourceQuotas (limit CPU, Memory etc.)
  • LimitRanges
  • Create Local Project Admin Group (and binding)
  • Default Set of Network Policies (to allow openshift Monitoring, DNS, Ingress etc.)
  • Custom Network Policies
  • Argo CD RBAC using AppProject resource.

Each Tenant might have one or more Namespaces. Under these Namespaces, all other settings are defined. See the possible variables and examples below.

values

Two values files are required here:

  • values-global.yaml Defines global values, currently the Namespace of the application-scoped GitOps instance, T-shirt sizes, a list of environments, etc.
  • values.yaml Defines the tenant-specifc settings. Here T-shirt sizes (Quotas and LimitRanges) might be overwritten.

Both files exist as examples in this repository.

Dependencies

This chart has the following dependencies:

RepositoryNameVersion
https://charts.stderr.at/tpl~1.0.27

None

Maintainers

NameEmailUrl
tjungbauer[email protected]https://blog.stderr.at/

Sources

Source:

Source code: https://github.com/tjungbauer/helm-charts/tree/main/charts/helper-proj-onboarding

Parameters Tenant individual values file

TIP: Verify the values.yaml to see possible additional settings.

Values

KeyTypeDefaultDescription
allowed_envslistnoneAllowed environments that this tenant can use. This list is mandatory to explicitly set the destination clusters. The name here must be equal to the configured environments in the Global-Values THIS IS FROM CLUSTER POV. Important: If there is a separate Argo CD instance per cluster, the developers still need access to the management cluster (typically in-cluster), since they need to be able to create Argo CD Applications NOTE: This list will be ignored, if overwrite_allowed_envs is set in the AppProject definition.
allowed_oidc_groupslistdummy-groupGroups that are allowed in RBAC configuration of the AppProject resource of Argo CD. This group can either be created using this Helm Chart (it will be named as -admin) or must be known (for example synced via LDAP Group Sync) NOTE: if either allowed_oidc_groups nor overwrite_oidc_groups are defined, then a dummy value will be set NOTE: This list will be ignored, if overwrite_oidc_groups is set in the AppProject definition.
allowed_source_namespacelist["my-allows-source-namespace"]Administrators can define a list of namespaces where Application or ApplicationSet resources may be created, updated and reconciled in. As of Argo CD 2.10 this is still a BETA feature. NOTE: This list will be ignored, if overwrite_source_namespaces is set in the AppProject definition.
allowed_source_reposlist*Allowed repositorie for this tenant. This setting might be later overwritten by namespaces.[].argocd_rbac_setup.{}.overwrite_sourceRepos. The allowed source repositories can be defined either (sorted by lowest priority, to highest priority) allow any repository global.allowed_source_repos allowed_source_repos namespaces.[].argocd_rbac_setup.{}.overwrite_sourceRepos Note: If nothing is set, then ANY source repository will be allowed.
namespaceslist''List of namespaces this tenant shall manage. A tenant or project may consist of multiple namespace
namespaces[0]object''Name of the first Namespace
namespaces[0].additional_settingsobject''Additional labels for Podsecurity and Monitoring for the Namespace
namespaces[0].additional_settings.podsecurity_auditstringN/APod Security Standards https://kubernetes.io/docs/concepts/security/pod-security-standards/#restricted Possible values: Privileged, Baseline, Restricted Privileged: Unrestricted policy, providing the widest possible level of permissions. This policy allows for known privilege escalations. Baseline: Minimally restrictive policy which prevents known privilege escalations. Allows the default (minimally specified) Pod configuration. Restricted: Heavily restricted policy, following current Pod hardening best practices. Policy violations will trigger the addition of an audit annotation to the event recorded in the audit log, but are otherwise allowed.
namespaces[0].additional_settings.podsecurity_enforcestringN/APolicy violations will cause the pod to be rejected.
namespaces[0].additional_settings.podsecurity_warnstringN/APolicy violations will trigger a user-facing warning, but are otherwise allowed.
namespaces[0].argocd_rbac_setupobject''Creation of Argo CD Project
namespaces[0].argocd_rbac_setup.argocd_project_1.namestring''Name of the AppProject.
namespaces[0].argocd_rbac_setup.argocd_project_1.overwrite_allowed_envslistemptyOVERWRITE Destination clusters (Optional). This list will replace the list defined at 'allowed_envs' and defines the allowed target clusters. The clusters here must exist in Argo CD and must be defined on the global-values file.
namespaces[0].argocd_rbac_setup.argocd_project_1.overwrite_sourceReposlist'*'OVERWRITE List of allowed repositories. If the tenant tries to use a different repo, Argo CD will deny it. * can be used to allow all. Typically not required, since global list can be defined and allowed_source_repos list can be defined too.
namespaces[0].argocd_rbac_setup.argocd_project_1.overwrite_source_namespaceslistemptyOVERWRITE sourceNamespaces (Optional). This will replace the list defined at 'source_namespaces'
namespaces[0].argocd_rbac_setup.argocd_project_1.rbac[0]objectemptyName of the RBAC rule
namespaces[0].argocd_rbac_setup.argocd_project_1.rbac[0].descriptionstring''Description of the RBAC rule
namespaces[0].argocd_rbac_setup.argocd_project_1.rbac[0].fullaccessboolfalseHINT: You can use fullaccess: true to simply provide full access to the aplication, without defining all actions manually in a list This will automatically set "allow" permissions to all actions (create, get, update, delete, sync and override) for all objects. If this is set to true, all definition at policies[] will be ignored.
namespaces[0].argocd_rbac_setup.argocd_project_1.rbac[0].overwrite_oidc_groupslistemptyOVERWRITE List of OCP groups that is allowed to manage objects in this project. This will replace settings defined in allowed_oidc_groups.
namespaces[0].argocd_rbac_setup.argocd_project_1.rbac[0].policieslist[]For better granularity, you can define the policies in such a list:
namespaces[0].argocd_rbac_setup.argocd_project_1.rbac[0].policies[0]object''Action: possible values are: get create update delete sync override
namespaces[0].argocd_rbac_setup.argocd_project_1.rbac[0].policies[0].objectstring'*'Object: which kind of objects can be managed.
namespaces[0].argocd_rbac_setup.argocd_project_1.rbac[0].policies[0].permissionstringdenyPermission: Possible values are: allow deny
namespaces[0].default_policiesobject''A set of default network policies will be created everytime, unless you choose to disable them here You can remove this whole block to have the policies created or you can select specific policies which shall be disabled/enabled. The default policies are: allow_from_ingress: Allow Ingress traffic from the OpenShift Router allow_from_monitoring: Allow OpenShift Monitoring to access and fetch metrics deny_all_ingress: Deny inner namespace communication (pod to pod of the same Namespace) allow_kube_apiserver: Allow Kube API Server deny_all_egress: Forbid ANY Egress traffic allow_from_same_namespace: allow inner namespace communication allow_to_dns: Allow openshift DNS WARNING: Per default the project role admin/edit (the project or namespace owner) can modify the Network Policies. If you do not want this, you need to create a custom role and assign this to the users.
namespaces[0].default_policies.allow_from_ingressboolfalseAllow traffic from the IngressController (OpenShift Router) into the namespace. Must be enabled explicitly.
namespaces[0].default_policies.allow_from_monitoringbooltrueAllow traffic from OpenShift Monitoring. This should typically be allowed.
namespaces[0].default_policies.allow_from_same_namespacebooltrueAllow traffic inside the own namespace between the Pods. This is usually allowed to make things easier.
namespaces[0].default_policies.allow_kube_apiserverbooltrueAllow traffic from OpenShift API server. This should typically be allowed.
namespaces[0].default_policies.allow_to_dnsbooltrueAllow traffic to OpenShift DNS services. This should be better allowed
namespaces[0].default_policies.deny_all_egressboolfalsePer default deny all outgoing traffic. Default would be false, to allow egress traffic without restriction.
namespaces[0].default_policies.deny_all_ingressboolfalseDeny any ingress connection to this namespace. This is very restrictive and if allow_from_same_namespace is set to false it means that also namespace inner connections are not possible unless they are explicitely permitted.
namespaces[0].egressIPsobject''EgressIPs for this Namespace Be sure that nodes are labells with: k8s.ovn.org/egress-assignable: "" NOTE: Curently only Namespace EgressIPs are supported (not pod)
namespaces[0].egressIPs.enabledboolfalseEnable or disable egressIPs.
namespaces[0].egressIPs.ipslist["10.100.60.130"]List of IP addresses that you want to assign the namespace
namespaces[0].enabledboolfalseIs this Namespace configuration enabled or not?
namespaces[0].labelsobjectemptyList of additional custom Labels that should be added to the Namespace resource, stored as a key/value pair
namespaces[0].labels.my_additional_labelstring"my_label"Example of an additional label
namespaces[0].limitRangesobject''Limit Ranges, are optional and restrict resource consumption in a project They can be disabled completely by settings enabled to false
namespaces[0].limitRanges.containerobject''To create a container in the project, the CPU and memory requests in the Pod spec must comply with the values set
namespaces[0].limitRanges.container.default.cpuintN/AThe default amount of CPU that a container can use if not specified in the Pod spec.
namespaces[0].limitRanges.container

Deploy helper-proj-onboarding with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has helper-proj-onboarding 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 charthelper-proj-onboarding is pinned at v1.0.48 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