Skip to content
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

Rework kobs architecture add dashboards #329

Merged
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
16 changes: 9 additions & 7 deletions .github/workflows/helm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,33 @@ name: Helm
on:
push:
paths:
- 'deploy/helm/kobs/**'
- 'deploy/helm/**'

jobs:
helm:
name: Helm Chart
runs-on: ubuntu-latest
matrix:
component: [hub, satellite]
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Lint
run: |
helm lint deploy/helm/kobs
helm lint deploy/helm/${{ matrix.component }}

- name: Template
run: |
helm template kobs -n observability deploy/helm/kobs
helm template kobs-${{ matrix.component }} -n observability deploy/helm/${{ matrix.component }}

- name: Install
run: |
kind create cluster
sleep 60s
kubectl create namespace observability
sleep 10s
helm install --namespace observability kobs deploy/helm/kobs
helm install --namespace observability kobs${{ matrix.component }} deploy/helm/${{ matrix.component }}

- name: Configure SSH
if: ${{ github.ref == 'refs/heads/main' }}
Expand All @@ -43,7 +45,7 @@ jobs:
- name: Package Helm Chart
if: ${{ github.ref == 'refs/heads/main' }}
run: |
helm package ./deploy/helm/kobs
helm package ./deploy/helm/${{ matrix.component }}

- name: Clone Helm Repository
if: ${{ github.ref == 'refs/heads/main' }}
Expand All @@ -53,12 +55,12 @@ jobs:
- name: Update Helm Repository
if: ${{ github.ref == 'refs/heads/main' }}
run: |
mv kobs* ./helm-repository/ && helm repo index helm-repository/ --url https://helm.kobs.io/
mv ${{ matrix.component }}* ./helm-repository/ && helm repo index helm-repository/ --url https://helm.kobs.io/

- name: Commit Changes
if: ${{ github.ref == 'refs/heads/main' }}
run: |
cd helm-repository/ && git add . && git commit -m "Add new release for kobs"
cd helm-repository/ && git add . && git commit -m "Add new release for kobs ${{ matrix.component }}"

- name: Push Changes
if: ${{ github.ref == 'refs/heads/main' }}
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ generate-crds:
@controller-gen "crd:crdVersions={v1}" paths="./pkg/..." output:crd:artifacts:config=deploy/kustomize/crds

@for crd in $(CRDS); do \
cp ./deploy/kustomize/crds/kobs.io_$$crd\s.yaml ./deploy/helm/kobs/crds/kobs.io_$$crd\s.yaml; \
cp ./deploy/kustomize/crds/kobs.io_$$crd\s.yaml ./deploy/helm/satellite/crds/kobs.io_$$crd\s.yaml; \
done

.PHONY: generate-assets
Expand Down
5 changes: 4 additions & 1 deletion cmd/kobs/hub/hub.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ var Cmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
// Get our global flags for kobs and use them to setup our logging configuration. After our logging is
// configured we print the version information and build context of kobs.
debugUsername, _ := cmd.Flags().GetString("debug.username")
debugPassword, _ := cmd.Flags().GetString("debug.password")

logLevel, _ := cmd.Flags().GetString("log.level")
logFormat, _ := cmd.Flags().GetString("log.format")
log.Setup(logLevel, logFormat)
Expand Down Expand Up @@ -94,7 +97,7 @@ var Cmd = &cobra.Command{
var appServer app.Server

if hubMode == "default" || hubMode == "server" {
hubSever, err = hub.New(hubAddress, authEnabled, authHeaderUser, authHeaderTeams, authLogoutRedirect, authSessionToken, authSessionInterval, satellitesClient, storeClient)
hubSever, err = hub.New(debugUsername, debugPassword, hubAddress, authEnabled, authHeaderUser, authHeaderTeams, authLogoutRedirect, authSessionToken, authSessionInterval, satellitesClient, storeClient)
if err != nil {
log.Fatal(nil, "Could not create hub server", zap.Error(err))
}
Expand Down
12 changes: 12 additions & 0 deletions cmd/kobs/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ var rootCmd = &cobra.Command{
}

func init() {
defaultDebugUsername := ""
if os.Getenv("KOBS_DEBUG_USERNAME") != "" {
defaultDebugUsername = os.Getenv("KOBS_DEBUG_USERNAME")
}

defaultDebugPassword := ""
if os.Getenv("KOBS_DEBUG_PASSWORD") != "" {
defaultDebugPassword = os.Getenv("KOBS_DEBUG_PASSWORD")
}

defaultLogFormat := "console"
if os.Getenv("KOBS_LOG_FORMAT") != "" {
defaultLogFormat = os.Getenv("KOBS_LOG_FORMAT")
Expand All @@ -33,6 +43,8 @@ func init() {
rootCmd.AddCommand(satellite.Cmd)
rootCmd.AddCommand(version.Cmd)

rootCmd.PersistentFlags().String("debug.username", defaultDebugUsername, "The username for the debug endpoints. The endpoints are only available when a username is provided.")
rootCmd.PersistentFlags().String("debug.password", defaultDebugPassword, "The password for the debug endpoints. The endpoints are only available when a password is provided.")
rootCmd.PersistentFlags().String("log.format", defaultLogFormat, "Set the output format of the logs. Must be \"console\" or \"json\".")
rootCmd.PersistentFlags().String("log.level", defaultLogLevel, "Set the log level. Must be \"debug\", \"info\", \"warn\", \"error\", \"fatal\" or \"panic\".")
}
Expand Down
5 changes: 4 additions & 1 deletion cmd/kobs/satellite/satellite.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ var Cmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
// Get our global flags for kobs and use them to setup our logging configuration. After our logging is
// configured we print the version information and build context of kobs.
debugUsername, _ := cmd.Flags().GetString("debug.username")
debugPassword, _ := cmd.Flags().GetString("debug.password")

logLevel, _ := cmd.Flags().GetString("log.level")
logFormat, _ := cmd.Flags().GetString("log.format")
log.Setup(logLevel, logFormat)
Expand Down Expand Up @@ -65,7 +68,7 @@ var Cmd = &cobra.Command{
// The satelliteServer handles all requests from a kobs hub and serves the configuration, so the hub knows which
// clusters and plugins are available via this satellite instance. The metrics server is used to serve the kobs
// metrics.
satelliteServer, err := satellite.New(satelliteAddress, satelliteToken, cfg.API, clustersClient, pluginsClient)
satelliteServer, err := satellite.New(debugUsername, debugPassword, satelliteAddress, satelliteToken, cfg.API, clustersClient, pluginsClient)
if err != nil {
log.Fatal(nil, "Could not create satellite server", zap.Error(err))
}
Expand Down
53 changes: 0 additions & 53 deletions deploy/demo/bookinfo/details-application.yaml

This file was deleted.

4 changes: 0 additions & 4 deletions deploy/demo/bookinfo/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- details-application.yaml
- details.yaml
- gateway.yaml
- namespace.yaml
- productpage-application.yaml
- productpage.yaml
- ratings-application.yaml
- ratings.yaml
- reviews-application.yaml
- reviews.yaml
65 changes: 0 additions & 65 deletions deploy/demo/bookinfo/productpage-application.yaml

This file was deleted.

55 changes: 0 additions & 55 deletions deploy/demo/bookinfo/ratings-application.yaml

This file was deleted.

59 changes: 0 additions & 59 deletions deploy/demo/bookinfo/reviews-application.yaml

This file was deleted.

Loading