mirror of https://github.com/kubernetes/kops.git
Merge pull request #13165 from justinsb/irsa_terraform
tests: ensure that we use ACLs with memfs
This commit is contained in:
commit
0985005bc8
|
|
@ -87,6 +87,18 @@ func (e *ManagedFile) Find(c *fi.Context) (*ManagedFile, error) {
|
|||
}
|
||||
}
|
||||
|
||||
if memfsfile, ok := filePath.(*vfs.MemFSPath); ok {
|
||||
public, err := memfsfile.IsPublic()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
actual.Public = &public
|
||||
|
||||
if e.Public == nil {
|
||||
e.Public = fi.Bool(false)
|
||||
}
|
||||
}
|
||||
|
||||
// Avoid spurious changes
|
||||
actual.Lifecycle = e.Lifecycle
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ import (
|
|||
type MemFSPath struct {
|
||||
context *MemFSContext
|
||||
location string
|
||||
acl ACL
|
||||
|
||||
mutex sync.Mutex
|
||||
contents []byte
|
||||
|
|
@ -109,6 +110,7 @@ func (p *MemFSPath) WriteFile(r io.ReadSeeker, acl ACL) error {
|
|||
return fmt.Errorf("error reading data: %v", err)
|
||||
}
|
||||
p.contents = data
|
||||
p.acl = acl
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
@ -193,6 +195,21 @@ func (p *MemFSPath) Location() string {
|
|||
return p.location
|
||||
}
|
||||
|
||||
func (p *MemFSPath) IsPublic() (bool, error) {
|
||||
if p.acl == nil {
|
||||
return false, nil
|
||||
}
|
||||
s3Acl, ok := p.acl.(*S3Acl)
|
||||
if !ok {
|
||||
return false, fmt.Errorf("expected acl to be S3Acl, was %T", p.acl)
|
||||
}
|
||||
isPublic := false
|
||||
if s3Acl.RequestACL != nil {
|
||||
isPublic = *s3Acl.RequestACL == "public-read"
|
||||
}
|
||||
return isPublic, nil
|
||||
}
|
||||
|
||||
// Terraform support for integration tests.
|
||||
|
||||
func (p *MemFSPath) TerraformProvider() (*TerraformProvider, error) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue