Skip to content

Commit 7ca4575

Browse files
authored
Merge branch 'main' into track-released-oss
2 parents 7eadcc4 + b8baa42 commit 7ca4575

File tree

32 files changed

+762
-210
lines changed

32 files changed

+762
-210
lines changed

api/query/query.proto

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ service Query {
4646
get: "/v1/debug/access-rules"
4747
};
4848
}
49+
50+
rpc ListEnabledComponents(ListEnabledComponentsRequest)
51+
returns (ListEnabledComponentsResponse) {
52+
option (google.api.http) = {
53+
get: "/v1/enabled-components"
54+
};
55+
}
4956
}
5057

5158
message QueryRequest {
@@ -111,3 +118,21 @@ message Facet {
111118
string field = 1;
112119
repeated string values = 2;
113120
}
121+
122+
// EnabledComponent represents a component of the UI that can be enabled or disabled
123+
enum EnabledComponent {
124+
unknown = 0;
125+
applications = 1;
126+
sources = 2;
127+
gitopssets = 3;
128+
templates = 4;
129+
}
130+
131+
message ListEnabledComponentsRequest {
132+
133+
}
134+
135+
message ListEnabledComponentsResponse {
136+
repeated EnabledComponent components = 1;
137+
}
138+

api/query/query.swagger.json

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,28 @@
3939
]
4040
}
4141
},
42+
"/v1/enabled-components": {
43+
"get": {
44+
"operationId": "Query_ListEnabledComponents",
45+
"responses": {
46+
"200": {
47+
"description": "A successful response.",
48+
"schema": {
49+
"$ref": "#/definitions/v1ListEnabledComponentsResponse"
50+
}
51+
},
52+
"default": {
53+
"description": "An unexpected error response.",
54+
"schema": {
55+
"$ref": "#/definitions/rpcStatus"
56+
}
57+
}
58+
},
59+
"tags": [
60+
"Query"
61+
]
62+
}
63+
},
4264
"/v1/facets": {
4365
"get": {
4466
"operationId": "Query_ListFacets",
@@ -168,6 +190,17 @@
168190
}
169191
}
170192
},
193+
"v1EnabledComponent": {
194+
"type": "string",
195+
"enum": [
196+
"unknown",
197+
"applications",
198+
"sources",
199+
"gitopssets",
200+
"templates"
201+
],
202+
"default": "unknown"
203+
},
171204
"v1Facet": {
172205
"type": "object",
173206
"properties": {
@@ -182,6 +215,17 @@
182215
}
183216
}
184217
},
218+
"v1ListEnabledComponentsResponse": {
219+
"type": "object",
220+
"properties": {
221+
"components": {
222+
"type": "array",
223+
"items": {
224+
"$ref": "#/definitions/v1EnabledComponent"
225+
}
226+
}
227+
}
228+
},
185229
"v1ListFacetsResponse": {
186230
"type": "object",
187231
"properties": {

charts/mccp/templates/clusters-service/collector.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{- if .Values.enableExplorer }}
1+
{{- if .Values.explorer.enabled }}
22
---
33
apiVersion: v1
44
kind: ServiceAccount

charts/mccp/templates/clusters-service/configmap.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,4 @@ data:
5858
MONITORING_BIND_ADDRESS: ":{{ .Values.monitoring.service.port }}"
5959
MONITORING_METRICS_ENABLED: {{ .Values.monitoring.metrics.enabled | quote }}
6060
MONITORING_PROFILING_ENABLED: {{ .Values.monitoring.profiling.enabled | quote }}
61+
EXPLORER_ENABLED_FOR: {{ .Values.explorer.enabledFor | join "," | quote }}

charts/mccp/templates/clusters-service/deployment.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,22 +89,22 @@ spec:
8989
- name: WEAVE_GITOPS_FEATURE_PIPELINES
9090
value: "true"
9191
{{- end }}
92-
{{- if .Values.enableExplorer }}
92+
{{- if .Values.explorer.enabled }}
9393
- name: WEAVE_GITOPS_FEATURE_EXPLORER
9494
value: "true"
9595
{{- end }}
9696
{{- if .Values.enableTerraformUI }}
9797
- name: WEAVE_GITOPS_FEATURE_TERRAFORM_UI
9898
value: "true"
9999
{{- end }}
100-
{{- if .Values.useQueryServiceBackend }}
101-
- name: WEAVE_GITOPS_FEATURE_QUERY_SERVICE_BACKEND
102-
value: "true"
103-
{{- end }}
104100
{{- if .Values.enableRunUI }}
105101
- name: WEAVE_GITOPS_FEATURE_RUN_UI
106102
value: "true"
107103
{{- end }}
104+
{{- if .Values.enableNewPipelines }}
105+
- name: WEAVE_GITOPS_FEATURE_NEW_PIPELINES
106+
value: "true"
107+
{{- end }}
108108
{{- if .Values.envVars }}
109109
{{- with .Values.envVars }}
110110
{{- toYaml . | nindent 12 }}

charts/mccp/templates/clusters-service/impersonator.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ rules:
66
- apiGroups: [""]
77
resources: ["users", "groups"]
88
verbs: ["impersonate"]
9-
{{- if .Values.enableExplorer }}
9+
{{- if .Values.explorer.enabled }}
1010
- apiGroups: [ "" ]
1111
resources: [ "serviceaccounts" ]
1212
verbs: [ "impersonate" ]

charts/mccp/templates/rbac/gitopscluster_reader_role.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ rules:
77
resources: ["gitopsclusters"]
88
verbs: ["get", "watch", "list"]
99

10-
{{- if .Values.enableExplorer }}
10+
{{- if .Values.explorer.enabled }}
1111
- apiGroups: ["rbac.authorization.k8s.io"]
1212
resources: ["clusterroles", "clusterrolebindings", "roles", "rolebindings"]
1313
verbs: ["get", "watch", "list"]

charts/mccp/values.yaml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ enableTerraformUI: false
3434
# Turns on UI elements for GitOps Run
3535
enableRunUI: false
3636

37+
# When set to true, this turns on the new Pipelines UI. This includes deploying the new API and controller.
38+
enableNewPipelines: false
39+
3740
config:
3841
logLevel: info
3942
cluster:
@@ -211,16 +214,18 @@ cluster-controller:
211214
tag: v1.5.2
212215

213216
#### Explorer
214-
# Turns on explorer to true
215-
enableExplorer: false
216-
# Uses the query service for Applications and Sources views
217-
useQueryServiceBackend: false
218-
219217
explorer:
218+
enabled: false
220219
collector:
221220
# ServiceAccount that explorer will use to watch clusters for resources
222221
serviceAccount:
223222
name: "collector"
224223
namespace: "flux-system"
225224
cleaner:
226225
disabled: false
226+
enabledFor:
227+
- applications
228+
- sources
229+
- gitopssets
230+
- templates
231+

cmd/clusters-service/app/options.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ type Options struct {
6060
CollectorServiceAccount collector.ImpersonateServiceAccount
6161
MonitoringOptions monitoring.Options
6262
EnableObjectCleaner bool
63+
ExplorerEnabledFor []string
6364
}
6465

6566
type Option func(*Options)
@@ -290,3 +291,10 @@ func WithObjectCleaner(enabled bool) Option {
290291
o.EnableObjectCleaner = enabled
291292
}
292293
}
294+
295+
// ExplorerEnabledFor turns on and off the explorer for different parts of the UI
296+
func WithExplorerEnabledFor(enabledFor []string) Option {
297+
return func(o *Options) {
298+
o.ExplorerEnabledFor = append(o.ExplorerEnabledFor, enabledFor...)
299+
}
300+
}

