Skip to content
Merged
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
4 changes: 2 additions & 2 deletions .github/workflows/codeql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
go-version: 1.26.5

- name: Initialize CodeQL
uses: github/codeql-action/init@7188fc363630916deb702c7fdcf4e481b751f97a # v4.37.1
uses: github/codeql-action/init@e4fba868fa4b1b91e1fdab776edc8cfbe6e9fb81 # v4.37.3
with:
languages: ${{ matrix.language }}

Expand All @@ -46,6 +46,6 @@ jobs:
run: go build ./...

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@7188fc363630916deb702c7fdcf4e481b751f97a # v4.37.1
uses: github/codeql-action/analyze@e4fba868fa4b1b91e1fdab776edc8cfbe6e9fb81 # v4.37.3
with:
category: "/language:${{ matrix.language }}"
8 changes: 4 additions & 4 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Go
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: 1.26.5
- name: Build
Expand All @@ -33,9 +33,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Go
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: 1.26.5
- name: ut
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/scorecard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
persist-credentials: false

- name: Run analysis
uses: ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a # v2.4.3
uses: ossf/scorecard-action@2d1146689b8cda280b9bc96326124645441f03bc # v2.4.4
with:
results_file: results.sarif
results_format: sarif
Expand All @@ -40,6 +40,6 @@ jobs:
retention-days: 5

- name: Upload to code-scanning
uses: github/codeql-action/upload-sarif@7188fc363630916deb702c7fdcf4e481b751f97a # v4.37.1
uses: github/codeql-action/upload-sarif@e4fba868fa4b1b91e1fdab776edc8cfbe6e9fb81 # v4.37.3
with:
sarif_file: results.sarif
21 changes: 12 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
FROM golang:1.26.5 AS builder

ARG ARCH
ARG GIT_VERSION=unknown
ARG LDFLAGS
ARG BUILDOS
ARG TARGETARCH
Expand All @@ -23,17 +22,21 @@ COPY internal/ internal/
# Build
RUN CGO_ENABLED=0 GOOS=$BUILDOS GOARCH=$TARGETARCH GO111MODULE=on go build -ldflags "$LDFLAGS" -a -o sveltosctl cmd/sveltosctl/main.go

LABEL name="Sveltos CLI tool" \
vendor="Projectsveltos" \
version=$GIT_VERSION \
release="1" \
summary="Sveltos CLI tool" \
description="sveltoctl is a command line tool used to visualize information on deployed features." \
maintainer=""

# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM gcr.io/distroless/static:nonroot

ARG GIT_VERSION=unknown

LABEL org.opencontainers.image.source="https://github.com/projectsveltos/sveltosctl" \
org.opencontainers.image.url="https://projectsveltos.io" \
org.opencontainers.image.licenses="Apache-2.0" \
org.opencontainers.image.vendor="projectsveltos" \
org.opencontainers.image.title="sveltosctl" \
org.opencontainers.image.description="Command line tool to visualize information on deployed Sveltos features." \
org.opencontainers.image.version="$GIT_VERSION" \
org.opencontainers.image.revision="$GIT_VERSION"

