Spinnaker - Reference ConfigMap versioned value inside manifest

5/13/2019

I'm deploying a single yaml file containing two manifests using the Spinnaker Kubernetes Provider V2 (Manifest deployer). Inside the Deployment I have a custom annotation that references the ConfigMap:

# ConfigMap
apiVersion: v1 
kind: ConfigMap 
metadata: 
  name: my-config-map
data: 
  foo: bar
---
# Deployment
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: my-deployment
spec:
  template:
    metadata:
      annotations:
        my-config-map-reference: my-config-map
  [...]

Upon deployment, Spinnaker applies versioning to the ConfigMap, which is then deployed as my-config-map-v000.

I'd like to be able to retrieve the full name inside my custom annotation, but since Spinnaker replaces automatically the configMap references with the appropriate versioned values only in specific entrypoints ( https://github.com/spinnaker/clouddriver/blob/master/clouddriver-kubernetes/src/main/groovy/com/netflix/spinnaker/clouddriver/kubernetes/v2/artifact/ArtifactReplacerFactory.java ) in this case this does not work.

According to Spinnaker documentation ( https://www.spinnaker.io/reference/artifacts/in-kubernetes-v2/#why-not-pipeline-expressions ) I may be able to write a Pipeline Expression to retrieve the full name, but I wasn't able to do so.

How can I set the full ConfigMap name inside the annotation?

-- MarcoReni
kubernetes
spinnaker

1 Answer

5/14/2019

Spinnaker can inject artifacts from the currently executing pipeline into your manifests as they are deployed

Refer to this guide for the instructions on how to Binding artifacts in manifests

However, as mentioned here, there's NO resource mapping for annotation, so it should be user-supplied only as a parameter for your manifest.

In the future, certain relationships between resources will be recorded and annotated by Spinnaker

-- A_Suh
Source: StackOverflow