name: "machine-config-daemon-firstboot.service"
enabled: true
contents: |
  [Unit]
  Description=Machine Config Daemon Firstboot
  # Make sure it runs only on OSTree booted system
  ConditionPathExists=/run/ostree-booted
  # Removal of this file signals firstboot completion
  ConditionPathExists=/etc/ignition-machine-config-encapsulated.json
  # We only want to run on 4.3 clusters and above; this came from
  # https://github.com/coreos/coreos-assembler/pull/768
  ConditionPathExists=/sysroot/.coreos-aleph-version.json
  After=ignition-firstboot-complete.service
  Before=crio.service crio-wipe.service
  Before=kubelet.service

  [Service]
  # Need oneshot to delay kubelet
  Type=oneshot
  ExecStart=/usr/libexec/machine-config-daemon firstboot-complete-machineconfig

  {{if .Proxy -}}
  {{if .Proxy.HTTPProxy -}}
  Environment=HTTP_PROXY={{.Proxy.HTTPProxy}}
  {{end -}}
  {{if .Proxy.HTTPSProxy -}}
  Environment=HTTPS_PROXY={{.Proxy.HTTPSProxy}}
  {{end -}}
  {{if .Proxy.NoProxy -}}
  Environment=NO_PROXY={{.Proxy.NoProxy}}
  {{end -}}
  {{end -}}

  [Install]
  WantedBy=multi-user.target
  RequiredBy=crio.service kubelet.service
