fleet: Deploying the multi-cluster kustomize example results in bundle render error
Steps to reproduce:
- Label a cluster with “env=dev”
- Create a GitRepo via the UI pointing to the Multi-Cluster Kustomize Example folder.
kind: GitRepo
apiVersion: fleet.cattle.io/v1alpha1
metadata:
name: kustomize
namespace: fleet-default
spec:
repo: https://github.com/rancher/fleet-examples
paths:
- multi-cluster/kustomize
targets:
- name: dev
clusterSelector:
matchLabels:
env: dev
Expected:
App is deployed to the cluster labeled “env=dev”
Actual: App is not deployed. Bundle is stuck in error.
error while running post render on files: Object ‘Kind’ is missing in ‘{“resources”:[“frontend-deployment.yaml”,“frontend-service.yaml”,“redis-master-deployment.yaml”,“redis-master-service.yaml”,“redis-slave-deployment.yaml”,“redis-slave-service.yaml”]}’
Environment: Rancher v2.5.5
Export of failing bundle:
apiVersion: fleet.cattle.io/v1alpha1
kind: Bundle
metadata:
creationTimestamp: "2021-01-22T13:56:00Z"
generation: 1
labels:
fleet.cattle.io/commit: c6e54d7a56565e52a63de8a2088997b46253c1fb
fleet.cattle.io/repo-name: test123
managedFields:
- apiVersion: fleet.cattle.io/v1alpha1
fieldsType: FieldsV1
fieldsV1:
f:metadata:
f:labels:
.: {}
f:fleet.cattle.io/commit: {}
f:fleet.cattle.io/repo-name: {}
f:spec:
.: {}
f:namespace: {}
f:resources: {}
f:targetRestrictions: {}
f:targets: {}
manager: fleet
operation: Update
time: "2021-01-22T13:56:00Z"
- apiVersion: fleet.cattle.io/v1alpha1
fieldsType: FieldsV1
fieldsV1:
f:status:
.: {}
f:conditions: {}
f:display:
.: {}
f:readyClusters: {}
f:maxUnavailable: {}
f:maxUnavailablePartitions: {}
f:observedGeneration: {}
f:summary:
.: {}
f:desiredReady: {}
f:ready: {}
f:unavailable: {}
f:unavailablePartitions: {}
manager: fleetcontroller
operation: Update
time: "2021-01-22T13:56:01Z"
name: test123-multi-cluster-kustomize
namespace: fleet-default
resourceVersion: "128834872"
selfLink: /apis/fleet.cattle.io/v1alpha1/namespaces/fleet-default/bundles/test123-multi-cluster-kustomize
uid: 777465f5-f2f0-4e02-a6d9-d917bc90a8f7
spec:
namespace: fleet-mc-kustomize-example
resources:
- content: |
# Multi-Cluster Kustomize Example
This example will deploy the [Kubernetes sample guestbook](https://github.com/kubernetes/examples/tree/master/guestbook/) application
using kustomize. The app will be deployed into the `fleet-mc-kustomize-example` namespace.
The application will be customized as follows per environment:
* Dev clusters: Only the redis leader is deployed and not the followers.
* Test clusters: Scale the front deployment to 3
* Prod clusters: Scale the front deployment to 3 and set the service type to LoadBalancer
```yaml
kind: GitRepo
apiVersion: fleet.cattle.io/v1alpha1
metadata:
name: kustomize
namespace: fleet-local
spec:
repo: https://github.com/rancher/fleet-examples
paths:
- multi-cluster/kustomize
targets:
- name: dev
clusterSelector:
matchLabels:
env: dev
- name: test
clusterSelector:
matchLabels:
env: test
- name: prod
clusterSelector:
matchLabels:
env: prod
```
name: README.md
- content: |
apiVersion: apps/v1
kind: Deployment
metadata:
name: frontend
spec:
selector:
matchLabels:
app: guestbook
tier: frontend
replicas: 1
template:
metadata:
labels:
app: guestbook
tier: frontend
spec:
containers:
- name: php-redis
image: gcr.io/google-samples/gb-frontend:v4
resources:
requests:
cpu: 100m
memory: 100Mi
ports:
- containerPort: 80
name: base/frontend-deployment.yaml
- content: |
apiVersion: v1
kind: Service
metadata:
name: frontend
labels:
app: guestbook
tier: frontend
spec:
type: NodePort
ports:
- port: 80
selector:
app: guestbook
tier: frontend
name: base/frontend-service.yaml
- content: |
resources:
- frontend-deployment.yaml
- frontend-service.yaml
- redis-master-deployment.yaml
- redis-master-service.yaml
- redis-slave-deployment.yaml
- redis-slave-service.yaml
name: base/kustomization.yaml
- content: |
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis-master
spec:
selector:
matchLabels:
app: redis
role: master
tier: backend
replicas: 1
template:
metadata:
labels:
app: redis
role: master
tier: backend
spec:
containers:
- name: master
image: redis
resources:
requests:
cpu: 100m
memory: 100Mi
ports:
- containerPort: 6379
name: base/redis-master-deployment.yaml
- content: |
apiVersion: v1
kind: Service
metadata:
name: redis-master
labels:
app: redis
role: master
tier: backend
spec:
ports:
- port: 6379
targetPort: 6379
selector:
app: redis
role: master
tier: backend
name: base/redis-master-service.yaml
- content: |
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis-slave
spec:
selector:
matchLabels:
app: redis
role: slave
tier: backend
replicas: 2
template:
metadata:
labels:
app: redis
role: slave
tier: backend
spec:
containers:
- name: slave
image: gcr.io/google_samples/gb-redisslave:v1
resources:
requests:
cpu: 100m
memory: 100Mi
ports:
- containerPort: 6379
name: base/redis-slave-deployment.yaml
- content: |
apiVersion: v1
kind: Service
metadata:
name: redis-slave
labels:
app: redis
role: slave
tier: backend
spec:
ports:
- port: 6379
selector:
app: redis
role: slave
tier: backend
name: base/redis-slave-service.yaml
- content: |
namespace: fleet-mc-kustomize-example
targetCustomizations:
- name: dev
clusterSelector:
matchLabels:
env: dev
kustomize:
dir: overlays/dev
- name: test
clusterSelector:
matchLabels:
env: test
kustomize:
dir: overlays/test
- name: prod
clusterSelector:
matchLabels:
env: prod
kustomize:
dir: overlays/prod
name: fleet.yaml
- content: |
resources:
- ../../base
patches:
- redis-slave-deployment.yaml
- redis-slave-service.yaml
name: overlays/dev/kustomization.yaml
- content: |
kind: Deployment
apiVersion: apps/v1
metadata:
name: redis-slave
spec:
replicas: 0
name: overlays/dev/redis-slave-deployment.yaml
- content: |
kind: Service
apiVersion: v1
metadata:
name: redis-slave
spec:
selector:
role: master
name: overlays/dev/redis-slave-service.yaml
- content: |
apiVersion: apps/v1
kind: Deployment
metadata:
name: frontend
spec:
replicas: 3
name: overlays/prod/frontend-deployment.yaml
- content: |
kind: Service
apiVersion: v1
metadata:
name: frontend
spec:
type: LoadBalancer
name: overlays/prod/frontend-service.yaml
- content: |
resources:
- ../../base
patches:
- frontend-deployment.yaml
- frontend-service.yaml
name: overlays/prod/kustomization.yaml
- content: |
apiVersion: apps/v1
kind: Deployment
metadata:
name: frontend
spec:
replicas: 3
name: overlays/test/frontend-deployment.yaml
- content: |
resources:
- ../../base
patches:
- frontend-deployment.yaml
name: overlays/test/kustomization.yaml
targetRestrictions:
- clusterSelector: {}
targets:
- clusterSelector:
matchLabels:
env: dev
kustomize:
dir: overlays/dev
name: dev
- clusterSelector:
matchLabels:
env: test
kustomize:
dir: overlays/test
name: test
- clusterSelector:
matchLabels:
env: prod
kustomize:
dir: overlays/prod
name: prod
- clusterSelector: {}
status:
conditions:
- lastUpdateTime: "2021-01-22T13:56:01Z"
message: 'error while running post render on files: Object ''Kind'' is missing
in ''{"resources":["frontend-deployment.yaml","frontend-service.yaml","redis-master-deployment.yaml","redis-master-service.yaml","redis-slave-deployment.yaml","redis-slave-service.yaml"]}'''
reason: Error
status: "False"
type: Processed
display:
readyClusters: 0/0
maxUnavailable: 0
maxUnavailablePartitions: 0
observedGeneration: 0
summary:
desiredReady: 0
ready: 0
unavailable: 0
unavailablePartitions: 0
gz#14552 gz#14575
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (9 by maintainers)
following the instructions in the original post, the fix has been tested (PASSED) on v2.5-head (a85f4d1) . Waiting for https://github.com/rancher/fleet/issues/290 to land in order to test master-head. Will close this and open a forward port ticket for master-head
Steps to reproduce: