Skip to content

Commit

Permalink
feat: add disabled feature
Browse files Browse the repository at this point in the history
  • Loading branch information
zufardhiyaulhaq committed Jun 14, 2024
1 parent 2bec09f commit b713812
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 7 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
```
2 changes: 2 additions & 0 deletions charts/internal-access-helper/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
1 change: 1 addition & 0 deletions charts/internal-access-helper/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ imagePullSecrets: []

argoCDNamespace: "argocd"
argoCDManagerSecretName: "argocd-manager"
disableFeatures: false
6 changes: 3 additions & 3 deletions charts/releases/index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: [email protected]
Expand All @@ -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"
Binary file modified charts/releases/internal-access-helper-1.0.0.tgz
Binary file not shown.
10 changes: 6 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,19 @@ 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)
if err != nil {
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)
})
Expand Down
1 change: 1 addition & 0 deletions settings/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}

Expand Down

0 comments on commit b713812

Please sign in to comment.