Commit da271f3a authored by psaromanola1's avatar psaromanola1
Browse files

Dynamic namespace on source code

parent 46288efe
Loading
Loading
Loading
Loading
+2 −2
Changes for src/ocm_scheduler_operator/config/manager/kustomization.yaml: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -4,5 +4,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
images:
- name: controller
  newName: quay.io/clwalsh/hypo-scheduler
  newTag: 1.0.0
  newName: labs.etsi.org:5050/osl/hypo/code/addons/ocm-scheduler/hypo-ocm-scheduler
  newTag: v2
+2 −2
Changes for src/ocm_scheduler_operator/deploy/hypo-ocm-scheduler.yaml: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -493,7 +493,7 @@ spec:
        - --health-probe-bind-address=:8081
        command:
        - /manager
        image: registry.ubitech.eu/nsit/hypo-ocm-scheduler:v1
        image: labs.etsi.org:5050/osl/hypo/code/addons/ocm-scheduler/hypo-ocm-scheduler:v2
        imagePullPolicy: Always
        livenessProbe:
          httpGet:
@@ -521,7 +521,7 @@ spec:
            drop:
            - ALL
      imagePullSecrets:
      - name: ubitech-registry
      - name: etsi-registry
      securityContext:
        runAsNonRoot: true
      serviceAccountName: hypo-scheduler-controller-manager
+7 −2
Changes for src/ocm_scheduler_operator/internal/controller/hyposchedulingmanifest_controller.go: 7 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import (
	"context"
	"errors"
	"fmt"
	"os"
	"slices"
	"strings"
	"time"
@@ -47,7 +48,8 @@ import (

const finalizer = "scheduling.hypo.eu/finalizer"
const ownershipLabel = "scheduling.hypo.eu/owner"
const HypoSchedulerNamespace = "hypo-scheduler-system"

var HypoSchedulerNamespace = os.Getenv("POD_NAMESPACE")

// HypoSchedulingManifestReconciler reconciles a HypoSchedulingManifest object
type HypoSchedulingManifestReconciler struct {
@@ -114,7 +116,10 @@ func (r *HypoSchedulingManifestReconciler) Reconcile(ctx context.Context, req ct
	// Validate that the HypoSchedulingManifest instance is in the correct namespace
	if req.Namespace != HypoSchedulerNamespace {
		errorTitle := "incorrect namespace"
		errorMessage := "Ignoring resource as it is not in the hypo-scheduler-system namespace"
		errorMessage := fmt.Sprintf(
			"Ignoring resource as it is not in the %s namespace",
			HypoSchedulerNamespace,
		)

		err := fmt.Errorf("%s", errorTitle)
		log.Error(err, errorMessage)