cmd/clusters-service/app/server.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ type Params struct {
166166
ProfilingEnabled bool `mapstructure:"monitoring-profiling-enabled"`
167167
EnableObjectCleaner bool `mapstructure:"enable-object-cleaner"`
168168
NoAuthUser string `mapstructure:"insecure-no-authentication-user"`
169+
ExplorerEnabledFor []string `mapstructure:"explorer-enabled-for"`
169170
}
170171

171172
type OIDCAuthenticationOptions struct {
@@ -268,6 +269,7 @@ func NewAPIServerCommand() *cobra.Command {
268269
cmdFlags.String("collector-serviceaccount-name", "", "name of the serviceaccount that collector impersonates to watch leaf clusters.")
269270
cmdFlags.String("collector-serviceaccount-namespace", "", "namespace of the serviceaccount that collector impersonates to watch leaf clusters.")
270271
cmdFlags.Bool("explorer-cleaner-disabled", false, "Enables the Explorer object cleaner that manages retaining objects")
272+
cmdFlags.StringSlice("explorer-enabled-for", []string{}, "List of components that the Explorer is enabled for")
271273

272274
// Monitoring
273275
cmdFlags.Bool("monitoring-enabled", false, "creates monitoring server")
@@ -578,6 +580,7 @@ func StartServer(ctx context.Context, p Params, logOptions flux_logger.Options)
578580
WithCollectorServiceAccount(p.CollectorServiceAccountName, p.CollectorServiceAccountNamespace),
579581
WithMonitoring(p.MonitoringEnabled, p.MonitoringBindAddress, p.MetricsEnabled, p.ProfilingEnabled, log),
580582
WithObjectCleaner(p.EnableObjectCleaner),
583+
WithExplorerEnabledFor(p.ExplorerEnabledFor),
581584
)
582585
}
583586

@@ -698,6 +701,7 @@ func RunInProcessGateway(ctx context.Context, addr string, setters ...Option) er
698701
ObjectKinds: configuration.SupportedObjectKinds,
699702
ServiceAccount: args.CollectorServiceAccount,
700703
EnableObjectCleaner: args.EnableObjectCleaner,
704+
EnabledFor: args.ExplorerEnabledFor,
701705
})
702706
if err != nil {
703707
return fmt.Errorf("hydrating query server: %w", err)

0 commit comments

Comments
 (0)