Skip to content

Commit 8c09273

Browse files
authored
fix: pull request actions workflow (#4)
* test pr * fix: actions * f * fix * fix: helm values * fix: e2e tests * fix: unit tests exclude e2e
1 parent c34a579 commit 8c09273

File tree

18 files changed

+403
-187
lines changed

18 files changed

+403
-187
lines changed

.github/pullrequest.yml renamed to .github/workflows/pullrequest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ jobs:
2121
with:
2222
go-version: '1.20'
2323
- uses: actions/checkout@v3
24-
- run: make smoketest
24+
- run: make smoketests

Makefile

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env bash
22

3+
include embedded-bins/Makefile.variables
34
include inttest/Makefile.variables
45

56
BIN_DIR := $(shell pwd)/bin
@@ -12,7 +13,6 @@ help: ## Display this help
1213
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
1314

1415
##@ Build
15-
ADMIN_CONSOLE_VERSION=1.99.0
1616

1717
GO_TAGS = -tags=''
1818

@@ -44,17 +44,17 @@ bin/helmbin: $(GO_SRCS) go.sum
4444
@mkdir -p bin
4545
CGO_ENABLED=0 go build $(GO_GCFLAGS) $(GO_ASMFLAGS) $(LD_FLAGS) $(GO_TAGS) -o $(BIN) ./cmd/helmbin
4646

47-
static: static/bin/k0s static/helm/000-admin-console-$(ADMIN_CONSOLE_VERSION).tgz ## Build static assets
47+
static: static/bin/k0s static/helm/000-admin-console-$(admin_console_version).tgz ## Build static assets
4848

4949
static/bin/k0s:
5050
@mkdir -p static/bin
51-
@curl -sSL -o static/bin/k0s https://github.com/k0sproject/k0s/releases/download/v1.27.2%2Bk0s.0/k0s-v1.27.2+k0s.0-amd64
51+
@curl -fsSL -o static/bin/k0s https://github.com/k0sproject/k0s/releases/download/$(k0s_version)/k0s-$(k0s_version)-amd64
5252
chmod +x static/bin/k0s
5353

54-
static/helm/000-admin-console-$(ADMIN_CONSOLE_VERSION).tgz: helm
54+
static/helm/000-admin-console-$(admin_console_version).tgz: helm
5555
@mkdir -p static/helm
56-
@helm pull oci://registry.replicated.com/library/admin-console --version=$(ADMIN_CONSOLE_VERSION)
57-
mv admin-console-$(ADMIN_CONSOLE_VERSION).tgz static/helm/000-admin-console-$(ADMIN_CONSOLE_VERSION).tgz
56+
@helm pull oci://registry.replicated.com/library/admin-console --version=$(admin_console_version)
57+
mv admin-console-$(admin_console_version).tgz static/helm/000-admin-console-$(admin_console_version).tgz
5858

5959
##@ Development
6060

@@ -68,7 +68,7 @@ lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes
6868

6969
.PHONY: test
7070
test: ## Run the unit tests
71-
go test $(GO_TAGS) -race -v ./...
71+
go test $(GO_TAGS) -race -v ./pkg/...
7272

7373
.PHONY: $(smoketests)
7474
$(smoketests): build
@@ -85,8 +85,7 @@ golangci-lint:
8585
curl -fsSL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell dirname $(GOLANGCI_LINT));\
8686
}
8787

88-
HELM_VERSION = v3.12.0
8988
.PHONY: helm
9089
helm:
9190
@mkdir -p $(BIN_DIR)
92-
curl -fsSL https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | DESIRED_VERSION=$(HELM_VERSION) HELM_INSTALL_DIR=$(BIN_DIR) bash
91+
curl -fsSL https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | DESIRED_VERSION=v$(helm_version) HELM_INSTALL_DIR=$(BIN_DIR) bash

README.md

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ Usage:
1212
Available Commands:
1313
completion Generate the autocompletion script for the specified shell
1414
help Help about any command
15-
install Installs and starts the server as a systemd service
15+
install Installs and starts a controller+worker as a systemd service
1616
kubectl kubectl controls the Kubernetes cluster manager
17-
run Runs the server
17+
run Runs a controller+worker node
1818
start Starts the systemd service
1919
stop Stops the systemd service
2020
version Prints version information
2121

