|  | 
|  | 1 | +# OpenShift's fork of k8s.io/kubernetes | 
|  | 2 | + | 
|  | 3 | +This respository contains core Kubernetes components with OpenShift-specific patches. | 
|  | 4 | + | 
|  | 5 | +## Cherry-picking an upstream commit into openshift/kubernetes: Why, how, and when. | 
|  | 6 | + | 
|  | 7 | +`openshift/kubernetes` carries patches on top of each rebase in one of two ways: | 
|  | 8 | + | 
|  | 9 | +1. *periodic rebases* against an upstream Kubernetes tag.  Eventually, | 
|  | 10 | +any code you have in upstream Kubernetes will land in Openshift via | 
|  | 11 | +this mechanism. | 
|  | 12 | + | 
|  | 13 | +2. Cherry-picked patches for important *bug fixes*.  We really try to | 
|  | 14 | +limit feature back-porting entirely. Unless there are exceptional circumstances, your backport should at least be merged in kubernetes master branch. With every carry patch (not included in upstream) you are introducing a maintenance burden for the team managing rebases. | 
|  | 15 | + | 
|  | 16 | +### For Openshift newcomers: Pick my Kubernetes fix into Openshift vs. wait for the next rebase? | 
|  | 17 | + | 
|  | 18 | +Assuming you read the bullets above... If your patch is really far behind, for | 
|  | 19 | +example, if there have been 5 commits modifying the directory you care about, | 
|  | 20 | +cherry picking will be increasingly difficult and you should consider waiting | 
|  | 21 | +for the next rebase, which will likely include the commit you care about or at | 
|  | 22 | +least decrease the amount of cherry picks you need to do to merge. | 
|  | 23 | + | 
|  | 24 | +To really know the answer, you need to know *how many commits behind you are in | 
|  | 25 | +a particular directory*, often. | 
|  | 26 | + | 
|  | 27 | +To do this, just use git log, like so (using pkg/scheduler/ as an example). | 
|  | 28 | + | 
|  | 29 | +``` | 
|  | 30 | +MYDIR=pkg/scheduler/algorithm git log --oneline -- | 
|  | 31 | +  ${MYDIR} | grep UPSTREAM | cut -d' ' -f 4-10 | head -1 | 
|  | 32 | +``` | 
|  | 33 | + | 
|  | 34 | +The commit message printed above will tell you: | 
|  | 35 | + | 
|  | 36 | +- what the LAST commit in Kubernetes was (which effected | 
|  | 37 | +"/pkg/scheduler/algorithm") | 
|  | 38 | +- directory, which will give you an intuition about how "hot" the code you are | 
|  | 39 | +cherry picking is.  If it has changed a lot, recently, then that means you | 
|  | 40 | +probably will want to wait for a rebase to land. | 
|  | 41 | + | 
|  | 42 | +### Cherry-picking an upstream change | 
|  | 43 | + | 
|  | 44 | +Since `openshift/kubernetes` closely resembles `k8s.io/kubernetes`, | 
|  | 45 | +cherry-picking largely involves proposing upstream commits in a PR to our | 
|  | 46 | +downstream fork. Other than the usual potential for merge conflicts, the | 
|  | 47 | +commit messages for all commits proposed to `openshift/kubernetes` must | 
|  | 48 | +reflect the following: | 
|  | 49 | + | 
|  | 50 | +- `UPSTREAM: <UPSTREAM PR ID>:` The prefix for upstream commits to ensure | 
|  | 51 | +  correct handling during a future rebase. The person performing the rebase | 
|  | 52 | +  will know to omit a commit with this prefix if the referenced PR is already | 
|  | 53 | +  present in the new base history. | 
|  | 54 | +- `UPSTREAM: <drop>:` The prefix for downstream commits of code that is | 
|  | 55 | +  generated (i.e. via `make update`) or that should not be retained by the | 
|  | 56 | +  next rebase. | 
|  | 57 | +- `UPSTREAM: <carry>:` The prefix for downstream commits that maintain | 
|  | 58 | +  downstream-specific behavior (i.e. to ensure an upstream change is | 
|  | 59 | +  compatible with OpenShift). Commits with this are usually retained across | 
|  | 60 | +  rebases. | 
|  | 61 | + | 
|  | 62 | +## Updating openshift/kubernetes to a new upstream release | 
|  | 63 | + | 
|  | 64 | +Instructions for rebasing `openshift/kubernetes` are maintained in a [separate | 
|  | 65 | +document](REBASE.openshift.md). | 
|  | 66 | + | 
|  | 67 | +## RPM Packaging | 
|  | 68 | + | 
|  | 69 | +A specfile is included in this repo which can be used to produce RPMs | 
|  | 70 | +including the openshift binary. While the specfile will be kept up to | 
|  | 71 | +date with build requirements the version is not updated. Building the | 
|  | 72 | +rpm with the `openshift-hack/build-rpms.sh` helper script will ensure | 
|  | 73 | +that the version is set correctly. | 
0 commit comments