Skip to content

Adding OS/Arch Support #212

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions cmd/app/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ const (
envACRPassword = "ACR_PASSWORD"
envACRRefreshToken = "ACR_REFRESH_TOKEN"

envACRAppID = "ACR_APP_ID"
envACRTenantID = "ACR_TENANT_ID"
envACRClientSecret = "ACR_CLIENT_SECRET"

envDockerUsername = "DOCKER_USERNAME"
envDockerPassword = "DOCKER_PASSWORD"
envDockerToken = "DOCKER_TOKEN"
Expand All @@ -47,6 +51,8 @@ const (
envSelfhostedBearer = "TOKEN"
envSelfhostedTokenPath = "TOKEN_PATH"
envSelfhostedInsecure = "INSECURE"
envSelfhostedTimeout = "TIMEOUT"
envSelfhostedRetries = "RETRIES"
envSelfhostedCAPath = "CA_PATH"
)

Expand All @@ -57,6 +63,8 @@ var (
selfhostedTokenPath = regexp.MustCompile("^VERSION_CHECKER_SELFHOSTED_TOKEN_PATH_(.*)")
selfhostedTokenReg = regexp.MustCompile("^VERSION_CHECKER_SELFHOSTED_TOKEN_(.*)")
selfhostedCAPath = regexp.MustCompile("^VERSION_CHECKER_SELFHOSTED_CA_PATH_(.*)")
selfhostedTimeout = regexp.MustCompile("^VERSION_CHECKER_SELFHOSTED_TIMEOUT_(.*)")
selfhostedRetryMax = regexp.MustCompile("^VERSION_CHECKER_SELFHOSTED_RETRIES_(.*)")
selfhostedInsecureReg = regexp.MustCompile("^VERSION_CHECKER_SELFHOSTED_INSECURE_(.*)")
)

Expand Down Expand Up @@ -140,6 +148,27 @@ func (o *Options) addAuthFlags(fs *pflag.FlagSet) {
"username/password (%s_%s).",
envPrefix, envACRRefreshToken,
))
fs.StringVar(&o.Client.ACR.AppID,
"acr-app-id", "",
fmt.Sprintf(
"App ID to authenticate with azure container registry, to be used with "+
"client-secret/tenant-id (%s_%s).",
envPrefix, envACRAppID,
))
fs.StringVar(&o.Client.ACR.TenantID,
"acr-tenant-id", "",
fmt.Sprintf(
"client ID to authenticate with azure container registry, to be used with "+
"client-secret/app-id (%s_%s).",
envPrefix, envACRTenantID,
))
fs.StringVar(&o.Client.ACR.ClientSecret,
"acr-client-secret", "",
fmt.Sprintf(
"Client Secret to authenticate with azure container registry, to be used with "+
"tenant-id/app-id (%s_%s).",
envPrefix, envACRClientSecret,
))
///

// Docker
Expand Down Expand Up @@ -264,6 +293,18 @@ func (o *Options) addAuthFlags(fs *pflag.FlagSet) {
"THIS IS NOT RECOMMENDED AND IS INTENDED FOR DEBUGGING (%s_%s)",
envPrefix, envSelfhostedInsecure,
))
fs.IntVarP(&o.selfhosted.Timeout,
"selfhosted-timeout", "", 10,
fmt.Sprintf(
"Timeout for API Calls to the Registry (%s_%s)",
envPrefix, envSelfhostedTimeout,
))
fs.IntVarP(&o.selfhosted.RetryMax,
"selfhosted-retries", "", 10,
fmt.Sprintf(
"Max number of retries per request to the Registry (%s_%s)",
envPrefix, envSelfhostedRetries,
))
///
}