2222
Flags:
23-
-d, --debug Debug logging (default: false)
23+
-d, --debug Enables debug logging
2424
-h, --help help for helmbin
2525

2626
Use "helmbin [command] --help" for more information about a command.
@@ -37,33 +37,49 @@ go build -gcflags "all=-trimpath=/home/ethan/go/src/github.com/emosbaugh" -asmfl
3737

3838
```bash
3939
./bin/helmbin server --help
40-
Runs the server
40+
Runs a controller+worker node
4141

4242
Usage:
43-
helmbin server [flags]
43+
helmbin run [flags]
44+
helmbin run [command]
4445

45-
Aliases:
46-
server, controller
46+
Available Commands:
47+
controller Runs a controller node
48+
worker Runs a worker node
4749

4850
Flags:
49-
--data-dir string Path to the data directory. (default "/var/lib/replicated")
50-
-h, --help help for server
51-
52-
Global Flags:
53-
-d, --debug Debug logging (default: false)
51+
-c, --config string k0s config file, use '-' to read the config from stdin (default "/etc/k0s/k0s.yaml")
52+
--data-dir string Data Directory. DO NOT CHANGE for an existing setup, things will break! (default "/var/lib/replicated")
53+
-d, --debug Debug logging (default: false)
54+
--enable-worker enable worker (default true)
55+
-h, --help help for run
56+
--no-taints disable default taints for controller node (default true)
57+
--token-file string Path to the file containing join-token.
58+
59+
Use "helmbin run [command] --help" for more information about a command.
5460
```
5561

5662
```bash
5763
$ ./bin/helmbin install --help
58-
Installs the server as a systemd service
64+
Installs and starts a controller+worker as a systemd service
5965

6066
Usage:
6167
helmbin install [flags]
68+
helmbin install [command]
6269

63-
Flags:
64-
--data-dir string Path to the data directory. (default "/var/lib/replicated")
65-
-h, --help help for install
70+
Available Commands:
71+
controller Installs and starts a controller as a systemd service
72+
controller Installs and starts a worker as a systemd service
6673

67-
Global Flags:
68-
-d, --debug Debug logging (default: false)
74+
Flags:
75+
-c, --config string k0s config file, use '-' to read the config from stdin (default "/etc/k0s/k0s.yaml")
76+
--data-dir string Data Directory. DO NOT CHANGE for an existing setup, things will break! (default "/var/lib/replicated")
77+
-d, --debug Debug logging (default: false)
78+
--enable-worker enable worker (default true)
79+
-h, --help help for install
80+
--no-taints disable default taints for controller node (default true)
81+
--start Start the service after installation (default true)
82+
--token-file string Path to the file containing join-token.
83+
84+
Use "helmbin install [command] --help" for more information about a command.
6985
```

embedded-bins/Makefile.variables

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
k0s_version = v1.27.2+k0s.0
2+
admin_console_version = 1.99.0
3+
4+
alpine_version = 3.17
5+
alpine_patch_version = $(alpine_version).3
6+
golang_buildimage=docker.io/library/golang:$(go_version)-alpine$(alpine_version)
7+
go_version = 1.20.4
8+
kubernetes_version = 1.27.2
9+
helm_version = 3.11.1
10+
etcd_version = 3.5.9

go.mod

