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

Commit

Permalink
add rhel support
Browse files Browse the repository at this point in the history
add a new case statement for rhel

small changes

cleanups

apply pr review changes

add rhel integration test

enable rhel integration test

enable USE_IMAGE=1 for rhel
  • Loading branch information
Mahmoud Saada committed Mar 31, 2020
1 parent 8c7a98e commit 5ac6b0c
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 10 deletions.
43 changes: 43 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ workflows:
- integration-tests-gcp-ubuntu:
requires:
- build
- integration-tests-gcp-rhel:
requires:
- build
- release:
requires:
- build
Expand Down Expand Up @@ -235,6 +238,46 @@ jobs:
- checkout
- setup_remote_docker

- attach_workspace:
at: /tmp/workspace
- run: /tmp/workspace/cmd/wksctl/wksctl version
- run:
name: Install kubectl
command: |
curl -L $KUBECTL_URL -o kubectl.tar.gz
echo "$KUBECTL_CHECKSUM kubectl.tar.gz" | sha256sum -c
tar xvzf kubectl.tar.gz --strip-components=3
sudo mv kubectl /usr/local/bin
- run:
name: Create VMs
command: $SRCDIR/test/integration/bin/up.sh

- run:
name: Run integration tests
command: $SRCDIR/test/integration/bin/test.sh

- run:
name: Destroy VMs
command: $SRCDIR/test/integration/bin/down.sh
when: always
- run: "true"
integration-tests-gcp-rhel:
docker:
- image: quay.io/wks/build:master-134af34f
environment:
GOPATH: /go/
SRCDIR: /src/github.com/weaveworks/wksctl
KUBECTL_URL: https://dl.k8s.io/v1.10.5/kubernetes-client-linux-amd64.tar.gz
KUBECTL_CHECKSUM: da9d557989a0b9671a610f21642052febb8f70c3cf144c98a8a4f7ecab6bafe2
CREATE_IMAGE: 1
USE_IMAGE: 1
IMAGE_NAME: rhel-cloud/rhel-7
working_directory: /src/github.com/weaveworks/wksctl
steps:
- checkout
- setup_remote_docker

- attach_workspace:
at: /tmp/workspace
- run: /tmp/workspace/cmd/wksctl/wksctl version
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions pkg/apis/wksprovider/machine/os/os.go
Original file line number Diff line number Diff line change
Expand Up @@ -1091,6 +1091,7 @@ func addAuthConfigResources(b *plan.Builder, authConfigMap *v1.ConfigMap, authTy
const (
centOS = "centos"
ubuntu = "ubuntu"
rhel = "rhel"
)

// Identify uses the provided SSH client to identify the operating system of
Expand All @@ -1103,6 +1104,8 @@ func Identify(sshClient *ssh.Client) (*OS, error) {
switch osID {
case centOS:
return &OS{Name: osID, runner: &sudo.Runner{Runner: sshClient}, PkgType: resource.PkgTypeRPM}, nil
case rhel:
return &OS{Name: osID, runner: &sudo.Runner{Runner: sshClient}, PkgType: resource.PkgTypeRHEL}, nil
case ubuntu:
return &OS{Name: osID, runner: &sudo.Runner{Runner: sshClient}, PkgType: resource.PkgTypeDeb}, nil
default:
Expand Down
14 changes: 9 additions & 5 deletions pkg/plan/recipe/install_plans.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package recipe

import (
"fmt"

"io/ioutil"

log "github.com/sirupsen/logrus"
Expand All @@ -19,14 +18,19 @@ func BuildBasePlan(pkgType resource.PkgType) plan.Resource {
b := plan.NewBuilder()

switch pkgType {
case resource.PkgTypeRPM:
case resource.PkgTypeRPM, resource.PkgTypeRHEL:
// Package manager features
b.AddResource("install:yum-utils", &resource.RPM{Name: "yum-utils"})
b.AddResource("install:yum-versionlock", &resource.RPM{Name: "yum-plugin-versionlock"})

// Device Mapper
b.AddResource("install:device-mapper-persistent-data", &resource.RPM{Name: "device-mapper-persistent-data"})
b.AddResource("install:lvm2", &resource.RPM{Name: "lvm2"})
if pkgType == resource.PkgTypeRHEL {
// RHEL requires installation of container-selinux
b.AddResource("install:container-selinux", &resource.RPM{Name: "container-selinux"})
}

case resource.PkgTypeDeb:
// Package manager features
b.AddResource("install:gnupg", &resource.Deb{Name: "gnupg"})
Expand Down Expand Up @@ -88,7 +92,7 @@ func BuildCRIPlan(criSpec *baremetalspecv1.ContainerRuntime, cfg *envcfg.EnvSpec

// Docker runtime
switch pkgType {
case resource.PkgTypeRPM:
case resource.PkgTypeRPM, resource.PkgTypeRHEL:
b.AddResource("install:docker", &resource.RPM{Name: criSpec.Package, Version: criSpec.Version})
case resource.PkgTypeDeb:
// TODO(michal): Use the official docker.com repo
Expand Down Expand Up @@ -140,7 +144,7 @@ func BuildK8SPlan(kubernetesVersion string, kubeletNodeIP string, setSELinuxPerm

// Kubernetes repos
switch pkgType {
case resource.PkgTypeRPM:
case resource.PkgTypeRPM, resource.PkgTypeRHEL:
// do nothing
case resource.PkgTypeDeb:
// XXX: Workaround for https://github.com/weaveworks/wksctl/issues/654 : *.gpg is a binary format, and currently wks is unable to handle
Expand Down Expand Up @@ -171,7 +175,7 @@ func BuildK8SPlan(kubernetesVersion string, kubeletNodeIP string, setSELinuxPerm

// Install k8s packages
switch pkgType {
case resource.PkgTypeRPM:
case resource.PkgTypeRPM, resource.PkgTypeRHEL:
b.AddResource("install:kubelet", &resource.RPM{Name: "kubelet", Version: kubernetesVersion, DisableExcludes: "kubernetes"})
b.AddResource("install:kubectl", &resource.RPM{Name: "kubectl", Version: kubernetesVersion, DisableExcludes: "kubernetes"})
b.AddResource("install:kubeadm",
Expand Down
5 changes: 3 additions & 2 deletions pkg/plan/resource/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ func removeFile(remotePath string, runner plan.Runner) error {
type PkgType string

const (
PkgTypeDeb PkgType = "Deb"
PkgTypeRPM PkgType = "RPM"
PkgTypeDeb PkgType = "Deb"
PkgTypeRPM PkgType = "RPM"
PkgTypeRHEL PkgType = "RHEL"
)

0 comments on commit 5ac6b0c

Please sign in to comment.