-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Moved the packages out of pkg to simplify the structure a bit * Fix local deployment * WIP: adding tolerations and central config for all namespaces * Switched to using central config for all namespaces and added tolerations. Renamed the affinityinjector package to injector. * Quickfix: go.mod * Added namespace tolerations * Tests for the injector package with tolerations * Added a sample pod to the examples for easy testing * - Lint fix - Updated readme * Attempt to fix go.sum * Update to go 1.17
- Loading branch information
Showing
23 changed files
with
724 additions
and
439 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
kind: ClusterRole | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
name: namespace-node-affinity | ||
rules: | ||
- apiGroups: ["admissionregistration.k8s.io"] | ||
resources: ["mutatingwebhookconfigurations"] | ||
verbs: ["get", "create", "update"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
kind: ClusterRoleBinding | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
name: namespace-node-affinity | ||
subjects: | ||
- kind: ServiceAccount | ||
name: namespace-node-affinity | ||
namespace: default | ||
apiGroup: "" | ||
roleRef: | ||
kind: ClusterRole | ||
name: namespace-node-affinity | ||
apiGroup: rbac.authorization.k8s.io |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
kind: ClusterRole | ||
--- | ||
kind: Role | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
name: namespace-node-affinity | ||
namespace: default | ||
rules: | ||
- apiGroups: ["admissionregistration.k8s.io"] | ||
resources: ["mutatingwebhookconfigurations"] | ||
verbs: ["get", "create", "update"] | ||
- apiGroups: [""] | ||
resources: ["configmaps"] | ||
verbs: ["get"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
kind: ClusterRoleBinding | ||
--- | ||
kind: RoleBinding | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
name: namespace-node-affinity | ||
namespace: default | ||
subjects: | ||
- kind: ServiceAccount | ||
name: namespace-node-affinity | ||
namespace: default | ||
apiGroup: "" | ||
roleRef: | ||
kind: ClusterRole | ||
kind: Role | ||
name: namespace-node-affinity | ||
apiGroup: rbac.authorization.k8s.io |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
--- | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
|
||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: testing-ns | ||
labels: | ||
namespace-node-affinity: enabled | ||
--- | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: testing-ns-b | ||
labels: | ||
namespace-node-affinity: enabled | ||
--- | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: testing-ns-c | ||
labels: | ||
namespace-node-affinity: enabled | ||
--- | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: testing-ns-d | ||
labels: | ||
namespace-node-affinity: enabled | ||
--- | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: testing-ns-e | ||
labels: | ||
namespace-node-affinity: enabled |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,35 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: namespace-node-affinity | ||
namespace: testing-ns | ||
namespace: default | ||
data: | ||
nodeSelectorTerms: | | ||
- matchExpressions: | ||
- key: the-testing-key | ||
operator: In | ||
values: | ||
- the-testing-val1 | ||
testing-ns: | | ||
nodeSelectorTerms: | ||
- matchExpressions: | ||
- key: the-testing-key | ||
operator: In | ||
values: | ||
- the-testing-val1 | ||
tolerations: | ||
- key: "example-key" | ||
operator: "Exists" | ||
effect: "NoSchedule" | ||
testing-ns-b: | | ||
nodeSelectorTerms: | ||
- matchExpressions: | ||
- key: the-testing-key | ||
operator: In | ||
values: | ||
- the-testing-val1 | ||
testing-ns-c: | | ||
tolerations: | ||
- key: "example-key" | ||
operator: "Exists" | ||
effect: "NoSchedule" | ||
testing-ns-d: | | ||
invalid: | ||
- key: "example-key" | ||
operator: "Exists" | ||
effect: "NoSchedule" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
creationTimestamp: null | ||
labels: | ||
run: nginx-test | ||
name: nginx-test | ||
namespace: testing-ns | ||
spec: | ||
containers: | ||
- image: nginx | ||
name: nginx-test | ||
resources: {} | ||
dnsPolicy: ClusterFirst | ||
restartPolicy: Always | ||
status: {} |
Oops, something went wrong.