GithubHelp home page GithubHelp logo

Comments (14)

vfarcic avatar vfarcic commented on July 25, 2024

I'm not sure I understood the question. Are you referring to one of the Gists that accompany this repo?

If you can provide a bit more info I'll do my best to resolve it.

from argocd-production.

nishit93-hub avatar nishit93-hub commented on July 25, 2024

I have deployed 1 PVC with a WordPress pod. Now I want to add another PVC without touching the main manifest files.

Now my question is can I do this with Kustomize.yaml?

from argocd-production.

vfarcic avatar vfarcic commented on July 25, 2024

Kustomize normally organizes manifests by using base directory and then overlays/ENV dir for each environment. If, for example, you'd like to add a PVC into production, you would add it to overlays/production dir and leave base intact. Is that what you meant?

from argocd-production.

nishit93-hub avatar nishit93-hub commented on July 25, 2024

Yes, I meant the same and doing same as you mentioned.

This is my WordPress.YAML file in base.

apiVersion: v1
kind: Service
metadata:
  name: wordpress
  labels:
    app: wordpress
spec:
  ports:
    - port: 80
  selector:
    app: wordpress
    tier: frontend
  type: LoadBalancer
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: wp-pv-claim
  labels:
    app: wordpress1
spec:
  storageClassName: px-file-sc
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 200Mi
---      
apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:
  name: wordpress
  labels:
    app: wordpress
spec:
  selector:
    matchLabels:
      app: wordpress
      tier: frontend
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: wordpress
        tier: frontend
    spec:
      containers:
      - image: nishit2408/argo-imageupdater
        name: wordpress
        env:
        - name: WORDPRESS_DB_HOST
          value: wordpress-mysql
        - name: WORDPRESS_DB_PASSWORD
          valueFrom:
            secretKeyRef:
              name: mysql-pass          # generated before in secret.yml
              key: password
        ports:
        - containerPort: 80
          name: wordpress
        volumeMounts:
        - name: wordpress-persistent-storage
          mountPath: "/var/www/html/wordpress"          # which data will be stored
      volumes:
      - name: wordpress-persistent-storage
        persistentVolumeClaim:
          claimName: wp-pv-claim

And this is my manifest file to add new PVC inside overlays/production dir

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: wp-pv-claim2
  labels:
    app: wordpress1
spec:
  storageClassName: px-file-sc
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 200Mi

It gives me error when apply manifest file using -K

error: no matches for Id ~G_v1_PersistentVolumeClaim|~X|wp-pv-claim2; failed to find unique target for patch ~G_v1_PersistentVolumeClaim|wp-pv-claim2

from argocd-production.

vfarcic avatar vfarcic commented on July 25, 2024

Can you paste your kustomize.yaml files (from both dirs)?

from argocd-production.

nishit93-hub avatar nishit93-hub commented on July 25, 2024

Here is kustomize.yaml from base dir

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
  - wordpress.yaml

Here is kustomize.yaml from overlays/production dir

bases:
  - ../../base
patches:
  - path: add-pvc.yaml

from argocd-production.

vfarcic avatar vfarcic commented on July 25, 2024

Assuming that add-pvc.yaml contains the definition of wp-pv-claim2, the problem is that you are trying to patch a resource that does not exist. If you're trying to add a new PVC instead of modifying an existing one, you would add add-pvc.yaml into resources section of kustomize.yaml inside the overlays/production directory.

from argocd-production.

nishit93-hub avatar nishit93-hub commented on July 25, 2024

Thanks, now I got what I was doing wrong.

from argocd-production.

nishit93-hub avatar nishit93-hub commented on July 25, 2024

Hi,

I am trying to add multiple pod specs using Kustomize. However, it is adding the last one. I am using patchesStrategicMerge: for this. Below are spec I am trying to add

apiVersion: argoproj.io/v1alpha1
kind:  ApplicationSet 
metadata:
  name: maven-app1
  namespace: argocd
spec:
  generators:
  - list:
      elements:
      - cluster: rancher
        url: https://192.168.29.143:6443/

---
apiVersion: argoproj.io/v1alpha1
kind:  ApplicationSet 
metadata:
  name: maven-app1
  namespace: argocd
spec:
  generators:
  - list:
      elements:
      - cluster: baremetal
        url: https://192.168.29.145:6443/

from argocd-production.

vfarcic avatar vfarcic commented on July 25, 2024

Both of those are having the same name and are in the same namespace so one is overwriting the other.

from argocd-production.

nishit93-hub avatar nishit93-hub commented on July 25, 2024

Ok but that I am giving to identify the target which is in base. If I give a different name or namespace then it is unable to find the target.

from argocd-production.

vfarcic avatar vfarcic commented on July 25, 2024

I'm not sure what you're trying to do. If you want maven-app1 to run in both rancher and baremetal clusters, than you should have two entries in the spec.generators.list entry.

Personally, I am not using ApplicationSet. It's only a workaround that creates Argp CD Application resources. I think it's a wrong direction for Argo CD. It Argo CD would like to be massive multi-cluster solution, it should copy what Rancher Fleet did. But, for anything below "massive", is quite OK with Application (without ApplicationSet).

from argocd-production.

nishit93-hub avatar nishit93-hub commented on July 25, 2024

I am trying to add multiple entries in the spec.generators.list using Kustomize. Above those are entries. when I do kustomize build, then it only adds the last one entry only. though it should add both entries.

from argocd-production.

vfarcic avatar vfarcic commented on July 25, 2024

I do not think you posted the kustomize.yaml file. There's the one from January 3 but I'm guessing that's not the one used with the ApplicationSet.

from argocd-production.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.