mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Grafana app platform: drop etcd requirement in example-apiserver (#77886)
This commit is contained in:
parent
4159f47df0
commit
28e58c1725
2
Makefile
2
Makefile
@ -7,7 +7,7 @@ WIRE_TAGS = "oss"
|
||||
-include local/Makefile
|
||||
include .bingo/Variables.mk
|
||||
|
||||
.PHONY: all deps-go deps-js deps build-go build-backend build-server build-cli build-js build build-docker-full build-docker-full-ubuntu lint-go golangci-lint test-go test-js gen-ts test run run-frontend clean devenv devenv-down protobuf drone help gen-go gen-cue fix-cue
|
||||
.PHONY: all deps-go deps-js deps build-go build-backend build-example-apiserver build-server build-cli build-js build build-docker-full build-docker-full-ubuntu lint-go golangci-lint test-go test-js gen-ts test run run-frontend clean devenv devenv-down protobuf drone help gen-go gen-cue fix-cue
|
||||
|
||||
GO = go
|
||||
GO_FILES ?= ./pkg/...
|
||||
|
@ -3,34 +3,23 @@
|
||||
The example-apiserver closely resembles the
|
||||
[sample-apiserver](https://github.com/kubernetes/sample-apiserver/tree/master) project in code and thus
|
||||
allows the same
|
||||
[CLI flags](https://kubernetes.io/docs/reference/command-line-tools-reference/kube-apiserver/) as kube-apiserver
|
||||
[CLI flags](https://kubernetes.io/docs/reference/command-line-tools-reference/kube-apiserver/) as kube-apiserver.
|
||||
It is currently used for testing our deployment pipelines for aggregated servers.
|
||||
|
||||
## Prerequisites:
|
||||
1. etcd
|
||||
```shell
|
||||
brew install etcd
|
||||
```
|
||||
2. kind: you will need kind (or another local K8s setup) if you want to test aggregation.
|
||||
1. kind: you will need kind (or another local K8s setup) if you want to test aggregation.
|
||||
```
|
||||
go install sigs.k8s.io/kind@v0.20.0 && kind create cluster
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Have `etcd` running in your environment:
|
||||
|
||||
```shell
|
||||
etcd &
|
||||
```
|
||||
|
||||
With etcd running, you can now start the example-apiserver. The Authn / Authz flags are set up so that the kind cluster
|
||||
You can start the example-apiserver with an invocation as shown below. The Authn / Authz flags are set up so that the kind cluster
|
||||
can be used as a root server for this example-apiserver (in aggregated mode). Here, it's assumed that you have a local
|
||||
kind cluster and that you can provide its kubeconfig in the parameters to the example-apiserver.
|
||||
|
||||
```shell
|
||||
go run ./pkg/cmd/grafana-example-apiserver \
|
||||
--etcd-servers=http://127.0.0.1:2379 \
|
||||
--authentication-kubeconfig ~/.kube/config \
|
||||
--authorization-kubeconfig ~/.kube/config \
|
||||
--kubeconfig ~/.kube/config \
|
||||
|
@ -18,10 +18,6 @@ func NewCommandStartExampleAPIServer(defaults *ExampleServerOptions, stopCh <-ch
|
||||
return err
|
||||
}
|
||||
|
||||
if err := o.Validate(args); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
config, err := o.Config()
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -80,6 +80,7 @@ func (o ExampleServerOptions) Config() (*genericapiserver.RecommendedConfig, err
|
||||
|
||||
o.RecommendedOptions.Admission = nil
|
||||
o.RecommendedOptions.CoreAPI = nil
|
||||
o.RecommendedOptions.Etcd = nil
|
||||
|
||||
serverConfig := genericapiserver.NewRecommendedConfig(Codecs)
|
||||
|
||||
@ -91,6 +92,8 @@ func (o ExampleServerOptions) Config() (*genericapiserver.RecommendedConfig, err
|
||||
}
|
||||
|
||||
// Validate validates ExampleServerOptions
|
||||
// NOTE: we don't call validate on the top level recommended options as it doesn't like skipping etcd-servers
|
||||
// the function is left here for troubleshooting any other config issues
|
||||
func (o ExampleServerOptions) Validate(args []string) error {
|
||||
errors := []error{}
|
||||
errors = append(errors, o.RecommendedOptions.Validate()...)
|
||||
|
Loading…
Reference in New Issue
Block a user