Expand All @@ -278,6 +319,9 @@ func (o *Options) complete() {
{envACRUsername, &o.Client.ACR.Username},
{envACRPassword, &o.Client.ACR.Password},
{envACRRefreshToken, &o.Client.ACR.RefreshToken},
{envACRAppID, &o.Client.ACR.AppID},
{envACRTenantID, &o.Client.ACR.TenantID},
{envACRClientSecret, &o.Client.ACR.ClientSecret},

{envDockerUsername, &o.Client.Docker.Username},
{envDockerPassword, &o.Client.Docker.Password},
Expand Down Expand Up @@ -365,6 +409,25 @@ func (o *Options) assignSelfhosted(envs []string) {
continue
}

if matches := selfhostedTimeout.FindStringSubmatch(strings.ToUpper(pair[0])); len(matches) == 2 {
initOptions(matches[1])
i, err := strconv.Atoi(pair[1])
if err != nil {
continue
}
o.Client.Selfhosted[matches[1]].Timeout = i
continue
}
if matches := selfhostedRetryMax.FindStringSubmatch(strings.ToUpper(pair[0])); len(matches) == 2 {
initOptions(matches[1])
i, err := strconv.Atoi(pair[1])
if err != nil {
continue
}
o.Client.Selfhosted[matches[1]].Timeout = i
continue
}

if matches := selfhostedInsecureReg.FindStringSubmatch(strings.ToUpper(pair[0])); len(matches) == 2 {
initOptions(matches[1])
val, err := strconv.ParseBool(pair[1])
Expand Down
1 change: 1 addition & 0 deletions deploy/charts/version-checker/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ rules:
- ""
resources:
- "pods"
- "nodes"
verbs:
- "get"
- "list"
Expand Down
4 changes: 2 additions & 2 deletions deploy/charts/version-checker/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ selfhosted:
# password: bar
# token:


# -- Setup version-checkers resource requests/limits
resources:
{}
Expand All @@ -121,7 +120,8 @@ resources:
#

# -- Set container-level security context
securityContext: {}
securityContext:
{}
# allowPrivilegeEscalation: false
# capabilities:
# drop:
Expand Down
48 changes: 24 additions & 24 deletions deploy/yaml/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,33 +49,33 @@ spec:
spec:
serviceAccountName: version-checker
containers:
- image: quay.io/jetstack/version-checker:v0.7.0
imagePullPolicy: Always
ports:
- containerPort: 8080
name: version-checker
command: ["version-checker"]
livenessProbe:
httpGet:
path: /readyz
port: 8080
initialDelaySeconds: 3
periodSeconds: 3
readinessProbe:
httpGet:
path: /readyz
port: 8080
initialDelaySeconds: 3
periodSeconds: 3
- image: quay.io/jetstack/version-checker:v0.7.0
imagePullPolicy: Always
ports:
- containerPort: 8080
name: version-checker
command: ["version-checker"]
livenessProbe:
httpGet:
path: /readyz
port: 8080
initialDelaySeconds: 3
periodSeconds: 3
readinessProbe:
httpGet:
path: /readyz
port: 8080
initialDelaySeconds: 3
periodSeconds: 3
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: version-checker
rules:
- apiGroups: [""]
resources: ["pods"]
verbs: ["get", "watch", "list"]
- apiGroups: [""]
resources: ["pods", "nodes"]
verbs: ["get", "watch", "list"]
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
Expand All @@ -86,6 +86,6 @@ roleRef:
kind: ClusterRole
name: version-checker
subjects:
- kind: ServiceAccount
name: version-checker
namespace: version-checker
- kind: ServiceAccount
name: version-checker
namespace: version-checker
109 changes: 72 additions & 37 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,18 @@ toolchain go1.22.3
// please place any replace statements here at the top for visibility and add a
// comment to it as to when it can be removed

replace github.com/imdario/mergo => github.com/imdario/mergo v0.3.16

require (
github.com/Azure/go-autorest/autorest v0.11.29
github.com/Azure/go-autorest/autorest/adal v0.9.24
github.com/aws/aws-sdk-go-v2 v1.30.0
github.com/golang-jwt/jwt/v5 v5.2.1
github.com/Azure/go-autorest/autorest/adal v0.9.24 // indirect
github.com/aws/aws-sdk-go-v2 v1.30.1
github.com/hashicorp/go-retryablehttp v0.7.7
github.com/prometheus/client_golang v1.19.1
github.com/sirupsen/logrus v1.9.3
github.com/spf13/cobra v1.8.1
github.com/spf13/pflag v1.0.5
golang.org/x/oauth2 v0.21.0 // indirect
golang.org/x/oauth2 v0.21.0
k8s.io/api v0.30.2
k8s.io/apimachinery v0.30.2
k8s.io/cli-runtime v0.30.2
Expand All @@ -28,65 +29,89 @@ require (
)

require (
github.com/aws/aws-sdk-go-v2/config v1.27.21
github.com/aws/aws-sdk-go-v2/credentials v1.17.21
github.com/aws/aws-sdk-go-v2/service/ecr v1.29.1
cloud.google.com/go/artifactregistry v1.14.11
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.12.0
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0
github.com/Azure/go-autorest/autorest/azure/auth v0.5.13
github.com/aws/aws-sdk-go-v2/config v1.27.24
github.com/aws/aws-sdk-go-v2/credentials v1.17.24
github.com/aws/aws-sdk-go-v2/service/ecr v1.30.1
github.com/gofri/go-github-ratelimit v1.1.0
github.com/google/go-containerregistry v0.19.0
github.com/google/go-github/v58 v58.0.0
github.com/golang-jwt/jwt/v5 v5.2.1
github.com/google/go-containerregistry v0.20.0
github.com/google/go-github/v62 v62.0.0
github.com/jarcoal/httpmock v1.3.1
github.com/stretchr/testify v1.9.0
google.golang.org/api v0.187.0
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd
)

require (
cloud.google.com/go v0.115.0 // indirect
cloud.google.com/go/auth v0.6.1 // indirect
cloud.google.com/go/auth/oauth2adapt v0.2.2 // indirect
cloud.google.com/go/compute/metadata v0.4.0 // indirect
cloud.google.com/go/iam v1.1.10 // indirect
cloud.google.com/go/longrunning v0.5.9 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v1.9.1 // indirect
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
github.com/Azure/go-autorest/autorest/azure/cli v0.4.6 // indirect
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
github.com/Azure/go-autorest/logger v0.2.1 // indirect
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.8 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.12 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.12 // indirect
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.9 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.13 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.13 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.14 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.21.1 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.25.1 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.29.1 // indirect
github.com/aws/smithy-go v1.20.2 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.3 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.15 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.22.1 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.26.2 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.30.1 // indirect
github.com/aws/smithy-go v1.20.3 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/containerd/stargz-snapshotter/estargz v0.14.3 // indirect
github.com/containerd/stargz-snapshotter/estargz v0.15.1 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/docker/cli v24.0.0+incompatible // indirect
github.com/docker/distribution v2.8.2+incompatible // indirect
github.com/docker/docker v24.0.9+incompatible // indirect
github.com/docker/docker-credential-helpers v0.7.0 // indirect
github.com/dimchansky/utfbom v1.1.1 // indirect
github.com/docker/cli v27.0.3+incompatible // indirect
github.com/docker/distribution v2.8.3+incompatible // indirect
github.com/docker/docker-credential-helpers v0.8.2 // indirect
github.com/emicklei/go-restful/v3 v3.12.1 // indirect
github.com/evanphx/json-patch v5.9.0+incompatible // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/go-errors/errors v1.5.1 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/jsonreference v0.21.0 // indirect
github.com/go-openapi/swag v0.23.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/btree v1.1.2 // indirect
github.com/google/gnostic-models v0.6.9-0.20230804172637-c7be7c783f49 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/s2a-go v0.1.7 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
github.com/googleapis/gax-go/v2 v2.12.5 // indirect
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/imdario/mergo v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.16.5 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/kylelemons/godebug v1.1.0 // indirect
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
Expand All @@ -96,31 +121,41 @@ require (
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.0-rc3 // indirect
github.com/opencontainers/image-spec v1.1.0 // indirect
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // 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_model v0.5.0 // indirect
github.com/prometheus/common v0.48.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/vbatts/tar-split v0.11.3 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.55.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/vbatts/tar-split v0.11.5 // indirect
github.com/xlab/treeprint v1.2.0 // indirect
go.starlark.net v0.0.0-20240520160348-046347dcd104 // indirect
golang.org/x/crypto v0.24.0 // indirect
golang.org/x/net v0.26.0 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 // indirect
go.opentelemetry.io/otel v1.28.0 // indirect
go.opentelemetry.io/otel/metric v1.28.0 // indirect
go.opentelemetry.io/otel/trace v1.28.0 // indirect
go.starlark.net v0.0.0-20240705175910-70002002b310 // indirect
golang.org/x/crypto v0.25.0 // indirect
golang.org/x/net v0.27.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/term v0.21.0 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/term v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/time v0.5.0 // indirect
google.golang.org/genproto v0.0.0-20240708141625-4ad9e859172b // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240708141625-4ad9e859172b // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240708141625-4ad9e859172b // indirect
google.golang.org/grpc v1.65.0 // indirect
google.golang.org/protobuf v1.34.2 // 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/klog/v2 v2.130.1 // indirect
k8s.io/kube-openapi v0.0.0-20240521193020-835d969ad83a // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
k8s.io/kube-openapi v0.0.0-20240709000822-3c01b740850f // indirect
sigs.k8s.io/kustomize/api v0.17.2 // indirect
sigs.k8s.io/kustomize/kyaml v0.17.1 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
Expand Down
Loading
Loading