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

Commit 1f8c830

Browse files
Merge pull request #1572 from ibuildthecloud/main
Change container name to match app public name
2 parents 0ecb7ed + b754e68 commit 1f8c830

File tree

114 files changed

+257
-64
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+257
-64
lines changed

integration/log/log_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,5 +196,5 @@ func TestSidecarContainerLog(t *testing.T) {
196196

197197
sort.Strings(lines)
198198
assert.Equal(t, "line 1-3\nline 1-4", strings.Join(lines, "\n"))
199-
assert.Len(t, strings.Split(replicas[1].Name, "."), 3)
199+
assert.Len(t, strings.Split(replicas[1].Name, ":"), 2)
200200
}

pkg/buildclient/filesyncclient.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"io"
77
"os"
88
"path/filepath"
9+
"strings"
910

1011
"github.com/moby/buildkit/session/filesync"
1112
"github.com/sirupsen/logrus"
@@ -125,7 +126,11 @@ func prepareSyncedDirs(localDirs map[string]string, dirNames []string, followPat
125126
}
126127
f := filepath.Join(d, followPath)
127128
if _, err := os.Stat(f); os.IsNotExist(err) {
128-
err := os.MkdirAll(f, 0755)
129+
if strings.Contains(f, "*") || strings.Contains(f, "?") {
130+
err = nil
131+
} else {
132+
err = os.MkdirAll(f, 0755)
133+
}
129134
if err != nil {
130135
return nil, err
131136
}

pkg/controller/appdefinition/acorn.go

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ func toAcorns(appInstance *v1.AppInstance, tag name.Reference, pullSecrets *Pull
3737
Labels: service.Labels,
3838
Annotations: service.Annotations,
3939
Image: service.Image,
40+
Build: service.Build,
4041
DeployArgs: service.ServiceArgs,
4142
Environment: service.Environment,
4243
Secrets: service.Secrets,
@@ -72,6 +73,11 @@ func toAcorn(appInstance *v1.AppInstance, tag name.Reference, pullSecrets *PullS
7273
image = strings.TrimPrefix(acorn.Image, "sha256:")
7374
}
7475

76+
originalImage := acorn.Image
77+
if acorn.Build != nil && acorn.Build.OriginalImage != "" {
78+
originalImage = acorn.Build.OriginalImage
79+
}
80+
7581
// Ensure secret gets copied
7682
pullSecrets.ForAcorn(acornName, image)
7783

@@ -83,10 +89,13 @@ func toAcorn(appInstance *v1.AppInstance, tag name.Reference, pullSecrets *PullS
8389

8490
acornInstance := &v1.AppInstance{
8591
ObjectMeta: metav1.ObjectMeta{
86-
Name: name2.SafeHashConcatName(appInstance.Name, acornName),
87-
Namespace: appInstance.Namespace,
88-
Labels: labelMap,
89-
Annotations: appInstanceScoped(acornName, appInstance.Status.AppSpec.Annotations, appInstance.Spec.Annotations, acorn.Annotations),
92+
Name: name2.SafeHashConcatName(appInstance.Name, acornName),
93+
Namespace: appInstance.Namespace,
94+
Labels: labelMap,
95+
Annotations: labels.Merge(appInstanceScoped(acornName, appInstance.Status.AppSpec.Annotations, appInstance.Spec.Annotations, acorn.Annotations),
96+
map[string]string{
97+
labels.AcornOriginalImage: originalImage,
98+
}),
9099
},
91100
Spec: v1.AppInstanceSpec{
92101
Region: appInstance.GetRegion(),

pkg/controller/appdefinition/deploy.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import (
1616
"github.com/acorn-io/acorn/pkg/labels"
1717
"github.com/acorn-io/acorn/pkg/pdb"
1818
"github.com/acorn-io/acorn/pkg/ports"
19+
"github.com/acorn-io/acorn/pkg/publicname"
1920
"github.com/acorn-io/acorn/pkg/secrets"
2021
"github.com/acorn-io/acorn/pkg/system"
2122
"github.com/acorn-io/acorn/pkg/volume"
@@ -594,7 +595,7 @@ func toDeployment(req router.Request, appInstance *v1.AppInstance, tag name.Refe
594595
return nil, err
595596
}
596597

597-
podLabels := containerLabels(appInstance, container, name)
598+
podLabels := containerLabels(appInstance, container, name, labels.AcornAppPublicName, publicname.Get(appInstance))
598599
deploymentLabels := containerLabels(appInstance, container, name)
599600
matchLabels := selectorMatchLabels(appInstance, name)
600601

pkg/controller/appdefinition/endpoints.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"strings"
88

99
v1 "github.com/acorn-io/acorn/pkg/apis/internal.acorn.io/v1"
10+
"github.com/acorn-io/acorn/pkg/controller/appstatus"
1011
"github.com/acorn-io/acorn/pkg/labels"
1112
"github.com/acorn-io/acorn/pkg/publish"
1213
"github.com/acorn-io/baaah/pkg/router"
@@ -139,7 +140,7 @@ func AppEndpointsStatus(req router.Request, _ router.Response) error {
139140

140141
eps := append(ingressEndpoints, serviceEndpoints...)
141142

142-
ingressTLSHosts, err := IngressTLSHosts(req.Ctx, req.Client, app)
143+
ingressTLSHosts, err := appstatus.IngressTLSHosts(req.Ctx, req.Client, app)
143144
if err != nil {
144145
return err
145146
}

pkg/controller/appdefinition/jobs.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55

66
v1 "github.com/acorn-io/acorn/pkg/apis/internal.acorn.io/v1"
77
"github.com/acorn-io/acorn/pkg/labels"
8+
"github.com/acorn-io/acorn/pkg/publicname"
89
"github.com/acorn-io/acorn/pkg/secrets"
910
"github.com/acorn-io/baaah/pkg/router"
1011
"github.com/acorn-io/baaah/pkg/typed"
@@ -89,6 +90,7 @@ func toJob(req router.Request, appInstance *v1.AppInstance, pullSecrets *PullSec
8990
ObjectMeta: metav1.ObjectMeta{
9091
Labels: jobLabels(appInstance, container, name,
9192
labels.AcornManaged, "true",
93+
labels.AcornAppPublicName, publicname.Get(appInstance),
9294
labels.AcornJobName, name,
9395
labels.AcornContainerName, ""),
9496
Annotations: labels.Merge(podAnnotations(appInstance, name, container), baseAnnotations),

pkg/controller/appdefinition/router.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ import (
77
"strings"
88

99
v1 "github.com/acorn-io/acorn/pkg/apis/internal.acorn.io/v1"
10+
"github.com/acorn-io/acorn/pkg/labels"
1011
"github.com/acorn-io/acorn/pkg/pdb"
1112
"github.com/acorn-io/acorn/pkg/ports"
13+
"github.com/acorn-io/acorn/pkg/publicname"
1214
"github.com/acorn-io/acorn/pkg/system"
1315
"github.com/acorn-io/acorn/pkg/tolerations"
1416
"github.com/acorn-io/baaah/pkg/router"
@@ -48,7 +50,7 @@ func toRouter(appInstance *v1.AppInstance, routerName string, router v1.Router)
4850

4951
conf, confName := toNginxConf(routerName, router)
5052

51-
podLabels := routerLabels(appInstance, router, routerName)
53+
podLabels := routerLabels(appInstance, router, routerName, labels.AcornAppPublicName, publicname.Get(appInstance))
5254
deploymentLabels := routerLabels(appInstance, router, routerName)
5355
matchLabels := routerSelectorMatchLabels(appInstance, routerName)
5456

pkg/controller/appdefinition/testdata/acorn/labels/expected.yaml.d/appinstance.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ metadata:
2222
"global2a": "value"
2323
"allacornsa": "value"
2424
"override2": "outervalue"
25+
acorn.io/original-image: foo
2526
spec:
2627
# The labels and annotations in this spec should be a combination of the "inner" acorn's definition and the outer
2728
# appInstance's scoped label and annotations.

pkg/controller/appdefinition/testdata/computeclass/all-set-overwrite-computeclass/expected.yaml.d/deployment.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ spec:
2020
labels:
2121
"acorn.io/app-namespace": "app-namespace"
2222
"acorn.io/app-name": "app-name"
23+
acorn.io/app-public-name: "app-name"
2324
"acorn.io/container-name": "oneimage"
2425
"acorn.io/managed": "true"
2526
annotations:

pkg/controller/appdefinition/testdata/computeclass/all-set/expected.yaml.d/deployment.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ spec:
2020
labels:
2121
"acorn.io/app-namespace": "app-namespace"
2222
"acorn.io/app-name": "app-name"
23+
"acorn.io/app-public-name": "app-name"
2324
"acorn.io/container-name": "oneimage"
2425
"acorn.io/managed": "true"
2526
annotations:

0 commit comments

Comments
 (0)