bhouse-nexthop opened a new pull request, #14783:
URL: https://github.com/apache/cloudstack/pull/14783

   ### Description
   
   createKubernetesCluster gains three optional parameters:
   
   | Parameter | Type | Used for |
   |---|---|---|
   | `apiserverargs` | map | kube-apiserver flags, e.g. OIDC 
(`oidc-issuer-url`, `oidc-client-id`, ...) |
   | `kubeletconfig` | JSON object | KubeletConfiguration fields, e.g. 
`systemReserved`, `kubeReserved`, `evictionHard` |
   | `auditpolicy` | string | audit Policy document; turns on audit logging |
   
   - **Storage:** kept in `kubernetes_cluster_details` and returned in the 
cluster response. No schema change.
   - **kubeadm config:**
     - Built in Java for both the external etcd and the stacked case: 
`kubeadm.k8s.io/v1beta3`, or v1beta4 for Kubernetes 1.31+.
     - The settings go into ClusterConfiguration `apiServer.extraArgs` / 
`extraVolumes` plus a KubeletConfiguration document, not into shell flags.
     - The stacked case keeps the existing flag-based `kubeadm init` unless one 
of the new parameters is set.
   - **Nodes added later:** kubeadm uploads the kubelet config to the 
`kubelet-config` ConfigMap, so nodes that join later (scale, extra control 
nodes) get the same settings. The audit policy file is also written on the 
extra control nodes.
   - **Audit logs:** written to `/var/log/kubernetes/audit` with rotation 
defaults (maxage 30, maxbackup 3, maxsize 100 MB) that `apiserverargs` can 
override.
   - **Validation:**
     - Flag names must be `[a-z0-9-]`. Values and kubelet strings are limited 
to a plain character set (no spaces, quotes or braces).
     - Duplicate flags are rejected, and JSON nulls are rejected.
     - Flags and kubelet fields CloudStack relies on are reserved, e.g. 
`secure-port`, `etcd-servers`, `anonymous-auth`, `audit-policy-file`, 
`requestheader-*`, `cgroupDriver`, `clusterDNS`, `staticPodURL`.
     - `NodeRestriction` stays in `enable-admission-plugins`.
     - Requires Kubernetes 1.22+, and is rejected for ExternalManaged clusters.
   - `kubeadm-config.yaml` is now 0600, since it holds the bootstrap token and 
certificate key.
   
   Fixes #14782
   
   ### Types of changes
   
   - [ ] Breaking change (fix or feature that would cause existing 
functionality to change)
   - [x] New feature (non-breaking change which adds functionality)
   - [ ] Bug fix (non-breaking change which fixes an issue)
   - [ ] Enhancement (improves an existing feature and functionality)
   - [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
   
   ### How Has This Been Tested?
   
   Unit tests: 155 in the kubernetes-service module, 27 of them in 
`KubeadmConfigBuilderTest` (v1beta3/v1beta4 output, stacked and external etcd, 
validation and reserved names).
   
   KVM lab, Kubernetes v1.33.13, HA cluster (2 control + 1 worker) created with 
OIDC `apiserverargs`, a `kubeletconfig` with `systemReserved` and 
`evictionHard`, and a Metadata-level `auditpolicy`:
   
   | Check | Result |
   |---|---|
   | Cluster create | Running, all nodes Ready, 19 pods Running |
   | kube-apiserver flags on both control nodes | `--oidc-issuer-url`, 
`--oidc-client-id`, `--audit-policy-file`, `--audit-log-*` defaults, 
`--enable-admission-plugins=NodeRestriction` |
   | Audit log on both control nodes | `/var/log/kubernetes/audit/audit.log` 
written, Metadata-level events |
   | Worker `/var/lib/kubelet/config.yaml` | `systemReserved` and 
`evictionHard` as given |
   | Scale to 2 workers | new worker gets the same kubelet settings and goes 
Ready |
   | `kubeadm-config.yaml` | mode 0600 |
   | Join token after create and after scale | deleted; only kubeadm's own 
certs-TTL token remains |
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to