Files
devops-infra-argo-config-gcp/secretstores/harbor-robot-dockerconfig.yaml
T
Mukul Sharma 33ae7a2104 Add demo-go-app-image-pull-secret; rekey harbor-robot-dockerconfig
Both needed for the registry hostname switch to
harbor.192.168.1.7.nip.io (devops-lib#3ffa2d8):

- harbor-robot-dockerconfig's auths key was hardcoded to
  harbor-core.harbor.svc.cluster.local — docker matches stored
  credentials by exact registry hostname, so this had to move with
  the image reference or push would go back to unauthorized.
- New demo-go-app-image-pull-secret, in the demo-go-app namespace
  (imagePullSecrets must be same-namespace as the pod), for the
  Deployment's own pull — separate from harbor-robot-dockerconfig,
  which only ever lived in the jenkins namespace for the build pod's
  push. Same underlying robot account/Vault path.
2026-09-02 23:54:50 +05:30

47 lines
1.9 KiB
YAML

# Docker registry credentials for Jenkins to push to Harbor, as a proper
# kubernetes.io/dockerconfigjson secret (not a plain Opaque one) so it can
# be mounted straight at ~/.docker/config.json in the build container —
# docker push/pull read that format natively, no explicit `docker login`
# step needed in the pipeline itself.
#
# Vault-backed, same pattern as everything else. Put the robot account's
# credentials in first (create it in the Harbor UI: your CI project ->
# Robot Accounts -> New Robot Account, scoped to push+pull on that one
# project — Harbor shows the secret once, copy it immediately):
# kubectl -n vault exec -i vault-0 -- vault kv put secret/harbor/jenkins-robot \
# username='robot$<project>+<robot-name>' \
# password='<the generated secret>'
apiVersion: external-secrets.io/v1
kind: ExternalSecret
metadata:
name: harbor-robot-dockerconfig
namespace: jenkins
spec:
refreshInterval: 1h
secretStoreRef:
name: vault-backend
kind: ClusterSecretStore
target:
name: harbor-robot-dockerconfig
creationPolicy: Owner
template:
type: kubernetes.io/dockerconfigjson
data:
# Keyed by exact registry hostname — docker matches credentials
# against the host portion of the image reference. Was
# harbor-core.harbor.svc.cluster.local; switched to the Contour
# ingress hostname alongside buildDocker.groovy and dind-pod.yaml
# so push/pull share one consistent, resolvable-from-anywhere
# reference.
.dockerconfigjson: |
{"auths":{"harbor.192.168.1.7.nip.io":{"username":"{{ .username }}","password":"{{ .password }}","auth":"{{ printf "%s:%s" .username .password | b64enc }}"}}}
data:
- secretKey: username
remoteRef:
key: harbor/jenkins-robot
property: username
- secretKey: password
remoteRef:
key: harbor/jenkins-robot
property: password