mirror of https://github.com/kubernetes/kops.git
Redhat/CentOS fixes per code review
* Always read /etc/redhat-release (symlinked on CentOS) * Make _rhel_family the tag name, not _centos_family * Add comment about writing to "system" systemd area
This commit is contained in:
parent
9596b64121
commit
a47674d10c
|
@ -32,7 +32,7 @@ In addition, we support a few-well known aliases for the owner:
|
|||
|
||||
|
||||
|
||||
## Centos
|
||||
## CentOS
|
||||
|
||||
CentOS7 support is still experimental.
|
||||
|
||||
|
@ -40,6 +40,7 @@ The following steps are known:
|
|||
|
||||
* Accept the agreement at http://aws.amazon.com/marketplace/pp?sku=aw0evgkw8e5c1q413zgy5pjce
|
||||
* Specify the AMI by id (there are no tags): us-east-1: ami-6d1c2007
|
||||
* CentOS7 AMIs are running an older kernel than we prefer to run elsewhere
|
||||
|
||||
## RHEL7
|
||||
|
||||
|
@ -48,3 +49,4 @@ RHEL7 support is still experimental.
|
|||
The following steps are known:
|
||||
|
||||
* Specify the AMI by id (there are no tags): us-east-1: ami-2051294a
|
||||
* RHEL7 AMIs are running an older kernel than we prefer to run elsewhere
|
||||
|
|
|
@ -94,7 +94,7 @@ func (e *Package) Find(c *fi.Context) (*Package, error) {
|
|||
return e.findDpkg(c)
|
||||
}
|
||||
|
||||
if target.HasTag(tags.TagOSFamilyCentos) {
|
||||
if target.HasTag(tags.TagOSFamilyRHEL) {
|
||||
return e.findYum(c)
|
||||
}
|
||||
|
||||
|
@ -252,7 +252,7 @@ func (_ *Package) RenderLocal(t *local.LocalTarget, a, e, changes *Package) erro
|
|||
var args []string
|
||||
if t.HasTag(tags.TagOSFamilyDebian) {
|
||||
args = []string{"dpkg", "-i", local}
|
||||
} else if t.HasTag(tags.TagOSFamilyCentos) {
|
||||
} else if t.HasTag(tags.TagOSFamilyRHEL) {
|
||||
args = []string{"/usr/bin/rpm", "-i", local}
|
||||
} else {
|
||||
return fmt.Errorf("unsupported package system")
|
||||
|
@ -268,7 +268,7 @@ func (_ *Package) RenderLocal(t *local.LocalTarget, a, e, changes *Package) erro
|
|||
if t.HasTag(tags.TagOSFamilyDebian) {
|
||||
args = []string{"apt-get", "install", "--yes", e.Name}
|
||||
|
||||
} else if t.HasTag(tags.TagOSFamilyCentos) {
|
||||
} else if t.HasTag(tags.TagOSFamilyRHEL) {
|
||||
args = []string{"/usr/bin/yum", "install", "-y", e.Name}
|
||||
} else {
|
||||
return fmt.Errorf("unsupported package system")
|
||||
|
@ -293,9 +293,9 @@ func (_ *Package) RenderLocal(t *local.LocalTarget, a, e, changes *Package) erro
|
|||
}
|
||||
|
||||
changes.Healthy = nil
|
||||
} else if t.HasTag(tags.TagOSFamilyCentos) {
|
||||
// We can't reach here anyway...
|
||||
return fmt.Errorf("package repair not supported on centos")
|
||||
} else if t.HasTag(tags.TagOSFamilyRHEL) {
|
||||
// Not set on TagOSFamilyRHEL, we can't currently reach here anyway...
|
||||
return fmt.Errorf("package repair not supported on RHEL/CentOS")
|
||||
} else {
|
||||
return fmt.Errorf("unsupported package system")
|
||||
}
|
||||
|
|
|
@ -20,6 +20,10 @@ import (
|
|||
|
||||
const (
|
||||
debianSystemdSystemPath = "/lib/systemd/system"
|
||||
|
||||
// TODO: Generally only repo packages write to /usr/lib/systemd/system on _rhel_family
|
||||
// But we use it in two ways: we update the docker manifest, and we install our own
|
||||
// package (protokube, kubelet). Maybe we should have the idea of a "system" package.
|
||||
centosSystemdSystemPath = "/usr/lib/systemd/system"
|
||||
)
|
||||
|
||||
|
@ -114,7 +118,7 @@ func getSystemdStatus(name string) (map[string]string, error) {
|
|||
func (e *Service) systemdSystemPath(target tags.HasTags) (string, error) {
|
||||
if target.HasTag(tags.TagOSFamilyDebian) {
|
||||
return debianSystemdSystemPath, nil
|
||||
} else if target.HasTag(tags.TagOSFamilyCentos) {
|
||||
} else if target.HasTag(tags.TagOSFamilyRHEL) {
|
||||
return centosSystemdSystemPath, nil
|
||||
} else {
|
||||
return "", fmt.Errorf("unsupported systemd system")
|
||||
|
|
|
@ -40,27 +40,17 @@ func FindOSTags(rootfs string) ([]string, error) {
|
|||
glog.Warningf("error reading /etc/debian_version: %v", err)
|
||||
}
|
||||
|
||||
// Centos has /etc/centos-release
|
||||
centosRelease, err := ioutil.ReadFile(path.Join(rootfs, "etc/centos-release"))
|
||||
if err == nil {
|
||||
for _, line := range strings.Split(string(centosRelease), "\n") {
|
||||
line = strings.TrimSpace(line)
|
||||
if strings.HasPrefix(line, "CentOS Linux release 7.") {
|
||||
return []string{"_centos7", tags.TagOSFamilyCentos, tags.TagSystemd}, nil
|
||||
}
|
||||
}
|
||||
glog.Warningf("unhandled centos-release info %q", string(lsbRelease))
|
||||
} else if !os.IsNotExist(err) {
|
||||
glog.Warningf("error reading /etc/centos-release: %v", err)
|
||||
}
|
||||
|
||||
// Redhat has /etc/redhat-release
|
||||
// Centos has /etc/centos-release
|
||||
redhatRelease, err := ioutil.ReadFile(path.Join(rootfs, "etc/redhat-release"))
|
||||
if err == nil {
|
||||
for _, line := range strings.Split(string(redhatRelease), "\n") {
|
||||
line = strings.TrimSpace(line)
|
||||
if strings.HasPrefix(line, "Red Hat Enterprise Linux Server release 7.") {
|
||||
return []string{"_rhel7", tags.TagOSFamilyCentos, tags.TagSystemd}, nil
|
||||
return []string{"_rhel7", tags.TagOSFamilyRHEL, tags.TagSystemd}, nil
|
||||
}
|
||||
if strings.HasPrefix(line, "CentOS Linux release 7.") {
|
||||
return []string{"_centos7", tags.TagOSFamilyRHEL, tags.TagSystemd}, nil
|
||||
}
|
||||
}
|
||||
glog.Warningf("unhandled redhat-release info %q", string(lsbRelease))
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package tags
|
||||
|
||||
const (
|
||||
TagOSFamilyCentos = "_centos_family"
|
||||
TagOSFamilyRHEL = "_rhel_family"
|
||||
TagOSFamilyDebian = "_debian_family"
|
||||
|
||||
TagSystemd = "_systemd"
|
||||
|
|
Loading…
Reference in New Issue