Skip to content
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

Can't patch Pod - no matches for Id Pod.v1.[noGrp]/airbyte-minio-create-bucket.airbyte #5687

Open
AurimasNav opened this issue May 2, 2024 · 3 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. kind/support Categorizes issue or PR as a support question. triage/needs-information Indicates an issue needs more information in order to work on it.

Comments

@AurimasNav
Copy link

AurimasNav commented May 2, 2024

What happened?

I am unable to patch a pod from specific helm chart.
I was not able to replicate this with plain yaml files, only in with this helm chart.

What did you expect to happen?

one of the resources from this helm chart is a pod:

apiVersion: v1
kind: Pod
metadata:
  annotations:
    helm.sh/hook: post-install, post-upgrade
    helm.sh/hook-delete-policy: hook-succeeded, before-hook-creation
  name: airbyte-minio-create-bucket
  namespace: airbyte

I expect it to patch with my label successfully, however it produces an error:

Error: no resource matches strategic merge patch "Pod.v1.[noGrp]/airbyte-minio-create-bucket.airbyte": no matches for Id Pod.v1.[noGrp]/airbyte-minio-create-bucket.airbyte; failed to find unique target for patch Pod.v1.[noGrp]/airbyte-minio-create-bucket.airbyte

How can we reproduce it (as minimally and precisely as possible)?

kustomization.yaml

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

namespace: airbyte

patches:
- path: no-istio-sidecar.yaml

helmGlobals:
  chartHome: charts
helmCharts:
- name: airbyte
  version: 0.64.81
  repo: https://airbytehq.github.io/helm-charts
  releaseName: airbyte
  includeCRDs: true
  namespace: airbyte
  valuesFile: values.yaml

no-istio-sidecar.yaml

apiVersion: v1
kind: Pod
metadata:
  name: airbyte-minio-create-bucket
  namespace: airbyte
  labels:
   sidecar.istio.io/inject: "false"

values.yaml

global:
  jobs:
    resources:
      requests:
        cpu: 1m
        memory: 128Mi
      limits:
        cpu: 1
        memory: 1Gi
airbyte-api-server:
  resources:
    requests:
      cpu: 1m
      memory: 32Mi
    limits:
      cpu: 1
      memory: 1Gi
connector-builder-server:
  resources:
    requests:
      cpu: 1m
      memory: 32Mi
    limits:
      cpu: 1
      memory: 1Gi
cron:
  resources:
    limits:
      cpu: 1
      memory: 1Gi
    requests:
      cpu: 1m
      memory: 32Mi
pod-sweeper:
  resources:
    limits:
      cpu: 1
      memory: 1Gi
    requests:
      cpu: 1m
      memory: 32Mi
temporal:
  resources:
    limits:
      cpu: 1
      memory: 1Gi
    requests:
      cpu: 1m
      memory: 32Mi
webapp:
  resources:
    requests:
      cpu: 1m
      memory: 32Mi
    limits:
      cpu: 1
      memory: 1Gi
worker:
  resources:
    requests:
      cpu: 1m
      memory: 32Mi
    limits:
      cpu: 1
      memory: 1Gi
workload-launcher:
  containerOrchestrator:
    enabled: false
  resources:
    limits:
      cpu: 1
      memory: 1Gi
    requests:
      cpu: 1m
      memory: 32Mi

Expected output

apiVersion: v1
kind: Pod
metadata:
  annotations:
    helm.sh/hook: post-install, post-upgrade
    helm.sh/hook-delete-policy: hook-succeeded, before-hook-creation
  name: airbyte-minio-create-bucket
  namespace: airbyte
  labels:
    sidecar.istio.io/inject: "false"

Actual output

Error: no resource matches strategic merge patch "Pod.v1.[noGrp]/airbyte-minio-create-bucket.airbyte": no matches for Id Pod.v1.[noGrp]/airbyte-minio-create-bucket.airbyte; failed to find unique target for patch Pod.v1.[noGrp]/airbyte-minio-create-bucket.airbyte

Kustomize version

v5.4.1

Operating system

MacOS

@AurimasNav AurimasNav added the kind/bug Categorizes issue or PR as related to a bug. label May 2, 2024
@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label May 2, 2024
@k8s-ci-robot
Copy link
Contributor

@harshsingh32: The label triage/accepted cannot be applied. Only GitHub organization members can add the label.

In response to this:

/triage accepted

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@stormqueen1990
Copy link
Member

stormqueen1990 commented May 29, 2024

Hello there, @AurimasNav!

I took a look at this Helm chart by running helm template and noticed that the Pod you're alluding to doesn't have a namespace set in the chart prior to kustomize build:

# Source: airbyte/templates/minio.yaml
# This pod creates the state-storage bucket in the minio server,
# which the local cloud deployment requires to store its state.
apiVersion: v1
kind: Pod
metadata:
  name: airbyte-minio-create-bucket
  annotations:
    "helm.sh/hook": post-install, post-upgrade
    "helm.sh/hook-delete-policy": hook-succeeded, before-hook-creation
spec:
  ...

I could also confirm this is the case here: https://github.com/airbytehq/airbyte-platform/blob/801feb0da0af30b86961c0e92b8e0ae72000016a/charts/airbyte/templates/minio.yaml#L110-L119

Therefore, for your patch to get correctly applied, it would have to be:

apiVersion: v1
kind: Pod
metadata:
  name: airbyte-minio-create-bucket
  labels:
    sidecar.istio.io/inject: "false"

After updating the patch as specified above, I can correctly generate the manifests with kustomize build:

apiVersion: v1
kind: Pod
metadata:
  annotations:
    helm.sh/hook: post-install, post-upgrade
    helm.sh/hook-delete-policy: hook-succeeded, before-hook-creation
  labels:
    sidecar.istio.io/inject: "false"
  name: airbyte-minio-create-bucket
  namespace: airbyte
spec:
  ...

Could you please confirm it works for you after the aforementioned change?

/kind support

@k8s-ci-robot k8s-ci-robot added the kind/support Categorizes issue or PR as a support question. label May 29, 2024
@stormqueen1990
Copy link
Member

/triage needs-information

@k8s-ci-robot k8s-ci-robot added triage/needs-information Indicates an issue needs more information in order to work on it. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. kind/support Categorizes issue or PR as a support question. triage/needs-information Indicates an issue needs more information in order to work on it.
Projects
None yet
Development

No branches or pull requests

3 participants