Skip to content

Commit

Permalink
Merge pull request #451 from kube-tarian/kadIssuefix
Browse files Browse the repository at this point in the history
Fixing the External Secret Creation issue
  • Loading branch information
vramk23 authored Apr 3, 2024
2 parents 2be93c4 + d7ed269 commit 49dc03b
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 11 deletions.
2 changes: 2 additions & 0 deletions capten/common-pkg/k8s/external_secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ func (k *K8SClient) CreateOrUpdateSecretStore(ctx context.Context, secretStoreNa
}

secretStoreData, err := yaml.Marshal(&secretStore)

if err != nil {
return
}
Expand All @@ -134,6 +135,7 @@ func (k *K8SClient) CreateOrUpdateExternalSecret(ctx context.Context, externalSe
Property: key,
},
}

secretKeysData = append(secretKeysData, secretKeyData)
}
externalSecret := ExternalSecret{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func (cp *CrossPlaneApp) configureExternalSecretsOnCluster(ctx context.Context,
}

vaultAddressStr := fmt.Sprintf(vaultAddress, cp.cfg.DomainName)

for _, namespace := range namespaces {
cred := map[string][]byte{"token": []byte(token)}
err = k8sclient.CreateOrUpdateSecret(ctx, namespace, vaultAppRoleTokenSecret, v1.SecretTypeOpaque, cred, nil)
Expand Down
4 changes: 2 additions & 2 deletions charts/kad/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.2.19
version: 0.2.20

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.28.1"
appVersion: "1.28.2"
17 changes: 9 additions & 8 deletions charts/kad/crossplane_plugin_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"secretName": "vault-nats-secret",
"vaultSecrets": [
{
"secretKey": "generic/nats/auth-token",
"secretPath": "nats"
"secretKey": "token",
"secretPath": "generic/nats/auth-token"
}
]
},
Expand All @@ -29,19 +29,20 @@
"secretName": "vault-cosign-secret",
"vaultSecrets": [
{
"secretKey": "generic/cosign/signer",
"secretPath": "cosign.pub"
"secretKey": "cosign.pub",
"secretPath": "generic/cosign/signer"
}
]
},

{
"namespace": "ml-server",
"secretName": "regcred-ghcr",
"secretType": "kubernetes.io/dockerconfigjson",
"vaultSecrets": [
{
"secretKey": "generic/container-registry/docker-config",
"secretPath": ".dockerconfigjson"
"secretKey": ".dockerconfigjson",
"secretPath": "generic/container-registry/docker-config"
}
]
},
Expand All @@ -50,8 +51,8 @@
"secretName": "vault-cosign-secret",
"vaultSecrets": [
{
"secretKey": "generic/cosign/signer",
"secretPath": "cosign.pub"
"secretKey": "cosign.pub",
"secretPath": "generic/cosign/signer"
}
]
}
Expand Down
7 changes: 6 additions & 1 deletion server/pkg/plugin-store/plugin_store_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,10 +313,12 @@ func (p *PluginStore) DeployPlugin(orgId, clusterId string, storeType pluginstor
}

if isUISSOCapabilitySupported(validCapabilities) {
clientId, clientSecret, err := p.registerPluginSSO(orgId, clusterId, pluginName, pluginConfig.UIEndpoint)

clientId, clientSecret, err := p.registerPluginSSO(orgId, clusterId, pluginName, uiEndpoint)
if err != nil {
return err
}

overrideValuesMapping[oAuthBaseURLName] = p.cfg.CaptenOAuthURL
overrideValuesMapping[oAuthClientIdName] = clientId
overrideValuesMapping[oAuthClientSecretName] = clientSecret
Expand Down Expand Up @@ -472,7 +474,9 @@ func (p *PluginStore) getOverrideTemplateValues(orgId, clusterID string) (map[st
overrideValues := map[string]string{}
for key, val := range clusterGlobalValues {
overrideValues[key] = fmt.Sprintf("%v", val)

}

return overrideValues, nil
}

Expand Down Expand Up @@ -532,6 +536,7 @@ func replaceTemplateValuesInString(data string, values map[string]string) (trans
}

transformedData = string(buf.Bytes())

return
}

Expand Down

0 comments on commit 49dc03b

Please sign in to comment.