Lines changed: 40 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ require (
1818
k8s.io/cli-runtime v0.27.2
1919
k8s.io/client-go v0.27.2
2020
k8s.io/component-base v0.27.2
21-
k8s.io/klog/v2 v2.100.1
2221
k8s.io/kubectl v0.27.2
2322
sigs.k8s.io/controller-runtime v0.13.1-0.20230412185432-fbd6b944a634
2423
sigs.k8s.io/yaml v1.3.0
@@ -35,7 +34,6 @@ require (
3534
github.com/Masterminds/sprig v2.22.0+incompatible // indirect
3635
github.com/Masterminds/sprig/v3 v3.2.3 // indirect
3736
github.com/Masterminds/squirrel v1.5.3 // indirect
38-
github.com/Microsoft/go-winio v0.6.1 // indirect
3937
github.com/NYTimes/gziphandler v1.1.1 // indirect
4038
github.com/antlr/antlr4/runtime/Go/antlr v1.4.10 // indirect
4139
github.com/asaskevich/govalidator v0.0.0-20200428143746-21a406dcc535 // indirect
@@ -46,6 +44,7 @@ require (
4644
github.com/cenkalti/backoff/v4 v4.2.0 // indirect
4745
github.com/cespare/xxhash/v2 v2.2.0 // indirect
4846
github.com/chai2010/gettext-go v1.0.2 // indirect
47+
github.com/cloudflare/cfssl v1.6.4 // indirect
4948
github.com/containerd/containerd v1.7.1 // indirect
5049
github.com/coreos/go-semver v0.3.0 // indirect
5150
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
@@ -81,6 +80,7 @@ require (
8180
github.com/golang/protobuf v1.5.3 // indirect
8281
github.com/google/btree v1.1.2 // indirect
8382
github.com/google/cel-go v0.12.6 // indirect
83+
github.com/google/certificate-transparency-go v1.1.4 // indirect
8484
github.com/google/gnostic v0.6.9 // indirect
8585
github.com/google/go-cmp v0.5.9 // indirect
8686
github.com/google/gofuzz v1.2.0 // indirect
@@ -100,6 +100,8 @@ require (
100100
github.com/josharian/intern v1.0.0 // indirect
101101
github.com/json-iterator/go v1.1.12 // indirect
102102
github.com/kardianos/service v1.2.2 // indirect
103+
github.com/karrick/godirwalk v1.17.0 // indirect
104+
github.com/kisielk/sqlstruct v0.0.0-20201105191214-5f3e10d3ab46 // indirect
103105
github.com/klauspost/compress v1.16.0 // indirect
104106
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect
105107
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect
@@ -137,15 +139,17 @@ require (
137139
github.com/rivo/uniseg v0.2.0 // indirect
138140
github.com/rubenv/sql-migrate v1.3.1 // indirect
139141
github.com/russross/blackfriday/v2 v2.1.0 // indirect
140-
github.com/sergi/go-diff v1.2.0 // indirect
141142
github.com/shopspring/decimal v1.3.1 // indirect
142143
github.com/spf13/cast v1.5.0 // indirect
143144
github.com/stoewer/go-strcase v1.2.0 // indirect
144145
github.com/weaveworks/footloose v0.0.0-20210208164054-2862489574a3 // indirect
146+
github.com/weppos/publicsuffix-go v0.15.1-0.20210511084619-b1f36a2d6c0b // indirect
145147
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
146148
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
147149
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
148150
github.com/xlab/treeprint v1.1.0 // indirect
151+
github.com/zmap/zcrypto v0.0.0-20210511125630-18f1e0152cfc // indirect
152+
github.com/zmap/zlint/v3 v3.1.0 // indirect
149153
go.etcd.io/etcd/api/v3 v3.5.9 // indirect
150154
go.etcd.io/etcd/client/pkg/v3 v3.5.9 // indirect
151155
go.etcd.io/etcd/client/v3 v3.5.9 // indirect
@@ -171,7 +175,6 @@ require (
171175
golang.org/x/term v0.7.0 // indirect
172176
golang.org/x/text v0.9.0 // indirect
173177
golang.org/x/time v0.3.0 // indirect
174-
golang.org/x/tools v0.8.0 // indirect
175178
google.golang.org/appengine v1.6.7 // indirect
176179
google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 // indirect
177180
google.golang.org/grpc v1.54.0 // indirect
@@ -184,6 +187,7 @@ require (
184187
k8s.io/cloud-provider v0.27.2 // indirect
185188
k8s.io/component-helpers v0.27.2 // indirect
186189
k8s.io/controller-manager v0.27.2 // indirect
190+
k8s.io/klog/v2 v2.100.1 // indirect
187191
k8s.io/kms v0.27.2 // indirect
188192
k8s.io/kube-aggregator v0.27.2 // indirect
189193
k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f // indirect
@@ -207,9 +211,9 @@ replace (
207211
// which includes https://github.com/open-telemetry/opentelemetry-go/pull/3631.
208212
// This is incompatible to the current Kubernetes libraries, which still
209213
// use those deprecated packages. Use v0.35.0 instead, which is the last
210-
// version that includes those. Use the otelhttp instrumentation which is
214+
// version that includes those. Use an otelhttp instrumentation which is
211215
// compatible to metric v0.35, too.
212-
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp => go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.38.0
216+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp => go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.39.0
213217
go.opentelemetry.io/otel/metric => go.opentelemetry.io/otel/metric v0.35.0
214218

215219
// Use a patched version of Helm so that it compiles using Kubernetes 1.27.
@@ -220,34 +224,34 @@ replace (
220224

221225
// Replacements duplicated from upstream Kubernetes
222226
replace (
223-
// https://github.com/kubernetes/kubernetes/blob/v1.27.1/go.mod#L245-L275
224-
k8s.io/api => k8s.io/api v0.27.1
225-
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.27.1
226-
k8s.io/apimachinery => k8s.io/apimachinery v0.27.1
227-
k8s.io/apiserver => k8s.io/apiserver v0.27.1
228-
k8s.io/cli-runtime => k8s.io/cli-runtime v0.27.1
229-
k8s.io/client-go => k8s.io/client-go v0.27.1
230-
k8s.io/cloud-provider => k8s.io/cloud-provider v0.27.1
231-
k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.27.1
232-
k8s.io/code-generator => k8s.io/code-generator v0.27.1
233-
k8s.io/component-base => k8s.io/component-base v0.27.1
234-
k8s.io/component-helpers => k8s.io/component-helpers v0.27.1
235-
k8s.io/controller-manager => k8s.io/controller-manager v0.27.1
236-
k8s.io/cri-api => k8s.io/cri-api v0.27.1
237-
k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.27.1
238-
k8s.io/dynamic-resource-allocation => k8s.io/dynamic-resource-allocation v0.27.1
239-
k8s.io/kms => k8s.io/kms v0.27.1
240-
k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.27.1
241-
k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.27.1
242-
k8s.io/kube-proxy => k8s.io/kube-proxy v0.27.1
243-
k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.27.1
244-
k8s.io/kubectl => k8s.io/kubectl v0.27.1
245-
k8s.io/kubelet => k8s.io/kubelet v0.27.1
246-
k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.27.1
247-
k8s.io/metrics => k8s.io/metrics v0.27.1
248-
k8s.io/mount-utils => k8s.io/mount-utils v0.27.1
249-
k8s.io/pod-security-admission => k8s.io/pod-security-admission v0.27.1
250-
k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.27.1
251-
k8s.io/sample-cli-plugin => k8s.io/sample-cli-plugin v0.27.1
252-
k8s.io/sample-controller => k8s.io/sample-controller v0.27.1
227+
// https://github.com/kubernetes/kubernetes/blob/v1.27.2/go.mod#L245-L275
228+
k8s.io/api => k8s.io/api v0.27.2
229+
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.27.2
230+
k8s.io/apimachinery => k8s.io/apimachinery v0.27.2
231+
k8s.io/apiserver => k8s.io/apiserver v0.27.2
232+
k8s.io/cli-runtime => k8s.io/cli-runtime v0.27.2
233+
k8s.io/client-go => k8s.io/client-go v0.27.2
234+
k8s.io/cloud-provider => k8s.io/cloud-provider v0.27.2
235+
k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.27.2
236+
k8s.io/code-generator => k8s.io/code-generator v0.27.2
237+
k8s.io/component-base => k8s.io/component-base v0.27.2
238+
k8s.io/component-helpers => k8s.io/component-helpers v0.27.2
239+
k8s.io/controller-manager => k8s.io/controller-manager v0.27.2
240+
k8s.io/cri-api => k8s.io/cri-api v0.27.2
241+
k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.27.2
242+
k8s.io/dynamic-resource-allocation => k8s.io/dynamic-resource-allocation v0.27.2
243+
k8s.io/kms => k8s.io/kms v0.27.2
244+
k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.27.2
245+
k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.27.2
246+
k8s.io/kube-proxy => k8s.io/kube-proxy v0.27.2
247+
k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.27.2
248+
k8s.io/kubectl => k8s.io/kubectl v0.27.2
249+
k8s.io/kubelet => k8s.io/kubelet v0.27.2
250+
k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.27.2
251+
k8s.io/metrics => k8s.io/metrics v0.27.2
252+
k8s.io/mount-utils => k8s.io/mount-utils v0.27.2
253+
k8s.io/pod-security-admission => k8s.io/pod-security-admission v0.27.2
254+
k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.27.2
255+
k8s.io/sample-cli-plugin => k8s.io/sample-cli-plugin v0.27.2
256+
k8s.io/sample-controller => k8s.io/sample-controller v0.27.2
253257
)

0 commit comments

Comments
 (0)