-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
porch: packagevariant bug "Internal error occurred: error applying patch: conflict: fragment line does not match src line" #469
Comments
Hi @johnbelamaric, Is there any workaround for this issue or an alternative way to update a published package managed by package variant Thanks a lot for your time and efforts |
Ok, so I pulled down your package and pasted in the pipeline, I get this trying
Looking at the Kptfile, pasting in your exact snippet from above, I get that result. The problem is that the
So, can you try that and see if it fixes the problem? If so, then the primary issue is in our error handling we should have rejected the package with an appropriate message. |
Thanks a lot @johnbelamaric, I will test and let you know |
Hi John, I had a look at the upstream kptfile and it doesn't contain the pipeline keyword initially as it is added by the packagevariant.
Controller logs: 0c7fbe386b", resources unchanged
I0122 10:11:22.726279 1 packagevariant_controller.go:826] PackageVariant "nrf-india-nif", PackageRevision "downstream-nif-5200b69beade9e7a0ceaa9499cc45e0c7fbe386b", resources unchanged
I0122 10:12:15.184284 1 packagevariant_controller.go:819] PackageVariant "nrf-india-nif", PackageRevision "downstream-nif-5200b69beade9e7a0ceaa9499cc45e0c7fbe386b", resources changed: "Kptfile" different
I0122 10:12:15.184335 1 packagevariant_controller.go:413] package variant "nrf-india-nif" needs to mutate to package revision "downstream-nif-5200b69beade9e7a0ceaa9499cc45e0c7fbe386b", creating new draft
I0122 10:12:15.184350 1 packagevariant_controller.go:637] package variant "nrf-india-nif" is creating package revision ""
E0122 10:12:15.248538 1 packagevariant_controller.go:417] package variant "nrf-india-nif" failed to copy "downstream-nif-5200b69beade9e7a0ceaa9499cc45e0c7fbe386b": Internal error occurred: error applying patch: conflict: fragment line does not match src line Packagerevisionresources output of the published package: apiVersion: porch.kpt.dev/v1alpha1
kind: PackageRevisionResources
metadata:
creationTimestamp: "2024-01-22T08:28:37Z"
name: downstream-nif-5200b69beade9e7a0ceaa9499cc45e0c7fbe386b
namespace: nrf
resourceVersion: 396729c2ab1bf82a503a58c71cb825b9347b08a4
uid: uid:nrf-india:packagevariant-1
spec:
packageName: nrf-india
repository: downstream-nif
resources:
Kptfile: |
apiVersion: kpt.dev/v1
kind: Kptfile
metadata: # kpt-merge: /nrf-india
name: nrf-india
annotations:
config.kubernetes.io/local-config: "true"
internal.kpt.dev/upstream-identifier: 'kpt.dev|Kptfile|default|nrf-india'
upstream:
type: git
git:
repo: https://gitlab.tech.orange/asc/rom-nif.git
directory: nrf
ref: nrf/upstream
upstreamLock:
type: git
git:
repo: https://gitlab.tech.orange/asc/rom-nif.git
directory: nrf
ref: nrf/upstream
commit: 46c69c01313f32530b8b9ea54f0b3514e59781bf
info:
readinessGates:
- conditionType: config.injection.ConfigMap.nrf-overrides-values
description: sample description
pipeline:
mutators:
- name: PackageVariant.nrf-india-nif..0
image: docker.io/uemk/replace-by-paths:v0.1.0
configMap:
spec.chart.spec.version: 0.2.7
spec.kubeConfig.secretRef.name: free5gc-cluster
spec.targetNamespace: nrf
selectors:
- kind: HelmRelease
- name: PackageVariant.nrf-india-nif..1
image: docker.io/uemk/replace-by-paths:v0.1.0
configMap:
metadata.name: nrf
spec.url: https://raw.githubusercontent.com/Orange-OpenSource/towards5gs-helm/main/repo/
selectors:
- kind: HelmRepository
status:
conditions:
- type: config.injection.ConfigMap.nrf-overrides-values
status: "True"
message: injected resource "nrf-overrides" from cluster
reason: ConfigInjected
README.md: |
# nrf
## Description
sample description
## Usage
### Fetch the package
`kpt pkg get REPO_URI[.git]/PKG_PATH[@VERSION] nrf`
Details: https://kpt.dev/reference/cli/pkg/get/
### View package content
`kpt pkg tree nrf`
Details: https://kpt.dev/reference/cli/pkg/tree/
### Apply the package
```
kpt live init nrf
kpt live apply nrf --reconcile-timeout=2m --output=table
```
Details: https://kpt.dev/reference/cli/live/
base/namespace.yaml: |
apiVersion: v1
kind: Namespace
metadata: # kpt-merge: /nrf
name: nrf
annotations:
internal.kpt.dev/upstream-identifier: '|Namespace|default|nrf'
kustomization.yml: |
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./base/namespace.yaml
- nrf-overrides-cm.yaml
- nrf-helmrepository.yml
- nrf-release.yaml
nrf-helmrepository.yml: |
apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: HelmRepository
metadata: # kpt-merge: nrf/nrf-test
name: nrf
namespace: nrf
annotations:
internal.kpt.dev/upstream-identifier: 'source.toolkit.fluxcd.io|HelmRepository|nrf|nrf-test'
spec:
interval: 1m0s
url: https://raw.githubusercontent.com/Orange-OpenSource/towards5gs-helm/main/repo/
nrf-overrides-cm.yaml: |
apiVersion: v1
kind: ConfigMap
metadata: # kpt-merge: nrf/nrf-overrides-values
name: nrf-overrides-values
namespace: nrf
annotations:
kpt.dev/config-injection: required
internal.kpt.dev/upstream-identifier: '|ConfigMap|nrf|nrf-overrides-values'
kpt.dev/injected-resource: nrf-overrides
data:
nrf-values.yaml: |
nrf:
readinessProbe:
initialDelaySeconds: 0
periodSeconds: 1
timeoutSeconds: 1
failureThreshold: 100
successThreshold: 1
image:
tag: latest
pullpolicy: IfNotPresent
resources:
requests:
nrf-release.yaml: |
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata: # kpt-merge: nrf/nrf
name: nrf
namespace: nrf
annotations:
internal.kpt.dev/upstream-identifier: 'helm.toolkit.fluxcd.io|HelmRelease|nrf|nrf'
spec:
chart:
spec:
chart: free5gc-nrf
interval: 5m
sourceRef:
kind: HelmRepository
name: nrf
namespace: nrf
version: 0.2.7
kubeConfig:
secretRef:
name: free5gc-cluster
install:
createNamespace: true
crds: CreateReplace
remediation:
retries: 1
interval: 5m
storageNamespace: nrf
targetNamespace: nrf
upgrade:
crds: CreateReplace
remediation:
retries: 1
valuesFrom:
- kind: ConfigMap
name: nrf-overrides-values
valuesKey: nrf-values.yaml
optional: true
package-context.yaml: |
apiVersion: v1
kind: ConfigMap
metadata: # kpt-merge: /kptfile.kpt.dev
name: kptfile.kpt.dev
annotations:
config.kubernetes.io/local-config: "true"
internal.kpt.dev/upstream-identifier: '|ConfigMap|default|kptfile.kpt.dev'
data:
name: nrf-india
package-path: nrf-india
revision: v1
workspaceName: packagevariant-1
status:
renderStatus:
error: ""
result:
exitCode: 0
metadata:
creationTimestamp: null |
Thanks. So, yes, definitely a bug, and I don't know of a workaround. This error comes from here: https://github.com/nephio-project/porch/blob/main/pkg/engine/patchgen.go#L118 which in turn is getting it from: https://github.com/bluekeyes/go-gitdiff/blob/master/gitdiff/apply_text.go#L130 So, my suspicion is that patchgen.go is producing an invalid patch somehow. It may be there is a simple fix in there somewhere; or perhaps we are using an older version of that library and an update would help. I am not sure. Now, in #450 I describe eliminating the "tasks" code. This would make this bug obsolete. Right now, I suspect "clone" is replaying all the tasks - I think that's where patchgen.go comes in. If we stopped doing that, and simply copied the package as-is, this would be a lot simpler and the problem would go away. |
Same root cause as #604 |
Triaged |
Closed #604 as it is a duplicate of this. Original issue URL: kptdev/kpt#3694 Actual behavior
Information
Note that this revision v1 from repo https://github.com/nephio-test/nephio-poc-004-edge-1 Steps to reproduce the behavior |
See kptdev/kpt#4110
cc @SamarSidharth
The text was updated successfully, but these errors were encountered: