apiVersion: v1
kind: Namespace
metadata:
  name: skuznets-reproducer
---
kind: ImageStream
apiVersion: image.openshift.io/v1
metadata:
  namespace: skuznets-reproducer
  name: input
spec:
  tags:
  - name: latest
    from: {"kind":"DockerImage", "name":"docker.io/openshift/origin-release:golang-1.16"}
    referencePolicy: {"type": "Local"}
    importPolicy: {"scheduled": true}
---
kind: ImageStream
apiVersion: image.openshift.io/v1
metadata:
  namespace: skuznets-reproducer
  name: output
---
kind: BuildConfig
apiVersion: build.openshift.io/v1
metadata:
  namespace: skuznets-reproducer
  name: dependent
spec:
  successfulBuildsHistoryLimit: 2
  failedBuildsHistoryLimit: 2
  output:
    to:
      kind: ImageStreamTag
      name: output:latest
  source:
    dockerfile: |
      FROM skuznets-reproducer/input:latest
      LABEL a=b
    type: Dockerfile
  strategy:
    dockerStrategy:
      from:
        kind: ImageStreamTag
        name: input:latest
        namespace: skuznets-reproducer
      imageOptimizationPolicy: SkipLayers
    type: Docker
  triggers:
  - imageChange:
      from:
        kind: ImageStreamTag
        name: input:latest
    type: ImageChange
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: applier
  namespace: skuznets-reproducer
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: applier-to-admin
  namespace: skuznets-reproducer
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: admin
subjects:
- kind: ServiceAccount
  name: applier
  namespace: skuznets-reproducer
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: manifest
  namespace: skuznets-reproducer
data:
  imagestream.yaml: |
    ---
    kind: ImageStream
    apiVersion: image.openshift.io/v1
    metadata:
      namespace: skuznets-reproducer
      name: input
    spec:
      tags:
      - name: latest
        from: {"kind":"DockerImage", "name":"docker.io/openshift/origin-release:golang-1.16"}
        referencePolicy: {"type": "Local"}
        importPolicy: {"scheduled": true}
    ---
    kind: BuildConfig
    apiVersion: build.openshift.io/v1
    metadata:
      namespace: skuznets-reproducer
      name: dependent
    spec:
      successfulBuildsHistoryLimit: 2
      failedBuildsHistoryLimit: 2
      output:
        to:
          kind: ImageStreamTag
          name: output:latest
      source:
        dockerfile: |
          FROM skuznets-reproducer/input:latest
          LABEL a=b
        type: Dockerfile
      strategy:
        dockerStrategy:
          from:
            kind: ImageStreamTag
            name: input:latest
            namespace: skuznets-reproducer
          imageOptimizationPolicy: SkipLayers
        type: Docker
      triggers:
      - imageChange:
          from:
            kind: ImageStreamTag
            name: input:latest
        type: ImageChange
---
apiVersion: v1
kind: Pod
metadata:
  name: applier
  namespace: skuznets-reproducer
spec:
  containers:
  - command:
    - /usr/bin/bash
    args:
    - -c
    - |
      while true; do
        oc apply -f /manifest/imagestream.yaml
        sleep 10
      done
    image: registry.ci.openshift.org/ocp/4.7:cli
    name: applier
    volumeMounts:
    - mountPath: /manifest
      name: manifest
  serviceAccount: applier
  volumes:
  - configMap:
      name: manifest
    name: manifest
