|
| 1 | +--- |
| 2 | +title: Precision Time Protocol |
| 3 | +authors: |
| 4 | + - "@zshi-redhat" |
| 5 | +reviewers: |
| 6 | + - "@oglok" |
| 7 | + - "@fepan" |
| 8 | + - "@pliurh" |
| 9 | +approvers: |
| 10 | + - TBD |
| 11 | +creation-date: 2019-09-03 |
| 12 | +last-updated: 2019-09-03 |
| 13 | +status: implementable |
| 14 | +--- |
| 15 | + |
| 16 | +# Add-Precision-Time-Protocol-Support |
| 17 | + |
| 18 | +## Release Signoff Checklist |
| 19 | + |
| 20 | +- [x] Enhancement is `implementable` |
| 21 | +- [ ] Design details are appropriately documented from clear requirements |
| 22 | +- [ ] Test plan is defined |
| 23 | +- [ ] Graduation criteria for dev preview, tech preview, GA |
| 24 | +- [ ] User-facing documentation is created in [openshift/docs] |
| 25 | + |
| 26 | +## Summary |
| 27 | + |
| 28 | +A proposal to enable Precision Time Protocol(PTP) on OpenShift. |
| 29 | + |
| 30 | +The linuxptp package, an implementaion of PTP according to IEEE standard 1588 |
| 31 | +for Linux, can be installed on a node and configured to synchronize system |
| 32 | +clock to remote PTP master clock. |
| 33 | + |
| 34 | +## Motivation |
| 35 | + |
| 36 | +NFV cRAN (Centralized Radio Access Networks) and vRAN (Virtual Radio Access |
| 37 | +Networks) require PTP level accuracy in sub-microsecond range, associated |
| 38 | +standards are based on PTP for time and phase synchronization. |
| 39 | + |
| 40 | +### Goals |
| 41 | + |
| 42 | +- Install linuxptp package on baremetal nodes |
| 43 | +- Configure linuxptp services on baremetal nodes |
| 44 | + |
| 45 | +### Non-Goals |
| 46 | + |
| 47 | +- Replace NTP |
| 48 | +- Support PTP software timestamping |
| 49 | +- Support PTP on platforms such as AWS, VMware, OpenStack |
| 50 | +- Provide full automation for linuxptp package deployment and configuration |
| 51 | +- Support comprehensive configurations for linuxptp services |
| 52 | + |
| 53 | +## Proposal |
| 54 | + |
| 55 | +A new PTP DaemonSet is deployed in the cluster after OpenShift installation |
| 56 | +finishes. This DaemonSet contains linuxptp package and interacts with two |
| 57 | +Custom Resource Definitions, `NodePTPDev` and `NodePTPCfg`. `NodePTPDev` |
| 58 | +custom resource is created for each node by PTP DaemonSet automatically, |
| 59 | +it collects PTP capable device names and updates to status of `NodePTPDev` |
| 60 | +custom resource. `NodePTPCfg` exposes configuration options for linuxptp |
| 61 | +services such as ptp4l and phc2sys. |
| 62 | + |
| 63 | +User deploys manifests that are necessary to run PTP DaemonSet which includes |
| 64 | +resources such as namespace, role based access control, Custom Resource |
| 65 | +Definition (`NodePTPDev` and `NodePTPCfg`), PTP DaemonSet. |
| 66 | + |
| 67 | +PTP DaemonSet creates a custom resource of `NodePTPDev` type per each node and |
| 68 | +updates PTP capable network device names from each OpenShift node to the status |
| 69 | +field of this custom resource. User can refer to these interface names for |
| 70 | +configuring linuxptp services with `NodePTPCfg`. |
| 71 | + |
| 72 | +User configures linuxptp services and apply rules in `NodePTPCfg` custom |
| 73 | +resource. Linuxptp services are configured via `profile` section in `NodePTPCfg` |
| 74 | +and apply rules are configured via `recommend` section in `NodePTPCfg`. |
| 75 | +Multiple `NodePTPCfg` custom resources can be created, PTP DaemonSet will merge |
| 76 | +all the `NodePTPCfg` custom resources according to recommend definition and |
| 77 | +apply one profile that best matches with the node. |
| 78 | + |
| 79 | +Upon receiving a notification event of `NodePTPCfg` creation or update, |
| 80 | +PTP Daemon verify the correctness of `NodePTPCfg` custom resource and |
| 81 | +apply the selected profile to each node. One profile at most will be |
| 82 | +applied to each node. |
| 83 | + |
| 84 | +### User Stories |
| 85 | + |
| 86 | +#### Virtual Radio Access Networks |
| 87 | + |
| 88 | +NFV vRAN workloads can run on OpenShift baremetal cluster. |
| 89 | + |
| 90 | +### Implementation Details |
| 91 | + |
| 92 | +The proposal introduces PTP as Tech Preview. |
| 93 | + |
| 94 | +#### Node PTP Devices |
| 95 | + |
| 96 | +Hardware PTP capability on network interface is detected with the following |
| 97 | +command: |
| 98 | + |
| 99 | +`ethtool -T <network-interface-name>` |
| 100 | + |
| 101 | +This command shows whether a MAC supports hardware time stamping. Only devices |
| 102 | +that contain below flags are listed as PTP capable device. |
| 103 | + |
| 104 | +``` |
| 105 | +SOF_TIMESTAMPING_TX_HARDWARE |
| 106 | +SOF_TIMESTAMPING_RX_HARDWARE |
| 107 | +SOF_TIMESTAMPING_RAW_HARDWARE |
| 108 | +``` |
| 109 | + |
| 110 | +#### PTP Clock Types |
| 111 | + |
| 112 | +Clocks synchronized by PTP are organized under a hierachy of master-slave type. |
| 113 | +The slaves are synchronized to their masters who can themselves be slaves to |
| 114 | +other masters. When a clock has only one port, it can be master or slave, this |
| 115 | +type of clock is called an `Ordinary Clock`, A clock with multiple ports can be |
| 116 | +master on one port and slave on another, this type of clock is called a |
| 117 | +`Boundary Clock`. The PTP Clock type supported in this proposal is |
| 118 | +`Ordinary Clock` and only one network interface on each node can be configured |
| 119 | +for PTP. |
| 120 | + |
| 121 | +#### Node PTP Config |
| 122 | + |
| 123 | +Although multiple `NodePTPCfg` custom resources can be defined in the cluster, |
| 124 | +only one profile can be applied to a specific node. Each profile contains |
| 125 | +combination of `Interface`, `ptp4lOpts` and `phc2sysOpts`, one clock at most |
| 126 | +can be configured on each node, this excludes the possibility to configure an |
| 127 | +OpenShift node to be a PTP `Boundary Clock` node. |
| 128 | + |
| 129 | +#### PTP Network Transport Mode |
| 130 | + |
| 131 | +PTP protocol supports three transport modes: IEEE 802.3, UDP IPv4 and UDP IPv6. |
| 132 | +When using UDP network transport mode, PTP device requires IP address be |
| 133 | +configured, however this is not supported by PTP daemon in this proposal, user |
| 134 | +will need to configure it manually. `NodePTPCfg` might be extended in the future |
| 135 | +to support necessary network configurations such as creating a bond interface |
| 136 | +for PTP redundancy, assigning IP address for UDP transport mode. |
| 137 | + |
| 138 | +#### PTP4L configuration file |
| 139 | + |
| 140 | +Default ptp4l configuration file (ptp4l.conf) will be used when starting ptp4l |
| 141 | +service. User doesn't need to specify `-f ptp4l.conf` in `ptp4lOpts`, it is |
| 142 | +automatically appended to `ptp4lOpts` by PTP Daemon. The `ptp4l.conf` file |
| 143 | +uses default content delivered in linuxptp package and is installed under |
| 144 | +path `/etc/ptp4l.conf` inside PTP Daemon image. It cannot be changed via |
| 145 | +CRDs exposed in this proposal. However, some of ptp4l configuration options |
| 146 | +in `ptp4l.conf` can be overwritten by specifying certain options in |
| 147 | +`ptp4lOpts`. For example, with `ptp4lOpts` set to `-2 -s`, it overwrites |
| 148 | +`network_transport` and `slaveOnly` options in `ptp4l.conf` which configures |
| 149 | +ptp4l service to use L2 transport and slave only mode. |
| 150 | + |
| 151 | +#### Redundancy |
| 152 | + |
| 153 | +##### PTP port redundancy |
| 154 | + |
| 155 | +Ptp4l supports using bonding interface in active-backup mode. It uses the |
| 156 | +active interface from bond as PTP clock and can switch to another active |
| 157 | +interface in case of a failover. Creation of bonding interface(e.g. bond0) |
| 158 | +is not supported in this proposal, to use bond interface as PTP device, |
| 159 | +user needs to create it manually(for example, on RHEL nodes). |
| 160 | + |
| 161 | +##### PTP and NTP redundancy |
| 162 | + |
| 163 | +Chrony is deployed and enabled by default during OpenShift installation process. |
| 164 | +This proposal doesn't support timemaster service configuration. Use of PTP will |
| 165 | +require disabling NTP(Chrony) first. No redundancy is provided between NTP and |
| 166 | +PTP in this proposal. |
| 167 | + |
| 168 | +### Risks and Mitigations |
| 169 | + |
| 170 | +In case of failure in linuxptp configuration, OpenShift nodes will be left as |
| 171 | +no time source to sync, resulting in potential time disorder among nodes. |
| 172 | +This can be mitigated by providing PTP and NTP redundancy via timemaster |
| 173 | +service which automatically rolls back to use default NTP time source. |
| 174 | +timemaster service configuration is not supported in this initial proposal. |
| 175 | + |
| 176 | + |
| 177 | +PTP device working in UDP transport mode requires IP configuration on network |
| 178 | +interface, if the network interface is also used by default openshift-sdn |
| 179 | +plugin, it may destroy network connection established by openshift-sdn. This |
| 180 | +should be documented as a risk. |
| 181 | + |
| 182 | +## Design Details |
| 183 | + |
| 184 | +### Test Plan |
| 185 | + |
| 186 | +- Tests will not be conducted against real PTP grandmaster clock |
| 187 | +- Functional tests will be implemented |
| 188 | + |
| 189 | +### Graduation Criteria |
| 190 | + |
| 191 | +Initial support for PTP will be Tech Preview |
| 192 | + |
| 193 | +#### Tech Preview |
| 194 | + |
| 195 | +- Linuxptp can be installed via container image |
| 196 | +- Linuxptp services can be configured via CRDs |
| 197 | +- End user documentation on how to interact with PTP DaemonSet |
| 198 | +- Sufficient test coverage |
| 199 | +- Gather feedback from users rather than just developers |
| 200 | + |
| 201 | +#### Tech Preview -> GA |
| 202 | + |
| 203 | +- Have an operator to manage PTP CRDs |
| 204 | +- Support advanced configuration of linuxptp such as timemaster |
| 205 | +- Support all PTP network transport modes |
| 206 | +- Provide redundancy support for PTP, both port and time source redundancy |
| 207 | +- Support configuration of all PTP Clock types |
| 208 | +- Measure PTP time accuracy in real environment |
| 209 | + |
| 210 | +### Upgrade / Downgrade Strategy |
| 211 | + |
| 212 | +### Version Skew Strategy |
| 213 | + |
| 214 | +PTP runs as a separate DaemonSet. |
| 215 | + |
| 216 | +## Implementation History |
| 217 | + |
| 218 | +### Version 4.3 |
| 219 | + |
| 220 | +Tech Preview |
| 221 | + |
| 222 | +## Infrastructure Needed |
| 223 | + |
| 224 | +This requires a github repo be created under openshift org to hold PTP |
| 225 | +DaemonSet code. The name of this repo is `ptp-daemon`. |
0 commit comments