Skip to content

Commit

Permalink
Level Up Semantic Versions
Browse files Browse the repository at this point in the history
We should treat these better and use a proper parsed backing type.  We
then need to add constraints to applications so the resolver can work in
a nicer fashion.  This also takes the liberty of upgrading libs so I can
use k8s native functions, but that requires a new compiler and linter,
which is good as it fixes CVEs.
  • Loading branch information
spjmurray committed Oct 18, 2024
1 parent a14f6f5 commit 5eea0b9
Show file tree
Hide file tree
Showing 16 changed files with 343 additions and 169 deletions.
12 changes: 1 addition & 11 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,11 @@ run:
linters:
enable-all: true
disable:
- exhaustivestruct
- exhaustruct
- lll
- gofumpt
- deadcode
- nosnakecase
- scopelint
- golint
- ifshort
- maligned
- structcheck
- varcheck
- interfacer
- rowserrcheck
- sqlclosecheck
- structcheck
- wastedassign
- forbidigo
- wrapcheck
Expand All @@ -31,6 +20,7 @@ linters:
- depguard
- perfsprint
- testifylint
- mnd
linters-settings:
gci:
sections:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ GOPATH := $(shell go env GOPATH)
GOBIN := $(if $(shell go env GOBIN),$(shell go env GOBIN),$(GOPATH)/bin)

# Defines the linter version.
LINT_VERSION=v1.57.1
LINT_VERSION=v1.61.0

# Defines the version of the CRD generation tools to use.
CONTROLLER_TOOLS_VERSION=v0.16.3
Expand Down
4 changes: 2 additions & 2 deletions charts/core/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ description: A Helm chart for deploying Unikorn Core

type: application

version: v0.1.75
appVersion: v0.1.75
version: v0.1.76
appVersion: v0.1.76

icon: https://assets.unikorn-cloud.org/images/logos/dark-on-light/icon.svg

