Skip to content

Commit

Permalink
Merge pull request #290 from navikt/cnpg-nodeselector-toleration
Browse files Browse the repository at this point in the history
CNPG: Dedicated hosts
  • Loading branch information
petteja authored Nov 20, 2024
2 parents 0b08c31 + b9ab7f5 commit 4f52add
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Ellers blir Knorten satt opp gjennom [nais/knada-gcp](https://github.com/nais/kn

## Utvikling

For å jobbe med Knorten lokalt trenger man å ha Postgres kjørende, og basen må prepouleres med litt data.
For å jobbe med Knorten lokalt trenger man å ha Postgres kjørende, og basen må prepopuleres med litt data.
I tillegg benytter vi et oppsett med Tailwind og Designsystemet.


Expand Down
10 changes: 10 additions & 0 deletions pkg/k8s/cnpg/cnpg.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,16 @@ func NewCluster(name, namespace, database, owner string, options ...ClusterOptio
StorageConfiguration: cnpgv1.StorageConfiguration{
Size: defaultStorageSize,
},
Affinity: cnpgv1.AffinityConfiguration{
NodeSelector: map[string]string{"knada-infrastructure": ""},
Tolerations: []v1.Toleration{
{
Key: "knada-infrastructure",
Operator: v1.TolerationOpExists,
Effect: v1.TaintEffectNoSchedule,
},
},
},
Resources: v1.ResourceRequirements{
Requests: v1.ResourceList{
v1.ResourceCPU: resource.MustParse(defaultRequestCPU),
Expand Down
8 changes: 7 additions & 1 deletion pkg/k8s/cnpg/testdata/cluster-with-app-label.golden
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@ metadata:
name: test-cluster
namespace: test-namespace
spec:
affinity: {}
affinity:
nodeSelector:
knada-infrastructure: ""
tolerations:
- effect: NoSchedule
key: knada-infrastructure
operator: Exists
backup:
retentionPolicy: 30d
volumeSnapshot:
Expand Down
8 changes: 7 additions & 1 deletion pkg/k8s/cnpg/testdata/cluster-with-backup.golden
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ metadata:
name: test-cluster
namespace: test-namespace
spec:
affinity: {}
affinity:
nodeSelector:
knada-infrastructure: ""
tolerations:
- effect: NoSchedule
key: knada-infrastructure
operator: Exists
backup:
retentionPolicy: 7d
volumeSnapshot:
Expand Down
8 changes: 7 additions & 1 deletion pkg/k8s/cnpg/testdata/cluster-with-instance-count.golden
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ metadata:
name: test-cluster
namespace: test-namespace
spec:
affinity: {}
affinity:
nodeSelector:
knada-infrastructure: ""
tolerations:
- effect: NoSchedule
key: knada-infrastructure
operator: Exists
backup:
retentionPolicy: 30d
volumeSnapshot:
Expand Down
8 changes: 7 additions & 1 deletion pkg/k8s/cnpg/testdata/cluster-with-monitoring.golden
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ metadata:
name: test-cluster
namespace: test-namespace
spec:
affinity: {}
affinity:
nodeSelector:
knada-infrastructure: ""
tolerations:
- effect: NoSchedule
key: knada-infrastructure
operator: Exists
backup:
retentionPolicy: 30d
volumeSnapshot:
Expand Down
8 changes: 7 additions & 1 deletion pkg/k8s/cnpg/testdata/cluster-with-requests.golden
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ metadata:
name: test-cluster
namespace: test-namespace
spec:
affinity: {}
affinity:
nodeSelector:
knada-infrastructure: ""
tolerations:
- effect: NoSchedule
key: knada-infrastructure
operator: Exists
backup:
retentionPolicy: 30d
volumeSnapshot:
Expand Down
8 changes: 7 additions & 1 deletion pkg/k8s/cnpg/testdata/cluster-with-storage-size.golden
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ metadata:
name: test-cluster
namespace: test-namespace
spec:
affinity: {}
affinity:
nodeSelector:
knada-infrastructure: ""
tolerations:
- effect: NoSchedule
key: knada-infrastructure
operator: Exists
backup:
retentionPolicy: 30d
volumeSnapshot:
Expand Down
8 changes: 7 additions & 1 deletion pkg/k8s/cnpg/testdata/default-cluster.golden
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ metadata:
name: test-cluster
namespace: test-namespace
spec:
affinity: {}
affinity:
nodeSelector:
knada-infrastructure: ""
tolerations:
- effect: NoSchedule
key: knada-infrastructure
operator: Exists
backup:
retentionPolicy: 30d
volumeSnapshot:
Expand Down

0 comments on commit 4f52add

Please sign in to comment.