Skip to content

Commit

Permalink
Merge branch 'master' into YUNIKORN-2724
Browse files Browse the repository at this point in the history
  • Loading branch information
pbacsko committed Aug 1, 2024
2 parents 89d6ecf + a95c356 commit e2104a5
Show file tree
Hide file tree
Showing 41 changed files with 1,007 additions and 528 deletions.
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ linters-settings:
goimports:
local-prefixes: github.com/apache/yunikorn
govet:
check-shadowing: true
shadow: true
goconst:
min-occurrences: 5
funlen:
Expand Down
76 changes: 50 additions & 26 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ endif

# shellcheck
SHELLCHECK_VERSION=v0.9.0
SHELLCHECK_BIN=${TOOLS_DIR}/shellcheck
SHELLCHECK_PATH=${TOOLS_DIR}/shellcheck-$(SHELLCHECK_VERSION)
SHELLCHECK_BIN=${SHELLCHECK_PATH}/shellcheck
SHELLCHECK_ARCHIVE := shellcheck-$(SHELLCHECK_VERSION).$(OS).$(HOST_ARCH).tar.xz
ifeq (darwin, $(OS))
ifeq (arm64, $(HOST_ARCH))
Expand All @@ -143,41 +144,56 @@ ifeq (armv7l, $(HOST_ARCH))
SHELLCHECK_ARCHIVE := shellcheck-$(SHELLCHECK_VERSION).$(OS).armv6hf.tar.xz
endif
endif
export PATH := $(BASE_DIR)/$(SHELLCHECK_PATH):$(PATH)

# golangci-lint
GOLANGCI_LINT_VERSION=1.57.2
GOLANGCI_LINT_BIN=$(TOOLS_DIR)/golangci-lint
GOLANGCI_LINT_PATH=$(TOOLS_DIR)/golangci-lint-v$(GOLANGCI_LINT_VERSION)
GOLANGCI_LINT_BIN=$(GOLANGCI_LINT_PATH)/golangci-lint
GOLANGCI_LINT_ARCHIVE=golangci-lint-$(GOLANGCI_LINT_VERSION)-$(OS)-$(EXEC_ARCH).tar.gz
GOLANGCI_LINT_ARCHIVEBASE=golangci-lint-$(GOLANGCI_LINT_VERSION)-$(OS)-$(EXEC_ARCH)
export PATH := $(BASE_DIR)/$(GOLANGCI_LINT_PATH):$(PATH)

# kubectl
KUBECTL_VERSION=v1.27.7
KUBECTL_BIN=$(TOOLS_DIR)/kubectl
KUBECTL_PATH=$(TOOLS_DIR)/kubectl-$(KUBECTL_VERSION)
KUBECTL_BIN=$(KUBECTL_PATH)/kubectl
export PATH := $(BASE_DIR)/$(KUBECTL_PATH):$(PATH)

# kind
KIND_VERSION=v0.23.0
KIND_BIN=$(TOOLS_DIR)/kind
KIND_PATH=$(TOOLS_DIR)/kind-$(KIND_VERSION)
KIND_BIN=$(KIND_PATH)/kind
export PATH := $(BASE_DIR)/$(KIND_PATH):$(PATH)

# helm
HELM_VERSION=v3.12.1
HELM_BIN=$(TOOLS_DIR)/helm
HELM_PATH=$(TOOLS_DIR)/helm-$(HELM_VERSION)
HELM_BIN=$(HELM_PATH)/helm
HELM_ARCHIVE=helm-$(HELM_VERSION)-$(OS)-$(EXEC_ARCH).tar.gz
HELM_ARCHIVE_BASE=$(OS)-$(EXEC_ARCH)
export PATH := $(BASE_DIR)/$(HELM_PATH):$(PATH)

# spark
export SPARK_VERSION=3.3.3
# sometimes the image is not avaiable with $SPARK_VERSION, the minor version must match
export SPARK_PYTHON_VERSION=3.3.1
export SPARK_HOME=$(BASE_DIR)$(TOOLS_DIR)/spark
export SPARK_HOME=$(BASE_DIR)$(TOOLS_DIR)/spark-v$(SPARK_VERSION)
export SPARK_SUBMIT_CMD=$(SPARK_HOME)/bin/spark-submit
export SPARK_PYTHON_IMAGE=docker.io/apache/spark-py:v$(SPARK_PYTHON_VERSION)
export PATH := $(SPARK_HOME):$(PATH)

