kpt
kpt copied to clipboard
rpkg update: --discover shows an update available, but update fails
Expected behavior
Update succeeds.
Actual behavior
jbelamaric@jbelamaric:~/proj/nephio-packages/coredns-caching$ kpt alpha rpkg update nephio-dev-deploy-0247f2adfd09fa113737ab033918095bdfaf16eb --discover
PACKAGE REVISION UPSTREAM REPOSITORY UPSTREAM UPDATES
nephio-dev-deploy-0247f2adfd09fa113737ab033918095bdfaf16eb nephio-packages v3, v4
jbelamaric@jbelamaric:~/proj/nephio-packages/coredns-caching$ kpt alpha rpkg update nephio-dev-deploy-0247f2adfd09fa113737ab033918095bdfaf16eb --revision v4
nephio-dev-deploy-0247f2adfd09fa113737ab033918095bdfaf16eb updated
Error: upstream source not found for package rev "dnscache"; only cloned packages can be updated
Information
kpt version 1.0.0-beta.18 porch version 0.0.7
I can share the packages if necessary but right now they are internal. Blueprints and deployments repos are CSR with workload identity.
Steps to reproduce the behavior
- I created a package manually and tagged it in Git.
- I used Porch to deploy it to a different repo, using
rpkg clone
in the CLI. - I manually created a RootSync - this worked and the package is running in my cluster.
- I updated the upstream package manually in git in the blueprints repo (just changed the README.md), and tagged a new revision.
- I created a new upstream revision in the Porch UI from that revision, and modified one resource.
- I proposed and accepted that change to the upstream.
- Everything looks good in the UI and the CLI.
- I run the discover command, it finds the two new revisions of the upstream.
- I try to update, and it fails.
For reference, here is the Kptfile
for the downstream package:
jbelamaric@jbelamaric:~/proj/nephio-dev-deploy$ cat dnscache/Kptfile
apiVersion: kpt.dev/v1
kind: Kptfile
metadata: # kpt-merge: /dnscache
name: dnscache
annotations:
config.kubernetes.io/local-config: "true"
internal.kpt.dev/upstream-identifier: kpt.dev|Kptfile|default|dnscache
upstream:
type: git
git:
repo: https://source.developers.google.com/p/jbelamaric-dev/r/nephio-packages
directory: coredns-caching
ref: coredns-caching/v2
upstreamLock:
type: git
git:
repo: https://source.developers.google.com/p/jbelamaric-dev/r/nephio-packages
directory: coredns-caching
ref: coredns-caching/v2
commit: d647225ad4b94286b89ae0529dd6164de6aeffe1
info:
description: CoreDNS application configured for the caching layer.
pipeline:
mutators:
- image: gcr.io/kpt-fn/set-namespace:v0.4.1
configPath: package-context.yaml
Porch currently relies on the clone task for the package to determine the common ancestor for the 3-way merge, so if the package doesn't have a clone task in the history the update functionality doesn't work. We do want to make this more flexible.
It is not clear to me why discovery does work, while the update doesn't. Can you run the following command and provide the output?
kpt alpha rpkg get nephio-dev-deploy-0247f2adfd09fa113737ab033918095bdfaf16eb -oyaml
You might also have to provide the namespace when running this.
jbelamaric@jbelamaric:~/proj/gh/coredns/deployment/kubernetes$ kpt alpha rpkg get nephio-dev-deploy-0247f2adfd09fa113737ab033918095bdfaf16eb -oyaml -ndefault
apiVersion: porch.kpt.dev/v1alpha1
kind: PackageRevision
metadata:
creationTimestamp: "2022-07-21T01:45:00Z"
name: nephio-dev-deploy-0247f2adfd09fa113737ab033918095bdfaf16eb
namespace: default
resourceVersion: 31dc52dd97b4a0630df4d9f0aec6e1d19fafcaca
uid: uid:dnscache:v2
spec:
lifecycle: Draft
packageName: dnscache
repository: nephio-dev-deploy
revision: v2
tasks:
- init:
description: dnscache description
type: ""
- type: ""
- eval:
config: null
image: render
match: {}
type: eval
status:
upstreamLock:
git:
commit: d647225ad4b94286b89ae0529dd6164de6aeffe1
directory: coredns-caching
ref: coredns-caching/v2
repo: https://source.developers.google.com/p/jbelamaric-dev/r/nephio-packages
type: git
jbelamaric@jbelamaric:~/proj/gh/coredns/deployment/kubernetes$
That task list doesn't look right. I will try to follow the steps and see if I can reproduce it.
I'm not able to reproduce this situation. So just to clarify:
- The package in question here (nephio-dev-deploy-0247f2adfd09fa113737ab033918095bdfaf16eb) is the result of running
rpkg clone
on a package created manually in git. This is step 2 on the list of steps to reproduce. - The steps to reproduce the behavior goes through several revisions on the upstream package, including creating new revisions directly through git and updating the package through the GUI. But these steps doesn't really affect the downstream package (nephio-dev-deploy-0247f2adfd09fa113737ab033918095bdfaf16eb).
- The downstream package doesn't get any other changes until the attempt to update it to use revision v4 of the upstream.
Based on the task list of the package, it shouldn't be possible to update it (currently) since it doesn't have an clone task in the task list. But I'm not sure why the list looks like that.
Since I wasn't able to reproduce this issue and it has been a long time, I'm just going to close this one. If we see similar problems in the future, just open a new issue.