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

New version of operator docs (#638) #724

Merged
merged 38 commits into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
4e2c26b
WIP: initial version of new operator docs (#638)
Amper Aug 11, 2023
725c7bb
add more info about conversion from prometheus
Amper Aug 29, 2023
3c2c6f1
WIP
Amper Aug 30, 2023
fa1a36c
updates for vmagent docs
Amper Sep 13, 2023
a6d7fc8
updates
Amper Sep 13, 2023
59259ef
updates for scraping, selectors and namespaced mode.
Amper Sep 13, 2023
a0a4528
updates
Amper Sep 13, 2023
dee7ba8
vmalerts selectors doc
Amper Sep 13, 2023
a0d7e20
vmalerts selectors doc + high availability + alertmanager + manage ve…
Amper Sep 13, 2023
4e43e86
updates
Amper Sep 13, 2023
2e01584
updates
Amper Sep 18, 2023
aa859c8
quickstart updates
Amper Sep 18, 2023
1fc6046
quickstart updates
Amper Sep 18, 2023
ffa27b0
updates
Amper Sep 18, 2023
4ef7f72
updates
Amper Sep 20, 2023
346859d
updates
Amper Sep 20, 2023
1ccd93b
updates
Amper Sep 20, 2023
590a1ba
updates
Amper Sep 20, 2023
59a4c0a
updates
Amper Sep 20, 2023
18972f7
updates
Amper Sep 20, 2023
3b3cf01
updates (still work in progress)
Amper Sep 21, 2023
7fef36a
updates
Amper Sep 22, 2023
43f5cdd
updates
Amper Sep 22, 2023
b113e95
updates
Amper Sep 22, 2023
2f7b678
fill up Security policies part
Haleygo Sep 25, 2023
8302271
updates
Amper Sep 25, 2023
1c0ba0a
updates
Amper Sep 25, 2023
0d862e4
updates
Amper Sep 25, 2023
344aa32
Merge branch 'master' into issue-638
Amper Sep 25, 2023
292add6
updates
Amper Sep 25, 2023
e5ac080
updates
Amper Sep 25, 2023
b6cf361
fixed links
Amper Sep 26, 2023
cbcbf67
fixed links
Amper Sep 26, 2023
ffef1ac
Merge branch 'master' into issue-638
Amper Sep 26, 2023
b89ad9d
Merge branch 'master' into issue-638
Amper Sep 27, 2023
ea13255
Update docs/resources/vmalertmanagerconfig.md
Amper Sep 28, 2023
9afc72a
fixed review comments
Amper Sep 29, 2023
61d7c33
fixed review comments
Amper Sep 29, 2023
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
8 changes: 4 additions & 4 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- master
paths:
- '.github/workflows/docs.yaml'
- 'docs/CHANGELOG.MD'
- 'docs/CHANGELOG.md'
- 'api/v1beta1/*types.go'
- 'api/v1beta1/additional.go'
- 'api/victoriametrics/v1beta1/*types.go'
Expand Down Expand Up @@ -71,9 +71,9 @@ jobs:

- name: Update CHANGELOG in VM docs
run: |
cat ./docs/CHANGELOG.MD > ../__vm-docs-repo/docs/operator/CHANGELOG.md
cat ./vars.MD > ../__vm-docs-repo/docs/operator/vars.md
cat ./doc_api.MD > ../__vm-docs-repo/docs/operator/api.md
cat ./docs/CHANGELOG.md > ../__vm-docs-repo/docs/operator/CHANGELOG.md
cat ./vars.md > ../__vm-docs-repo/docs/operator/vars.md
cat ./doc_api.md > ../__vm-docs-repo/docs/operator/api.md
working-directory: "__vm-operator-repo"

- name: Commit and push changes
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ fix_crd_nulls_yaml:


doc: install-develop-tools
cat hack/doc_header.md > doc_api.MD
cat hack/doc_header.md > doc_api.md
doc-print --paths=\
$(APIS_BASE_PATH)/vmalertmanager_types.go,\
$(APIS_BASE_PATH)/vmalertmanagerconfig_types.go,\
Expand All @@ -216,11 +216,11 @@ doc: install-develop-tools
$(APIS_BASE_PATH)/vmstaticscrape_types.go,\
$(APIS_BASE_PATH)/vmprobe_types.go \
--owner VictoriaMetrics \
>> doc_api.MD
>> doc_api.md

operator-conf: install-develop-tools
cat hack/doc_vars_header.md > vars.MD
envconfig-docs --input internal/config/config.go --truncate=false >> vars.MD
cat hack/doc_vars_header.md > vars.md
envconfig-docs --input internal/config/config.go --truncate=false >> vars.md


docker: build manager
Expand Down
191 changes: 191 additions & 0 deletions controllers/factory/scrapes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,37 @@ func TestSelectServiceMonitors(t *testing.T) {
p *victoriametricsv1beta1.VMAgent
l logr.Logger
}

predefinedObjects := []runtime.Object{
&corev1.Namespace{ObjectMeta: metav1.ObjectMeta{Name: "default"}},
&victoriametricsv1beta1.VMServiceScrape{
ObjectMeta: metav1.ObjectMeta{Namespace: "default", Name: "ss1", Labels: map[string]string{"name": "ss1"}},
Spec: victoriametricsv1beta1.VMServiceScrapeSpec{},
},
&victoriametricsv1beta1.VMServiceScrape{
ObjectMeta: metav1.ObjectMeta{Namespace: "default", Name: "ss2", Labels: map[string]string{"name": "ss2"}},
Spec: victoriametricsv1beta1.VMServiceScrapeSpec{},
},
&corev1.Namespace{ObjectMeta: metav1.ObjectMeta{Name: "other1", Labels: map[string]string{"name": "other1"}}},
&victoriametricsv1beta1.VMServiceScrape{
ObjectMeta: metav1.ObjectMeta{Namespace: "other1", Name: "ss1", Labels: map[string]string{"name": "ss1"}},
Spec: victoriametricsv1beta1.VMServiceScrapeSpec{},
},
&victoriametricsv1beta1.VMServiceScrape{
ObjectMeta: metav1.ObjectMeta{Namespace: "other1", Name: "ss2", Labels: map[string]string{"name": "ss2"}},
Spec: victoriametricsv1beta1.VMServiceScrapeSpec{},
},
&corev1.Namespace{ObjectMeta: metav1.ObjectMeta{Name: "other2", Labels: map[string]string{"name": "other2"}}},
&victoriametricsv1beta1.VMServiceScrape{
ObjectMeta: metav1.ObjectMeta{Namespace: "other2", Name: "ss1", Labels: map[string]string{"name": "ss1"}},
Spec: victoriametricsv1beta1.VMServiceScrapeSpec{},
},
&victoriametricsv1beta1.VMServiceScrape{
ObjectMeta: metav1.ObjectMeta{Namespace: "other2", Name: "ss2", Labels: map[string]string{"name": "ss2"}},
Spec: victoriametricsv1beta1.VMServiceScrapeSpec{},
},
}

tests := []struct {
name string
args args
Expand Down Expand Up @@ -87,6 +118,166 @@ func TestSelectServiceMonitors(t *testing.T) {
want: []string{"stg/default-monitor"},
wantErr: false,
},
{
name: "If NamespaceSelector and Selector both undefined, selectAllByDefault=false and empty watchNS",
args: args{
p: &victoriametricsv1beta1.VMAgent{
ObjectMeta: metav1.ObjectMeta{
Name: "default-agent",
Namespace: "default",
},
Spec: victoriametricsv1beta1.VMAgentSpec{
ServiceScrapeNamespaceSelector: nil,
ServiceScrapeSelector: nil,
SelectAllByDefault: false,
},
},
l: logf.Log.WithName("unit-test"),
},
predefinedObjects: predefinedObjects,
want: []string{},
wantErr: false,
},
{
name: "If NamespaceSelector and Selector both undefined, selectAllByDefault=true and empty watchNS",
args: args{
p: &victoriametricsv1beta1.VMAgent{
ObjectMeta: metav1.ObjectMeta{
Name: "default-agent",
Namespace: "default",
},
Spec: victoriametricsv1beta1.VMAgentSpec{
ServiceScrapeNamespaceSelector: nil,
ServiceScrapeSelector: nil,
SelectAllByDefault: true,
},
},
l: logf.Log.WithName("unit-test"),
},
predefinedObjects: predefinedObjects,
want: []string{"default/ss1", "default/ss2", "other1/ss1", "other1/ss2", "other2/ss1", "other2/ss2"},
wantErr: false,
},
{
name: "If NamespaceSelector defined, Selector undefined, selectAllByDefault=false and empty watchNS",
args: args{
p: &victoriametricsv1beta1.VMAgent{
ObjectMeta: metav1.ObjectMeta{
Name: "default-agent",
Namespace: "default",
},
Spec: victoriametricsv1beta1.VMAgentSpec{
ServiceScrapeNamespaceSelector: &metav1.LabelSelector{MatchLabels: map[string]string{"name": "other1"}},
ServiceScrapeSelector: nil,
SelectAllByDefault: false,
},
},
l: logf.Log.WithName("unit-test"),
},
predefinedObjects: predefinedObjects,
want: []string{"other1/ss1", "other1/ss2"},
wantErr: false,
},
{
name: "If NamespaceSelector defined, Selector undefined, selectAllByDefault=true and empty watchNS",
args: args{
p: &victoriametricsv1beta1.VMAgent{
ObjectMeta: metav1.ObjectMeta{
Name: "default-agent",
Namespace: "default",
},
Spec: victoriametricsv1beta1.VMAgentSpec{
ServiceScrapeNamespaceSelector: &metav1.LabelSelector{MatchLabels: map[string]string{"name": "other1"}},
ServiceScrapeSelector: nil,
SelectAllByDefault: true,
},
},
l: logf.Log.WithName("unit-test"),
},
predefinedObjects: predefinedObjects,
want: []string{"other1/ss1", "other1/ss2"},
wantErr: false,
},
{
name: "If NamespaceSelector undefined, Selector defined, selectAllByDefault=false and empty watchNS",
args: args{
p: &victoriametricsv1beta1.VMAgent{
ObjectMeta: metav1.ObjectMeta{
Name: "default-agent",
Namespace: "default",
},
Spec: victoriametricsv1beta1.VMAgentSpec{
ServiceScrapeNamespaceSelector: nil,
ServiceScrapeSelector: &metav1.LabelSelector{MatchLabels: map[string]string{"name": "ss1"}},
SelectAllByDefault: false,
},
},
l: logf.Log.WithName("unit-test"),
},
predefinedObjects: predefinedObjects,
want: []string{"default/ss1"},
wantErr: false,
},
{
name: "If NamespaceSelector undefined, Selector defined, selectAllByDefault=true and empty watchNS",
args: args{
p: &victoriametricsv1beta1.VMAgent{
ObjectMeta: metav1.ObjectMeta{
Name: "default-agent",
Namespace: "default",
},
Spec: victoriametricsv1beta1.VMAgentSpec{
ServiceScrapeNamespaceSelector: nil,
ServiceScrapeSelector: &metav1.LabelSelector{MatchLabels: map[string]string{"name": "ss1"}},
SelectAllByDefault: true,
},
},
l: logf.Log.WithName("unit-test"),
},
predefinedObjects: predefinedObjects,
want: []string{"default/ss1"},
wantErr: false,
},
{
name: "If NamespaceSelector and Selector both defined, selectAllByDefault=false and empty watchNS",
args: args{
p: &victoriametricsv1beta1.VMAgent{
ObjectMeta: metav1.ObjectMeta{
Name: "default-agent",
Namespace: "default",
},
Spec: victoriametricsv1beta1.VMAgentSpec{
ServiceScrapeNamespaceSelector: &metav1.LabelSelector{MatchLabels: map[string]string{"name": "other1"}},
ServiceScrapeSelector: &metav1.LabelSelector{MatchLabels: map[string]string{"name": "ss1"}},
SelectAllByDefault: false,
},
},
l: logf.Log.WithName("unit-test"),
},
predefinedObjects: predefinedObjects,
want: []string{"other1/ss1"},
wantErr: false,
},
{
name: "If NamespaceSelector and Selector both defined, selectAllByDefault=true and empty watchNS",
args: args{
p: &victoriametricsv1beta1.VMAgent{
ObjectMeta: metav1.ObjectMeta{
Name: "default-agent",
Namespace: "default",
},
Spec: victoriametricsv1beta1.VMAgentSpec{
ServiceScrapeNamespaceSelector: &metav1.LabelSelector{MatchLabels: map[string]string{"name": "other2"}},
ServiceScrapeSelector: &metav1.LabelSelector{MatchLabels: map[string]string{"name": "ss2"}},
SelectAllByDefault: true,
},
},
l: logf.Log.WithName("unit-test"),
},
predefinedObjects: predefinedObjects,
want: []string{"other2/ss2"},
wantErr: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down
Loading
Loading