Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b62f1cf632 | |||
| cfc6360ffc | |||
| 9b1fde11a2 | |||
| 8c1403a87b | |||
| 9d4d1a1d03 | |||
| cdaa33a539 | |||
| aaa26cf714 | |||
| e64faa0ab1 |
@@ -1,4 +1,4 @@
|
||||
apiVersion: v2
|
||||
description: A Helm chart for cert-manager-webhook-gandi
|
||||
name: cert-manager-webhook-gandi
|
||||
version: v0.4.0
|
||||
version: v0.4.3
|
||||
|
||||
17
main.go
17
main.go
@@ -28,7 +28,10 @@ const (
|
||||
GandiMinTtl = 300 // Gandi reports an error for values < this value
|
||||
)
|
||||
|
||||
var GroupName = os.Getenv("GROUP_NAME")
|
||||
var (
|
||||
DebugHTTP = os.Getenv("DEBUG_HTTP")
|
||||
GroupName = os.Getenv("GROUP_NAME")
|
||||
)
|
||||
|
||||
func main() {
|
||||
if GroupName == "" {
|
||||
@@ -202,28 +205,28 @@ func (c *gandiDNSProviderSolver) newClient(ch *v1alpha1.ChallengeRequest) (*live
|
||||
}
|
||||
|
||||
return gandi.NewLiveDNSClient(config.Config{
|
||||
APIKey: *apiKey,
|
||||
APIKey: apiKey,
|
||||
Timeout: time.Second * 30,
|
||||
Debug: DebugHTTP != "",
|
||||
}), nil
|
||||
}
|
||||
|
||||
// Get Gandi API key from Kubernetes secret.
|
||||
func (c *gandiDNSProviderSolver) getApiKey(cfg *gandiDNSProviderConfig, namespace string) (*string, error) {
|
||||
func (c *gandiDNSProviderSolver) getApiKey(cfg *gandiDNSProviderConfig, namespace string) (string, error) {
|
||||
secretName := cfg.APIKeySecretRef.LocalObjectReference.Name
|
||||
|
||||
klog.V(6).Infof("try to load secret `%s` with key `%s`", secretName, cfg.APIKeySecretRef.Key)
|
||||
|
||||
sec, err := c.client.CoreV1().Secrets(namespace).Get(context.Background(), secretName, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unable to get secret `%s`; %v", secretName, err)
|
||||
return "", fmt.Errorf("unable to get secret `%s`; %v", secretName, err)
|
||||
}
|
||||
|
||||
secBytes, ok := sec.Data[cfg.APIKeySecretRef.Key]
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("key %q not found in secret \"%s/%s\"", cfg.APIKeySecretRef.Key,
|
||||
return "", fmt.Errorf("key %q not found in secret \"%s/%s\"", cfg.APIKeySecretRef.Key,
|
||||
cfg.APIKeySecretRef.LocalObjectReference.Name, namespace)
|
||||
}
|
||||
|
||||
apiKey := string(secBytes)
|
||||
return &apiKey, nil
|
||||
return string(secBytes), nil
|
||||
}
|
||||
|
||||
33
scripts/release.sh
Executable file
33
scripts/release.sh
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/bin/sh -eux
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
version="$(yq '.version' ../deploy/cert-manager-webhook-gandi/Chart.yaml)"
|
||||
version="${version#v}"
|
||||
major="$(echo "$version" | cut -d'.' -f1)"
|
||||
minor="$(echo "$version" | cut -d'.' -f2)"
|
||||
patch="$(echo "$version" | cut -d'.' -f3)"
|
||||
case "${1:-""}" in
|
||||
major)
|
||||
major=$((major + 1))
|
||||
minor=0
|
||||
patch=0
|
||||
;;
|
||||
minor)
|
||||
minor=$((minor + 1))
|
||||
patch=0
|
||||
;;
|
||||
patch)
|
||||
patch=$((patch + 1))
|
||||
;;
|
||||
*)
|
||||
echo "Unknown release type"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
version="$major.$minor.$patch"
|
||||
|
||||
yq -i ".version |= \"v$version\"" ../deploy/cert-manager-webhook-gandi/Chart.yaml
|
||||
git add ../deploy/
|
||||
git commit -m "Bump version to v$version"
|
||||
git tag -a "v$version"
|
||||
Reference in New Issue
Block a user