# go-licenses
GO_LICENSES_VERSION=v1.6.0
GO_LICENSES_BIN=$(TOOLS_DIR)/go-licenses
GO_LICENSES_PATH=$(TOOLS_DIR)/go-licenses-$(GO_LICENSES_VERSION)
GO_LICENSES_BIN=$(GO_LICENSES_PATH)/go-licenses
export PATH := $(BASE_DIR)/$(GO_LICENSES_PATH):$(PATH)

# ginkgo
GINKGO_BIN=$(TOOLS_DIR)/ginkgo
GINKGO_VERSION=v2.19.0
GINKGO_PATH=$(TOOLS_DIR)/ginkgo-$(GINKGO_VERSION)
GINKGO_BIN=$(GINKGO_PATH)/ginkgo
export PATH := $(BASE_DIR)/$(GINKGO_PATH):$(PATH)

FLAG_PREFIX=github.com/apache/yunikorn-k8shim/pkg/conf

Expand Down Expand Up @@ -222,50 +238,61 @@ init: conf/scheduler-config-local.yaml
conf/scheduler-config-local.yaml: conf/scheduler-config.yaml
./scripts/plugin-conf-gen.sh $(KUBECONFIG) "conf/scheduler-config.yaml" "conf/scheduler-config-local.yaml"

# Print tools version
.PHONY: print_kubectl_version
print_kubectl_version:
@echo $(KUBECTL_VERSION)
.PHONY: print_kind_version
print_kind_version:
@echo $(KIND_VERSION)
.PHONY: print_helm_version
print_helm_version:
@echo $(HELM_VERSION)

# Install tools
.PHONY: tools
tools: $(SHELLCHECK_BIN) $(GOLANGCI_LINT_BIN) $(KUBECTL_BIN) $(KIND_BIN) $(HELM_BIN) $(SPARK_SUBMIT_CMD) $(GO_LICENSES_BIN) $(GINKGO_BIN)

# Install shellcheck
$(SHELLCHECK_BIN):
@echo "installing shellcheck $(SHELLCHECK_VERSION)"
@mkdir -p "$(TOOLS_DIR)"
@mkdir -p "$(SHELLCHECK_PATH)"
@curl -sSfL "https://github.com/koalaman/shellcheck/releases/download/$(SHELLCHECK_VERSION)/$(SHELLCHECK_ARCHIVE)" \
| tar -x -J --strip-components=1 -C "$(TOOLS_DIR)" "shellcheck-$(SHELLCHECK_VERSION)/shellcheck"
| tar -x -J --strip-components=1 -C "$(SHELLCHECK_PATH)" "shellcheck-$(SHELLCHECK_VERSION)/shellcheck"

# Install golangci-lint
$(GOLANGCI_LINT_BIN):
@echo "installing golangci-lint v$(GOLANGCI_LINT_VERSION)"
@mkdir -p "$(TOOLS_DIR)"
@mkdir -p "$(GOLANGCI_LINT_PATH)"
@curl -sSfL "https://github.com/golangci/golangci-lint/releases/download/v$(GOLANGCI_LINT_VERSION)/$(GOLANGCI_LINT_ARCHIVE)" \
| tar -x -z --strip-components=1 -C "$(TOOLS_DIR)" "$(GOLANGCI_LINT_ARCHIVEBASE)/golangci-lint"
| tar -x -z --strip-components=1 -C "$(GOLANGCI_LINT_PATH)" "$(GOLANGCI_LINT_ARCHIVEBASE)/golangci-lint"

# Install kubectl
$(KUBECTL_BIN):
@echo "installing kubectl $(KUBECTL_VERSION)"
@mkdir -p "$(TOOLS_DIR)"
@mkdir -p "$(KUBECTL_PATH)"
@curl -sSfL -o "$(KUBECTL_BIN)" \
"https://storage.googleapis.com/kubernetes-release/release/$(KUBECTL_VERSION)/bin/$(OS)/$(EXEC_ARCH)/kubectl" && \
chmod +x "$(KUBECTL_BIN)"

