Skip to content

Commit

Permalink
don't merge this: just a test for the corresponding CAPI PR
Browse files Browse the repository at this point in the history
  • Loading branch information
sbueringer committed Jun 10, 2021
1 parent e7e8c13 commit 57655c9
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 122 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ if [[ "$${KUBERNETES_VERSION}" != "" ]]; then
CI_DIR=/tmp/k8s-ci
mkdir -p "$${CI_DIR}"
declare -a PACKAGES_TO_TEST=("kubectl" "kubelet" "kubeadm")
{{- if .IsControlPlaneMachine }}
declare -a CONTAINERS_TO_TEST=("kube-apiserver" "kube-controller-manager" "kube-proxy" "kube-scheduler")
{{- else }}
declare -a CONTAINERS_TO_TEST=("kube-proxy")
{{- end }}
CONTAINER_EXT="tar"
echo "* testing CI version $${KUBERNETES_VERSION}"
# Check for semver
Expand Down

This file was deleted.

21 changes: 15 additions & 6 deletions test/e2e/shared/kubernetesversions/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package kubernetesversions

import (
"bytes"
_ "embed"
"errors"
"fmt"
Expand All @@ -25,18 +26,18 @@ import (
"os/exec"
"path"
"strings"
"text/template"

"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"sigs.k8s.io/cluster-api/test/framework"
"sigs.k8s.io/yaml"
)

var (
//go:embed data/debian_injection_script_control_plane.envsubst.sh
debianInjectionScriptControlPlaneBytes string
//go:embed data/debian_injection_script.envsubst.sh.tpl
debianInjectionScriptBytes string

//go:embed data/debian_injection_script_worker.envsubst.sh
debianInjectionScriptWorkerBytes string
debianInjectionScriptTemplate = template.Must(template.New("").Parse(debianInjectionScriptBytes))

//go:embed data/kustomization.yaml
kustomizationYAMLBytes string
Expand Down Expand Up @@ -93,15 +94,23 @@ func GenerateCIArtifactsInjectedTemplateForDebian(input GenerateCIArtifactsInjec
return "", err
}

patch, err := generateInjectScriptJSONPatch(input.SourceTemplate, "KubeadmControlPlane", input.KubeadmControlPlaneName, "/spec/kubeadmConfigSpec", "/usr/local/bin/ci-artifacts.sh", debianInjectionScriptControlPlaneBytes)
var debianInjectionScriptControlPlaneBytes bytes.Buffer
if err := debianInjectionScriptTemplate.Execute(&debianInjectionScriptControlPlaneBytes, map[string]bool{"IsControlPlaneMachine": true}); err != nil {
return "", err
}
patch, err := generateInjectScriptJSONPatch(input.SourceTemplate, "KubeadmControlPlane", input.KubeadmControlPlaneName, "/spec/kubeadmConfigSpec", "/usr/local/bin/ci-artifacts.sh", debianInjectionScriptControlPlaneBytes.String())
if err != nil {
return "", err
}
if err := os.WriteFile(path.Join(overlayDir, "kubeadmcontrolplane-patch.yaml"), patch, 0o600); err != nil {
return "", err
}

patch, err = generateInjectScriptJSONPatch(input.SourceTemplate, "KubeadmConfigTemplate", input.KubeadmConfigTemplateName, "/spec/template/spec", "/usr/local/bin/ci-artifacts.sh", debianInjectionScriptWorkerBytes)
var debianInjectionScriptWorkerBytes bytes.Buffer
if err := debianInjectionScriptTemplate.Execute(&debianInjectionScriptWorkerBytes, map[string]bool{"IsControlPlaneMachine": false}); err != nil {
return "", err
}
patch, err = generateInjectScriptJSONPatch(input.SourceTemplate, "KubeadmConfigTemplate", input.KubeadmConfigTemplateName, "/spec/template/spec", "/usr/local/bin/ci-artifacts.sh", debianInjectionScriptWorkerBytes.String())
if err != nil {
return "", err
}
Expand Down

0 comments on commit 57655c9

Please sign in to comment.