WORKDIR /
COPY --from=builder /workspace/sveltosctl .
USER nonroot:nonroot
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ REGISTRY ?= projectsveltos
IMAGE_NAME ?= sveltosctl
K8S_LATEST_VER ?= $(shell curl -s https://dl.k8s.io/release/stable.txt)
export SVELTOSCTL_IMG ?= $(REGISTRY)/$(IMAGE_NAME)
TAG ?= main
TAG ?= v1.13.0
ARCH ?= $(shell go env GOARCH)

# Directories.
Expand Down Expand Up @@ -146,11 +146,11 @@ PKEY ?= id_rsa

.PHONY: docker-build
docker-build: ## Build the docker image for sveltosctl
docker build --build-arg BUILDOS=linux --build-arg TARGETARCH=amd64 --build-arg LDFLAGS="$(LDFLAGS)" --build-arg ARCH=$(ARCH) -t $(REGISTRY)/$(IMAGE_NAME)-$(ARCH):$(TAG) -f Dockerfile .
docker build --build-arg BUILDOS=linux --build-arg TARGETARCH=amd64 --build-arg LDFLAGS="$(LDFLAGS)" --build-arg ARCH=$(ARCH) --build-arg GIT_VERSION=$(TAG) -t $(REGISTRY)/$(IMAGE_NAME)-$(ARCH):$(TAG) -f Dockerfile .

.PHONY: docker-buildx
docker-buildx: ## docker build for multiple arch and push to docker hub
docker buildx build --push --platform linux/amd64,linux/arm64 -t $(SVELTOSCTL_IMG):$(TAG) .
docker buildx build --push --platform linux/amd64,linux/arm64 --build-arg GIT_VERSION=$(TAG) -t $(SVELTOSCTL_IMG):$(TAG) .

##@ Build

Expand Down
49 changes: 44 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
[![CI](https://github.com/projectsveltos/sveltosctl/actions/workflows/main.yaml/badge.svg)](https://github.com/projectsveltos/sveltosctl/actions)
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/projectsveltos/sveltosctl/badge)](https://scorecard.dev/viewer/?uri=github.com/projectsveltos/sveltosctl)
[![CodeQL](https://github.com/projectsveltos/sveltosctl/actions/workflows/codeql.yaml/badge.svg)](https://github.com/projectsveltos/sveltosctl/actions/workflows/codeql.yaml)
[![Slack](https://img.shields.io/badge/join%20slack-%23projectsveltos-brighteen)](https://join.slack.com/t/projectsveltos/shared_invite/zt-1hraownbr-W8NTs6LTimxLPB8Erj8Q6Q)
[![Release](https://img.shields.io/github/v/release/projectsveltos/sveltosctl)](https://github.com/projectsveltos/sveltosctl/releases)
[![License](https://img.shields.io/badge/license-Apache-blue.svg)](LICENSE)
[![Twitter Follow](https://img.shields.io/twitter/follow/projectsveltos?style=social)](https://twitter.com/projectsveltos)
[![Slack](https://img.shields.io/badge/join%20slack-%23projectsveltos-brighteen)](https://join.slack.com/t/projectsveltos/shared_invite/zt-1hraownbr-W8NTs6LTimxLPB8Erj8Q6Q)
[![LinkedIn](https://custom-icon-badges.demolab.com/badge/LinkedIn-0A66C2?logo=linkedin-white&logoColor=fff)](https://www.linkedin.com/company/projectsveltos/)
[![X URL](https://img.shields.io/twitter/url/https/twitter.com/projectsveltos.svg?style=social&label=Follow%20%40projectsveltos)](https://x.com/projectsveltos)

# sveltosctl
👋 Welcome to **Projectsveltos**!

<img src="https://raw.githubusercontent.com/projectsveltos/sveltos/main/docs/assets/logo.png" width="200">
<div align="center">

Please refere to sveltos [documentation](https://projectsveltos.github.io/sveltos/).
| 🌐 Website | 📚 Documentation | 📅 Book a Demo | 💼 Enterprise Support | 🏢 Adopters |
|:---:|:---:|:---:|:---:|:---:|
| [Visit](https://website.projectsveltos.io) | [Get Started](https://projectsveltos.github.io/sveltos/) | [Schedule 30 min](https://cal.com/gianluca-mardente-nuclsu/30min) | [Contact Us](mailto:gianluca@projectsveltos.io) | [View List](https://website.projectsveltos.io/companies) |

</div>

## What this repository is
**sveltosctl** is the command line client for Sveltos. **sveltosctl** nicely displays resources and helm charts info in custer deployed using [ClusterProfile/Profile](https://github.com/projectsveltos/addon-controller).

It assumes:
Expand Down Expand Up @@ -74,6 +81,38 @@ Usage:
--profile=<kind/name> Show addons deployed because of this clusterprofile/profile. If not specified all clusterprofiles/profiles are considered.
```

## Display outdated Helm chart versions

**show helm-updates** displays, for each Helm chart currently deployed in a cluster, the newer version
and/or newer same-minor patch version available upstream. Charts already on the latest version are omitted.

```
./bin/sveltosctl show helm-updates
+-------------------------------------+-----------+--------------+-----------------+---------------+---------------------+
| CLUSTER | NAMESPACE | RELEASE NAME | CURRENT VERSION | NEWER VERSION | NEWER PATCH VERSION |
+-------------------------------------+-----------+--------------+-----------------+---------------+---------------------+
| default/sveltos-management-workload | kyverno | kyverno | v3.1.0 | v3.3.0 | v3.1.4 |
+-------------------------------------+-----------+--------------+-----------------+---------------+---------------------+
```

**show helm-updates** command has some arguments which allow filtering by:
1. clusters' namespace
2. clusters' name
3. cluster type

```
./bin/sveltosctl show helm-updates --help
Usage:
sveltosctl show helm-updates [options] [--namespace=<name>] [--cluster=<name>] [--cluster-type=<type>] [--verbose]

--namespace=<name> Show outdated helm charts deployed in clusters in this namespace.
If not specified all namespaces are considered.
--cluster=<name> Show outdated helm charts deployed in cluster with name.
If not specified all cluster names are considered.
--cluster-type=<type> Show outdated helm charts deployed in cluster with this type
(Capi or Sveltos). If not specified all cluster types are considered.
```

## Register a cluster

If there is kubeconfig with multiple contexts, the option __fleet-cluster-context__
Expand Down
34 changes: 17 additions & 17 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ require (
github.com/onsi/ginkgo/v2 v2.32.0
github.com/onsi/gomega v1.42.1
github.com/pkg/errors v0.9.1
github.com/projectsveltos/addon-controller v1.12.1-0.20260723092031-49d76669b5b7
github.com/projectsveltos/event-manager v1.12.1-0.20260718113804-c7366cad218f
github.com/projectsveltos/libsveltos v1.12.1-0.20260723073052-095dee392300
github.com/projectsveltos/addon-controller v1.13.0
github.com/projectsveltos/event-manager v1.13.0
github.com/projectsveltos/libsveltos v1.13.0
gopkg.in/yaml.v3 v3.0.1
k8s.io/api v0.36.3
k8s.io/apiextensions-apiserver v0.36.3
Expand All @@ -33,19 +33,19 @@ require (
github.com/Azure/azure-sdk-for-go/sdk/internal v1.12.0 // indirect
github.com/AzureAD/microsoft-authentication-library-for-go v1.7.2 // indirect
github.com/Masterminds/semver/v3 v3.5.0 // indirect
github.com/aws/aws-sdk-go-v2 v1.42.1 // indirect
github.com/aws/aws-sdk-go-v2/config v1.32.30 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.19.29 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.30 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.30 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.30 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.31 // indirect
github.com/aws/aws-sdk-go-v2 v1.43.0 // indirect
github.com/aws/aws-sdk-go-v2/config v1.32.31 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.19.30 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.31 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.31 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.31 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.32 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.13 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.30 // indirect
github.com/aws/aws-sdk-go-v2/service/signin v1.4.1 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.32.1 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.37.1 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.44.1 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.31 // indirect
github.com/aws/aws-sdk-go-v2/service/signin v1.5.0 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.33.0 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.38.0 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.45.0 // indirect
github.com/aws/smithy-go v1.27.3 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
Expand Down Expand Up @@ -94,9 +94,9 @@ require (
github.com/olekukonko/ll v0.1.6 // indirect
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_golang v1.24.0 // indirect
github.com/prometheus/client_golang v1.24.1 // indirect
github.com/prometheus/client_model v0.6.2 // indirect
github.com/prometheus/common v0.70.0 // indirect
github.com/prometheus/common v0.70.1 // indirect
github.com/prometheus/procfs v0.21.1 // indirect
github.com/spf13/pflag v1.0.10 // indirect
github.com/x448/float16 v0.8.4 // indirect
Expand Down
Loading