# Install kind
$(KIND_BIN):
@echo "installing kind $(KIND_VERSION)"
@mkdir -p "$(TOOLS_DIR)"
@mkdir -p "$(KIND_PATH)"
@curl -sSfL -o "$(KIND_BIN)" \
"https://kind.sigs.k8s.io/dl/$(KIND_VERSION)/kind-$(OS)-$(EXEC_ARCH)" && \
chmod +x "$(KIND_BIN)"

# Install helm
$(HELM_BIN):
@echo "installing helm $(HELM_VERSION)"
@mkdir -p "$(TOOLS_DIR)"
@mkdir -p "$(HELM_PATH)"
@curl -sSfL "https://get.helm.sh/$(HELM_ARCHIVE)" \
| tar -x -z --strip-components=1 -C "$(TOOLS_DIR)" "$(HELM_ARCHIVE_BASE)/helm"
| tar -x -z --strip-components=1 -C "$(HELM_PATH)" "$(HELM_ARCHIVE_BASE)/helm"

# Install spark
$(SPARK_SUBMIT_CMD):
@echo "installing spark $(SPARK_VERSION)"
@echo "installing spark v$(SPARK_VERSION)"
@rm -rf "$(SPARK_HOME)" "$(SPARK_HOME).tmp"
@mkdir -p "$(SPARK_HOME).tmp"
@curl -sSfL "https://archive.apache.org/dist/spark/spark-${SPARK_VERSION}/spark-${SPARK_VERSION}-bin-hadoop3.tgz" \
Expand All @@ -275,23 +302,20 @@ $(SPARK_SUBMIT_CMD):
# Install go-licenses
$(GO_LICENSES_BIN):
@echo "installing go-licenses $(GO_LICENSES_VERSION)"
@mkdir -p "$(TOOLS_DIR)"
@GOBIN="$(BASE_DIR)/$(TOOLS_DIR)" "$(GO)" install "github.com/google/go-licenses@$(GO_LICENSES_VERSION)"
@mkdir -p "$(GO_LICENSES_PATH)"
@GOBIN="$(BASE_DIR)/$(GO_LICENSES_PATH)" "$(GO)" install "github.com/google/go-licenses@$(GO_LICENSES_VERSION)"

$(GINKGO_BIN):
@echo "installing ginkgo"
@mkdir -p "$(TOOLS_DIR)"
@GOBIN="$(BASE_DIR)/$(TOOLS_DIR)" "$(GO)" install "github.com/onsi/ginkgo/v2/ginkgo"
@echo "installing ginkgo $(GINKGO_VERSION)"
@mkdir -p "$(GINKGO_PATH)"
@GOBIN="$(BASE_DIR)/$(GINKGO_PATH)" "$(GO)" install "github.com/onsi/ginkgo/v2/ginkgo@$(GINKGO_VERSION)"

# Run lint against the previous commit for PR and branch build
# In dev setup look at all changes on top of master
.PHONY: lint
lint: $(GOLANGCI_LINT_BIN)
@echo "running golangci-lint"
@git symbolic-ref -q HEAD && REV="origin/HEAD" || REV="HEAD^" ; \
headSHA=$$(git rev-parse --short=12 $${REV}) ; \
echo "checking against commit sha $${headSHA}" ; \
"${GOLANGCI_LINT_BIN}" run --new-from-rev=$${headSHA}
@"${GOLANGCI_LINT_BIN}" run

# Check scripts
.PHONY: check_scripts
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module github.com/apache/yunikorn-k8shim
go 1.21

