mirror of
https://github.com/kairos-io/osbuilder.git
synced 2025-12-24 20:34:11 +00:00
Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ac60a3dc91 | ||
|
|
93769cf295 | ||
|
|
7e4846785d | ||
|
|
cb21b7742b | ||
|
|
6dde050079 | ||
|
|
ad3860dbd3 | ||
|
|
3bc7583466 | ||
|
|
6951d26fda | ||
|
|
da695e3461 | ||
|
|
287ed276eb | ||
|
|
29da8c271e | ||
|
|
2997c7aa2f | ||
|
|
78a728910d | ||
|
|
680907ab43 | ||
|
|
b3e7dcbf59 |
2
.github/workflows/image.yml
vendored
2
.github/workflows/image.yml
vendored
@@ -18,7 +18,7 @@ jobs:
|
||||
- name: Prepare
|
||||
id: prep
|
||||
run: |
|
||||
DOCKER_IMAGE=quay.io/c3os/osbuilder
|
||||
DOCKER_IMAGE=quay.io/kairos/osbuilder
|
||||
VERSION=latest
|
||||
SHORTREF=${GITHUB_SHA::8}
|
||||
# If this is git tag, use the tag name as a docker tag
|
||||
|
||||
19
.github/workflows/test.yml
vendored
Normal file
19
.github/workflows/test.yml
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
---
|
||||
name: 'test'
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
jobs:
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Test
|
||||
run: |
|
||||
make kind-e2e-tests
|
||||
63
.github/workflows/tool-image.yml
vendored
Normal file
63
.github/workflows/tool-image.yml
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
---
|
||||
name: 'build tools container images'
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
jobs:
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Prepare
|
||||
id: prep
|
||||
run: |
|
||||
DOCKER_IMAGE=quay.io/kairos/osbuilder-tools
|
||||
VERSION=latest
|
||||
SHORTREF=${GITHUB_SHA::8}
|
||||
# If this is git tag, use the tag name as a docker tag
|
||||
if [[ $GITHUB_REF == refs/tags/* ]]; then
|
||||
VERSION=${GITHUB_REF#refs/tags/}
|
||||
fi
|
||||
TAGS="${DOCKER_IMAGE}:${VERSION},${DOCKER_IMAGE}:${SHORTREF}"
|
||||
# If the VERSION looks like a version number, assume that
|
||||
# this is the most recent version of the image and also
|
||||
# tag it 'latest'.
|
||||
if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
|
||||
TAGS="$TAGS,${DOCKER_IMAGE}:latest"
|
||||
fi
|
||||
# Set output parameters.
|
||||
echo ::set-output name=tags::${TAGS}
|
||||
echo ::set-output name=docker_image::${DOCKER_IMAGE}
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@master
|
||||
with:
|
||||
platforms: all
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
id: buildx
|
||||
uses: docker/setup-buildx-action@master
|
||||
|
||||
- name: Login to DockerHub
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
registry: quay.io
|
||||
username: ${{ secrets.QUAY_USERNAME }}
|
||||
password: ${{ secrets.QUAY_PASSWORD }}
|
||||
|
||||
- name: Build
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
builder: ${{ steps.buildx.outputs.name }}
|
||||
context: ./tools-image
|
||||
file: ./tools-image/Dockerfile
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.prep.outputs.tags }}
|
||||
19
Makefile
19
Makefile
@@ -4,8 +4,8 @@
|
||||
# - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2)
|
||||
# - use environment variables to overwrite this value (e.g export VERSION=0.0.2)
|
||||
VERSION ?= 0.0.1
|
||||
IMG ?= quay.io/c3os/osbuilder:test
|
||||
CLUSTER_NAME?="c3os-osbuilder-e2e"
|
||||
IMG ?= quay.io/kairos/osbuilder:test
|
||||
CLUSTER_NAME?="kairos-osbuilder-e2e"
|
||||
export ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
|
||||
|
||||
# CHANNELS define the bundle channels used in the bundle.
|
||||
@@ -31,8 +31,8 @@ BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)
|
||||
# This variable is used to construct full image tags for bundle and catalog images.
|
||||
#
|
||||
# For example, running 'make bundle-build bundle-push catalog-build catalog-push' will build and push both
|
||||
# c3os-x.io/osbuilder-operator-bundle:$VERSION and c3os-x.io/osbuilder-operator-catalog:$VERSION.
|
||||
IMAGE_TAG_BASE ?= c3os-x.io/osbuilder-operator
|
||||
# kairos.io/osbuilder-bundle:$VERSION and kairos.io/osbuilder-catalog:$VERSION.
|
||||
IMAGE_TAG_BASE ?= kairos.io/osbuilder
|
||||
|
||||
# BUNDLE_IMG defines the image:tag used for the bundle.
|
||||
# You can use it as an arg. (E.g make bundle-build BUNDLE_IMG=<some-registry>/<project-name-bundle>:<tag>)
|
||||
@@ -172,6 +172,7 @@ $(LOCALBIN):
|
||||
|
||||
## Tool Binaries
|
||||
KUSTOMIZE ?= $(LOCALBIN)/kustomize
|
||||
GINKGO ?= $(LOCALBIN)/ginkgo
|
||||
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
|
||||
ENVTEST ?= $(LOCALBIN)/setup-envtest
|
||||
|
||||
@@ -190,6 +191,10 @@ controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessar
|
||||
$(CONTROLLER_GEN): $(LOCALBIN)
|
||||
GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION)
|
||||
|
||||
ginkgo: $(GINKGO) ## Download ginkgo locally if necessary.
|
||||
$(GINKGO): $(LOCALBIN)
|
||||
GOBIN=$(LOCALBIN) go install -mod=mod github.com/onsi/ginkgo/v2/ginkgo
|
||||
|
||||
.PHONY: envtest
|
||||
envtest: $(ENVTEST) ## Download envtest-setup locally if necessary.
|
||||
$(ENVTEST): $(LOCALBIN)
|
||||
@@ -266,9 +271,9 @@ test_deps:
|
||||
|
||||
.PHONY: unit-tests
|
||||
unit-tests: test_deps
|
||||
ginkgo -r -v --covermode=atomic --coverprofile=coverage.out -p -r ./pkg/...
|
||||
$(GINKGO) -r -v --covermode=atomic --coverprofile=coverage.out -p -r ./pkg/...
|
||||
|
||||
e2e-tests:
|
||||
KUBE_VERSION=${KUBE_VERSION} $(ROOT_DIR)/script/test.sh
|
||||
GINKGO=$(GINKGO) KUBE_VERSION=${KUBE_VERSION} $(ROOT_DIR)/script/test.sh
|
||||
|
||||
kind-e2e-tests: kind-setup install undeploy-dev deploy-dev e2e-tests
|
||||
kind-e2e-tests: ginkgo kind-setup install undeploy-dev deploy-dev e2e-tests
|
||||
8
PROJECT
8
PROJECT
@@ -1,19 +1,19 @@
|
||||
domain: c3os-x.io
|
||||
domain: kairos.io
|
||||
layout:
|
||||
- go.kubebuilder.io/v3
|
||||
plugins:
|
||||
manifests.sdk.operatorframework.io/v2: {}
|
||||
scorecard.sdk.operatorframework.io/v2: {}
|
||||
projectName: osartifactbuilder-operator
|
||||
repo: github.com/c3os-io/osbuilder-operator
|
||||
repo: github.com/kairos-io/osbuilder
|
||||
resources:
|
||||
- api:
|
||||
crdVersion: v1
|
||||
namespaced: true
|
||||
controller: true
|
||||
domain: c3os-x.io
|
||||
domain: kairos.io
|
||||
group: build
|
||||
kind: OSArtifact
|
||||
path: github.com/c3os-io/osbuilder-operator/api/v1alpha1
|
||||
path: github.com/kairos-io/osbuilder/api/v1alpha1
|
||||
version: v1alpha1
|
||||
version: "3"
|
||||
|
||||
@@ -15,8 +15,8 @@ limitations under the License.
|
||||
*/
|
||||
|
||||
// Package v1alpha1 contains API Schema definitions for the build v1alpha1 API group
|
||||
//+kubebuilder:object:generate=true
|
||||
//+groupName=build.c3os-x.io
|
||||
// +kubebuilder:object:generate=true
|
||||
// +groupName=build.kairos.io
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
@@ -26,7 +26,7 @@ import (
|
||||
|
||||
var (
|
||||
// GroupVersion is group version used to register these objects
|
||||
GroupVersion = schema.GroupVersion{Group: "build.c3os-x.io", Version: "v1alpha1"}
|
||||
GroupVersion = schema.GroupVersion{Group: "build.kairos.io", Version: "v1alpha1"}
|
||||
|
||||
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
|
||||
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
|
||||
|
||||
@@ -35,7 +35,31 @@ type OSArtifactSpec struct {
|
||||
CloudConfig string `json:"cloudConfig,omitempty"`
|
||||
GRUBConfig string `json:"grubConfig,omitempty"`
|
||||
|
||||
PullFromKube bool `json:"pullFromKube,omitempty"`
|
||||
Bundles []string `json:"bundles,omitempty"`
|
||||
PullOptions Pull `json:"pull,omitempty"`
|
||||
OSRelease string `json:"osRelease,omitempty"`
|
||||
PushOptions Push `json:"push,omitempty"`
|
||||
}
|
||||
|
||||
type Push struct {
|
||||
Push bool `json:"push,omitempty"`
|
||||
ImageName string `json:"imageName,omitempty"`
|
||||
ContainerRegistryCredentials *SecretKeySelector `json:"containerRegistryCredentials,omitempty"`
|
||||
}
|
||||
|
||||
type Pull struct {
|
||||
ContainerRegistryCredentials *SecretKeySelector `json:"containerRegistryCredentials,omitempty"`
|
||||
}
|
||||
type LocalObjectReference struct {
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type SecretKeySelector struct {
|
||||
LocalObjectReference `json:",inline"`
|
||||
// +optional
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
// +optional
|
||||
Key string `json:"key,omitempty"`
|
||||
}
|
||||
|
||||
// OSArtifactStatus defines the observed state of OSArtifact
|
||||
|
||||
@@ -25,12 +25,27 @@ import (
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *LocalObjectReference) DeepCopyInto(out *LocalObjectReference) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LocalObjectReference.
|
||||
func (in *LocalObjectReference) DeepCopy() *LocalObjectReference {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(LocalObjectReference)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *OSArtifact) DeepCopyInto(out *OSArtifact) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
out.Spec = in.Spec
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
out.Status = in.Status
|
||||
}
|
||||
|
||||
@@ -87,6 +102,13 @@ func (in *OSArtifactList) DeepCopyObject() runtime.Object {
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *OSArtifactSpec) DeepCopyInto(out *OSArtifactSpec) {
|
||||
*out = *in
|
||||
if in.Bundles != nil {
|
||||
in, out := &in.Bundles, &out.Bundles
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
in.PullOptions.DeepCopyInto(&out.PullOptions)
|
||||
in.PushOptions.DeepCopyInto(&out.PushOptions)
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OSArtifactSpec.
|
||||
@@ -113,3 +135,59 @@ func (in *OSArtifactStatus) DeepCopy() *OSArtifactStatus {
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Pull) DeepCopyInto(out *Pull) {
|
||||
*out = *in
|
||||
if in.ContainerRegistryCredentials != nil {
|
||||
in, out := &in.ContainerRegistryCredentials, &out.ContainerRegistryCredentials
|
||||
*out = new(SecretKeySelector)
|
||||
**out = **in
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Pull.
|
||||
func (in *Pull) DeepCopy() *Pull {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Pull)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Push) DeepCopyInto(out *Push) {
|
||||
*out = *in
|
||||
if in.ContainerRegistryCredentials != nil {
|
||||
in, out := &in.ContainerRegistryCredentials, &out.ContainerRegistryCredentials
|
||||
*out = new(SecretKeySelector)
|
||||
**out = **in
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Push.
|
||||
func (in *Push) DeepCopy() *Push {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Push)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *SecretKeySelector) DeepCopyInto(out *SecretKeySelector) {
|
||||
*out = *in
|
||||
out.LocalObjectReference = in.LocalObjectReference
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecretKeySelector.
|
||||
func (in *SecretKeySelector) DeepCopy() *SecretKeySelector {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(SecretKeySelector)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
@@ -5,9 +5,9 @@ metadata:
|
||||
annotations:
|
||||
controller-gen.kubebuilder.io/version: v0.9.0
|
||||
creationTimestamp: null
|
||||
name: osartifacts.build.c3os-x.io
|
||||
name: osartifacts.build.kairos.io
|
||||
spec:
|
||||
group: build.c3os-x.io
|
||||
group: build.kairos.io
|
||||
names:
|
||||
kind: OSArtifact
|
||||
listKind: OSArtifactList
|
||||
@@ -35,7 +35,15 @@ spec:
|
||||
spec:
|
||||
description: OSArtifactSpec defines the desired state of OSArtifact
|
||||
properties:
|
||||
bundles:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
cloudConfig:
|
||||
description: 'TODO: treat cloudconfig as a secret, and take a secretRef
|
||||
where to store it (optionally)'
|
||||
type: string
|
||||
grubConfig:
|
||||
type: string
|
||||
imageName:
|
||||
description: Foo is an example field of OSArtifact. Edit osartifact_types.go
|
||||
@@ -43,6 +51,40 @@ spec:
|
||||
type: string
|
||||
iso:
|
||||
type: boolean
|
||||
osRelease:
|
||||
type: string
|
||||
pull:
|
||||
properties:
|
||||
containerRegistryCredentials:
|
||||
properties:
|
||||
key:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
namespace:
|
||||
type: string
|
||||
required:
|
||||
- name
|
||||
type: object
|
||||
type: object
|
||||
push:
|
||||
properties:
|
||||
containerRegistryCredentials:
|
||||
properties:
|
||||
key:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
namespace:
|
||||
type: string
|
||||
required:
|
||||
- name
|
||||
type: object
|
||||
imageName:
|
||||
type: string
|
||||
push:
|
||||
type: boolean
|
||||
type: object
|
||||
type: object
|
||||
status:
|
||||
description: OSArtifactStatus defines the observed state of OSArtifact
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# since it depends on service name and namespace that are out of this kustomize package.
|
||||
# It should be run by config/default
|
||||
resources:
|
||||
- bases/build.c3os-x.io_osartifacts.yaml
|
||||
- bases/build.kairos.io_osartifacts.yaml
|
||||
#+kubebuilder:scaffold:crdkustomizeresource
|
||||
|
||||
patchesStrategicMerge:
|
||||
|
||||
@@ -4,4 +4,4 @@ kind: CustomResourceDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
|
||||
name: osartifacts.build.c3os-x.io
|
||||
name: osartifacts.build.kairos.io
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
name: osartifacts.build.c3os-x.io
|
||||
name: osartifacts.build.kairos.io
|
||||
spec:
|
||||
conversion:
|
||||
strategy: Webhook
|
||||
|
||||
@@ -8,7 +8,7 @@ webhook:
|
||||
port: 9443
|
||||
leaderElection:
|
||||
leaderElect: true
|
||||
resourceName: 98ca89ca.c3os-x.io
|
||||
resourceName: 98ca89ca.kairos.io
|
||||
# leaderElectionReleaseOnCancel defines if the leader should step down volume
|
||||
# when the Manager ends. This requires the binary to immediately end when the
|
||||
# Manager is stopped, otherwise, this setting is unsafe. Setting this significantly
|
||||
|
||||
@@ -12,5 +12,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
images:
|
||||
- name: controller
|
||||
newName: quay.io/c3os/osbuilder
|
||||
newName: quay.io/kairos/osbuilder
|
||||
newTag: test
|
||||
|
||||
@@ -5,7 +5,7 @@ metadata:
|
||||
name: osartifact-editor-role
|
||||
rules:
|
||||
- apiGroups:
|
||||
- build.c3os-x.io
|
||||
- build.kairos.io
|
||||
resources:
|
||||
- osartifacts
|
||||
verbs:
|
||||
@@ -17,7 +17,7 @@ rules:
|
||||
- update
|
||||
- watch
|
||||
- apiGroups:
|
||||
- build.c3os-x.io
|
||||
- build.kairos.io
|
||||
resources:
|
||||
- osartifacts/status
|
||||
verbs:
|
||||
|
||||
@@ -5,7 +5,7 @@ metadata:
|
||||
name: osartifact-viewer-role
|
||||
rules:
|
||||
- apiGroups:
|
||||
- build.c3os-x.io
|
||||
- build.kairos.io
|
||||
resources:
|
||||
- osartifacts
|
||||
verbs:
|
||||
@@ -13,7 +13,7 @@ rules:
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- build.c3os-x.io
|
||||
- build.kairos.io
|
||||
resources:
|
||||
- osartifacts/status
|
||||
verbs:
|
||||
|
||||
@@ -6,7 +6,7 @@ metadata:
|
||||
name: manager-role
|
||||
rules:
|
||||
- apiGroups:
|
||||
- build.c3os-x.io
|
||||
- build.kairos.io
|
||||
resources:
|
||||
- osartifacts
|
||||
verbs:
|
||||
@@ -18,13 +18,13 @@ rules:
|
||||
- update
|
||||
- watch
|
||||
- apiGroups:
|
||||
- build.c3os-x.io
|
||||
- build.kairos.io
|
||||
resources:
|
||||
- osartifacts/finalizers
|
||||
verbs:
|
||||
- update
|
||||
- apiGroups:
|
||||
- build.c3os-x.io
|
||||
- build.kairos.io
|
||||
resources:
|
||||
- osartifacts/status
|
||||
verbs:
|
||||
|
||||
@@ -6,7 +6,7 @@ metadata:
|
||||
name: manager-role
|
||||
rules:
|
||||
- apiGroups:
|
||||
- build.c3os-x.io
|
||||
- build.kairos.io
|
||||
resources:
|
||||
- osartifacts
|
||||
verbs:
|
||||
@@ -18,13 +18,13 @@ rules:
|
||||
- update
|
||||
- watch
|
||||
- apiGroups:
|
||||
- build.c3os-x.io
|
||||
- build.kairos.io
|
||||
resources:
|
||||
- osartifacts/finalizers
|
||||
verbs:
|
||||
- update
|
||||
- apiGroups:
|
||||
- build.c3os-x.io
|
||||
- build.kairos.io
|
||||
resources:
|
||||
- osartifacts/status
|
||||
verbs:
|
||||
@@ -32,7 +32,7 @@ rules:
|
||||
- patch
|
||||
- update
|
||||
- apiGroups:
|
||||
- build.c3os-x.io
|
||||
- build.kairos.io
|
||||
resources:
|
||||
- osartifacts/finalizers
|
||||
verbs:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
apiVersion: build.c3os-x.io/v1alpha1
|
||||
apiVersion: build.kairos.io/v1alpha1
|
||||
kind: OSArtifact
|
||||
metadata:
|
||||
name: osartifact-sample
|
||||
|
||||
@@ -17,7 +17,7 @@ limitations under the License.
|
||||
package controllers
|
||||
|
||||
import (
|
||||
buildv1alpha1 "github.com/c3os-io/osbuilder-operator/api/v1alpha1"
|
||||
buildv1alpha1 "github.com/kairos-io/osbuilder/api/v1alpha1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
@@ -32,7 +32,8 @@ func (r *OSArtifactReconciler) genConfigMap(artifact buildv1alpha1.OSArtifact) *
|
||||
OwnerReferences: genOwner(artifact),
|
||||
},
|
||||
Data: map[string]string{
|
||||
"config": artifact.Spec.CloudConfig,
|
||||
"grub.cfg": artifact.Spec.GRUBConfig,
|
||||
"config": artifact.Spec.CloudConfig,
|
||||
"grub.cfg": artifact.Spec.GRUBConfig,
|
||||
"os-release": artifact.Spec.OSRelease,
|
||||
}}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ package controllers
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
buildv1alpha1 "github.com/c3os-io/osbuilder-operator/api/v1alpha1"
|
||||
buildv1alpha1 "github.com/kairos-io/osbuilder/api/v1alpha1"
|
||||
appsv1 "k8s.io/api/apps/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
|
||||
@@ -31,6 +31,79 @@ func genDeploymentLabel(s string) map[string]string {
|
||||
"osbuild": "workload" + s,
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Handle registry auth
|
||||
// TODO: This shells out, but needs ENV_VAR with key refs mapping
|
||||
func unpackContainer(id, containerImage, pullImage string, pullOptions buildv1alpha1.Pull) v1.Container {
|
||||
return v1.Container{
|
||||
ImagePullPolicy: v1.PullAlways,
|
||||
Name: fmt.Sprintf("pull-image-%s", id),
|
||||
Image: containerImage,
|
||||
Command: []string{"/bin/bash", "-cxe"},
|
||||
Args: []string{
|
||||
fmt.Sprintf(
|
||||
"luet util unpack %s %s",
|
||||
pullImage,
|
||||
"/rootfs",
|
||||
),
|
||||
},
|
||||
VolumeMounts: []v1.VolumeMount{
|
||||
{
|
||||
Name: "rootfs",
|
||||
MountPath: "/rootfs",
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func createImageContainer(containerImage string, pushOptions buildv1alpha1.Push) v1.Container {
|
||||
return v1.Container{
|
||||
ImagePullPolicy: v1.PullAlways,
|
||||
Name: "create-image",
|
||||
Image: containerImage,
|
||||
Command: []string{"/bin/bash", "-cxe"},
|
||||
Args: []string{
|
||||
fmt.Sprintf(
|
||||
"tar -czvpf test.tar -C /rootfs . && luet util pack %s test.tar image.tar && mv image.tar /public",
|
||||
pushOptions.ImageName,
|
||||
),
|
||||
},
|
||||
VolumeMounts: []v1.VolumeMount{
|
||||
{
|
||||
Name: "rootfs",
|
||||
MountPath: "/rootfs",
|
||||
},
|
||||
{
|
||||
Name: "public",
|
||||
MountPath: "/public",
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func osReleaseContainer(containerImage string) v1.Container {
|
||||
return v1.Container{
|
||||
ImagePullPolicy: v1.PullAlways,
|
||||
Name: "os-release",
|
||||
Image: containerImage,
|
||||
Command: []string{"/bin/bash", "-cxe"},
|
||||
Args: []string{
|
||||
"cp -rfv /etc/os-release /rootfs/etc/os-release",
|
||||
},
|
||||
VolumeMounts: []v1.VolumeMount{
|
||||
{
|
||||
Name: "config",
|
||||
MountPath: "/etc/os-release",
|
||||
SubPath: "os-release",
|
||||
},
|
||||
{
|
||||
Name: "rootfs",
|
||||
MountPath: "/rootfs",
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (r *OSArtifactReconciler) genDeployment(artifact buildv1alpha1.OSArtifact) *appsv1.Deployment {
|
||||
objMeta := metav1.ObjectMeta{
|
||||
Name: artifact.Name,
|
||||
@@ -38,19 +111,21 @@ func (r *OSArtifactReconciler) genDeployment(artifact buildv1alpha1.OSArtifact)
|
||||
OwnerReferences: genOwner(artifact),
|
||||
}
|
||||
|
||||
pushImage := artifact.Spec.PushOptions.Push
|
||||
|
||||
privileged := false
|
||||
serviceAccount := false
|
||||
|
||||
buildIsoContainer := v1.Container{
|
||||
ImagePullPolicy: v1.PullAlways,
|
||||
SecurityContext: &v1.SecurityContext{Privileged: &privileged},
|
||||
Name: "build-iso",
|
||||
Image: r.BuildImage,
|
||||
Image: r.ToolImage,
|
||||
Command: []string{"/bin/bash", "-cxe"},
|
||||
Args: []string{
|
||||
fmt.Sprintf(
|
||||
"elemental --debug --name %s build-iso --date=false --overlay-iso /iso/iso-overlay %s --output /public",
|
||||
"/entrypoint.sh --debug --name %s build-iso --date=false --overlay-iso /iso/iso-overlay --output /public dir:/rootfs",
|
||||
artifact.Name,
|
||||
artifact.Spec.ImageName,
|
||||
),
|
||||
},
|
||||
VolumeMounts: []v1.VolumeMount{
|
||||
@@ -64,35 +139,10 @@ func (r *OSArtifactReconciler) genDeployment(artifact buildv1alpha1.OSArtifact)
|
||||
SubPath: "config",
|
||||
},
|
||||
{
|
||||
Name: "grub",
|
||||
Name: "config",
|
||||
MountPath: "/iso/iso-overlay/boot/grub2/grub.cfg",
|
||||
SubPath: "grub.cfg",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
if artifact.Spec.PullFromKube {
|
||||
buildIsoContainer.Args = []string{
|
||||
fmt.Sprintf(
|
||||
"elemental --debug --name %s build-iso --date=false --overlay-iso /iso/iso-overlay --output /public /rootfs",
|
||||
artifact.Name,
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
pullContainer := v1.Container{
|
||||
ImagePullPolicy: v1.PullAlways,
|
||||
Name: "build-iso",
|
||||
Image: artifact.Spec.ImageName,
|
||||
Command: []string{"/bin/bash", "-cxe"},
|
||||
Args: []string{
|
||||
fmt.Sprintf(
|
||||
"rsync -aqAX --exclude='mnt' --exclude='proc' --exclude='sys' --exclude='dev' --exclude='tmp' %s %s",
|
||||
"/",
|
||||
"/rootfs",
|
||||
),
|
||||
},
|
||||
VolumeMounts: []v1.VolumeMount{
|
||||
{
|
||||
Name: "rootfs",
|
||||
MountPath: "/rootfs",
|
||||
@@ -134,11 +184,24 @@ func (r *OSArtifactReconciler) genDeployment(artifact buildv1alpha1.OSArtifact)
|
||||
},
|
||||
}
|
||||
|
||||
pod.InitContainers = []v1.Container{buildIsoContainer}
|
||||
if artifact.Spec.PullFromKube {
|
||||
// pull first
|
||||
pod.InitContainers = append([]v1.Container{pullContainer}, pod.InitContainers...)
|
||||
pod.InitContainers = []v1.Container{unpackContainer("baseimage", r.ToolImage, artifact.Spec.ImageName, artifact.Spec.PullOptions)}
|
||||
|
||||
for i, bundle := range artifact.Spec.Bundles {
|
||||
pod.InitContainers = append(pod.InitContainers, unpackContainer(fmt.Sprint(i), r.ToolImage, bundle, artifact.Spec.PullOptions))
|
||||
}
|
||||
|
||||
if artifact.Spec.OSRelease != "" {
|
||||
pod.InitContainers = append(pod.InitContainers, osReleaseContainer(r.ToolImage))
|
||||
|
||||
}
|
||||
|
||||
pod.InitContainers = append(pod.InitContainers, buildIsoContainer)
|
||||
|
||||
if pushImage {
|
||||
pod.InitContainers = append(pod.InitContainers, createImageContainer(r.ToolImage, artifact.Spec.PushOptions))
|
||||
|
||||
}
|
||||
|
||||
pod.Containers = []v1.Container{servingContainer}
|
||||
|
||||
deploymentLabels := genDeploymentLabel(artifact.Name)
|
||||
|
||||
@@ -21,7 +21,7 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
buildv1alpha1 "github.com/c3os-io/osbuilder-operator/api/v1alpha1"
|
||||
buildv1alpha1 "github.com/kairos-io/osbuilder/api/v1alpha1"
|
||||
"github.com/pkg/errors"
|
||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
@@ -38,9 +38,9 @@ import (
|
||||
// OSArtifactReconciler reconciles a OSArtifact object
|
||||
type OSArtifactReconciler struct {
|
||||
client.Client
|
||||
Scheme *runtime.Scheme
|
||||
clientSet *kubernetes.Clientset
|
||||
ServingImage, BuildImage string
|
||||
Scheme *runtime.Scheme
|
||||
clientSet *kubernetes.Clientset
|
||||
ServingImage, ToolImage string
|
||||
}
|
||||
|
||||
func genOwner(artifact buildv1alpha1.OSArtifact) []metav1.OwnerReference {
|
||||
@@ -53,9 +53,9 @@ func genOwner(artifact buildv1alpha1.OSArtifact) []metav1.OwnerReference {
|
||||
}
|
||||
}
|
||||
|
||||
//+kubebuilder:rbac:groups=build.c3os-x.io,resources=osartifacts,verbs=get;list;watch;create;update;patch;delete
|
||||
//+kubebuilder:rbac:groups=build.c3os-x.io,resources=osartifacts/status,verbs=get;update;patch
|
||||
//+kubebuilder:rbac:groups=build.c3os-x.io,resources=osartifacts/finalizers,verbs=update
|
||||
//+kubebuilder:rbac:groups=build.kairos.io,resources=osartifacts,verbs=get;list;watch;create;update;patch;delete
|
||||
//+kubebuilder:rbac:groups=build.kairos.io,resources=osartifacts/status,verbs=get;update;patch
|
||||
//+kubebuilder:rbac:groups=build.kairos.io,resources=osartifacts/finalizers,verbs=update
|
||||
|
||||
// Reconcile is part of the main kubernetes reconciliation loop which aims to
|
||||
// move the current state of the cluster closer to the desired state.
|
||||
@@ -110,6 +110,7 @@ func (r *OSArtifactReconciler) Reconcile(ctx context.Context, req ctrl.Request)
|
||||
logger.Error(err, "Failed while creating svc")
|
||||
return ctrl.Result{}, err
|
||||
}
|
||||
|
||||
return ctrl.Result{Requeue: true}, err
|
||||
}
|
||||
if err != nil {
|
||||
|
||||
@@ -17,10 +17,9 @@ limitations under the License.
|
||||
package controllers
|
||||
|
||||
import (
|
||||
buildv1alpha1 "github.com/c3os-io/osbuilder-operator/api/v1alpha1"
|
||||
buildv1alpha1 "github.com/kairos-io/osbuilder/api/v1alpha1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
)
|
||||
|
||||
func genService(artifact buildv1alpha1.OSArtifact) *v1.Service {
|
||||
@@ -32,7 +31,8 @@ func genService(artifact buildv1alpha1.OSArtifact) *v1.Service {
|
||||
return &v1.Service{
|
||||
ObjectMeta: objMeta,
|
||||
Spec: v1.ServiceSpec{
|
||||
Ports: []v1.ServicePort{{Name: "http", Port: int32(80), TargetPort: intstr.FromInt(80)}},
|
||||
Type: v1.ServiceTypeNodePort,
|
||||
Ports: []v1.ServicePort{{Name: "http", Port: int32(80)}},
|
||||
Selector: genDeploymentLabel(artifact.Name),
|
||||
},
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ import (
|
||||
logf "sigs.k8s.io/controller-runtime/pkg/log"
|
||||
"sigs.k8s.io/controller-runtime/pkg/log/zap"
|
||||
|
||||
buildv1alpha1 "github.com/c3os-io/osbuilder-operator/api/v1alpha1"
|
||||
buildv1alpha1 "github.com/kairos-io/osbuilder/api/v1alpha1"
|
||||
//+kubebuilder:scaffold:imports
|
||||
)
|
||||
|
||||
|
||||
2
go.mod
2
go.mod
@@ -1,4 +1,4 @@
|
||||
module github.com/c3os-io/osbuilder-operator
|
||||
module github.com/kairos-io/osbuilder
|
||||
|
||||
go 1.18
|
||||
|
||||
|
||||
13
main.go
13
main.go
@@ -31,8 +31,8 @@ import (
|
||||
"sigs.k8s.io/controller-runtime/pkg/healthz"
|
||||
"sigs.k8s.io/controller-runtime/pkg/log/zap"
|
||||
|
||||
buildv1alpha1 "github.com/c3os-io/osbuilder-operator/api/v1alpha1"
|
||||
"github.com/c3os-io/osbuilder-operator/controllers"
|
||||
buildv1alpha1 "github.com/kairos-io/osbuilder/api/v1alpha1"
|
||||
"github.com/kairos-io/osbuilder/controllers"
|
||||
//+kubebuilder:scaffold:imports
|
||||
)
|
||||
|
||||
@@ -52,10 +52,11 @@ func main() {
|
||||
var metricsAddr string
|
||||
var enableLeaderElection bool
|
||||
var probeAddr string
|
||||
var buildImage, serveImage string
|
||||
var serveImage, toolImage string
|
||||
flag.StringVar(&metricsAddr, "metrics-bind-address", ":8080", "The address the metric endpoint binds to.")
|
||||
flag.StringVar(&buildImage, "build-image", "quay.io/costoolkit/elemental-cli:v0.0.15-8a78e6b", "Build image.")
|
||||
flag.StringVar(&serveImage, "serve-image", "nginx", "Serve image.")
|
||||
// It needs luet inside
|
||||
flag.StringVar(&toolImage, "tool-image", "quay.io/kairos/osbuilder-tools:latest", "Tool image.")
|
||||
|
||||
flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.")
|
||||
flag.BoolVar(&enableLeaderElection, "leader-elect", false,
|
||||
@@ -75,7 +76,7 @@ func main() {
|
||||
Port: 9443,
|
||||
HealthProbeBindAddress: probeAddr,
|
||||
LeaderElection: enableLeaderElection,
|
||||
LeaderElectionID: "98ca89ca.c3os-x.io",
|
||||
LeaderElectionID: "98ca89ca.kairos.io",
|
||||
// LeaderElectionReleaseOnCancel defines if the leader should step down voluntarily
|
||||
// when the Manager ends. This requires the binary to immediately end when the
|
||||
// Manager is stopped, otherwise, this setting is unsafe. Setting this significantly
|
||||
@@ -96,7 +97,7 @@ func main() {
|
||||
if err = (&controllers.OSArtifactReconciler{
|
||||
Client: mgr.GetClient(),
|
||||
ServingImage: serveImage,
|
||||
BuildImage: buildImage,
|
||||
ToolImage: toolImage,
|
||||
Scheme: mgr.GetScheme(),
|
||||
}).SetupWithManager(mgr); err != nil {
|
||||
setupLog.Error(err, "unable to create controller", "controller", "OSArtifact")
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
KUBE_VERSION=${KUBE_VERSION:-v1.22.7}
|
||||
CLUSTER_NAME="${CLUSTER_NAME:-c3os-osbuilder-e2e}"
|
||||
CLUSTER_NAME="${CLUSTER_NAME:-kairos-osbuilder-e2e}"
|
||||
|
||||
if ! kind get clusters | grep "$CLUSTER_NAME"; then
|
||||
cat << EOF > kind.config
|
||||
@@ -29,4 +29,4 @@ kubectl wait --for=condition=Ready node/$CLUSTER_NAME-control-plane
|
||||
export EXTERNAL_IP=$(kubectl get nodes -o jsonpath='{.items[].status.addresses[?(@.type == "InternalIP")].address}')
|
||||
export BRIDGE_IP="172.18.0.1"
|
||||
kubectl get nodes -o wide
|
||||
cd $ROOT_DIR/tests && ginkgo -r -v ./e2e
|
||||
cd $ROOT_DIR/tests && $GINKGO -r -v ./e2e
|
||||
39
tests/e2e/e2e_simple_test.go
Normal file
39
tests/e2e/e2e_simple_test.go
Normal file
@@ -0,0 +1,39 @@
|
||||
package e2e_test
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
. "github.com/onsi/gomega"
|
||||
kubectl "github.com/rancher-sandbox/ele-testhelpers/kubectl"
|
||||
)
|
||||
|
||||
var _ = Describe("ISO build test", func() {
|
||||
//k := kubectl.New()
|
||||
Context("registration", func() {
|
||||
|
||||
AfterEach(func() {
|
||||
kubectl.New().Delete("osartifacts", "-n", "default", "hello-kairos")
|
||||
})
|
||||
|
||||
It("creates a simple iso", func() {
|
||||
err := kubectl.Apply("", "../../tests/fixtures/simple.yaml")
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
Eventually(func() string {
|
||||
b, _ := kubectl.GetData("default", "osartifacts", "hello-kairos", "jsonpath={.spec.imageName}")
|
||||
return string(b)
|
||||
}, 2*time.Minute, 2*time.Second).Should(Equal("quay.io/kairos/core-opensuse:latest"))
|
||||
|
||||
Eventually(func() string {
|
||||
b, _ := kubectl.GetData("default", "deployments", "hello-kairos", "jsonpath={.spec.template.metadata.labels.osbuild}")
|
||||
return string(b)
|
||||
}, 2*time.Minute, 2*time.Second).Should(Equal("workloadhello-kairos"))
|
||||
Eventually(func() string {
|
||||
b, _ := kubectl.GetData("default", "deployments", "hello-kairos", "jsonpath={.spec.status.unavailableReplicas}")
|
||||
return string(b)
|
||||
}, 15*time.Minute, 2*time.Second).ShouldNot(Equal("1"))
|
||||
})
|
||||
})
|
||||
|
||||
})
|
||||
@@ -1,39 +1,13 @@
|
||||
package e2e_test
|
||||
|
||||
import (
|
||||
"time"
|
||||
"testing"
|
||||
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
. "github.com/onsi/gomega"
|
||||
kubectl "github.com/rancher-sandbox/ele-testhelpers/kubectl"
|
||||
)
|
||||
|
||||
var _ = Describe("ISO build test", func() {
|
||||
//k := kubectl.New()
|
||||
Context("registration", func() {
|
||||
|
||||
AfterEach(func() {
|
||||
kubectl.New().Delete("osartifacts", "-n", "default", "hello-c3os")
|
||||
})
|
||||
|
||||
It("creates a simple iso", func() {
|
||||
err := kubectl.Apply("", "../../tests/fixtures/simple.yaml")
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
Eventually(func() string {
|
||||
b, _ := kubectl.GetData("default", "osartifacts", "hello-c3os", "jsonpath={.spec.imageName}")
|
||||
return string(b)
|
||||
}, 2*time.Minute, 2*time.Second).Should(Equal("quay.io/c3os/c3os:opensuse-latest"))
|
||||
|
||||
Eventually(func() string {
|
||||
b, _ := kubectl.GetData("default", "deployments", "hello-c3os", "jsonpath={.spec.template.metadata.labels.osbuild}")
|
||||
return string(b)
|
||||
}, 2*time.Minute, 2*time.Second).Should(Equal("workloadhello-c3os"))
|
||||
Eventually(func() string {
|
||||
b, _ := kubectl.GetData("default", "deployments", "hello-c3os", "jsonpath={.spec.status.unavailableReplicas}")
|
||||
return string(b)
|
||||
}, 15*time.Minute, 2*time.Second).ShouldNot(Equal("1"))
|
||||
})
|
||||
})
|
||||
|
||||
})
|
||||
func TestE2e(t *testing.T) {
|
||||
RegisterFailHandler(Fail)
|
||||
RunSpecs(t, "kairos-operator e2e test Suite")
|
||||
}
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
package e2e_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
func TestE2e(t *testing.T) {
|
||||
RegisterFailHandler(Fail)
|
||||
RunSpecs(t, "c3os-operator e2e test Suite")
|
||||
}
|
||||
53
tests/fixtures/simple.yaml
vendored
53
tests/fixtures/simple.yaml
vendored
@@ -1,7 +1,52 @@
|
||||
apiVersion: build.c3os-x.io/v1alpha1
|
||||
apiVersion: build.kairos.io/v1alpha1
|
||||
kind: OSArtifact
|
||||
metadata:
|
||||
name: hello-c3os
|
||||
name: hello-kairos
|
||||
spec:
|
||||
imageName: "quay.io/c3os/c3os:opensuse-latest"
|
||||
iso: true
|
||||
imageName: "quay.io/kairos/core-opensuse:latest"
|
||||
iso: true
|
||||
bundles:
|
||||
- quay.io/kairos/packages:goreleaser-utils-1.11.1
|
||||
grubConfig: |
|
||||
search --file --set=root /boot/kernel.xz
|
||||
set default=0
|
||||
set timeout=10
|
||||
set timeout_style=menu
|
||||
set linux=linux
|
||||
set initrd=initrd
|
||||
if [ "${grub_cpu}" = "x86_64" -o "${grub_cpu}" = "i386" -o "${grub_cpu}" = "arm64" ];then
|
||||
if [ "${grub_platform}" = "efi" ]; then
|
||||
if [ "${grub_cpu}" != "arm64" ]; then
|
||||
set linux=linuxefi
|
||||
set initrd=initrdefi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ "${grub_platform}" = "efi" ]; then
|
||||
echo "Please press 't' to show the boot menu on this console"
|
||||
fi
|
||||
set font=($root)/boot/${grub_cpu}/loader/grub2/fonts/unicode.pf2
|
||||
if [ -f ${font} ];then
|
||||
loadfont ${font}
|
||||
fi
|
||||
menuentry "install" --class os --unrestricted {
|
||||
echo Loading kernel...
|
||||
$linux ($root)/boot/kernel.xz cdroot root=live:CDLABEL=COS_LIVE rd.live.dir=/ rd.live.squashimg=rootfs.squashfs console=tty1 console=ttyS0 rd.cos.disable vga=795 nomodeset nodepair.enable
|
||||
echo Loading initrd...
|
||||
$initrd ($root)/boot/rootfs.xz
|
||||
}
|
||||
|
||||
if [ "${grub_platform}" = "efi" ]; then
|
||||
hiddenentry "Text mode" --hotkey "t" {
|
||||
set textmode=true
|
||||
terminal_output console
|
||||
}
|
||||
fi
|
||||
|
||||
cloudConfig: |
|
||||
#node-config
|
||||
install:
|
||||
device: "/dev/sda"
|
||||
reboot: true
|
||||
poweroff: true
|
||||
auto: true # Required, for automated installations
|
||||
23
tools-image/Dockerfile
Normal file
23
tools-image/Dockerfile
Normal file
@@ -0,0 +1,23 @@
|
||||
ARG ELEMENTAL_CLI_VERSION=v0.0.15-ae4f000
|
||||
ARG LEAP_VERSION=15.4
|
||||
ARG LUET_VERSION=0.32.5
|
||||
FROM quay.io/costoolkit/elemental-cli:$ELEMENTAL_CLI_VERSION AS elemental
|
||||
FROM quay.io/luet/base:$LUET_VERSION AS luet
|
||||
FROM quay.io/costoolkit/releases-teal:grub2-live-0.0.3-2 AS grub2
|
||||
FROM quay.io/costoolkit/releases-teal:grub2-efi-image-live-0.0.2-2 AS efi
|
||||
|
||||
FROM opensuse/leap:$LEAP_VERSION
|
||||
COPY --from=elemental /usr/bin/elemental /usr/bin/elemental
|
||||
COPY --from=luet /usr/bin/luet /usr/bin/luet
|
||||
|
||||
COPY --from=grub2 / /grub2
|
||||
COPY --from=efi / /efi
|
||||
|
||||
RUN zypper ref && zypper dup -y
|
||||
RUN zypper ref && zypper in -y xfsprogs parted util-linux-systemd e2fsprogs util-linux udev rsync grub2 dosfstools grub2-x86_64-efi squashfs mtools xorriso lvm2
|
||||
RUN mkdir /config
|
||||
|
||||
COPY ./config.yaml /config/manifest.yaml
|
||||
COPY ./entrypoint.sh /entrypoint.sh
|
||||
|
||||
ENTRYPOINT [ "/entrypoint.sh" ]
|
||||
6
tools-image/config.yaml
Normal file
6
tools-image/config.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
iso:
|
||||
uefi:
|
||||
- dir:/efi
|
||||
image:
|
||||
- dir:/efi
|
||||
- dir:/grub2
|
||||
5
tools-image/entrypoint.sh
Executable file
5
tools-image/entrypoint.sh
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -ex
|
||||
|
||||
elemental --config-dir /config $@
|
||||
Reference in New Issue
Block a user