Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

Commit

Permalink
Allow external publisher
Browse files Browse the repository at this point in the history
  • Loading branch information
ibuildthecloud committed Jun 27, 2022
1 parent e7c5e98 commit 76e1920
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 49 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ validate-ci:
go mod tidy
go run tools/gendocs/main.go
if [ -n "$$(git status --porcelain)" ]; then \
git status --porcelain --untracked-files=no; \
git status --porcelain; \
echo "Encountered dirty repo!"; \
exit 1 \
;fi
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/acornrouter/gc.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
apierrors "k8s.io/apimachinery/pkg/api/errors"
)

const ownerGVK = "acorn.io/v1, Kind=AppInstance"
const ownerGVK = "internal.acorn.io/v1, Kind=AppInstance"

func GCAcornRouter(req router.Request, resp router.Response) error {
ds := req.Object.(*appsv1.DaemonSet)
Expand Down
7 changes: 6 additions & 1 deletion pkg/controller/appdefinition/endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,12 @@ func ingressEndpoints(req router.Request, app *v1.AppInstance, containerName str
app.Namespace, app.Name)
}

for _, hostname := range strings.Split(ingress.Annotations[labels.AcornHostnames], ",") {
hostnames := ingress.Annotations[labels.AcornPublishURL]
if hostnames == "" {
hostnames = ingress.Annotations[labels.AcornHostnames]
}

for _, hostname := range strings.Split(hostnames, ",") {
hostname = strings.TrimSpace(hostname)
if hostname == "" {
continue
Expand Down
10 changes: 6 additions & 4 deletions pkg/controller/appdefinition/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,12 @@ func endpoints(cfg *apiv1.Config, app *v1.AppInstance) string {
buf := &strings.Builder{}
switch endpoint.Protocol {
case v1.ProtocolHTTP:
if *cfg.TLSEnabled {
buf.WriteString("https://")
} else {
buf.WriteString("http://")
if !strings.HasPrefix(endpoint.Address, "http") {
if *cfg.TLSEnabled {
buf.WriteString("https://")
} else {
buf.WriteString("http://")
}
}
default:
buf.WriteString(strings.ToLower(string(endpoint.Protocol)))
Expand Down
1 change: 1 addition & 0 deletions pkg/labels/labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const (
AcornSecretRevPrefix = "secret-rev." + Prefix
AcornRootNamespace = Prefix + "root-namespace"
AcornRootPrefix = Prefix + "root-prefix"
AcornPublishURL = Prefix + "publish-url"
)

func RootPrefix(parentLabels map[string]string, name string) string {
Expand Down
46 changes: 4 additions & 42 deletions pkg/version/version.go
Original file line number Diff line number Diff line change
@@ -1,51 +1,13 @@
package version

import (
"fmt"
"runtime/debug"
"github.com/acorn-io/baaah/pkg/version"
)

var (
Tag = "v0.0.0-dev"
)

type Version struct {
Tag string `json:"tag,omitempty"`
Commit string `json:"commit,omitempty"`
Dirty bool `json:"dirty,omitempty"`
}

func (v Version) String() string {
if len(v.Commit) < 12 {
return v.Tag
} else if v.Dirty {
return fmt.Sprintf("%s-%s-dirty", v.Tag, v.Commit[:8])
}

return fmt.Sprintf("%s+%s", v.Tag, v.Commit[:8])
}

func Get() Version {
v := Version{
Tag: Tag,
}
v.Commit, v.Dirty = GitCommit()
return v
}

func GitCommit() (commit string, dirty bool) {
bi, ok := debug.ReadBuildInfo()
if !ok {
return "", false
}
for _, setting := range bi.Settings {
switch setting.Key {
case "vcs.modified":
dirty = setting.Value == "true"
case "vcs.revision":
commit = setting.Value
}
}

return
}
func Get() version.Version {
return version.NewVersion(Tag)
}

0 comments on commit 76e1920

Please sign in to comment.