Skip to content

Commit

Permalink
allow to configure client plaintext connection (#148)
Browse files Browse the repository at this point in the history
* allow to configure client plaintext connection

* bump chart and app versions

* fixup! bump chart and app versions
  • Loading branch information
riuvshyn authored Jan 3, 2022
1 parent 85a0afb commit a371095
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 3 deletions.
4 changes: 2 additions & 2 deletions charts/applicationset-progressive-sync/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ 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.4.0-prealpha
version: 0.5.1-prealpha

# 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: "v0.4.0-prealpha"
appVersion: "v0.5.0-prealpha"

keywords:
- argoproj
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ data:
ARGOCD_AUTH_TOKEN: {{ .Values.config.argoCDAuthToken | b64enc }}
ARGOCD_SERVER_ADDR: {{ .Values.config.argoCDServerAddr | b64enc }}
ARGOCD_INSECURE: {{ .Values.config.argoCDInsecure | b64enc }}
ARGOCD_PLAINTEXT: {{ .Values.config.argoCDPlaintext | b64enc }}
{{- end }}
2 changes: 2 additions & 0 deletions charts/applicationset-progressive-sync/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,5 @@ config:
argoCDServerAddr: "argocd-server"
# -- Allow insecure connection with ArgoCD server
argoCDInsecure: "true"
# -- Allow http connection with ArgoCD server
argoCDPlaintext: "false"
1 change: 1 addition & 0 deletions internal/consts/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const (
AppSetAPIGroup = "argoproj.io/v1alpha1"
ArgoCDAuthTokenKey = "ARGOCD_AUTH_TOKEN"
ArgoCDInsecureKey = "ARGOCD_INSECURE"
ArgoCDPlaintextKey = "ARGOCD_PLAINTEXT"
ArgoCDServerAddrKey = "ARGOCD_SERVER_ADDR"
ConfigDirectory = "/etc/prcconfig/"
)
1 change: 1 addition & 0 deletions internal/utils/argocd_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ func GetArgoCDAppClient(c Configuration) ArgoCDAppClient {
ServerAddr: c.ArgoCDServerAddr,
Insecure: c.ArgoCDInsecure,
AuthToken: c.ArgoCDAuthToken,
PlainText: c.ArgoCDPlaintext,
}

acdClient := argocdclient.NewClientOrDie(&acdClientOpts)
Expand Down
9 changes: 8 additions & 1 deletion internal/utils/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type Configuration struct {
ArgoCDAuthToken string
ArgoCDServerAddr string
ArgoCDInsecure bool
ArgoCDPlaintext bool
}

// readFromFile returns the content of a file
Expand Down Expand Up @@ -67,7 +68,7 @@ func isFlagSet(paramName string) (bool, error) {
func ReadConfiguration() (Configuration, error) {
var err error
var acdAuthToken, acdServerAddr string
var acdInsecure bool
var acdInsecure, acdPlaintext bool

acdAuthToken, err = readFromEnvOrFile(consts.ArgoCDAuthTokenKey)
if err != nil {
Expand All @@ -84,10 +85,16 @@ func ReadConfiguration() (Configuration, error) {
return Configuration{}, err
}

acdPlaintext, err = isFlagSet(consts.ArgoCDPlaintextKey)
if err != nil {
return Configuration{}, err
}

c := Configuration{
ArgoCDAuthToken: acdAuthToken,
ArgoCDServerAddr: acdServerAddr,
ArgoCDInsecure: acdInsecure,
ArgoCDPlaintext: acdPlaintext,
}

return c, nil
Expand Down

0 comments on commit a371095

Please sign in to comment.