diff --git a/README.md b/README.md new file mode 100644 index 0000000..b76f68c --- /dev/null +++ b/README.md @@ -0,0 +1,8 @@ +## Installation + +To install the chart with the release name `internal-access-helper`: + +```console +helm repo add internal-access-helper https://zufardhiyaulhaq.com/internal-access-helper/charts/releases/ +helm install internal-access-helper internal-access-helper/internal-access-helper --version 1.0.0 +``` diff --git a/charts/internal-access-helper/templates/deployment.yaml b/charts/internal-access-helper/templates/deployment.yaml index d268412..2a8b87e 100644 --- a/charts/internal-access-helper/templates/deployment.yaml +++ b/charts/internal-access-helper/templates/deployment.yaml @@ -34,5 +34,7 @@ spec: value: "{{ .Values.argoCDNamespace }}" - name: ARGOCD_MANAGER_SECRET_NAME value: "{{ .Values.argoCDManagerSecretName }}" + - name: DISABLE_FEATURES + value: "{{ .Values.disableFeatures }}" - name: HTTP_PORT value: "8080" diff --git a/charts/internal-access-helper/values.yaml b/charts/internal-access-helper/values.yaml index 8e28749..691fcc9 100644 --- a/charts/internal-access-helper/values.yaml +++ b/charts/internal-access-helper/values.yaml @@ -8,3 +8,4 @@ imagePullSecrets: [] argoCDNamespace: "argocd" argoCDManagerSecretName: "argocd-manager" +disableFeatures: false diff --git a/charts/releases/index.yaml b/charts/releases/index.yaml index 4101944..ce2fdf8 100644 --- a/charts/releases/index.yaml +++ b/charts/releases/index.yaml @@ -3,9 +3,9 @@ entries: internal-access-helper: - apiVersion: v2 appVersion: 1.0.0 - created: "2024-06-14T23:52:28.229223+07:00" + created: "2024-06-15T00:04:19.6966+07:00" description: A Helm chart for Kubernetes - digest: acdd99b31175684e77bf964c9a4b607473b5e2dbcefd6d57e2236929490ecf60 + digest: 2e05dbf354c51b3fb0f6a871487365b47f1aba7592f14263f6b4d2a6498dc3ac home: https://github.com/gopaytech/internal-access-helper maintainers: - email: zufardhiyaulhaq@gmail.com @@ -16,4 +16,4 @@ entries: urls: - internal-access-helper-1.0.0.tgz version: 1.0.0 -generated: "2024-06-14T23:52:28.228383+07:00" +generated: "2024-06-15T00:04:19.695805+07:00" diff --git a/charts/releases/internal-access-helper-1.0.0.tgz b/charts/releases/internal-access-helper-1.0.0.tgz index 1971074..34e9e31 100644 Binary files a/charts/releases/internal-access-helper-1.0.0.tgz and b/charts/releases/internal-access-helper-1.0.0.tgz differ diff --git a/main.go b/main.go index 3440ea7..c70fa6e 100644 --- a/main.go +++ b/main.go @@ -35,9 +35,11 @@ func main() { log.Printf("failed to get namespace %s secret %s: %s\n", settings.ArgoCDNamespace, settings.ArgoCDManagerSecretName, err.Error()) } - argoCDSecret := ArgoCDSecret{ - CACert: base64.StdEncoding.EncodeToString(secret.Data["ca.crt"]), - Token: base64.StdEncoding.EncodeToString(secret.Data["token"]), + argoCDSecret := ArgoCDSecret{} + + if !settings.DisableFeatures { + argoCDSecret.CACert = base64.StdEncoding.EncodeToString(secret.Data["ca.crt"]) + argoCDSecret.Token = base64.StdEncoding.EncodeToString(secret.Data["token"]) } argoCDSecretByte, err := json.Marshal(argoCDSecret) @@ -45,7 +47,7 @@ func main() { log.Printf("failed to marshal argoCDSecret") } - http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + http.HandleFunc("/argocd", func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") w.Write(argoCDSecretByte) }) diff --git a/settings/settings.go b/settings/settings.go index 7396826..ad224aa 100644 --- a/settings/settings.go +++ b/settings/settings.go @@ -7,6 +7,7 @@ import ( type Settings struct { ArgoCDNamespace string `envconfig:"ARGOCD_NAMESPACE" required:"true" default:"argocd"` ArgoCDManagerSecretName string `envconfig:"ARGOCD_MANAGER_SECRET_NAME" required:"true" default:"argocd-manager"` + DisableFeatures bool `envconfig:"DISABLE_FEATURES" required:"true" default:"false"` HTTPPort string `envconfig:"HTTP_PORT" required:"true" default:"8080"` }