Expand Down
65 changes: 46 additions & 19 deletions charts/core/crds/unikorn-cloud.org_helmapplications.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,12 @@ spec:
description: Versions are the application versions that are supported.
items:
properties:
branch:
description: Branch defines the branch name if the repo is a
git repository.
type: string
chart:
description: |-
Chart is the chart name in the repository.
If not set, uses the application default.
description: Chart is the chart name in the repository.
type: string
createNamespace:
description: |-
Expand All @@ -92,9 +94,34 @@ spec:
be installed before this one.
items:
properties:
constraints:
description: |-
Constraints is a set of versioning constraints that must be met
by a SAT solver, the set is composed as a logical AND so all
constraints must be met.
items:
properties:
operator:
description: Operator defines the constraint operation.
enum:
- Equal
- GreaterThan
- LessThan
- GreaterThanOrEqual
- LessThanOrEqual
type: string
version:
description: Version is the version the operator
compares against.
pattern: ^v?[0-9]+(\.[0-9]+)?(\.[0-9]+)?(-([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?(\+([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?$
type: string
required:
- operator
- version
type: object
type: array
name:
description: Name the name of the application to depend
on.
description: Name of the application to depend on.
type: string
required:
- name
Expand Down Expand Up @@ -129,9 +156,7 @@ spec:
type: object
type: array
path:
description: |-
Path is the path if the repo is a git repo.
If not set, uses the application default.
description: Path is the path if the repo is a git repository.
type: string
recommends:
description: |-
Expand All @@ -141,8 +166,10 @@ spec:
items:
properties:
name:
description: Name the name of the application to depend
on.
description: |-
Name of the application to require.
That recommendation MUST have a dependency with any constraints
on this application.
type: string
required:
- name
Expand All @@ -156,9 +183,8 @@ spec:
If not set, uses the application default.
type: string
repo:
description: |-
Repo is either a Helm chart repository, or git repository.
If not set, uses the application default.
description: Repo is either a Helm chart repository, or git
repository.
type: string
serverSideApply:
description: |-
Expand All @@ -169,18 +195,19 @@ spec:
If not set, uses the application default.
type: boolean
version:
description: Version is the chart version, or a branch when
a path is provided.
description: |-
Version is the chart version, but must also be set for Git based repositories.
This value must be a semantic version.
type: string
required:
- repo
- version
type: object
x-kubernetes-validations:
- message: either chart or path must be specified
rule: has(self.chart) || has(self.path)
- message: only one of chart or path may be specified
rule: '!(has(self.chart) && has(self.path))'
- message: either chart or branch must be specified
rule: has(self.chart) || has(self.branch)
- message: only one of chart or branch may be specified
rule: '!(has(self.chart) && has(self.branch))'
type: array
required:
- documentation
Expand Down
60 changes: 31 additions & 29 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
module github.com/unikorn-cloud/core

go 1.22.5
go 1.23.2

require (
github.com/getkin/kin-openapi v0.127.0
github.com/getkin/kin-openapi v0.128.0
github.com/go-logr/logr v1.4.2
github.com/go-openapi/jsonpointer v0.21.0
github.com/masterminds/semver v1.5.0
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.9.0
go.opentelemetry.io/otel v1.29.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.29.0
go.opentelemetry.io/otel/sdk v1.29.0
go.opentelemetry.io/otel/trace v1.29.0
go.uber.org/mock v0.4.0
go.opentelemetry.io/otel v1.31.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.31.0
go.opentelemetry.io/otel/sdk v1.31.0
go.opentelemetry.io/otel/trace v1.31.0
go.uber.org/mock v0.5.0
golang.org/x/sync v0.8.0
k8s.io/api v0.31.0
k8s.io/apimachinery v0.31.0
k8s.io/client-go v0.31.0
k8s.io/api v0.31.1
k8s.io/apimachinery v0.31.1
k8s.io/client-go v0.31.1
k8s.io/klog/v2 v2.130.1
k8s.io/utils v0.0.0-20240921022957-49e7df575cb6
sigs.k8s.io/controller-runtime v0.19.0
sigs.k8s.io/structured-merge-diff/v4 v4.4.1
sigs.k8s.io/yaml v1.4.0
)

require (
github.com/Masterminds/semver v1.5.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
Expand All @@ -50,7 +53,7 @@ require (
github.com/invopop/yaml v0.3.1 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/klauspost/compress v1.17.11 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
Expand All @@ -59,34 +62,33 @@ require (
github.com/perimeterx/marshmallow v1.1.5 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_golang v1.20.2 // indirect
github.com/prometheus/client_golang v1.20.5 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.55.0 // indirect
github.com/prometheus/common v0.60.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.12 // indirect
github.com/x448/float16 v0.8.4 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.29.0 // indirect
go.opentelemetry.io/otel/metric v1.29.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0 // indirect
go.opentelemetry.io/otel/metric v1.31.0 // indirect
go.opentelemetry.io/proto/otlp v1.3.1 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/exp v0.0.0-20240823005443-9b4947da3948 // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/oauth2 v0.22.0 // indirect
golang.org/x/sys v0.24.0 // indirect
golang.org/x/term v0.23.0 // indirect
golang.org/x/text v0.17.0 // indirect
golang.org/x/time v0.6.0 // indirect
golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c // indirect
golang.org/x/net v0.30.0 // indirect
golang.org/x/oauth2 v0.23.0 // indirect
golang.org/x/sys v0.26.0 // indirect
golang.org/x/term v0.25.0 // indirect
golang.org/x/text v0.19.0 // indirect
golang.org/x/time v0.7.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240826202546-f6391c0de4c7 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240826202546-f6391c0de4c7 // indirect
google.golang.org/grpc v1.65.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20241015192408-796eee8c2d53 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53 // indirect
google.golang.org/grpc v1.67.1 // indirect
google.golang.org/protobuf v1.35.1 // indirect
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/kube-openapi v0.0.0-20240826222958-65a50c78dec5 // indirect
k8s.io/utils v0.0.0-20240821151609-f90d01438635 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
k8s.io/kube-openapi v0.0.0-20241009091222-67ed5848f094 // indirect
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect
)
Loading

0 comments on commit 5eea0b9

Please sign in to comment.