fix name ref issue

This commit is contained in:
ymqytw 2018-01-26 15:03:01 -08:00
parent 775ef29560
commit 333d6e8ddf
3 changed files with 5 additions and 8 deletions

View File

@ -116,6 +116,8 @@ spec:
ports: ports:
- containerPort: 80 - containerPort: 80
- envFrom: - envFrom:
- configMapRef:
name: someConfigMap
- configMapRef: - configMapRef:
name: test-infra-app-env-hf26mf2f2f name: test-infra-app-env-hf26mf2f2f
- secretRef: - secretRef:

View File

@ -23,6 +23,8 @@ spec:
- name: busybox - name: busybox
image: busybox image: busybox
envFrom: envFrom:
- configMapRef:
name: someConfigMap
- configMapRef: - configMapRef:
name: app-env name: app-env
- secretRef: - secretRef:

View File

@ -61,12 +61,6 @@ func (o *NameReferenceTransformer) Transform(
} }
err := mutateField(objMap, path.Path, path.CreateIfNotPresent, err := mutateField(objMap, path.Path, path.CreateIfNotPresent,
o.updateNameReference(referencePathConfig.referencedGVK, m)) o.updateNameReference(referencePathConfig.referencedGVK, m))
// Ignore the error when we can't find the GVKN that is being
// referenced, because the missing GVKN may be not included in
// this manifest and will be created later.
if IsNoMatchingGVKNError(err) {
continue
}
if err != nil { if err != nil {
return err return err
} }
@ -116,7 +110,6 @@ func (o *NameReferenceTransformer) updateNameReference(
return obj.GetName(), nil return obj.GetName(), nil
} }
} }
return nil, NewNoMatchingGVKNError( return in, nil
fmt.Sprintf("no matching for GroupVersionKind %v and Name %v", GVK, s))
} }
} }