Skip to content

Commit

Permalink
more updates
Browse files Browse the repository at this point in the history
  • Loading branch information
dmolik committed Jul 29, 2024
1 parent 59e477b commit 33c84e2
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ jobs:

- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
if: always()
with:
sarif_file: 'trivy-results.sarif'
#env:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/scan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
# we let the report trigger content trigger a failure using the GitHub Security features.
args: '-fmt sarif -out results.sarif ./...'
- name: Upload SARIF file
if: always()
uses: github/codeql-action/upload-sarif@v3
with:
# Path to SARIF file relative to the root of the repository
Expand Down
25 changes: 25 additions & 0 deletions internal/controller/valkey_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,15 @@ package controller
import (
"context"

"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/runtime"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/log"

hyperv1 "hyperspike.io/valkey-operator/api/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// ValkeyReconciler reconciles a Valkey object
Expand Down Expand Up @@ -74,6 +77,28 @@ func (r *ValkeyReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctr
}

func (r *ValkeyReconciler) upsertConfigMap(ctx context.Context, valkey *hyperv1.Valkey) error {
logger := log.FromContext(ctx)

logger.Info("upserting configmap", "valkey", valkey.Name, "namespace", valkey.Namespace)

cm := &corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Name: valkey.Name,
Namespace: valkey.Namespace,
},
Data: map[string]string{
"": "",
},
}
if err := r.Create(ctx, cm); err != nil {
if errors.IsAlreadyExists(err) {
if err := r.Update(ctx, cm); err != nil {
return err
}
} else {
return err
}
}
return nil
}

Expand Down

0 comments on commit 33c84e2

Please sign in to comment.