require (
github.com/apache/yunikorn-core v0.0.0-20240705110923-108ed0d25768
github.com/apache/yunikorn-core v0.0.0-20240711165824-d96cd583305b
github.com/apache/yunikorn-scheduler-interface v0.0.0-20240425182941-07f5695119a1
github.com/google/go-cmp v0.6.0
github.com/google/uuid v1.6.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ github.com/NYTimes/gziphandler v1.1.1 h1:ZUDjpQae29j0ryrS0u/B8HZfJBtBQHjqw2rQ2cq
github.com/NYTimes/gziphandler v1.1.1/go.mod h1:n/CVRwUEOgIxrgPvAQhUUr9oeUtvrhMomdKFjzJNB0c=
github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df h1:7RFfzj4SSt6nnvCPbCqijJi1nWCd+TqAT3bYCStRC18=
github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df/go.mod h1:pSwJ0fSY5KhvocuWSx4fz3BA8OrA1bQn+K1Eli3BRwM=
github.com/apache/yunikorn-core v0.0.0-20240705110923-108ed0d25768 h1:RYjrRqr8rumlEAbYRh5Z88FsJe+8LQ4c1mzjNJoSk70=
github.com/apache/yunikorn-core v0.0.0-20240705110923-108ed0d25768/go.mod h1:pSi7AFBRiGCGQ7RwQffpD4m6dvA5lc1HuCrg7LpJJqs=
github.com/apache/yunikorn-core v0.0.0-20240711165824-d96cd583305b h1:GDizY3dcE+hkfik/+NY3Zdw71A/V4dWGp9Pl6k5Ii2M=
github.com/apache/yunikorn-core v0.0.0-20240711165824-d96cd583305b/go.mod h1:pSi7AFBRiGCGQ7RwQffpD4m6dvA5lc1HuCrg7LpJJqs=
github.com/apache/yunikorn-scheduler-interface v0.0.0-20240425182941-07f5695119a1 h1:v4J9L3MlW8BQfYnbq6FV2l3uyay3SqMS2Ffpo+SFat4=
github.com/apache/yunikorn-scheduler-interface v0.0.0-20240425182941-07f5695119a1/go.mod h1:WuHJpVk34t8N5+1ErYGj/5Qq33/cRzL4YtuoAsbMtWc=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
Expand Down
2 changes: 1 addition & 1 deletion pkg/admission/admission_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ func (c *AdmissionController) updateLabels(namespace string, pod *v1.Pod, patch
zap.String("namespace", namespace),
zap.Any("labels", pod.Labels))

result := updatePodLabel(pod, namespace, c.conf.GetGenerateUniqueAppIds(), c.conf.GetDefaultQueueName())
result := updatePodLabel(pod, namespace, c.conf.GetGenerateUniqueAppIds())

patch = append(patch, common.PatchOperation{
Op: "add",
Expand Down
22 changes: 6 additions & 16 deletions pkg/admission/admission_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,8 @@ func TestUpdateLabels(t *testing.T) {
assert.Equal(t, patch[0].Op, "add")
assert.Equal(t, patch[0].Path, "/metadata/labels")
if updatedMap, ok := patch[0].Value.(map[string]string); ok {
assert.Equal(t, len(updatedMap), 5)
assert.Equal(t, len(updatedMap), 3)
assert.Equal(t, updatedMap["random"], "random")
assert.Equal(t, updatedMap[constants.CanonicalLabelQueueName], "root.default")
assert.Equal(t, updatedMap[constants.LabelQueueName], "root.default")
assert.Equal(t, strings.HasPrefix(updatedMap[constants.CanonicalLabelApplicationID], constants.AutoGenAppPrefix), true)
assert.Equal(t, strings.HasPrefix(updatedMap[constants.LabelApplicationID], constants.AutoGenAppPrefix), true)
} else {
Expand Down Expand Up @@ -119,10 +117,8 @@ func TestUpdateLabels(t *testing.T) {
assert.Equal(t, patch[0].Op, "add")
assert.Equal(t, patch[0].Path, "/metadata/labels")
if updatedMap, ok := patch[0].Value.(map[string]string); ok {
assert.Equal(t, len(updatedMap), 5)
assert.Equal(t, len(updatedMap), 3)
assert.Equal(t, updatedMap["random"], "random")
assert.Equal(t, updatedMap[constants.CanonicalLabelQueueName], "root.default")
assert.Equal(t, updatedMap[constants.LabelQueueName], "root.default")
assert.Equal(t, updatedMap[constants.CanonicalLabelApplicationID], "app-0001")
assert.Equal(t, updatedMap[constants.LabelApplicationID], "app-0001")
} else {
Expand Down Expand Up @@ -192,9 +188,7 @@ func TestUpdateLabels(t *testing.T) {
assert.Equal(t, patch[0].Op, "add")
assert.Equal(t, patch[0].Path, "/metadata/labels")
if updatedMap, ok := patch[0].Value.(map[string]string); ok {
assert.Equal(t, len(updatedMap), 4)
assert.Equal(t, updatedMap[constants.CanonicalLabelQueueName], "root.default")
assert.Equal(t, updatedMap[constants.LabelQueueName], "root.default")
assert.Equal(t, len(updatedMap), 2)
assert.Equal(t, strings.HasPrefix(updatedMap[constants.CanonicalLabelApplicationID], constants.AutoGenAppPrefix), true)
assert.Equal(t, strings.HasPrefix(updatedMap[constants.LabelApplicationID], constants.AutoGenAppPrefix), true)
} else {
Expand Down Expand Up @@ -222,9 +216,7 @@ func TestUpdateLabels(t *testing.T) {
assert.Equal(t, patch[0].Op, "add")
assert.Equal(t, patch[0].Path, "/metadata/labels")
if updatedMap, ok := patch[0].Value.(map[string]string); ok {
assert.Equal(t, len(updatedMap), 4)
assert.Equal(t, updatedMap[constants.CanonicalLabelQueueName], "root.default")
assert.Equal(t, updatedMap[constants.LabelQueueName], "root.default")
assert.Equal(t, len(updatedMap), 2)
assert.Equal(t, strings.HasPrefix(updatedMap[constants.CanonicalLabelApplicationID], constants.AutoGenAppPrefix), true)
assert.Equal(t, strings.HasPrefix(updatedMap[constants.LabelApplicationID], constants.AutoGenAppPrefix), true)
} else {
Expand All @@ -250,9 +242,7 @@ func TestUpdateLabels(t *testing.T) {
assert.Equal(t, patch[0].Op, "add")
assert.Equal(t, patch[0].Path, "/metadata/labels")
if updatedMap, ok := patch[0].Value.(map[string]string); ok {
assert.Equal(t, len(updatedMap), 4)
assert.Equal(t, updatedMap[constants.CanonicalLabelQueueName], "root.default")
assert.Equal(t, updatedMap[constants.LabelQueueName], "root.default")
assert.Equal(t, len(updatedMap), 2)
assert.Equal(t, strings.HasPrefix(updatedMap[constants.CanonicalLabelApplicationID], constants.AutoGenAppPrefix), true)
assert.Equal(t, strings.HasPrefix(updatedMap[constants.LabelApplicationID], constants.AutoGenAppPrefix), true)
} else {
Expand Down Expand Up @@ -462,7 +452,7 @@ func TestMutate(t *testing.T) {
assert.Check(t, resp.Allowed, "response not allowed for pod")
assert.Equal(t, schedulerName(t, resp.Patch), "yunikorn", "yunikorn not set as scheduler for pod")
assert.Equal(t, labels(t, resp.Patch)[constants.LabelApplicationID], "yunikorn-default-autogen", "wrong applicationId label")
assert.Equal(t, labels(t, resp.Patch)[constants.LabelQueueName], "root.default", "incorrect queue name")
assert.Equal(t, labels(t, resp.Patch)[constants.LabelQueueName], nil, "incorrect queue name")

// pod without applicationID
pod = v1.Pod{ObjectMeta: metav1.ObjectMeta{
Expand Down
20 changes: 2 additions & 18 deletions pkg/admission/conf/am_conf.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package conf

import (
"errors"
"fmt"
"regexp"
"strconv"
Expand Down Expand Up @@ -52,7 +53,6 @@ const (
AMFilteringLabelNamespaces = FilteringPrefix + "labelNamespaces"
AMFilteringNoLabelNamespaces = FilteringPrefix + "noLabelNamespaces"
AMFilteringGenerateUniqueAppIds = FilteringPrefix + "generateUniqueAppId"
AMFilteringDefaultQueueName = FilteringPrefix + "defaultQueue"

// access control configuration
AMAccessControlBypassAuth = AccessControlPrefix + "bypassAuth"
Expand All @@ -73,7 +73,6 @@ const (
DefaultFilteringLabelNamespaces = ""
DefaultFilteringNoLabelNamespaces = ""
DefaultFilteringGenerateUniqueAppIds = false
DefaultFilteringQueueName = constants.ApplicationDefaultQueue

// access control defaults
DefaultAccessControlBypassAuth = false
Expand Down Expand Up @@ -102,7 +101,6 @@ type AdmissionControllerConf struct {
systemUsers []*regexp.Regexp
externalUsers []*regexp.Regexp
externalGroups []*regexp.Regexp
defaultQueueName string
configMaps []*v1.ConfigMap

lock locking.RWMutex
Expand All @@ -120,7 +118,7 @@ func NewAdmissionControllerConf(configMaps []*v1.ConfigMap) *AdmissionController
func (acc *AdmissionControllerConf) RegisterHandlers(configMaps informersv1.ConfigMapInformer) error {
_, err := configMaps.Informer().AddEventHandler(&configMapUpdateHandler{conf: acc})
if err != nil {
return fmt.Errorf("failed to create register handlers: %w", err)
return errors.Join(errors.New("failed to create register handlers: "), err)
}

return nil
Expand Down Expand Up @@ -222,12 +220,6 @@ func (acc *AdmissionControllerConf) GetExternalGroups() []*regexp.Regexp {
return acc.externalGroups
}

func (acc *AdmissionControllerConf) GetDefaultQueueName() string {
acc.lock.RLock()
defer acc.lock.RUnlock()
return acc.defaultQueueName
}

type configMapUpdateHandler struct {
conf *AdmissionControllerConf
}
Expand Down Expand Up @@ -331,14 +323,6 @@ func (acc *AdmissionControllerConf) updateConfigMaps(configMaps []*v1.ConfigMap,
acc.externalUsers = parseConfigRegexps(configs, AMAccessControlExternalUsers, DefaultAccessControlExternalUsers)
acc.externalGroups = parseConfigRegexps(configs, AMAccessControlExternalGroups, DefaultAccessControlExternalGroups)

// labeling
acc.defaultQueueName = parseConfigString(configs, AMFilteringDefaultQueueName, DefaultFilteringQueueName)
if acc.defaultQueueName != "" && !strings.HasPrefix(acc.defaultQueueName, constants.RootQueue) {
log.Log(log.AdmissionConf).Warn("invalid default queue. defaultQueue must be fully qualified. Resetting to "+DefaultFilteringQueueName,
zap.String(AMFilteringDefaultQueueName, acc.defaultQueueName))
acc.defaultQueueName = DefaultFilteringQueueName
}

// logging
log.UpdateLoggingConfig(configs)

Expand Down
9 changes: 0 additions & 9 deletions pkg/admission/conf/am_conf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ func TestConfigMapVars(t *testing.T) {
AMAccessControlExternalUsers: "^yunikorn$",
AMAccessControlExternalGroups: "^devs$",
AMAccessControlTrustControllers: "false",
AMFilteringDefaultQueueName: "root.default.queue",
}}})
assert.Equal(t, conf.GetPolicyGroup(), "testPolicyGroup")
assert.Equal(t, conf.GetAmServiceName(), "testYunikornService")
Expand All @@ -58,7 +57,6 @@ func TestConfigMapVars(t *testing.T) {
assert.Equal(t, conf.GetExternalUsers()[0].String(), "^yunikorn$")
assert.Equal(t, conf.GetExternalGroups()[0].String(), "^devs$")
assert.Equal(t, conf.GetTrustControllers(), false)
assert.Equal(t, conf.GetDefaultQueueName(), "root.default.queue")

// test missing settings
conf = NewAdmissionControllerConf([]*v1.ConfigMap{nil, nil})
Expand All @@ -75,7 +73,6 @@ func TestConfigMapVars(t *testing.T) {
assert.Equal(t, 0, len(conf.GetExternalUsers()))
assert.Equal(t, 0, len(conf.GetExternalGroups()))
assert.Equal(t, conf.GetTrustControllers(), DefaultAccessControlTrustControllers)
assert.Equal(t, conf.GetDefaultQueueName(), DefaultFilteringQueueName)

// test faulty settings for boolean values
conf = NewAdmissionControllerConf([]*v1.ConfigMap{nil, {Data: map[string]string{
Expand All @@ -93,12 +90,6 @@ func TestConfigMapVars(t *testing.T) {
}}})
assert.Equal(t, len(conf.GetProcessNamespaces()), 0)

// test invalid defaultQueue name
conf = NewAdmissionControllerConf([]*v1.ConfigMap{nil, {Data: map[string]string{
AMFilteringDefaultQueueName: "default.queue",
}}})
assert.Equal(t, conf.GetDefaultQueueName(), DefaultFilteringQueueName)

// test disable / enable of config hot refresh
conf = NewAdmissionControllerConf([]*v1.ConfigMap{nil, nil})

Expand Down
Loading

0 comments on commit e2104a5

Please sign in to comment.