mirror of
https://github.com/siderolabs/talos.git
synced 2025-08-06 14:47:05 +02:00
chore: use buildkit for builds (#295)
This commit is contained in:
parent
3de43232dc
commit
72eb1b34f5
@ -1,5 +1,3 @@
|
||||
metadata:
|
||||
repository: autonomy/talos
|
||||
policies:
|
||||
- type: conventionalCommit
|
||||
spec:
|
||||
@ -25,15 +23,3 @@ policies:
|
||||
- rootfs
|
||||
- tools
|
||||
- '*'
|
||||
script:
|
||||
template: |
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
mkdir -p ./build
|
||||
cd ./src/rootfs && conform build
|
||||
cd ../initramfs && conform build
|
||||
cd ../image && conform build
|
||||
cd ../docs && conform build
|
||||
cd ../
|
||||
|
@ -1,2 +1,8 @@
|
||||
build
|
||||
vendor
|
||||
**
|
||||
!hack
|
||||
!installer
|
||||
!internal
|
||||
!vendor
|
||||
!web
|
||||
!go.mod
|
||||
!go.sum
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,4 +1,5 @@
|
||||
build
|
||||
cache
|
||||
vendor
|
||||
.vscode
|
||||
|
||||
|
232
Dockerfile
Normal file
232
Dockerfile
Normal file
@ -0,0 +1,232 @@
|
||||
# syntax=docker/dockerfile:experimental
|
||||
ARG TOOLCHAIN_VERSION
|
||||
ARG KERNEL_VERSION
|
||||
ARG GOLANG_VERSION
|
||||
|
||||
ARG GOLANG_VERSION
|
||||
FROM golang:${GOLANG_VERSION} AS proto
|
||||
RUN apt update
|
||||
RUN apt -y install bsdtar
|
||||
WORKDIR /go/src/github.com/golang/protobuf
|
||||
RUN curl -L https://github.com/golang/protobuf/archive/v1.2.0.tar.gz | tar -xz --strip-components=1
|
||||
RUN cd protoc-gen-go && go install .
|
||||
RUN curl -L https://github.com/google/protobuf/releases/download/v3.6.1/protoc-3.6.1-linux-x86_64.zip | bsdtar -xf - -C /tmp \
|
||||
&& mv /tmp/bin/protoc /bin \
|
||||
&& mv /tmp/include/* /usr/local/include \
|
||||
&& chmod +x /bin/protoc
|
||||
WORKDIR /osd
|
||||
COPY ./internal/app/osd/proto ./proto
|
||||
RUN protoc -I/usr/local/include -I./proto --go_out=plugins=grpc:proto proto/api.proto
|
||||
WORKDIR /trustd
|
||||
COPY ./internal/app/trustd/proto ./proto
|
||||
RUN protoc -I/usr/local/include -I./proto --go_out=plugins=grpc:proto proto/api.proto
|
||||
WORKDIR /blockd
|
||||
COPY ./internal/app/blockd/proto ./proto
|
||||
RUN protoc -I/usr/local/include -I./proto --go_out=plugins=grpc:proto proto/api.proto
|
||||
|
||||
ARG GOLANG_VERSION
|
||||
FROM golang:${GOLANG_VERSION} AS base
|
||||
ENV GO111MODULE on
|
||||
WORKDIR /src
|
||||
COPY ./ ./
|
||||
ENV GOOS linux
|
||||
ENV GOARCH amd64
|
||||
ENV CGO_ENABLED 0
|
||||
COPY --from=proto /osd/proto/api.pb.go ./internal/app/osd/proto
|
||||
COPY --from=proto /trustd/proto/api.pb.go ./internal/app/trustd/proto
|
||||
COPY --from=proto /blockd/proto/api.pb.go ./internal/app/blockd/proto
|
||||
RUN go mod download
|
||||
RUN go mod verify
|
||||
|
||||
FROM base AS udevd-build
|
||||
ARG SHA
|
||||
ARG TAG
|
||||
ARG VERSION_PKG="github.com/autonomy/talos/internal/pkg/version"
|
||||
WORKDIR /src/internal/app/udevd
|
||||
RUN go build -a -ldflags "-s -w -X ${VERSION_PKG}.Name=Server -X ${VERSION_PKG}.SHA=${SHA} -X ${VERSION_PKG}.Tag=${TAG}" -o /udevd
|
||||
RUN chmod +x /udevd
|
||||
ARG APP
|
||||
FROM scratch AS udevd
|
||||
COPY --from=udevd-build /udevd /udevd
|
||||
ENTRYPOINT ["/udevd"]
|
||||
|
||||
ARG TOOLCHAIN_VERSION
|
||||
FROM autonomy/toolchain:${TOOLCHAIN_VERSION} AS rootfs
|
||||
RUN rm -rf /rootfs/etc
|
||||
RUN mkdir -p /rootfs/var/etc
|
||||
RUN ln -sv var/etc /rootfs/etc
|
||||
# xfsprogs
|
||||
RUN mkdir -p /etc/ssl/certs
|
||||
RUN ln -s /toolchain/etc/ssl/certs/ca-certificates /etc/ssl/certs/ca-certificates
|
||||
WORKDIR /tmp/xfsprogs
|
||||
RUN curl -L https://www.kernel.org/pub/linux/utils/fs/xfs/xfsprogs/xfsprogs-4.18.0.tar.xz | tar -xJ --strip-components=1
|
||||
RUN make \
|
||||
DEBUG=-DNDEBUG \
|
||||
INSTALL_USER=0 \
|
||||
INSTALL_GROUP=0 \
|
||||
LOCAL_CONFIGURE_OPTIONS="--prefix=/"
|
||||
RUN make install DESTDIR=/rootfs
|
||||
# libseccomp
|
||||
WORKDIR /toolchain/usr/local/src/libseccomp
|
||||
RUN curl -L https://github.com/seccomp/libseccomp/releases/download/v2.3.3/libseccomp-2.3.3.tar.gz | tar --strip-components=1 -xz
|
||||
WORKDIR /toolchain/usr/local/src/libseccomp/build
|
||||
RUN ../configure \
|
||||
--prefix=/usr \
|
||||
--disable-static
|
||||
RUN make -j $(($(nproc) / 2))
|
||||
RUN make install DESTDIR=/rootfs
|
||||
# libblkid
|
||||
RUN cp /toolchain/lib/libblkid.* /rootfs/lib
|
||||
# libuuid
|
||||
RUN cp /toolchain/lib/libuuid.* /rootfs/lib
|
||||
# ca-certificates
|
||||
RUN mkdir -p /rootfs/etc/ssl/certs
|
||||
RUN curl -o /rootfs/etc/ssl/certs/ca-certificates.crt https://curl.haxx.se/ca/cacert.pem
|
||||
# containerd
|
||||
RUN curl -L https://github.com/kubernetes-sigs/cri-tools/releases/download/v1.13.0/crictl-v1.13.0-linux-amd64.tar.gz | tar -xz -C /rootfs/bin
|
||||
RUN curl -L https://github.com/containerd/containerd/releases/download/v1.2.1/containerd-1.2.1.linux-amd64.tar.gz | tar --strip-components=1 -xz -C /rootfs/bin
|
||||
RUN rm /rootfs/bin/ctr
|
||||
# runc
|
||||
RUN curl -L https://github.com/opencontainers/runc/releases/download/v1.0.0-rc6/runc.amd64 -o /rootfs/bin/runc
|
||||
RUN chmod +x /rootfs/bin/runc
|
||||
RUN ln -sv ../opt /rootfs/var/opt
|
||||
RUN mkdir -p /rootfs/opt/cni/bin
|
||||
# CNI
|
||||
RUN curl -L https://github.com/containernetworking/cni/releases/download/v0.6.0/cni-amd64-v0.6.0.tgz | tar -xz -C /rootfs/opt/cni/bin
|
||||
RUN curl -L https://github.com/containernetworking/plugins/releases/download/v0.7.4/cni-plugins-amd64-v0.7.4.tgz | tar -xz -C /rootfs/opt/cni/bin
|
||||
# kubeadm
|
||||
RUN curl --retry 3 --retry-delay 60 -L https://storage.googleapis.com/kubernetes-release/release/v1.13.1/bin/linux/amd64/kubeadm -o /rootfs/bin/kubeadm
|
||||
RUN chmod +x /rootfs/bin/kubeadm
|
||||
# udevd
|
||||
COPY --from=udevd-build /udevd /rootfs/bin/udevd
|
||||
# cleanup
|
||||
COPY ./hack/scripts/cleanup.sh /bin
|
||||
RUN chmod +x /bin/cleanup.sh
|
||||
RUN /bin/cleanup.sh /rootfs
|
||||
COPY ./hack/scripts/symlink.sh /bin
|
||||
RUN chmod +x /bin/symlink.sh
|
||||
RUN /bin/symlink.sh /rootfs
|
||||
WORKDIR /rootfs
|
||||
RUN ["/toolchain/bin/tar", "-cvpzf", "/rootfs.tar.gz", "."]
|
||||
|
||||
FROM base AS initramfs
|
||||
ARG SHA
|
||||
ARG TAG
|
||||
ARG VERSION_PKG="github.com/autonomy/talos/internal/pkg/version"
|
||||
ENV CGO_ENABLED 1
|
||||
RUN apt update \
|
||||
&& apt install -y util-linux libblkid-dev cpio xz-utils
|
||||
WORKDIR /src/internal/app/init
|
||||
RUN go build -a -ldflags "-s -w -X ${VERSION_PKG}.Name=Server -X ${VERSION_PKG}.SHA=${SHA} -X ${VERSION_PKG}.Tag=${TAG}" -o /init
|
||||
RUN chmod +x /init
|
||||
WORKDIR /initramfs
|
||||
RUN cp /init ./
|
||||
COPY --from=rootfs /rootfs ./
|
||||
COPY ./hack/scripts/cleanup.sh /bin
|
||||
RUN chmod +x /bin/cleanup.sh
|
||||
RUN /bin/cleanup.sh /initramfs
|
||||
RUN find . 2>/dev/null | cpio -H newc -o | xz -v -C crc32 -0 -e -T 0 -z >/initramfs.xz
|
||||
|
||||
FROM base AS osd-build
|
||||
ARG SHA
|
||||
ARG TAG
|
||||
ARG VERSION_PKG="github.com/autonomy/talos/internal/pkg/version"
|
||||
WORKDIR /src/internal/app/osd
|
||||
RUN go build -a -ldflags "-s -w -X ${VERSION_PKG}.Name=Server -X ${VERSION_PKG}.SHA=${SHA} -X ${VERSION_PKG}.Tag=${TAG}" -o /osd
|
||||
RUN chmod +x /osd
|
||||
|
||||
ARG APP
|
||||
FROM scratch AS osd
|
||||
COPY --from=osd-build /osd /osd
|
||||
ENTRYPOINT ["/osd"]
|
||||
|
||||
FROM base AS osctl
|
||||
ARG SHA
|
||||
ARG TAG
|
||||
ARG VERSION_PKG="github.com/autonomy/talos/internal/pkg/version"
|
||||
WORKDIR /src/internal/app/osctl
|
||||
RUN go build -a -ldflags "-s -w -X ${VERSION_PKG}.Name=Client -X ${VERSION_PKG}.SHA=${SHA} -X ${VERSION_PKG}.Tag=${TAG}" -o /osctl-linux-amd64
|
||||
RUN GOOS=darwin GOARCH=amd64 go build -a -ldflags "-s -w -X ${VERSION_PKG}.Name=Client -X ${VERSION_PKG}.SHA=${SHA} -X ${VERSION_PKG}.Tag=${TAG}" -o /osctl-darwin-amd64
|
||||
RUN chmod +x /osctl-linux-amd64
|
||||
RUN chmod +x /osctl-darwin-amd64
|
||||
|
||||
FROM base AS trustd-build
|
||||
ARG SHA
|
||||
ARG TAG
|
||||
ARG VERSION_PKG="github.com/autonomy/talos/internal/pkg/version"
|
||||
WORKDIR /src/internal/app/trustd
|
||||
RUN go build -a -ldflags "-s -w -X ${VERSION_PKG}.Name=Server -X ${VERSION_PKG}.SHA=${SHA} -X ${VERSION_PKG}.Tag=${TAG}" -o /trustd
|
||||
RUN chmod +x /trustd
|
||||
ARG APP
|
||||
FROM scratch AS trustd
|
||||
COPY --from=trustd-build /trustd /trustd
|
||||
ENTRYPOINT ["/trustd"]
|
||||
|
||||
FROM base AS proxyd-build
|
||||
ARG SHA
|
||||
ARG TAG
|
||||
ARG VERSION_PKG="github.com/autonomy/talos/internal/pkg/version"
|
||||
WORKDIR /src/internal/app/proxyd
|
||||
RUN go build -a -ldflags "-s -w -X ${VERSION_PKG}.Name=Server -X ${VERSION_PKG}.SHA=${SHA} -X ${VERSION_PKG}.Tag=${TAG}" -o /proxyd
|
||||
RUN chmod +x /proxyd
|
||||
ARG APP
|
||||
FROM scratch AS proxyd
|
||||
COPY --from=proxyd-build /proxyd /proxyd
|
||||
ENTRYPOINT ["/proxyd"]
|
||||
|
||||
FROM base AS blockd-build
|
||||
ARG SHA
|
||||
ARG TAG
|
||||
ARG VERSION_PKG="github.com/autonomy/talos/internal/pkg/version"
|
||||
WORKDIR /src/internal/app/blockd
|
||||
RUN go build -a -ldflags "-s -w -X ${VERSION_PKG}.Name=Server -X ${VERSION_PKG}.SHA=${SHA} -X ${VERSION_PKG}.Tag=${TAG}" -o /blockd
|
||||
RUN chmod +x /blockd
|
||||
ARG APP
|
||||
FROM scratch AS blockd
|
||||
COPY --from=blockd-build /blockd /blockd
|
||||
ENTRYPOINT ["/blockd"]
|
||||
|
||||
FROM base AS test
|
||||
RUN apt update \
|
||||
&& apt install -y util-linux libblkid-dev xfsprogs
|
||||
RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin v1.12.3
|
||||
RUN chmod +x ./hack/golang/test.sh
|
||||
ENV PATH /rootfs/bin:$PATH
|
||||
RUN ./hack/golang/test.sh --unit
|
||||
RUN ./hack/golang/test.sh --lint ./hack/golang/golangci-lint.yaml
|
||||
|
||||
FROM golang:1.11.4 as docs
|
||||
RUN curl -L https://github.com/gohugoio/hugo/releases/download/v0.49.2/hugo_0.49.2_Linux-64bit.tar.gz | tar -xz -C /bin
|
||||
WORKDIR /web
|
||||
COPY ./web ./
|
||||
RUN mkdir /docs
|
||||
RUN hugo --destination=/docs --verbose
|
||||
RUN echo "talos.autonomy.io" > /docs/CNAME
|
||||
|
||||
ARG KERNEL_VERSION
|
||||
FROM autonomy/kernel:${KERNEL_VERSION} as kernel
|
||||
|
||||
FROM alpine:3.7 AS installer-build
|
||||
RUN apk --update add curl tar xz
|
||||
WORKDIR /usr/local/src/syslinux
|
||||
RUN curl -L https://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-6.03.tar.xz | tar --strip-components=1 -xJ
|
||||
WORKDIR /
|
||||
COPY --from=kernel /vmlinuz /generated/boot/vmlinuz
|
||||
COPY --from=rootfs /rootfs.tar.gz /generated/rootfs.tar.gz
|
||||
COPY --from=initramfs /initramfs.xz /generated/boot/initramfs.xz
|
||||
|
||||
FROM alpine:3.7 AS installer
|
||||
RUN apk --update add bash curl gzip e2fsprogs tar cdrkit parted syslinux util-linux xfsprogs xz sgdisk sfdisk qemu-img unzip
|
||||
COPY --from=installer-build /usr/local/src/syslinux /usr/local/src/syslinux
|
||||
COPY --from=installer-build /generated/rootfs.tar.gz /generated/rootfs.tar.gz
|
||||
COPY --from=installer-build /generated/boot /generated/boot
|
||||
RUN curl -L https://releases.hashicorp.com/packer/1.3.1/packer_1.3.1_linux_amd64.zip -o /tmp/packer.zip \
|
||||
&& unzip -d /tmp /tmp/packer.zip \
|
||||
&& mv /tmp/packer /bin \
|
||||
&& rm /tmp/packer.zip
|
||||
COPY ./hack/installer/packer.json /packer.json
|
||||
COPY ./hack/installer/entrypoint.sh /bin/entrypoint.sh
|
||||
RUN chmod +x /bin/entrypoint.sh
|
||||
ARG TAG
|
||||
ENV VERSION ${TAG}
|
||||
ENTRYPOINT ["entrypoint.sh"]
|
95
Makefile
Normal file
95
Makefile
Normal file
@ -0,0 +1,95 @@
|
||||
SHA := $(shell gitmeta git sha)
|
||||
TAG := $(shell gitmeta image tag)
|
||||
BUILT := $(shell gitmeta built)
|
||||
|
||||
COMMON_APP_ARGS := -f ./Dockerfile --build-arg TOOLCHAIN_VERSION=690a03a --build-arg KERNEL_VERSION=e18620a --build-arg GOLANG_VERSION=1.11.4 --build-arg SHA=$(SHA) --build-arg TAG=$(TAG) .
|
||||
|
||||
export DOCKER_BUILDKIT := 1
|
||||
|
||||
all: enforce rootfs initramfs osd osctl trustd proxyd blockd udevd test installer docs
|
||||
|
||||
enforce:
|
||||
@conform enforce
|
||||
|
||||
osd:
|
||||
@docker build \
|
||||
-t autonomy/$@:$(SHA) \
|
||||
--target=$@ \
|
||||
$(COMMON_APP_ARGS)
|
||||
|
||||
osctl:
|
||||
@docker build \
|
||||
-t autonomy/$@:$(SHA) \
|
||||
--target=$@ \
|
||||
$(COMMON_APP_ARGS)
|
||||
@docker run --rm -it -v $(PWD)/build:/build autonomy/$@:$(SHA) cp /osctl-linux-amd64 /build
|
||||
@docker run --rm -it -v $(PWD)/build:/build autonomy/$@:$(SHA) cp /osctl-darwin-amd64 /build
|
||||
|
||||
trustd:
|
||||
@docker build \
|
||||
-t autonomy/$@:$(SHA) \
|
||||
--target=$@ \
|
||||
$(COMMON_APP_ARGS)
|
||||
|
||||
proxyd:
|
||||
@docker build \
|
||||
-t autonomy/$@:$(SHA) \
|
||||
--target=$@ \
|
||||
$(COMMON_APP_ARGS)
|
||||
|
||||
blockd:
|
||||
@docker build \
|
||||
-t autonomy/$@:$(SHA) \
|
||||
--target=$@ \
|
||||
$(COMMON_APP_ARGS)
|
||||
|
||||
udevd:
|
||||
@docker build \
|
||||
-t autonomy/$@:$(SHA) \
|
||||
--target=$@ \
|
||||
$(COMMON_APP_ARGS) \
|
||||
|
||||
test:
|
||||
@docker build \
|
||||
-t autonomy/$@:$(SHA) \
|
||||
--target=$@ \
|
||||
$(COMMON_APP_ARGS)
|
||||
|
||||
rootfs:
|
||||
@docker build \
|
||||
-t autonomy/$@:$(SHA) \
|
||||
--target=$@ \
|
||||
$(COMMON_APP_ARGS)
|
||||
@docker run --rm -it -v $(PWD)/build:/build autonomy/$@:$(SHA) cp /rootfs.tar.gz /build
|
||||
|
||||
initramfs:
|
||||
@docker build \
|
||||
-t autonomy/$@:$(SHA) \
|
||||
--target=$@ \
|
||||
$(COMMON_APP_ARGS)
|
||||
@docker run --rm -it -v $(PWD)/build:/build autonomy/$@:$(SHA) cp /initramfs.xz /build
|
||||
|
||||
.PHONY: docs
|
||||
docs:
|
||||
@docker build \
|
||||
-t autonomy/$@:$(SHA) \
|
||||
--target=$@ \
|
||||
$(COMMON_APP_ARGS)
|
||||
@rm -rf ./docs
|
||||
@docker run --rm -it -v $(PWD):/out autonomy/$@:$(SHA) cp -R /docs /out
|
||||
|
||||
.PHONY: installer
|
||||
installer:
|
||||
@docker build \
|
||||
-t autonomy/talos:$(SHA) \
|
||||
--target=$@ \
|
||||
$(COMMON_APP_ARGS)
|
||||
@docker run --rm -it -v $(PWD)/build:/build autonomy/talos:$(SHA) cp /generated/boot/vmlinuz /build
|
||||
|
||||
deps:
|
||||
@GO111MODULES=on CGO_ENABLED=0 go get -u github.com/autonomy/gitmeta
|
||||
@GO111MODULES=on CGO_ENABLED=0 go get -u github.com/autonomy/conform
|
||||
|
||||
clean:
|
||||
go clean -modcache
|
||||
rm -rf build vendor
|
71
brigade.js
71
brigade.js
@ -1,71 +0,0 @@
|
||||
const { events, Job, Group } = require("brigadier");
|
||||
|
||||
events.on("exec", function (e, project) {
|
||||
job = conform(e, project)
|
||||
job.run().then(result => {
|
||||
console.log(result.toString())
|
||||
})
|
||||
})
|
||||
|
||||
events.on("push", function (e, project) {
|
||||
job = conform(e, project)
|
||||
job.run().then(result => {
|
||||
console.log(result.toString())
|
||||
})
|
||||
})
|
||||
|
||||
events.on("pull_request", function (e, project) {
|
||||
start = notify("pending", `Build ${e.buildID} started`, e, project)
|
||||
job = conform(e, project)
|
||||
Group.runAll([start, job])
|
||||
.then(() => {
|
||||
return notify("success", `Build ${e.buildID} passed`, e, project).run()
|
||||
}).catch(err => {
|
||||
return notify("failure", `Build ${e.buildID} failed`, e, project).run()
|
||||
});
|
||||
})
|
||||
|
||||
function conform(e, project) {
|
||||
var job = new Job("talos", "autonomy/conform:latest")
|
||||
|
||||
job.env = {
|
||||
// "DOCKER_HOST": "tcp://docker:2375"
|
||||
"DOCKER_USERNAME": project.secrets.DOCKER_USERNAME,
|
||||
"DOCKER_PASSWORD": project.secrets.DOCKER_PASSWORD,
|
||||
}
|
||||
|
||||
job.tasks = [
|
||||
"apk --no-cache add docker",
|
||||
"cd /src",
|
||||
"conform enforce",
|
||||
"conform build",
|
||||
]
|
||||
|
||||
job.docker.enabled = true
|
||||
|
||||
// Unit is milliseconds, 14400000ms = 4h.
|
||||
job.timeout = 14400000
|
||||
|
||||
job.host.nodeSelector.set("node-role.kubernetes.io/ci", "")
|
||||
|
||||
job.resourceRequests.memory = "8Gi";
|
||||
job.resourceRequests.cpu = "4";
|
||||
job.resourceLimits.memory = "16Gi";
|
||||
job.resourceLimits.cpu = "8";
|
||||
|
||||
return job
|
||||
}
|
||||
|
||||
function notify(state, msg, e, project) {
|
||||
const gh = new Job(`notify-${state}`, "technosophos/github-notify:latest")
|
||||
gh.env = {
|
||||
GH_REPO: project.repo.name,
|
||||
GH_STATE: state,
|
||||
GH_DESCRIPTION: msg,
|
||||
GH_CONTEXT: "brigade",
|
||||
GH_TOKEN: project.secrets.GH_TOKEN,
|
||||
GH_COMMIT: e.revision.commit,
|
||||
GH_TARGET_URL: `https://ci.dev.autonomy.io/builds/${e.buildID}`,
|
||||
}
|
||||
return gh
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
module github.com/autonomy/talos/src/initramfs
|
||||
module github.com/autonomy/talos
|
||||
|
||||
require (
|
||||
github.com/BurntSushi/toml v0.3.0 // indirect
|
||||
@ -10,13 +10,10 @@ require (
|
||||
github.com/containerd/cri v1.11.1 // indirect
|
||||
github.com/containerd/fifo v0.0.0-20180307165137-3d5202aec260 // indirect
|
||||
github.com/containerd/typeurl v0.0.0-20180627222232-a93fcdb778cd
|
||||
github.com/containers/storage v0.0.0-20180829143637-d0cb01076460 // indirect
|
||||
github.com/coreos/go-systemd v0.0.0-20180828140353-eee3db372b31 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/docker/distribution v2.7.0-rc.0+incompatible // indirect
|
||||
github.com/docker/docker v1.13.1 // indirect
|
||||
github.com/docker/engine-api v0.4.0
|
||||
github.com/docker/go-connections v0.4.0 // indirect
|
||||
github.com/docker/go-events v0.0.0-20170721190031-9461782956ad // indirect
|
||||
github.com/docker/go-units v0.3.3 // indirect
|
||||
github.com/evanphx/json-patch v4.1.0+incompatible // indirect
|
||||
@ -38,7 +35,6 @@ require (
|
||||
github.com/imdario/mergo v0.3.6 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.0.0 // indirect
|
||||
github.com/json-iterator/go v0.0.0-20180701071628-ab8a2e0c74be // indirect
|
||||
github.com/kubernetes-incubator/cri-o v1.11.2
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 // indirect
|
||||
github.com/onsi/ginkgo v1.6.0 // indirect
|
||||
@ -52,7 +48,7 @@ require (
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/renstrom/dedent v1.0.0 // indirect
|
||||
github.com/sirupsen/logrus v1.0.6 // indirect
|
||||
github.com/spf13/afero v1.1.2 // indirect
|
||||
github.com/spf13/afero v1.2.0 // indirect
|
||||
github.com/spf13/cobra v0.0.3
|
||||
github.com/spf13/pflag v1.0.1 // indirect
|
||||
github.com/stretchr/testify v1.2.2 // indirect
|
||||
@ -85,7 +81,7 @@ require (
|
||||
k8s.io/kube-openapi v0.0.0-20181109181836-c59034cc13d5 // indirect
|
||||
k8s.io/kube-proxy v0.0.0-20181108055616-8eeec43ca7b5 // indirect
|
||||
k8s.io/kubelet v0.0.0-20181108055742-1ff588f76017 // indirect
|
||||
k8s.io/kubernetes v1.13.1 // indirect
|
||||
k8s.io/kubernetes v1.13.1
|
||||
k8s.io/utils v0.0.0-20181102055113-1bd4f387aa67 // indirect
|
||||
sigs.k8s.io/yaml v1.1.0 // indirect
|
||||
)
|
@ -12,26 +12,20 @@ github.com/containerd/containerd v1.2.1 h1:rG4/dK9V2qa5a9ly/E3CtG6/FBXfmSkDo8An3
|
||||
github.com/containerd/containerd v1.2.1/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA=
|
||||
github.com/containerd/continuity v0.0.0-20181003075958-be9bd761db19 h1:HSgjWPBWohO3kHDPwCPUGSLqJjXCjA7ad5057beR2ZU=
|
||||
github.com/containerd/continuity v0.0.0-20181003075958-be9bd761db19/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y=
|
||||
github.com/containerd/cri v1.11.1 h1:mmU4M2zh6yLy2jMUAhosOOuaZRoXa1CwYIxM2zNj8iI=
|
||||
github.com/containerd/cri v1.11.1 h1:mR8+eNW4zEcbWGTGEpmDd7GzMmK7IMxMSVAZ2aIDKA4=
|
||||
github.com/containerd/cri v1.11.1/go.mod h1:DavH5Qa8+6jOmeOMO3dhWoqksucZDe06LfuhBz/xPZs=
|
||||
github.com/containerd/fifo v0.0.0-20180307165137-3d5202aec260 h1:XGyg7oTtD0DoRFhbpV6x1WfV0flKC4UxXU7ab1zC08U=
|
||||
github.com/containerd/fifo v0.0.0-20180307165137-3d5202aec260/go.mod h1:ODA38xgv3Kuk8dQz2ZQXpnv/UZZUHUCL7pnLehbXgQI=
|
||||
github.com/containerd/typeurl v0.0.0-20180627222232-a93fcdb778cd h1:JNn81o/xG+8NEo3bC/vx9pbi/g2WI8mtP2/nXzu297Y=
|
||||
github.com/containerd/typeurl v0.0.0-20180627222232-a93fcdb778cd/go.mod h1:Cm3kwCdlkCfMSHURc+r6fwoGH6/F1hH3S4sg0rLFWPc=
|
||||
github.com/containers/storage v0.0.0-20180829143637-d0cb01076460 h1:hClnCyhG6PhaW7JSMg5kzP2WxNtbaedG9Ws0wTfsGMQ=
|
||||
github.com/containers/storage v0.0.0-20180829143637-d0cb01076460/go.mod h1:+RirK6VQAqskQlaTBrOG6ulDvn4si2QjFE1NZCn06MM=
|
||||
github.com/coreos/go-systemd v0.0.0-20180828140353-eee3db372b31 h1:wRzCUSYhBIk1KvRIlx+nvScCRIxX0iIhSU5h9xj7MUU=
|
||||
github.com/coreos/go-systemd v0.0.0-20180828140353-eee3db372b31/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/docker/distribution v2.7.0-rc.0+incompatible h1:Nw9tozLpkMnG3IA1zLzsCuwKizII6havt4iIXWWzU2s=
|
||||
github.com/docker/distribution v2.7.0-rc.0+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
|
||||
github.com/docker/docker v1.13.1 h1:5VBhsO6ckUxB0A8CE5LlUJdXzik9cbEbBTQ/ggeml7M=
|
||||
github.com/docker/docker v1.13.1 h1:IkZjBSIc8hBjLpqeAbeE5mca5mNgeatLHBy3GO78BWo=
|
||||
github.com/docker/docker v1.13.1/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
|
||||
github.com/docker/engine-api v0.4.0 h1:D0Osr6+45yAlQqLyoczv5qJtAu+P0HB0rLCddck03wY=
|
||||
github.com/docker/engine-api v0.4.0/go.mod h1:xtQCpzf4YysNZCVFfIGIm7qfLvYbxtLkEVVfKhTVOvw=
|
||||
github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ=
|
||||
github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec=
|
||||
github.com/docker/go-events v0.0.0-20170721190031-9461782956ad h1:VXIse57M5C6ezDuCPyq6QmMvEJ2xclYKZ35SfkXdm3E=
|
||||
github.com/docker/go-events v0.0.0-20170721190031-9461782956ad/go.mod h1:Uw6UezgYA44ePAFQYUehOuCzmy5zmg/+nl2ZfMWGkpA=
|
||||
github.com/docker/go-units v0.3.3 h1:Xk8S3Xj5sLGlG5g67hJmYMmUgXv5N4PhkjJHHqrwnTk=
|
||||
@ -78,8 +72,6 @@ github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANyt
|
||||
github.com/json-iterator/go v0.0.0-20180701071628-ab8a2e0c74be h1:AHimNtVIpiBjPUhEF5KNCkrUyqTSA5zWUl8sQ2bfGBE=
|
||||
github.com/json-iterator/go v0.0.0-20180701071628-ab8a2e0c74be/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||
github.com/kubernetes-incubator/cri-o v1.11.2 h1:fFVGShhe9znd4QmLYk19zJNocapw9Mr73ISXkj+Bpes=
|
||||
github.com/kubernetes-incubator/cri-o v1.11.2/go.mod h1:iVQXkISBUrMZCggYuwSRBDDZ9XoP3WzfFFYpF+/RI8g=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg=
|
||||
@ -106,8 +98,8 @@ github.com/renstrom/dedent v1.0.0 h1:MKUQ4Nr+V8f9ax+9wYAx5GhspvFzs47vK0oXePaVoWk
|
||||
github.com/renstrom/dedent v1.0.0/go.mod h1:M3t8jnE/HlAaLf3m0P158lCmrc8ZErlRB4/cN6V5TXY=
|
||||
github.com/sirupsen/logrus v1.0.6 h1:hcP1GmhGigz/O7h1WVUM5KklBp1JoNS9FggWKdj/j3s=
|
||||
github.com/sirupsen/logrus v1.0.6/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc=
|
||||
github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI=
|
||||
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
|
||||
github.com/spf13/afero v1.2.0 h1:O9FblXGxoTc51M+cqr74Bm2Tmt4PvkA5iu/j8HrkNuY=
|
||||
github.com/spf13/afero v1.2.0/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk=
|
||||
github.com/spf13/cobra v0.0.3 h1:ZlrZ4XsMRm04Fr5pSFxBgfND2EBVa1nLpiy1stUsX/8=
|
||||
github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
|
||||
github.com/spf13/pflag v1.0.1 h1:aCvUg6QPl3ibpQUxyLkrEkCHtPqYJL4x9AuhqVqFis4=
|
||||
@ -121,16 +113,13 @@ github.com/vmware/vmw-guestinfo v0.0.0-20170707015358-25eff159a728/go.mod h1:x9o
|
||||
golang.org/x/crypto v0.0.0-20180515001509-1a580b3eff78 h1:uJIReYEB1ZZLarzi83Pmig1HhZ/cwFCysx05l0PFBIk=
|
||||
golang.org/x/crypto v0.0.0-20180515001509-1a580b3eff78/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225 h1:kNX+jCowfMYzvlSvJu5pQWEmyWFrBXJ3PBy10xKMXK8=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d h1:g9qWBGx4puODJTMVyoPrpoxPFgVGd+z1DZwjfRu4d0I=
|
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20181201002055-351d144fa1fc h1:a3CU5tJYVj92DY2LaA1kUkrsqD5/3mLDhx2NcNqyW+0=
|
||||
golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20181003184128-c57b0facaced h1:4oqSq7eft7MdPKBGQK11X9WYUxmj6ZLgGTqYIbY1kyw=
|
||||
golang.org/x/oauth2 v0.0.0-20181003184128-c57b0facaced/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f h1:Bl/8QSvNqXvPGPGXa2z5xUTmV7VDcZyvRZ+QQXkXTZQ=
|
||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
@ -173,9 +162,6 @@ k8s.io/apiextensions-apiserver v0.0.0-20181213153335-0fe22c71c476 h1:Ws9zfxsgV19
|
||||
k8s.io/apiextensions-apiserver v0.0.0-20181213153335-0fe22c71c476/go.mod h1:IxkesAMoaCRoLrPJdZNZUQp9NfZnzqaVzLhb2VEQzXE=
|
||||
k8s.io/apimachinery v0.0.0-20181127025237-2b1284ed4c93 h1:tT6oQBi0qwLbbZSfDkdIsb23EwaLY85hoAV4SpXfdao=
|
||||
k8s.io/apimachinery v0.0.0-20181127025237-2b1284ed4c93/go.mod h1:ccL7Eh7zubPUSh9A3USN90/OzHNSVN6zxzde07TDCL0=
|
||||
k8s.io/apiserver v0.0.0-20181110111630-c45349c92333 h1:vJS6O3laUr6RjawTCj6mGtWAtSZIj8UJHHdJkVoq8iY=
|
||||
k8s.io/apiserver v0.0.0-20181110111630-c45349c92333/go.mod h1:6bqaTSOSJavUIXUtfaR9Os9JtTCm8ZqH2SUl2S60C4w=
|
||||
k8s.io/apiserver v0.0.0-20181211031017-bbe3b7124d2b h1:doK90r3QcG9/+ZIBcWhPPoMv7CfRkGQVgrVAe8kFWS8=
|
||||
k8s.io/apiserver v0.0.0-20181213151703-3ccfe8365421 h1:NyOpnIh+7SLvC05NGCIXF9c4KhnkTZQE2SxF+m9otww=
|
||||
k8s.io/apiserver v0.0.0-20181213151703-3ccfe8365421/go.mod h1:6bqaTSOSJavUIXUtfaR9Os9JtTCm8ZqH2SUl2S60C4w=
|
||||
k8s.io/client-go v10.0.0+incompatible h1:F1IqCqw7oMBzDkqlcBymRq1450wD0eNqLE9jzUrIi34=
|
||||
@ -190,7 +176,7 @@ k8s.io/kube-proxy v0.0.0-20181108055616-8eeec43ca7b5 h1:tM7Kt5AXss8IHvgPHoff1hyJ
|
||||
k8s.io/kube-proxy v0.0.0-20181108055616-8eeec43ca7b5/go.mod h1:wYVhqAVLhGBLbGzgb9GsBakzIddI81JxSUHANQvzZZs=
|
||||
k8s.io/kubelet v0.0.0-20181108055742-1ff588f76017 h1:Df4PBcfWHh/oi4pHC+G7mbJEKtbukYl34RDo12caUxA=
|
||||
k8s.io/kubelet v0.0.0-20181108055742-1ff588f76017/go.mod h1:m6JOtVhjgs4GGnzhPpXuNF9VG+IjARwo/dHCNw4+QDA=
|
||||
k8s.io/kubernetes v1.13.1 h1:UGJpxWwhE/oxhHhaNgmoW/nQcdFdKETx5bV8K5FHgyk=
|
||||
k8s.io/kubernetes v1.13.1 h1:IwCCcPOZwY9rKcQyBJYXAE4Wgma4oOW5NYR3HXKFfZ8=
|
||||
k8s.io/kubernetes v1.13.1/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk=
|
||||
k8s.io/utils v0.0.0-20181102055113-1bd4f387aa67 h1:+kBMW7D4cSYIhPz0fVs6NRp5QILMz6+65ec4kWJOoXs=
|
||||
k8s.io/utils v0.0.0-20181102055113-1bd4f387aa67/go.mod h1:8k8uAuAQ0rXslZKaEWd0c3oVhZz7sSzSiPnVZayjIX0=
|
@ -1,24 +0,0 @@
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: debug
|
||||
spec:
|
||||
# nodeSelector:
|
||||
# kubernetes.io/hostname: ${HOSTNAME}
|
||||
tolerations:
|
||||
- operator: Exists
|
||||
containers:
|
||||
- name: debug
|
||||
image: ubuntu:18.04
|
||||
command: [ "/bin/sh", "-c", "--" ]
|
||||
args: [ "while true; do sleep 30; done;" ]
|
||||
env:
|
||||
- name: DOCKER_HOST
|
||||
value: unix:///rootfs/run/docker.sock
|
||||
volumeMounts:
|
||||
- mountPath: /rootfs
|
||||
name: root
|
||||
volumes:
|
||||
- name: root
|
||||
hostPath:
|
||||
path: /
|
@ -100,6 +100,8 @@ linters:
|
||||
- gas
|
||||
- typecheck
|
||||
- megacheck
|
||||
- gochecknoglobals
|
||||
- gochecknoinits
|
||||
disable-all: false
|
||||
fast: false
|
||||
|
@ -50,17 +50,3 @@ rm -rf \
|
||||
${PREFIX}/usr/share/* \
|
||||
${PREFIX}/usr/libexec/getconf \
|
||||
${PREFIX}/var/db
|
||||
|
||||
mkdir -p ${PREFIX}/usr/share
|
||||
mkdir -p ${PREFIX}/usr/local/share
|
||||
|
||||
paths=( /etc/pki /usr/share/ca-certificates /usr/local/share/ca-certificates /etc/ca-certificates )
|
||||
for d in "${paths[@]}"; do
|
||||
ln -sv /etc/ssl/certs ${PREFIX}$d
|
||||
done
|
||||
|
||||
# Required by kube-proxy.
|
||||
mkdir ${PREFIX}/lib/modules
|
||||
|
||||
mkdir -p ${PREFIX}/usr/libexec
|
||||
ln -sv ../../var/libexec/kubernetes ${PREFIX}/usr/libexec/kubernetes
|
17
hack/scripts/symlink.sh
Normal file
17
hack/scripts/symlink.sh
Normal file
@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
PREFIX="${1}"
|
||||
|
||||
mkdir -p ${PREFIX}/usr/share
|
||||
mkdir -p ${PREFIX}/usr/local/share
|
||||
|
||||
paths=( /etc/pki /usr/share/ca-certificates /usr/local/share/ca-certificates /etc/ca-certificates )
|
||||
for d in "${paths[@]}"; do
|
||||
ln -sv /etc/ssl/certs ${PREFIX}$d
|
||||
done
|
||||
|
||||
# Required by kube-proxy.
|
||||
mkdir ${PREFIX}/lib/modules
|
||||
|
||||
mkdir -p ${PREFIX}/usr/libexec
|
||||
ln -sv ../../var/libexec/kubernetes ${PREFIX}/usr/libexec/kubernetes
|
@ -3,8 +3,8 @@ package reg
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/blockd/proto"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/userdata"
|
||||
"github.com/autonomy/talos/internal/app/blockd/proto"
|
||||
"github.com/autonomy/talos/internal/pkg/userdata"
|
||||
"github.com/golang/protobuf/ptypes/empty"
|
||||
"google.golang.org/grpc"
|
||||
)
|
@ -4,12 +4,12 @@ import (
|
||||
"flag"
|
||||
"log"
|
||||
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/constants"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/trustd/pkg/reg"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/grpc/factory"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/grpc/gen"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/grpc/tls"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/userdata"
|
||||
"github.com/autonomy/talos/internal/app/blockd/internal/reg"
|
||||
"github.com/autonomy/talos/internal/pkg/constants"
|
||||
"github.com/autonomy/talos/internal/pkg/grpc/factory"
|
||||
"github.com/autonomy/talos/internal/pkg/grpc/gen"
|
||||
"github.com/autonomy/talos/internal/pkg/grpc/tls"
|
||||
"github.com/autonomy/talos/internal/pkg/userdata"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials"
|
||||
)
|
@ -5,6 +5,7 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// PartNo returns the partition number.
|
||||
func PartNo(partname string) string {
|
||||
if strings.HasPrefix(partname, "/dev/nvme") {
|
||||
idx := strings.Index(partname, "p")
|
||||
@ -16,6 +17,7 @@ func PartNo(partname string) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
// DevnameFromPartname returns the device name from a partition name.
|
||||
func DevnameFromPartname(partname, partno string) string {
|
||||
if strings.HasPrefix(partname, "/dev/nvme") {
|
||||
return strings.TrimRight(partname, "p"+partno)
|
@ -1,3 +1,4 @@
|
||||
//nolint: scopelint
|
||||
package util
|
||||
|
||||
import (
|
@ -19,10 +19,14 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
BLKID_SUBLKS_LABEL = (1 << 1)
|
||||
BLKID_SUBLKS_UUID = (1 << 3)
|
||||
BLKID_SUBLKS_TYPE = (1 << 5)
|
||||
BLKID_PARTS_ENTRY_DETAILS = (1 << 2)
|
||||
// BlkidSublksLabel read LABEL from superblock.
|
||||
BlkidSublksLabel = (1 << 1)
|
||||
// BlkidSublksUUID read UUID from superblock.
|
||||
BlkidSublksUUID = (1 << 3)
|
||||
// BlkidSublksType reads the TYPE from superblock.
|
||||
BlkidSublksType = (1 << 5)
|
||||
// BlkidPartsEntryDetails reads the partition details from superblock.
|
||||
BlkidPartsEntryDetails = (1 << 2)
|
||||
)
|
||||
|
||||
// GetDevWithAttribute returns the dev name of a block device matching the ATTRIBUTE=VALUE
|
||||
@ -40,12 +44,12 @@ func GetDevWithAttribute(attribute, value string) (string, error) {
|
||||
|
||||
C.blkid_probe_all(cache)
|
||||
|
||||
cs_attribute := C.CString(attribute)
|
||||
cs_value := C.CString(value)
|
||||
defer C.free(unsafe.Pointer(cs_attribute))
|
||||
defer C.free(unsafe.Pointer(cs_value))
|
||||
csAttribute := C.CString(attribute)
|
||||
csValue := C.CString(value)
|
||||
defer C.free(unsafe.Pointer(csAttribute))
|
||||
defer C.free(unsafe.Pointer(csValue))
|
||||
|
||||
devname := C.blkid_get_devname(cache, cs_attribute, cs_value)
|
||||
devname := C.blkid_get_devname(cache, csAttribute, csValue)
|
||||
defer C.free(unsafe.Pointer(devname))
|
||||
|
||||
// If you have called blkid_get_cache(), you should call blkid_put_cache()
|
||||
@ -97,9 +101,9 @@ func ProbeLookupValue(pr C.blkid_probe, name string, size *int) (string, error)
|
||||
defer C.free(unsafe.Pointer(data))
|
||||
|
||||
C.blkid_probe_enable_superblocks(pr, 1)
|
||||
C.blkid_probe_set_superblocks_flags(pr, BLKID_SUBLKS_LABEL|BLKID_SUBLKS_UUID|BLKID_SUBLKS_TYPE)
|
||||
C.blkid_probe_set_superblocks_flags(pr, BlkidSublksLabel|BlkidSublksUUID|BlkidSublksType)
|
||||
C.blkid_probe_enable_partitions(pr, 1)
|
||||
C.blkid_probe_set_partitions_flags(pr, BLKID_PARTS_ENTRY_DETAILS)
|
||||
C.blkid_probe_set_partitions_flags(pr, BlkidPartsEntryDetails)
|
||||
|
||||
if err := DoSafeProbe(pr); err != nil {
|
||||
return "", errors.Errorf("failed to do safe probe: %v", err)
|
@ -10,11 +10,11 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/constants"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/fs/xfs"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/mount/blkid"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/blockdevice"
|
||||
gptpartition "github.com/autonomy/talos/src/initramfs/pkg/blockdevice/table/gpt/partition"
|
||||
"github.com/autonomy/talos/internal/app/init/internal/fs/xfs"
|
||||
"github.com/autonomy/talos/internal/app/init/internal/mount/blkid"
|
||||
"github.com/autonomy/talos/internal/pkg/blockdevice"
|
||||
gptpartition "github.com/autonomy/talos/internal/pkg/blockdevice/table/gpt/partition"
|
||||
"github.com/autonomy/talos/internal/pkg/constants"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
@ -359,6 +359,8 @@ func ProbeDevice(devname string) (*BlockDevice, error) {
|
||||
}
|
||||
|
||||
// TODO(andrewrynhard): Should we return an error here?
|
||||
// TODO(andrewrynhard): Move the PartNo function in the xfs package to an
|
||||
// appropriate package and use that instead of this.
|
||||
func partNo(partname string) string {
|
||||
if strings.HasPrefix(partname, "/dev/nvme") {
|
||||
idx := strings.Index(partname, "p")
|
||||
@ -371,6 +373,8 @@ func partNo(partname string) string {
|
||||
}
|
||||
|
||||
// TODO(andrewrynhard): Should we return an error here?
|
||||
// TODO(andrewrynhard): Move the DevnameFromPartname function in the xfs
|
||||
// package to an appropriate package and use that instead of this.
|
||||
func devnameFromPartname(partname string) string {
|
||||
partno := partNo(partname)
|
||||
if strings.HasPrefix(partname, "/dev/nvme") {
|
@ -18,16 +18,16 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/constants"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/fs/xfs"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/kernel"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/mount"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/mount/blkid"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/blockdevice"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/blockdevice/table"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/blockdevice/table/gpt/partition"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/userdata"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/version"
|
||||
"github.com/autonomy/talos/internal/app/init/internal/fs/xfs"
|
||||
"github.com/autonomy/talos/internal/app/init/internal/kernel"
|
||||
"github.com/autonomy/talos/internal/app/init/internal/mount"
|
||||
"github.com/autonomy/talos/internal/app/init/internal/mount/blkid"
|
||||
"github.com/autonomy/talos/internal/pkg/blockdevice"
|
||||
"github.com/autonomy/talos/internal/pkg/blockdevice/table"
|
||||
"github.com/autonomy/talos/internal/pkg/blockdevice/table/gpt/partition"
|
||||
"github.com/autonomy/talos/internal/pkg/constants"
|
||||
"github.com/autonomy/talos/internal/pkg/userdata"
|
||||
"github.com/autonomy/talos/internal/pkg/version"
|
||||
"golang.org/x/sys/unix"
|
||||
yaml "gopkg.in/yaml.v2"
|
||||
)
|
@ -8,8 +8,8 @@ import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/constants"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/blockdevice"
|
||||
"github.com/autonomy/talos/internal/pkg/blockdevice"
|
||||
"github.com/autonomy/talos/internal/pkg/constants"
|
||||
)
|
||||
|
||||
// nolint: gocyclo
|
@ -10,7 +10,7 @@ import (
|
||||
"log"
|
||||
"net/http"
|
||||
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/userdata"
|
||||
"github.com/autonomy/talos/internal/pkg/userdata"
|
||||
"github.com/fullsailor/pkcs7"
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
@ -6,9 +6,9 @@ import (
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/constants"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/kernel"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/userdata"
|
||||
"github.com/autonomy/talos/internal/app/init/internal/kernel"
|
||||
"github.com/autonomy/talos/internal/pkg/constants"
|
||||
"github.com/autonomy/talos/internal/pkg/userdata"
|
||||
"github.com/vmware/vmw-guestinfo/rpcvmx"
|
||||
"github.com/vmware/vmw-guestinfo/vmcheck"
|
||||
yaml "gopkg.in/yaml.v2"
|
@ -5,12 +5,12 @@ package platform
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/constants"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/kernel"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/platform/baremetal"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/platform/cloud/aws"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/platform/cloud/vmware"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/userdata"
|
||||
"github.com/autonomy/talos/internal/app/init/internal/kernel"
|
||||
"github.com/autonomy/talos/internal/app/init/internal/platform/baremetal"
|
||||
"github.com/autonomy/talos/internal/app/init/internal/platform/cloud/aws"
|
||||
"github.com/autonomy/talos/internal/app/init/internal/platform/cloud/vmware"
|
||||
"github.com/autonomy/talos/internal/pkg/constants"
|
||||
"github.com/autonomy/talos/internal/pkg/userdata"
|
||||
)
|
||||
|
||||
// Platform is an interface describing a platform.
|
@ -4,8 +4,8 @@ import (
|
||||
"os"
|
||||
"path"
|
||||
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/constants"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/userdata"
|
||||
"github.com/autonomy/talos/internal/pkg/constants"
|
||||
"github.com/autonomy/talos/internal/pkg/userdata"
|
||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||
"github.com/pkg/errors"
|
||||
)
|
@ -11,7 +11,7 @@ import (
|
||||
"strings"
|
||||
"text/template"
|
||||
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/version"
|
||||
"github.com/autonomy/talos/internal/pkg/version"
|
||||
)
|
||||
|
||||
const hostsTemplate = `
|
@ -5,11 +5,11 @@ import (
|
||||
"net"
|
||||
"os"
|
||||
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/constants"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/rootfs/cni"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/rootfs/etc"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/rootfs/proc"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/userdata"
|
||||
"github.com/autonomy/talos/internal/app/init/internal/rootfs/cni"
|
||||
"github.com/autonomy/talos/internal/app/init/internal/rootfs/etc"
|
||||
"github.com/autonomy/talos/internal/app/init/internal/rootfs/proc"
|
||||
"github.com/autonomy/talos/internal/pkg/constants"
|
||||
"github.com/autonomy/talos/internal/pkg/userdata"
|
||||
yaml "gopkg.in/yaml.v2"
|
||||
)
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
"text/template"
|
||||
"time"
|
||||
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/constants"
|
||||
"github.com/autonomy/talos/internal/pkg/constants"
|
||||
|
||||
"k8s.io/api/core/v1"
|
||||
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
@ -6,8 +6,8 @@ import (
|
||||
"os"
|
||||
"syscall"
|
||||
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/mount"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/mount/cgroups"
|
||||
"github.com/autonomy/talos/internal/app/init/internal/mount"
|
||||
"github.com/autonomy/talos/internal/app/init/internal/mount/cgroups"
|
||||
"github.com/pkg/errors"
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
@ -11,14 +11,14 @@ import (
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/constants"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/mount"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/platform"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/rootfs"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/switchroot"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/system"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/system/services"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/userdata"
|
||||
"github.com/autonomy/talos/internal/app/init/internal/mount"
|
||||
"github.com/autonomy/talos/internal/app/init/internal/platform"
|
||||
"github.com/autonomy/talos/internal/app/init/internal/rootfs"
|
||||
"github.com/autonomy/talos/internal/app/init/internal/switchroot"
|
||||
"github.com/autonomy/talos/internal/app/init/pkg/system"
|
||||
"github.com/autonomy/talos/internal/app/init/pkg/system/services"
|
||||
"github.com/autonomy/talos/internal/pkg/constants"
|
||||
"github.com/autonomy/talos/internal/pkg/userdata"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"golang.org/x/sys/unix"
|
@ -4,10 +4,10 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/constants"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/system/conditions"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/system/runner"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/userdata"
|
||||
"github.com/autonomy/talos/internal/app/init/pkg/system/conditions"
|
||||
"github.com/autonomy/talos/internal/app/init/pkg/system/runner"
|
||||
"github.com/autonomy/talos/internal/pkg/constants"
|
||||
"github.com/autonomy/talos/internal/pkg/userdata"
|
||||
"github.com/containerd/containerd"
|
||||
"github.com/containerd/containerd/cio"
|
||||
"github.com/containerd/containerd/containers"
|
||||
@ -63,6 +63,7 @@ func (c *Containerd) Run(data *userdata.UserData, args runner.Args, setters ...r
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// nolint: errcheck
|
||||
defer client.Close()
|
||||
|
||||
// Pull the image and unpack it.
|
||||
@ -120,8 +121,7 @@ func newContainerOpts(image containerd.Image, args runner.Args, opts *runner.Opt
|
||||
containerd.WithNewSnapshot(args.ID, image),
|
||||
containerd.WithNewSpec(specOpts...),
|
||||
}
|
||||
switch opts.Type {
|
||||
case runner.Forever:
|
||||
if opts.Type == runner.Forever {
|
||||
containerOpts = append(containerOpts, restart.WithStatus(containerd.Running), restart.WithLogPath(logPath(args)))
|
||||
}
|
||||
containerOpts = append(containerOpts, opts.ContainerOpts...)
|
||||
@ -129,7 +129,7 @@ func newContainerOpts(image containerd.Image, args runner.Args, opts *runner.Opt
|
||||
return containerOpts
|
||||
}
|
||||
|
||||
func newOCISpecOpts(image containerd.Image, args runner.Args, opts *runner.Options) []oci.SpecOpts {
|
||||
func newOCISpecOpts(image oci.Image, args runner.Args, opts *runner.Options) []oci.SpecOpts {
|
||||
specOpts := []oci.SpecOpts{
|
||||
oci.WithImageConfig(image),
|
||||
oci.WithProcessArgs(args.ProcessArgs...),
|
@ -7,7 +7,7 @@ import (
|
||||
"path"
|
||||
"sync"
|
||||
|
||||
filechunker "github.com/autonomy/talos/src/initramfs/pkg/chunker/file"
|
||||
filechunker "github.com/autonomy/talos/internal/pkg/chunker/file"
|
||||
)
|
||||
|
||||
var instance = map[string]*Log{}
|
@ -8,10 +8,10 @@ import (
|
||||
"os/exec"
|
||||
"time"
|
||||
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/constants"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/system/runner"
|
||||
processlogger "github.com/autonomy/talos/src/initramfs/cmd/init/pkg/system/runner/process/log"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/userdata"
|
||||
"github.com/autonomy/talos/internal/app/init/pkg/system/runner"
|
||||
processlogger "github.com/autonomy/talos/internal/app/init/pkg/system/runner/process/log"
|
||||
"github.com/autonomy/talos/internal/pkg/constants"
|
||||
"github.com/autonomy/talos/internal/pkg/userdata"
|
||||
)
|
||||
|
||||
// Process is a runner.Runner that runs a process on the host.
|
||||
@ -42,7 +42,7 @@ func (p *Process) build(data *userdata.UserData, args *runner.Args, opts *runner
|
||||
cmd = exec.Command(args.ProcessArgs[0], args.ProcessArgs[1:]...)
|
||||
|
||||
// Set the environment for the service.
|
||||
cmd.Env = append(opts.Env, fmt.Sprintf("PATH=%s", constants.PATH))
|
||||
cmd.Env = append([]string{fmt.Sprintf("PATH=%s", constants.PATH)}, opts.Env...)
|
||||
|
||||
// Setup logging.
|
||||
w, err := processlogger.New(args.ID)
|
@ -1,7 +1,7 @@
|
||||
package runner
|
||||
|
||||
import (
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/userdata"
|
||||
"github.com/autonomy/talos/internal/pkg/userdata"
|
||||
"github.com/containerd/containerd"
|
||||
"github.com/containerd/containerd/oci"
|
||||
)
|
@ -5,12 +5,12 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/constants"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/system/conditions"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/system/runner"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/system/runner/containerd"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/userdata"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/version"
|
||||
"github.com/autonomy/talos/internal/app/init/pkg/system/conditions"
|
||||
"github.com/autonomy/talos/internal/app/init/pkg/system/runner"
|
||||
"github.com/autonomy/talos/internal/app/init/pkg/system/runner/containerd"
|
||||
"github.com/autonomy/talos/internal/pkg/constants"
|
||||
"github.com/autonomy/talos/internal/pkg/userdata"
|
||||
"github.com/autonomy/talos/internal/pkg/version"
|
||||
"github.com/containerd/containerd/oci"
|
||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||
)
|
@ -4,10 +4,10 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/system/conditions"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/system/runner"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/system/runner/process"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/userdata"
|
||||
"github.com/autonomy/talos/internal/app/init/pkg/system/conditions"
|
||||
"github.com/autonomy/talos/internal/app/init/pkg/system/runner"
|
||||
"github.com/autonomy/talos/internal/app/init/pkg/system/runner/process"
|
||||
"github.com/autonomy/talos/internal/pkg/userdata"
|
||||
)
|
||||
|
||||
// Containerd implements the Service interface. It serves as the concrete type with
|
@ -2,6 +2,7 @@ package services
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
@ -9,15 +10,15 @@ import (
|
||||
"path"
|
||||
"time"
|
||||
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/constants"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/security/cis"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/system/conditions"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/system/runner"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/system/runner/containerd"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/trustd/proto"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/crypto/x509"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/grpc/middleware/auth/basic"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/userdata"
|
||||
"github.com/autonomy/talos/internal/app/init/internal/security/cis"
|
||||
"github.com/autonomy/talos/internal/app/init/pkg/system/conditions"
|
||||
"github.com/autonomy/talos/internal/app/init/pkg/system/runner"
|
||||
"github.com/autonomy/talos/internal/app/init/pkg/system/runner/containerd"
|
||||
"github.com/autonomy/talos/internal/app/trustd/proto"
|
||||
"github.com/autonomy/talos/internal/pkg/constants"
|
||||
"github.com/autonomy/talos/internal/pkg/crypto/x509"
|
||||
"github.com/autonomy/talos/internal/pkg/grpc/middleware/auth/basic"
|
||||
"github.com/autonomy/talos/internal/pkg/userdata"
|
||||
"github.com/containerd/containerd/oci"
|
||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||
|
||||
@ -176,7 +177,10 @@ func enforceMasterOverrides(initConfiguration *kubeadmapi.InitConfiguration) {
|
||||
func writeKubeadmConfig(data *userdata.UserData) (err error) {
|
||||
var b []byte
|
||||
if data.IsBootstrap() {
|
||||
initConfiguration := data.Services.Kubeadm.Configuration.(*kubeadmapi.InitConfiguration)
|
||||
initConfiguration, ok := data.Services.Kubeadm.Configuration.(*kubeadmapi.InitConfiguration)
|
||||
if !ok {
|
||||
return errors.New("expected InitConfiguration")
|
||||
}
|
||||
initConfiguration.NodeRegistration.CRISocket = constants.ContainerdSocket
|
||||
enforceMasterOverrides(initConfiguration)
|
||||
if err = cis.EnforceMasterRequirements(initConfiguration); err != nil {
|
||||
@ -187,7 +191,10 @@ func writeKubeadmConfig(data *userdata.UserData) (err error) {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
joinConfiguration := data.Services.Kubeadm.Configuration.(*kubeadmapi.JoinConfiguration)
|
||||
joinConfiguration, ok := data.Services.Kubeadm.Configuration.(*kubeadmapi.JoinConfiguration)
|
||||
if !ok {
|
||||
return errors.New("expected JoinConfiguration")
|
||||
}
|
||||
joinConfiguration.NodeRegistration.CRISocket = constants.ContainerdSocket
|
||||
if err = cis.EnforceWorkerRequirements(joinConfiguration); err != nil {
|
||||
return err
|
||||
@ -199,7 +206,7 @@ func writeKubeadmConfig(data *userdata.UserData) (err error) {
|
||||
}
|
||||
|
||||
p := path.Dir(constants.KubeadmConfig)
|
||||
if err := os.MkdirAll(p, os.ModeDir); err != nil {
|
||||
if err = os.MkdirAll(p, os.ModeDir); err != nil {
|
||||
return fmt.Errorf("create %s: %v", p, err)
|
||||
}
|
||||
|
@ -6,12 +6,12 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/constants"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/rootfs/cni"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/system/conditions"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/system/runner"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/system/runner/containerd"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/userdata"
|
||||
"github.com/autonomy/talos/internal/app/init/internal/rootfs/cni"
|
||||
"github.com/autonomy/talos/internal/app/init/pkg/system/conditions"
|
||||
"github.com/autonomy/talos/internal/app/init/pkg/system/runner"
|
||||
"github.com/autonomy/talos/internal/app/init/pkg/system/runner/containerd"
|
||||
"github.com/autonomy/talos/internal/pkg/constants"
|
||||
"github.com/autonomy/talos/internal/pkg/userdata"
|
||||
"github.com/containerd/containerd/oci"
|
||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||
)
|
@ -4,12 +4,12 @@ package services
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/constants"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/system/conditions"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/system/runner"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/system/runner/containerd"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/userdata"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/version"
|
||||
"github.com/autonomy/talos/internal/app/init/pkg/system/conditions"
|
||||
"github.com/autonomy/talos/internal/app/init/pkg/system/runner"
|
||||
"github.com/autonomy/talos/internal/app/init/pkg/system/runner/containerd"
|
||||
"github.com/autonomy/talos/internal/pkg/constants"
|
||||
"github.com/autonomy/talos/internal/pkg/userdata"
|
||||
"github.com/autonomy/talos/internal/pkg/version"
|
||||
"github.com/containerd/containerd/oci"
|
||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||
)
|
@ -4,11 +4,11 @@ package services
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/system/conditions"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/system/runner"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/system/runner/containerd"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/userdata"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/version"
|
||||
"github.com/autonomy/talos/internal/app/init/pkg/system/conditions"
|
||||
"github.com/autonomy/talos/internal/app/init/pkg/system/runner"
|
||||
"github.com/autonomy/talos/internal/app/init/pkg/system/runner/containerd"
|
||||
"github.com/autonomy/talos/internal/pkg/userdata"
|
||||
"github.com/autonomy/talos/internal/pkg/version"
|
||||
"github.com/containerd/containerd/oci"
|
||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||
)
|
@ -4,12 +4,12 @@ package services
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/constants"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/system/conditions"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/system/runner"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/system/runner/containerd"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/userdata"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/version"
|
||||
"github.com/autonomy/talos/internal/app/init/pkg/system/conditions"
|
||||
"github.com/autonomy/talos/internal/app/init/pkg/system/runner"
|
||||
"github.com/autonomy/talos/internal/app/init/pkg/system/runner/containerd"
|
||||
"github.com/autonomy/talos/internal/pkg/constants"
|
||||
"github.com/autonomy/talos/internal/pkg/userdata"
|
||||
"github.com/autonomy/talos/internal/pkg/version"
|
||||
"github.com/containerd/containerd/oci"
|
||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||
)
|
@ -3,10 +3,10 @@ package services
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/system/conditions"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/system/runner"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/system/runner/process"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/userdata"
|
||||
"github.com/autonomy/talos/internal/app/init/pkg/system/conditions"
|
||||
"github.com/autonomy/talos/internal/app/init/pkg/system/runner"
|
||||
"github.com/autonomy/talos/internal/app/init/pkg/system/runner/process"
|
||||
"github.com/autonomy/talos/internal/pkg/userdata"
|
||||
)
|
||||
|
||||
// Udevd implements the Service interface. It serves as the concrete type with
|
@ -4,8 +4,8 @@ import (
|
||||
"log"
|
||||
"sync"
|
||||
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/system/conditions"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/userdata"
|
||||
"github.com/autonomy/talos/internal/app/init/pkg/system/conditions"
|
||||
"github.com/autonomy/talos/internal/pkg/userdata"
|
||||
)
|
||||
|
||||
type singleton struct {
|
@ -6,7 +6,7 @@ import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/osctl/pkg/config"
|
||||
"github.com/autonomy/talos/internal/app/osctl/internal/client/config"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
@ -4,9 +4,9 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/constants"
|
||||
"github.com/autonomy/talos/internal/pkg/constants"
|
||||
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/osctl/pkg/client"
|
||||
"github.com/autonomy/talos/internal/app/osctl/internal/client"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
@ -11,7 +11,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/crypto/x509"
|
||||
"github.com/autonomy/talos/internal/pkg/crypto/x509"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
@ -5,8 +5,8 @@ import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/crypto/x509"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/userdata"
|
||||
"github.com/autonomy/talos/internal/pkg/crypto/x509"
|
||||
"github.com/autonomy/talos/internal/pkg/userdata"
|
||||
"github.com/spf13/cobra"
|
||||
yaml "gopkg.in/yaml.v2"
|
||||
)
|
@ -6,8 +6,8 @@ import (
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/constants"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/osctl/pkg/client"
|
||||
"github.com/autonomy/talos/internal/app/osctl/internal/client"
|
||||
"github.com/autonomy/talos/internal/pkg/constants"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
@ -4,9 +4,9 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/constants"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/osctl/pkg/client"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/osd/proto"
|
||||
"github.com/autonomy/talos/internal/app/osctl/internal/client"
|
||||
"github.com/autonomy/talos/internal/app/osd/proto"
|
||||
"github.com/autonomy/talos/internal/pkg/constants"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
@ -5,8 +5,8 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/constants"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/osctl/pkg/client"
|
||||
"github.com/autonomy/talos/internal/app/osctl/internal/client"
|
||||
"github.com/autonomy/talos/internal/pkg/constants"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
@ -5,8 +5,8 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/constants"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/osctl/pkg/client"
|
||||
"github.com/autonomy/talos/internal/app/osctl/internal/client"
|
||||
"github.com/autonomy/talos/internal/pkg/constants"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
@ -5,8 +5,8 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/constants"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/osctl/pkg/client"
|
||||
"github.com/autonomy/talos/internal/app/osctl/internal/client"
|
||||
"github.com/autonomy/talos/internal/pkg/constants"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
@ -5,9 +5,9 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/constants"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/osctl/pkg/client"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/osd/proto"
|
||||
"github.com/autonomy/talos/internal/app/osctl/internal/client"
|
||||
"github.com/autonomy/talos/internal/app/osd/proto"
|
||||
"github.com/autonomy/talos/internal/pkg/constants"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
@ -4,9 +4,9 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/constants"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/osctl/pkg/client"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/version"
|
||||
"github.com/autonomy/talos/internal/app/osctl/internal/client"
|
||||
"github.com/autonomy/talos/internal/pkg/constants"
|
||||
"github.com/autonomy/talos/internal/pkg/version"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
@ -10,8 +10,8 @@ import (
|
||||
"os"
|
||||
"text/tabwriter"
|
||||
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/osctl/pkg/config"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/osd/proto"
|
||||
"github.com/autonomy/talos/internal/app/osctl/internal/client/config"
|
||||
"github.com/autonomy/talos/internal/app/osd/proto"
|
||||
"github.com/golang/protobuf/ptypes/empty"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials"
|
7
internal/app/osctl/main.go
Normal file
7
internal/app/osctl/main.go
Normal file
@ -0,0 +1,7 @@
|
||||
package main
|
||||
|
||||
import "github.com/autonomy/talos/internal/app/osctl/cmd"
|
||||
|
||||
func main() {
|
||||
cmd.Execute()
|
||||
}
|
@ -8,15 +8,15 @@ import (
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/constants"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/system/runner"
|
||||
containerdrunner "github.com/autonomy/talos/src/initramfs/cmd/init/pkg/system/runner/containerd"
|
||||
servicelog "github.com/autonomy/talos/src/initramfs/cmd/init/pkg/system/runner/process/log"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/osd/proto"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/chunker"
|
||||
filechunker "github.com/autonomy/talos/src/initramfs/pkg/chunker/file"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/userdata"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/version"
|
||||
"github.com/autonomy/talos/internal/app/init/pkg/system/runner"
|
||||
containerdrunner "github.com/autonomy/talos/internal/app/init/pkg/system/runner/containerd"
|
||||
servicelog "github.com/autonomy/talos/internal/app/init/pkg/system/runner/process/log"
|
||||
"github.com/autonomy/talos/internal/app/osd/proto"
|
||||
"github.com/autonomy/talos/internal/pkg/chunker"
|
||||
filechunker "github.com/autonomy/talos/internal/pkg/chunker/file"
|
||||
"github.com/autonomy/talos/internal/pkg/constants"
|
||||
"github.com/autonomy/talos/internal/pkg/userdata"
|
||||
"github.com/autonomy/talos/internal/pkg/version"
|
||||
"github.com/containerd/cgroups"
|
||||
"github.com/containerd/containerd"
|
||||
tasks "github.com/containerd/containerd/api/services/tasks/v1"
|
||||
@ -63,6 +63,7 @@ func (r *Registrator) Processes(ctx context.Context, in *empty.Empty) (reply *pr
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// nolint: errcheck
|
||||
defer client.Close()
|
||||
containers, err := client.Containers(ctx)
|
||||
processes := []*proto.Process{}
|
||||
@ -126,6 +127,7 @@ func (r *Registrator) Restart(ctx context.Context, in *proto.RestartRequest) (re
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// nolint: errcheck
|
||||
defer client.Close()
|
||||
task := client.TaskService()
|
||||
_, err = task.Kill(ctx, &tasks.KillRequest{ContainerID: in.Id, Signal: uint32(unix.SIGTERM)})
|
||||
@ -189,6 +191,7 @@ func (r *Registrator) Reset(ctx context.Context, in *empty.Empty) (reply *proto.
|
||||
|
||||
// Reboot implements the proto.OSDServer interface.
|
||||
func (r *Registrator) Reboot(ctx context.Context, in *empty.Empty) (reply *proto.RebootReply, err error) {
|
||||
// nolint: errcheck
|
||||
unix.Reboot(int(unix.LINUX_REBOOT_CMD_RESTART))
|
||||
|
||||
reply = &proto.RebootReply{}
|
@ -4,12 +4,12 @@ import (
|
||||
"flag"
|
||||
"log"
|
||||
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/constants"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/osd/pkg/reg"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/grpc/factory"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/grpc/gen"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/grpc/tls"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/userdata"
|
||||
"github.com/autonomy/talos/internal/app/osd/internal/reg"
|
||||
"github.com/autonomy/talos/internal/pkg/constants"
|
||||
"github.com/autonomy/talos/internal/pkg/grpc/factory"
|
||||
"github.com/autonomy/talos/internal/pkg/grpc/gen"
|
||||
"github.com/autonomy/talos/internal/pkg/grpc/tls"
|
||||
"github.com/autonomy/talos/internal/pkg/userdata"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials"
|
||||
)
|
@ -11,8 +11,8 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/proxyd/pkg/backend"
|
||||
pkgnet "github.com/autonomy/talos/src/initramfs/pkg/net"
|
||||
"github.com/autonomy/talos/internal/app/proxyd/internal/backend"
|
||||
pkgnet "github.com/autonomy/talos/internal/pkg/net"
|
||||
"k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/fields"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
@ -165,6 +165,7 @@ func (r *ReverseProxy) Watch() (err error) {
|
||||
// AddFunc is a ResourceEventHandlerFunc.
|
||||
func (r *ReverseProxy) AddFunc() func(obj interface{}) {
|
||||
return func(obj interface{}) {
|
||||
// nolint: errcheck
|
||||
pod := obj.(*v1.Pod)
|
||||
|
||||
if !isAPIServer(pod) {
|
||||
@ -194,7 +195,9 @@ func (r *ReverseProxy) AddFunc() func(obj interface{}) {
|
||||
// UpdateFunc is a ResourceEventHandlerFunc.
|
||||
func (r *ReverseProxy) UpdateFunc() func(oldObj, newObj interface{}) {
|
||||
return func(oldObj, newObj interface{}) {
|
||||
// nolint: errcheck
|
||||
old := oldObj.(*v1.Pod)
|
||||
// nolint: errcheck
|
||||
new := newObj.(*v1.Pod)
|
||||
|
||||
if !isAPIServer(old) {
|
||||
@ -225,6 +228,7 @@ func (r *ReverseProxy) UpdateFunc() func(oldObj, newObj interface{}) {
|
||||
// DeleteFunc is a ResourceEventHandlerFunc.
|
||||
func (r *ReverseProxy) DeleteFunc() func(obj interface{}) {
|
||||
return func(obj interface{}) {
|
||||
// nolint: errcheck
|
||||
pod := obj.(*v1.Pod)
|
||||
|
||||
if !isAPIServer(pod) {
|
@ -3,7 +3,7 @@ package main
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/proxyd/pkg/frontend"
|
||||
"github.com/autonomy/talos/internal/app/proxyd/internal/frontend"
|
||||
)
|
||||
|
||||
func main() {
|
@ -11,9 +11,9 @@ import (
|
||||
"path"
|
||||
"time"
|
||||
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/trustd/proto"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/crypto/x509"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/userdata"
|
||||
"github.com/autonomy/talos/internal/app/trustd/proto"
|
||||
"github.com/autonomy/talos/internal/pkg/crypto/x509"
|
||||
"github.com/autonomy/talos/internal/pkg/userdata"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
@ -4,12 +4,12 @@ import (
|
||||
"flag"
|
||||
"log"
|
||||
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/init/pkg/constants"
|
||||
"github.com/autonomy/talos/src/initramfs/cmd/trustd/pkg/reg"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/grpc/factory"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/grpc/middleware/auth/basic"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/grpc/tls"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/userdata"
|
||||
"github.com/autonomy/talos/internal/app/trustd/internal/reg"
|
||||
"github.com/autonomy/talos/internal/pkg/constants"
|
||||
"github.com/autonomy/talos/internal/pkg/grpc/factory"
|
||||
"github.com/autonomy/talos/internal/pkg/grpc/middleware/auth/basic"
|
||||
"github.com/autonomy/talos/internal/pkg/grpc/tls"
|
||||
"github.com/autonomy/talos/internal/pkg/userdata"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials"
|
||||
)
|
@ -8,8 +8,8 @@ import (
|
||||
"os"
|
||||
"path"
|
||||
|
||||
"github.com/autonomy/talos/src/rootfs/udevd/pkg/drivers/scsi"
|
||||
"github.com/autonomy/talos/src/rootfs/udevd/pkg/uevent"
|
||||
"github.com/autonomy/talos/internal/app/udevd/internal/drivers/scsi"
|
||||
"github.com/autonomy/talos/internal/app/udevd/internal/uevent"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
@ -40,8 +40,7 @@ func watch() error {
|
||||
|
||||
// nolint: gocyclo
|
||||
func handle(message *uevent.Message) (err error) {
|
||||
switch message.Subsystem {
|
||||
case uevent.SubsystemBlock:
|
||||
if message.Subsystem == uevent.SubsystemBlock {
|
||||
var devname, devtype, partn string
|
||||
var ok bool
|
||||
|
@ -6,8 +6,8 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/blockdevice/table"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/blockdevice/table/gpt"
|
||||
"github.com/autonomy/talos/internal/pkg/blockdevice/table"
|
||||
"github.com/autonomy/talos/internal/pkg/blockdevice/table/gpt"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"golang.org/x/sys/unix"
|
@ -7,11 +7,11 @@ import (
|
||||
"syscall"
|
||||
"unsafe"
|
||||
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/blockdevice/pkg/lba"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/blockdevice/pkg/serde"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/blockdevice/table"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/blockdevice/table/gpt/header"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/blockdevice/table/gpt/partition"
|
||||
"github.com/autonomy/talos/internal/pkg/blockdevice/pkg/lba"
|
||||
"github.com/autonomy/talos/internal/pkg/blockdevice/pkg/serde"
|
||||
"github.com/autonomy/talos/internal/pkg/blockdevice/table"
|
||||
"github.com/autonomy/talos/internal/pkg/blockdevice/table/gpt/header"
|
||||
"github.com/autonomy/talos/internal/pkg/blockdevice/table/gpt/partition"
|
||||
"github.com/google/uuid"
|
||||
"github.com/pkg/errors"
|
||||
"golang.org/x/sys/unix"
|
||||
@ -123,10 +123,7 @@ func (gpt *GPT) New() (table.PartitionTable, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
pmbr, err := gpt.newPMBR(h)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
pmbr := gpt.newPMBR(h)
|
||||
|
||||
gpt.header = h
|
||||
gpt.partitions = []table.Partition{}
|
||||
@ -168,7 +165,7 @@ func (gpt *GPT) newHeader(size int64) (*header.Header, error) {
|
||||
// - https://en.wikipedia.org/wiki/GUID_Partition_Table#Protective_MBR_(LBA_0)
|
||||
// - https://www.syslinux.org/wiki/index.php?title=Doc/gpt
|
||||
// - https://en.wikipedia.org/wiki/Master_boot_record
|
||||
func (gpt *GPT) newPMBR(h *header.Header) ([]byte, error) {
|
||||
func (gpt *GPT) newPMBR(h *header.Header) []byte {
|
||||
pmbr := make([]byte, 512)
|
||||
|
||||
// Boot signature.
|
||||
@ -183,7 +180,7 @@ func (gpt *GPT) newPMBR(h *header.Header) ([]byte, error) {
|
||||
// Partition length in sectors.
|
||||
binary.LittleEndian.PutUint32(b[12:16], uint32(h.BackupLBA))
|
||||
|
||||
return pmbr, nil
|
||||
return pmbr
|
||||
}
|
||||
|
||||
// Write the primary table.
|
@ -7,8 +7,8 @@ import (
|
||||
"fmt"
|
||||
"hash/crc32"
|
||||
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/blockdevice/pkg/lba"
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/blockdevice/pkg/serde"
|
||||
"github.com/autonomy/talos/internal/pkg/blockdevice/pkg/lba"
|
||||
"github.com/autonomy/talos/internal/pkg/blockdevice/pkg/serde"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/blockdevice/pkg/serde"
|
||||
"github.com/autonomy/talos/internal/pkg/blockdevice/pkg/serde"
|
||||
"github.com/google/uuid"
|
||||
"golang.org/x/text/encoding/unicode"
|
||||
)
|
@ -1,7 +1,7 @@
|
||||
// Package table provides a library for working with block device partition tables.
|
||||
package table
|
||||
|
||||
import "github.com/autonomy/talos/src/initramfs/pkg/blockdevice/pkg/serde"
|
||||
import "github.com/autonomy/talos/internal/pkg/blockdevice/pkg/serde"
|
||||
|
||||
// Table represents a partition table.
|
||||
type Table = []byte
|
@ -5,7 +5,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/autonomy/talos/src/initramfs/pkg/chunker"
|
||||
"github.com/autonomy/talos/internal/pkg/chunker"
|
||||
)
|
||||
|
||||
// Options is the functional options struct.
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user