Skip to content

Commit

Permalink
add crossplane secrets to vault and create ns
Browse files Browse the repository at this point in the history
  • Loading branch information
jarededwards authored and DrummyFloyd committed Mar 11, 2024
1 parent 47e55e5 commit 7f7ab85
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions extensions/k3s/secrets.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ func BootstrapK3sMgmtCluster(clientset *kubernetes.Clientset, cl *pkgtypes.Clust
"origin-ca-api-key": []byte(cl.CloudflareAuth.OriginCaIssuerKey),
},
},
{
ObjectMeta: metav1.ObjectMeta{Name: "crossplane-secrets", Namespace: "crossplane-system"},
Data: map[string][]byte{
"username": []byte(cl.GitAuth.User),
"password": []byte(cl.GitAuth.Token),
},
},
}
for _, secret := range createSecrets {
_, err := clientset.CoreV1().Secrets(secret.ObjectMeta.Namespace).Get(context.TODO(), secret.ObjectMeta.Name, metav1.GetOptions{})
Expand Down
5 changes: 5 additions & 0 deletions internal/controller/vault.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,11 @@ func (clctrl *ClusterController) WriteVaultSecrets() error {
"origin-ca-api-key": cl.CloudflareAuth.OriginCaIssuerKey,
})

_, err = vaultClient.KVv2("secret").Put(context.Background(), "crossplane", map[string]interface{}{
"username": cl.GitAuth.User,
"password": cl.GitAuth.Token,
})

if cl.CloudProvider == "google" {
log.Info("writing google specific secrets to vault secret store")
homeDir, err := os.UserHomeDir()
Expand Down
1 change: 1 addition & 0 deletions pkg/providerConfigs/bootstrapSecrets.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ func K8sNamespaces(clientset *kubernetes.Clientset) error {
"atlantis",
"chartmuseum",
"cert-manager",
"crossplane-system",
"kubefirst",
"external-dns",
"external-secrets-operator",
Expand Down

0 comments on commit 7f7ab85

Please sign in to comment.