Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(private-containers): private registries #1931

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions sdl/_testdata/v2.1-credentials.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
version: "2.1"
services:
web:
image: nginx
expose:
- port: 80
accept:
- ahostname.com
to:
- global: true
- port: 12345
to:
- global: true
proto: udp
credentials:
host: "https://test.com/v1"
username: "foo"
password: "foo"
profiles:
compute:
web:
resources:
cpu:
units: "100m"
memory:
size: "128Mi"
storage:
size: "1Gi"
placement:
westcoast:
attributes:
region: us-west
signedBy:
anyOf:
- 1
- 2
allOf:
- 3
- 4
pricing:
web:
denom: uakt
amount: 50
deployment:
web:
westcoast:
profile: web
count: 2
9 changes: 9 additions & 0 deletions sdl/groupBuilder_v2_1.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,15 @@
msvc.Params = params
}

if svc.Credentials != nil {
msvc.Credentials = &manifest.ServiceImageCredentials{

Check failure on line 127 in sdl/groupBuilder_v2_1.go

View workflow job for this annotation

GitHub Actions / build-bins

msvc.Credentials undefined (type v2beta2.Service has no field or method Credentials)

Check failure on line 127 in sdl/groupBuilder_v2_1.go

View workflow job for this annotation

GitHub Actions / build-bins

undefined: manifest.ServiceImageCredentials

Check failure on line 127 in sdl/groupBuilder_v2_1.go

View workflow job for this annotation

GitHub Actions / build-macos

msvc.Credentials undefined (type v2beta2.Service has no field or method Credentials)

Check failure on line 127 in sdl/groupBuilder_v2_1.go

View workflow job for this annotation

GitHub Actions / build-macos

undefined: manifest.ServiceImageCredentials

Check failure on line 127 in sdl/groupBuilder_v2_1.go

View workflow job for this annotation

GitHub Actions / coverage

msvc.Credentials undefined (type v2beta2.Service has no field or method Credentials)

Check failure on line 127 in sdl/groupBuilder_v2_1.go

View workflow job for this annotation

GitHub Actions / coverage

undefined: manifest.ServiceImageCredentials

Check failure on line 127 in sdl/groupBuilder_v2_1.go

View workflow job for this annotation

GitHub Actions / tests

msvc.Credentials undefined (type v2beta2.Service has no field or method Credentials)

Check failure on line 127 in sdl/groupBuilder_v2_1.go

View workflow job for this annotation

GitHub Actions / tests

undefined: manifest.ServiceImageCredentials

Check failure on line 127 in sdl/groupBuilder_v2_1.go

View workflow job for this annotation

GitHub Actions / lint

msvc.Credentials undefined (type v2beta2.Service has no field or method Credentials)

Check failure on line 127 in sdl/groupBuilder_v2_1.go

View workflow job for this annotation

GitHub Actions / lint

undefined: manifest.ServiceImageCredentials

Check failure on line 127 in sdl/groupBuilder_v2_1.go

View workflow job for this annotation

GitHub Actions / release-dry-run

msvc.Credentials undefined (type v2beta2.Service has no field or method Credentials)

Check failure on line 127 in sdl/groupBuilder_v2_1.go

View workflow job for this annotation

GitHub Actions / release-dry-run

undefined: manifest.ServiceImageCredentials

Check failure on line 127 in sdl/groupBuilder_v2_1.go

View workflow job for this annotation

GitHub Actions / sims

msvc.Credentials undefined (type v2beta2.Service has no field or method Credentials)

Check failure on line 127 in sdl/groupBuilder_v2_1.go

View workflow job for this annotation

GitHub Actions / sims

undefined: manifest.ServiceImageCredentials
Host: svc.Credentials.Host,
Email: svc.Credentials.Email,
Username: svc.Credentials.Username,
Password: svc.Credentials.Password,
}
}

group.mgroup.Services = append(group.mgroup.Services, msvc)
}
}
Expand Down
20 changes: 14 additions & 6 deletions sdl/v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,20 @@ type v2ServiceParams struct {

type v2Service struct {
Image string
Command []string `yaml:",omitempty"`
Args []string `yaml:",omitempty"`
Env []string `yaml:",omitempty"`
Expose v2Exposes `yaml:",omitempty"`
Dependencies []v2Dependency `yaml:",omitempty"`
Params *v2ServiceParams `yaml:",omitempty"`
Command []string `yaml:",omitempty"`
Args []string `yaml:",omitempty"`
Env []string `yaml:",omitempty"`
Expose v2Exposes `yaml:",omitempty"`
Dependencies []v2Dependency `yaml:",omitempty"`
Params *v2ServiceParams `yaml:",omitempty"`
Credentials *v2ServiceCredentials `yaml:",omitempty"`
}

type v2ServiceCredentials struct {
Host string `yaml:",omitempty"`
Email string `yaml:",omitempty"`
Username string `yaml:",omitempty"`
Password string `yaml:",omitempty"`
}

type v2ServiceDeployment struct {
Expand Down
27 changes: 27 additions & 0 deletions sdl/v2_1_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,33 @@ func Test_V2_1_Parse_simple(t *testing.T) {
},
},
}, mani.GetGroups()[0])

assert.Nil(t, mani.GetGroups()[0].Services[0].Credentials)

}

func Test_V2_1_Parse_credentials(t *testing.T) {
sdl, err := ReadFile("./_testdata/v2.1-credentials.yaml")
require.NoError(t, err)

mani, err := sdl.Manifest()
require.NoError(t, err)

assert.Len(t, mani.GetGroups(), 1)

grp := mani.GetGroups()[0]
assert.Len(t, grp.Services, 1)

svc := grp.Services[0]

assert.NotNil(t, svc)

creds := svc.Credentials
assert.NotNil(t, creds)

assert.Equal(t, "https://test.com/v1", creds.Host)
assert.Equal(t, "foo", creds.Username)
assert.Equal(t, "foo", creds.Password)
}

func Test_v2_1_Parse_ProfileNameNotServiceName(t *testing.T) {
Expand Down
Loading