Skip to content

Commit

Permalink
Apply some quick fixes (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
regadas committed Oct 13, 2021
1 parent f64b62e commit a30fbb6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
4 changes: 3 additions & 1 deletion controllers/batchscheduler/volcano/volcano.go
Expand Up @@ -111,8 +111,10 @@ func newOwnerReference(flinkCluster *v1beta1.FlinkCluster) metav1.OwnerReference

func (v *VolcanoBatchScheduler) syncPodGroup(cluster *v1beta1.FlinkCluster, size int32, minResource corev1.ResourceList) error {
var err error
var pg *scheduling.PodGroup

podGroupName := v.getPodGroupName(cluster)
if pg, err := v.volcanoClient.SchedulingV1beta1().PodGroups(cluster.Namespace).Get(context.TODO(), podGroupName, metav1.GetOptions{}); err != nil {
if pg, err = v.volcanoClient.SchedulingV1beta1().PodGroups(cluster.Namespace).Get(context.TODO(), podGroupName, metav1.GetOptions{}); err != nil {
if !errors.IsNotFound(err) {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion controllers/flinkcluster_converter.go
Expand Up @@ -857,7 +857,7 @@ func getFlinkProperties(properties map[string]string) string {
return builder.String()
}

var jobManagerIngressHostRegex = regexp.MustCompile("{{\\s*[$]clusterName\\s*}}")
var jobManagerIngressHostRegex = regexp.MustCompile(`{{\s*[$]clusterName\s*}}`)

func getJobManagerIngressHost(ingressHostFormat string, clusterName string) string {
// TODO: Validating webhook should verify hostFormat
Expand Down
14 changes: 7 additions & 7 deletions controllers/flinkcluster_util.go
Expand Up @@ -84,8 +84,8 @@ func getFlinkAPIBaseURL(cluster *v1beta1.FlinkCluster) string {

return fmt.Sprintf(
"http://%s.%s.svc.%s:%d",
getJobManagerServiceName(cluster.ObjectMeta.Name),
cluster.ObjectMeta.Namespace,
getJobManagerServiceName(cluster.Name),
cluster.Namespace,
clusterDomain,
*cluster.Spec.JobManager.Ports.UI)
}
Expand Down Expand Up @@ -202,18 +202,18 @@ func newRevision(cluster *v1beta1.FlinkCluster, revision int64, collisionCount *
}
cr, err := history.NewControllerRevision(cluster,
controllerKind,
cluster.ObjectMeta.Labels,
cluster.Labels,
runtime.RawExtension{Raw: patch},
revision,
collisionCount)
if err != nil {
return nil, err
}
if cr.ObjectMeta.Annotations == nil {
cr.ObjectMeta.Annotations = make(map[string]string)
if cr.Annotations == nil {
cr.Annotations = make(map[string]string)
}
for key, value := range cluster.Annotations {
cr.ObjectMeta.Annotations[key] = value
cr.Annotations[key] = value
}
cr.SetNamespace(cluster.GetNamespace())
cr.GetLabels()[history.ControllerRevisionManagedByLabel] = cluster.GetName()
Expand Down Expand Up @@ -572,7 +572,7 @@ func getPodLogs(clientset *kubernetes.Clientset, pod *corev1.Pod) (string, error
req := pods.GetLogs(pod.Name, &corev1.PodLogOptions{})
podLogs, err := req.Stream(context.TODO())
if err != nil {
return "", fmt.Errorf("Failed to get logs for pod %s: %v", pod.Name, err)
return "", fmt.Errorf("failed to get logs for pod %s: %v", pod.Name, err)
}
defer podLogs.Close()

Expand Down

0 comments on commit a30fbb6

Please sign in to comment.