Skip to content

Commit

Permalink
Merge pull request #870 from jarrpa/add-metrics-toleration
Browse files Browse the repository at this point in the history
csv-merger: Add OCS Toleration to metrics-exporter
  • Loading branch information
openshift-merge-robot committed Oct 29, 2020
2 parents 3512b29 + bb0cd29 commit 9424a79
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
Expand Up @@ -2271,6 +2271,11 @@ spec:
securityContext:
runAsNonRoot: true
serviceAccountName: ocs-metrics-exporter
tolerations:
- effect: NoSchedule
key: node.ocs.openshift.io/storage
operator: Equal
value: "true"
permissions:
- rules:
- apiGroups:
Expand Down
29 changes: 16 additions & 13 deletions tools/csv-merger/csv-merger.go
Expand Up @@ -65,6 +65,15 @@ var (
"backingstores.noobaa.io",
"bucketclasses.noobaa.io",
}

ocsNodeToleration = []corev1.Toleration{
{
Key: "node.ocs.openshift.io/storage",
Operator: corev1.TolerationOpEqual,
Value: "true",
Effect: corev1.TaintEffectNoSchedule,
},
}
)

type templateData struct {
Expand Down Expand Up @@ -499,25 +508,19 @@ func generateUnifiedCSV() *csvv1.ClusterServiceVersion {
}
}

// Add tolerations to deployments
for i := range templateStrategySpec.DeploymentSpecs {
d := &templateStrategySpec.DeploymentSpecs[i]
d.Spec.Template.Spec.Tolerations = []corev1.Toleration{
{
Key: "node.ocs.openshift.io/storage",
Operator: corev1.TolerationOpEqual,
Value: "true",
Effect: corev1.TaintEffectNoSchedule,
},
}
}

// Add metrics exporter deployment to CSV
metricExporterStrategySpec := csvv1.StrategyDeploymentSpec{
Name: "ocs-metrics-exporter",
Spec: getMetricsExporterDeployment(),
}
templateStrategySpec.DeploymentSpecs = append(templateStrategySpec.DeploymentSpecs, metricExporterStrategySpec)

// Add tolerations to deployments
for i := range templateStrategySpec.DeploymentSpecs {
d := &templateStrategySpec.DeploymentSpecs[i]
d.Spec.Template.Spec.Tolerations = ocsNodeToleration
}

templateStrategySpec.ClusterPermissions = append(templateStrategySpec.ClusterPermissions, csvv1.StrategyDeploymentPermissions{
ServiceAccountName: "ocs-metrics-exporter",
Rules: []rbac.PolicyRule{
Expand Down

0 comments on commit 9424a79

Please sign in to comment.