Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

Commit

Permalink
Expose log level in KubeCarrier CRD (#516)
Browse files Browse the repository at this point in the history
* support logLevel for manager, operator, apiserver and catapult

* expose logLevel for ferry and elevator

* use webhooks for defaulting log level

* rename VERBOSE to LOG_LEVEL

* get log level from kubecarrier object

* simplify
  • Loading branch information
aborilov committed Jul 27, 2020
1 parent 78f7f02 commit 042fdaa
Show file tree
Hide file tree
Showing 50 changed files with 818 additions and 38 deletions.
1 change: 1 addition & 0 deletions config/internal/catapult/manager/manager.yaml
Expand Up @@ -21,6 +21,7 @@ spec:
name: manager
args:
- "--cert-dir=$(CERT_DIR)"
- "-v=$(LOG_LEVEL)"
env:
- name: KUBERNETES_NAMESPACE
valueFrom:
Expand Down
1 change: 1 addition & 0 deletions config/internal/elevator/manager/manager.yaml
Expand Up @@ -21,6 +21,7 @@ spec:
name: manager
args:
- "--cert-dir=$(CERT_DIR)"
- "-v=$(LOG_LEVEL)"
env:
- name: KUBERNETES_NAMESPACE
valueFrom:
Expand Down
1 change: 1 addition & 0 deletions config/internal/ferry/manager/manager.yaml
Expand Up @@ -22,6 +22,7 @@ spec:
- "--service-cluster-name=$(SERVICE_CLUSTER)"
- "--service-cluster-kubeconfig=/kubeconfig/kubeconfig"
- "--provider-namespace=$(KUBERNETES_NAMESPACE)"
- "-v=$(LOG_LEVEL)"
name: manager
env:
# Inserted during manifest generation in resouce
Expand Down
1 change: 1 addition & 0 deletions config/internal/manager/manager/manager.yaml
Expand Up @@ -21,6 +21,7 @@ spec:
name: manager
args:
- "--cert-dir=$(CERT_DIR)"
- "-v=$(LOG_LEVEL)"
env:
- name: KUBECARRIER_NAMESPACE
valueFrom:
Expand Down
Expand Up @@ -152,6 +152,9 @@ spec:
type: object
type: object
type: array
logLevel:
description: LogLevel
type: integer
tlsSecretRef:
description: TLSSecretRef references the TLS certificate and private
key for serving the KubeCarrier API.
Expand Down
Expand Up @@ -47,6 +47,9 @@ spec:
spec:
description: CatapultSpec defines the desired state of Catapult.
properties:
logLevel:
description: LogLevel
type: integer
managementClusterCRD:
description: References the CRD in the Management Cluster.
properties:
Expand Down
Expand Up @@ -56,6 +56,9 @@ spec:
required:
- name
type: object
logLevel:
description: LogLevel
type: integer
paused:
description: Paused tell controller to pause reconciliation process
and assume that Catapult is ready
Expand Down
Expand Up @@ -65,6 +65,9 @@ spec:
required:
- name
type: object
logLevel:
description: LogLevel
type: integer
paused:
description: Paused tell controller to pause reconciliation process
and assume that Ferry is ready
Expand Down
Expand Up @@ -157,6 +157,9 @@ spec:
type: object
type: object
type: array
logLevel:
description: LogLevel
type: integer
tlsSecretRef:
description: TLSSecretRef references the TLS certificate and private
key for serving the KubeCarrier API.
Expand All @@ -167,6 +170,9 @@ spec:
- name
type: object
type: object
logLevel:
description: LogLevel
type: integer
paused:
description: Paused tell controller to pause reconciliation process
and assume that KubaCarrier is ready
Expand Down
1 change: 1 addition & 0 deletions config/operator/manager/manager.yaml
Expand Up @@ -21,6 +21,7 @@ spec:
name: manager
args:
- "--cert-dir=$(CERT_DIR)"
- "-v=$(LOG_LEVEL)"
env:
- name: CERT_DIR
value: "/tmp/k8s-webhook-server/serving-certs"
Expand Down
68 changes: 68 additions & 0 deletions config/operator/webhook/manifests.yaml
Expand Up @@ -6,6 +6,74 @@ metadata:
creationTimestamp: null
name: mutating-webhook-configuration
webhooks:
- clientConfig:
caBundle: Cg==
service:
name: webhook-service
namespace: system
path: /mutate-operator-kubecarrier-io-v1alpha1-apiserver
failurePolicy: Fail
name: mapiserver.kubecarrier.io
rules:
- apiGroups:
- operator.kubecarrier.io
apiVersions:
- v1alpha1
operations:
- CREATE
resources:
- apiservers
- clientConfig:
caBundle: Cg==
service:
name: webhook-service
namespace: system
path: /mutate-operator-kubecarrier-io-v1alpha1-catapult
failurePolicy: Fail
name: mcatapult.kubecarrier.io
rules:
- apiGroups:
- operator.kubecarrier.io
apiVersions:
- v1alpha1
operations:
- CREATE
resources:
- catapults
- clientConfig:
caBundle: Cg==
service:
name: webhook-service
namespace: system
path: /mutate-operator-kubecarrier-io-v1alpha1-elevator
failurePolicy: Fail
name: melevator.kubecarrier.io
rules:
- apiGroups:
- operator.kubecarrier.io
apiVersions:
- v1alpha1
operations:
- CREATE
resources:
- elevators
- clientConfig:
caBundle: Cg==
service:
name: webhook-service
namespace: system
path: /mutate-operator-kubecarrier-io-v1alpha1-ferry
failurePolicy: Fail
name: mferry.kubecarrier.io
rules:
- apiGroups:
- operator.kubecarrier.io
apiVersions:
- v1alpha1
operations:
- CREATE
resources:
- ferries
- clientConfig:
caBundle: Cg==
service:
Expand Down
5 changes: 1 addition & 4 deletions go.mod
Expand Up @@ -5,8 +5,6 @@ go 1.14
replace k8s.io/client-go => k8s.io/client-go v0.18.5

require (
github.com/Masterminds/goutils v1.1.0 // indirect
github.com/Masterminds/semver v1.5.0 // indirect
github.com/Masterminds/sprig v2.22.0+incompatible
github.com/coreos/go-oidc v2.1.0+incompatible
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect
Expand All @@ -20,10 +18,9 @@ require (
github.com/grpc-ecosystem/go-grpc-middleware v1.2.0
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
github.com/grpc-ecosystem/grpc-gateway v1.14.3
github.com/huandu/xstrings v1.3.0 // indirect
github.com/improbable-eng/grpc-web v0.12.0
github.com/jetstack/cert-manager v0.13.0
github.com/kubermatic/utils v0.0.0-20200707131849-09ebdec30295
github.com/kubermatic/utils v0.0.0-20200724064042-10ba458e0d8d
github.com/rs/cors v1.7.0 // indirect
github.com/spf13/cobra v1.0.0
github.com/spf13/pflag v1.0.5
Expand Down
14 changes: 10 additions & 4 deletions go.sum
Expand Up @@ -21,6 +21,7 @@ github.com/Azure/go-autorest/logger v0.1.0 h1:ruG4BSDXONFRrZZJ2GUXDiUyVpayPmb1Gn
github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc=
github.com/Azure/go-autorest/tracing v0.5.0 h1:TRn4WjSnkcSy5AEG3pnbtFSwNtwzjr4VYyQflFE619k=
github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk=
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/Masterminds/goutils v1.1.0 h1:zukEsf/1JZwCMgHiK3GZftabmxiCw4apj3a28RPBiVg=
Expand Down Expand Up @@ -292,6 +293,7 @@ github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/gofuzz v1.1.0 h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g=
github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
Expand Down Expand Up @@ -369,8 +371,8 @@ github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d/go.mod h1:+NfK9FKe
github.com/howeyc/gopass v0.0.0-20170109162249-bf9dde6d0d2c/go.mod h1:lADxMC39cJJqL93Duh1xhAs4I2Zs8mKS89XWXFGp9cs=
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/huandu/xstrings v1.3.0 h1:gvV6jG9dTgFEncxo+AF7PH6MZXi/vZl25owA/8Dg8Wo=
github.com/huandu/xstrings v1.3.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/huandu/xstrings v1.3.2 h1:L18LIDzqlW6xN2rEkpdV8+oL/IXWJ1APd+vsdYy4Wdw=
github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
github.com/imdario/mergo v0.3.6 h1:xTNEAn+kxVO7dTZGu0CegyqKZmoWFI0rF8UxjlB2d28=
github.com/imdario/mergo v0.3.6/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
Expand Down Expand Up @@ -409,8 +411,8 @@ github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA=
github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kubermatic/utils v0.0.0-20200707131849-09ebdec30295 h1:T0EFhA0hYq648w390+vGc2B7Mn3qL0hky0pQPFrH+Ec=
github.com/kubermatic/utils v0.0.0-20200707131849-09ebdec30295/go.mod h1:97VciwlDNVCONPEnuIZI10EhFPP36SMWeyFTXdc3vPc=
github.com/kubermatic/utils v0.0.0-20200724064042-10ba458e0d8d h1:wieaCrv8j8KaOQcP68ATzP0WhqlGuy3X1BMbu14oleE=
github.com/kubermatic/utils v0.0.0-20200724064042-10ba458e0d8d/go.mod h1:U2wBP2Ol83znPuMzq04JunjqO2F/Ns5n/MicHeKcb/U=
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de h1:9TO3cAIGXtEhnIaL+V+BEER86oLrvS+kWobKpbJuye0=
Expand Down Expand Up @@ -661,6 +663,7 @@ golang.org/x/crypto v0.0.0-20190617133340-57b3e21c3d56/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7 h1:0hQKqeLdqlt5iIwVOBErRisrHJAN57yOiPRQItI20fU=
golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191202143827-86a70503ff7e/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975 h1:/Tl7pH94bvbAAHBdZJT947M/+gp0+CqQXDtMRC0fseo=
golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
Expand All @@ -674,6 +677,7 @@ golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTk
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand Down Expand Up @@ -783,8 +787,10 @@ golang.org/x/tools v0.0.0-20190911230505-6bfd74cf029c/go.mod h1:b+2E5dAYhXwXZwtn
golang.org/x/tools v0.0.0-20190912215617-3720d1ec3678/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20190920225731-5eefd052ad72 h1:bw9doJza/SFBEweII/rHQh338oozWyiFsBRHtrflcws=
golang.org/x/tools v0.0.0-20190920225731-5eefd052ad72/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7 h1:9zdDQZ7Thm29KFXgAX/+yaf3eVbP7djjWp/dXAppNCc=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gomodules.xyz/jsonpatch/v2 v2.0.1 h1:xyiBuvkD2g5n7cYzx6u2sxQvsAy4QJsZFCzGVdzOXZ0=
Expand Down
7 changes: 7 additions & 0 deletions pkg/apis/operator/v1alpha1/apiserver_types.go
Expand Up @@ -62,6 +62,13 @@ type APIServerSpec struct {
// +optional
// Authentication configuration
Authentication Authentication `json:"authentication,omitempty"`
// LogLevel
// +optional
LogLevel *int `json:"logLevel,omitempty"`
}

func (a *APIServerSpec) SetLogLevel(logLevel int) {
a.LogLevel = &logLevel
}

func (a APIServerSpec) Validate() error {
Expand Down
7 changes: 7 additions & 0 deletions pkg/apis/operator/v1alpha1/catapult_types.go
Expand Up @@ -38,6 +38,13 @@ type CatapultSpec struct {
WebhookStrategy corev1alpha1.WebhookStrategyType `json:"webhookStrategy,omitempty"`
// Paused tell controller to pause reconciliation process and assume that Catapult is ready
Paused PausedFlagType `json:"paused,omitempty"`
// LogLevel
// +optional
LogLevel *int `json:"logLevel,omitempty"`
}

func (a *CatapultSpec) SetLogLevel(logLevel int) {
a.LogLevel = &logLevel
}

// CatapultStatus defines the observed state of Catapult.
Expand Down
7 changes: 7 additions & 0 deletions pkg/apis/operator/v1alpha1/elevator_types.go
Expand Up @@ -30,6 +30,13 @@ type ElevatorSpec struct {
DerivedCR ObjectReference `json:"derivedCR"`
// Paused tell controller to pause reconciliation process and assume that Catapult is ready
Paused PausedFlagType `json:"paused,omitempty"`
// LogLevel
// +optional
LogLevel *int `json:"logLevel,omitempty"`
}

func (a *ElevatorSpec) SetLogLevel(logLevel int) {
a.LogLevel = &logLevel
}

// ElevatorStatus defines the observed state of Elevator.
Expand Down
7 changes: 7 additions & 0 deletions pkg/apis/operator/v1alpha1/ferry_types.go
Expand Up @@ -26,6 +26,13 @@ type FerrySpec struct {
KubeconfigSecret ObjectReference `json:"kubeconfigSecret"`
// Paused tell controller to pause reconciliation process and assume that Ferry is ready
Paused PausedFlagType `json:"paused,omitempty"`
// LogLevel
// +optional
LogLevel *int `json:"logLevel,omitempty"`
}

func (a *FerrySpec) SetLogLevel(logLevel int) {
a.LogLevel = &logLevel
}

// FerryStatus defines the observed state of Ferry.
Expand Down
7 changes: 7 additions & 0 deletions pkg/apis/operator/v1alpha1/kubecarrier_types.go
Expand Up @@ -27,6 +27,13 @@ type KubeCarrierSpec struct {
// Paused tell controller to pause reconciliation process and assume that KubaCarrier is ready
// +optional
Paused PausedFlagType `json:"paused,omitempty"`
// LogLevel
// +optional
LogLevel int `json:"logLevel,omitempty"`
}

func (a *KubeCarrierSpec) SetLogLevel(logLevel int) {
a.LogLevel = logLevel
}

// KubeCarrierStatus defines the observed state of KubeCarrier
Expand Down

0 comments on commit 042fdaa

Please sign in to comment.