Skip to content

Commit

Permalink
Rework TaskController
Browse files Browse the repository at this point in the history
  • Loading branch information
mtneug committed Dec 12, 2024
1 parent 3fdc793 commit 6b31f51
Show file tree
Hide file tree
Showing 5 changed files with 869 additions and 465 deletions.
12 changes: 2 additions & 10 deletions config/rbac/role-workflow-manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ rules:
- ""
resources:
- configmaps
- secrets
- services
verbs:
- create
- delete
Expand All @@ -23,16 +25,6 @@ rules:
verbs:
- create
- patch
- apiGroups:
- ""
resources:
- secrets
verbs:
- create
- delete
- get
- patch
- update
- apiGroups:
- batch
resources:
Expand Down
40 changes: 40 additions & 0 deletions internal/pkg/apis/utils/names.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
Copyright 2022-2024 The nagare media authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package utils

import (
"fmt"

utilrand "k8s.io/apimachinery/pkg/util/rand"
)

// Adopted from:
// https://github.com/kubernetes/apiserver/blob/cccad306d649184bf2a0e319ba830c53f65c445c/pkg/storage/names/generate.go
// Copyright 2014 The Kubernetes Authors. Apache-2.0 license.

const (
maxNameLength = 63
randomLength = 5
maxGeneratedNameLength = maxNameLength - randomLength - 1
)

func GenerateName(base string) string {
if len(base) > maxGeneratedNameLength {
base = base[:maxGeneratedNameLength]
}
return fmt.Sprintf("%s-%s", base, utilrand.String(randomLength))
}
4 changes: 4 additions & 0 deletions internal/pkg/engineurl/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ const (

type URL string

func IsEngineURL(u string) bool {
return strings.HasPrefix(u, NagareEngineScheme+"://")
}

func Parse(u string) (ParsedURL, error) {
url := URL(u)
return url.Parse()
Expand Down
Loading

0 comments on commit 6b31f51

Please sign in to comment.