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

WIP namespace isolation for artifacts and pipeline definitions #7406

Closed
wants to merge 54 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
704b528
use debug dockerfile
gabor-nyerges Feb 11, 2022
064583c
test docker file for persistence agent
gabor-nyerges Feb 11, 2022
726c255
ReadArtifact receives the namespace as resourceKey
gabor-nyerges Feb 15, 2022
d3f9512
ReadArtifact works with namespaced bucket name
gabor-nyerges Feb 15, 2022
972dee1
bucketName was added to AddFile / DeleteFile too.
gabor-nyerges Feb 17, 2022
3542bfd
remove unused method
gabor-nyerges Feb 21, 2022
dabdd6f
remove not used methods
gabor-nyerges Feb 21, 2022
3c57c29
remove not used methods
gabor-nyerges Feb 21, 2022
19bfacf
remove not used methods
gabor-nyerges Feb 21, 2022
d6c9994
fix tests
gabor-nyerges Feb 21, 2022
1c9ee01
fix tests
gabor-nyerges Feb 21, 2022
145e229
strictNamespaceIsolation
gabor-nyerges Feb 21, 2022
9ceaf56
private pipelines
gabor-nyerges Mar 1, 2022
0fc2381
refresh table if checkbox state changes
gabor-nyerges Mar 3, 2022
12330d3
use debug dockerfile
gabor-nyerges Feb 11, 2022
5347204
test docker file for persistence agent
gabor-nyerges Feb 11, 2022
0c267c2
ReadArtifact receives the namespace as resourceKey
gabor-nyerges Feb 15, 2022
9acef40
ReadArtifact works with namespaced bucket name
gabor-nyerges Feb 15, 2022
adc1846
bucketName was added to AddFile / DeleteFile too.
gabor-nyerges Feb 17, 2022
3760b47
remove unused method
gabor-nyerges Feb 21, 2022
1691273
remove not used methods
gabor-nyerges Feb 21, 2022
55dd972
remove not used methods
gabor-nyerges Feb 21, 2022
4f90508
remove not used methods
gabor-nyerges Feb 21, 2022
c86c885
fix tests
gabor-nyerges Feb 21, 2022
bcaa563
fix tests
gabor-nyerges Feb 21, 2022
eaba32f
strictNamespaceIsolation
gabor-nyerges Feb 21, 2022
2f79f48
private pipelines
gabor-nyerges Mar 1, 2022
fd0bcfd
refresh table if checkbox state changes
gabor-nyerges Mar 3, 2022
767f792
setting strict namespace isolation for pipelines and profile-controller
gabor-nyerges Mar 8, 2022
a200c2e
Merge branch 'namespace-isolation' of https://gitlab.devops.telekom.d…
gabor-nyerges Mar 8, 2022
15dc166
fix indentation
gabor-nyerges Mar 8, 2022
dd32358
disable debug mode
gabor-nyerges Mar 8, 2022
5de7280
disable debug mode
gabor-nyerges Mar 8, 2022
0a5f2d3
Update pipeline-install-config.yaml
juliusvonkohout Mar 11, 2022
e161424
Merge branch 'namespace-isolation' of https://github.com/juliusvonkoh…
Mar 11, 2022
629317a
npm run format
gabor-nyerges Mar 28, 2022
c2fca14
fixing test to contain ResourceReferenceKey: &api.ResourceKey{
gabor-nyerges Mar 28, 2022
c6660b9
Merge branch 'kubeflow:master' into patch-20
gabor-nyerges Mar 28, 2022
12442e0
revert uninteded tsx reformats
gabor-nyerges Mar 28, 2022
ac5dfb1
revert uninteded tsx reformats
gabor-nyerges Mar 28, 2022
8130f9f
Merge branch 'patch-20' of github.com:juliusvonkohout/pipelines into …
gabor-nyerges Mar 28, 2022
c9bdcee
Merge branch 'patch-20' of github.com:juliusvonkohout/pipelines into …
gabor-nyerges Mar 28, 2022
969cc8e
Merge branch 'patch-20' of github.com:juliusvonkohout/pipelines into …
gabor-nyerges Mar 28, 2022
cddfcd5
Merge branch 'patch-20' of github.com:juliusvonkohout/pipelines into …
gabor-nyerges Mar 28, 2022
ebb391f
Merge branch 'patch-20' of github.com:juliusvonkohout/pipelines into …
gabor-nyerges Mar 28, 2022
c6363e0
test prettier version
gabor-nyerges Mar 29, 2022
97837a3
fix formatting issues
gabor-nyerges Mar 29, 2022
0ed9918
revert not project specific formatting
gabor-nyerges Mar 31, 2022
498341b
linting frontend folder, fix some frontend tests
gabor-nyerges Apr 1, 2022
c7f887a
linting frontend folder QUERY_PARAMS.namespace
gabor-nyerges Apr 1, 2022
445a083
fixed another bunch of tests
gabor-nyerges Apr 1, 2022
9bdad69
format code again
gabor-nyerges Apr 1, 2022
fd6eb70
Merge branch 'kubeflow:master' into patch-20
gabor-nyerges Apr 11, 2022
7241afc
fix documentation
gabor-nyerges Apr 20, 2022
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
231 changes: 124 additions & 107 deletions backend/api/go_client/run.pb.go

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions backend/api/go_client/run.pb.gw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions backend/api/run.proto
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,10 @@ message ReadArtifactRequest {
string node_id = 2;
// The name of the artifact.
string artifact_name = 3;
// What resource reference to filter on.
// For Experiment, the only valid resource type is Namespace. An sample query string could be
// resource_reference_key.type=NAMESPACE&resource_reference_key.id=ns1
ResourceKey resource_reference_key = 4;
}

message ReadArtifactResponse {
Expand Down
23 changes: 23 additions & 0 deletions backend/api/swagger/kfp_api_single_file.swagger.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions backend/api/swagger/run.swagger.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 9 additions & 6 deletions backend/src/agent/persistence/worker/metrics_reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,11 @@ func (r MetricsReporter) ReportMetrics(workflow *util.Workflow) error {
return nil
}
runID := workflow.ObjectMeta.Labels[util.LabelKeyWorkflowRunId]
namespace := workflow.ObjectMeta.Namespace
runMetrics := []*api.RunMetric{}
partialFailures := []error{}
for _, nodeStatus := range workflow.Status.Nodes {
nodeMetrics, err := r.collectNodeMetricsOrNil(runID, nodeStatus)
nodeMetrics, err := r.collectNodeMetricsOrNil(namespace, runID, nodeStatus)
if err != nil {
partialFailures = append(partialFailures, err)
continue
Expand Down Expand Up @@ -88,13 +89,11 @@ func (r MetricsReporter) ReportMetrics(workflow *util.Workflow) error {
return aggregateErrors(partialFailures)
}

func (r MetricsReporter) collectNodeMetricsOrNil(
runID string, nodeStatus workflowapi.NodeStatus) (
[]*api.RunMetric, error) {
func (r MetricsReporter) collectNodeMetricsOrNil(namespace string, runID string, nodeStatus workflowapi.NodeStatus) ([]*api.RunMetric, error) {
if !nodeStatus.Completed() {
return nil, nil
}
metricsJSON, err := r.readNodeMetricsJSONOrEmpty(runID, nodeStatus)
metricsJSON, err := r.readNodeMetricsJSONOrEmpty(namespace, runID, nodeStatus)
if err != nil || metricsJSON == "" {
return nil, err
}
Expand Down Expand Up @@ -126,7 +125,7 @@ func (r MetricsReporter) collectNodeMetricsOrNil(
return reportMetricsRequest.GetMetrics(), nil
}

func (r MetricsReporter) readNodeMetricsJSONOrEmpty(runID string, nodeStatus workflowapi.NodeStatus) (string, error) {
func (r MetricsReporter) readNodeMetricsJSONOrEmpty(namespace string, runID string, nodeStatus workflowapi.NodeStatus) (string, error) {
if nodeStatus.Outputs == nil || nodeStatus.Outputs.Artifacts == nil {
return "", nil // No output artifacts, skip the reporting
}
Expand All @@ -145,6 +144,10 @@ func (r MetricsReporter) readNodeMetricsJSONOrEmpty(runID string, nodeStatus wor
RunId: runID,
NodeId: nodeStatus.ID,
ArtifactName: metricsArtifactName,
ResourceReferenceKey: &api.ResourceKey{
Id: namespace,
Type: api.ResourceType_NAMESPACE,
},
}
artifactResponse, err := r.pipelineClient.ReadArtifact(artifactRequest)
if err != nil {
Expand Down
39 changes: 36 additions & 3 deletions backend/src/agent/persistence/worker/metrics_reporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ package worker
import (
"encoding/json"
"fmt"
"testing"

"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"google.golang.org/protobuf/testing/protocmp"
"testing"

workflowapi "github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1"
api "github.com/kubeflow/pipelines/backend/api/go_client"
Expand Down Expand Up @@ -168,6 +169,10 @@ func TestReportMetrics_Succeed(t *testing.T) {
RunId: "run-1",
NodeId: "node-1",
ArtifactName: "mlpipeline-metrics",
ResourceReferenceKey: &api.ResourceKey{
Type: api.ResourceType_NAMESPACE,
Id: "MY_NAMESPACE",
},
},
&api.ReadArtifactResponse{
Data: []byte(artifactData),
Expand Down Expand Up @@ -197,7 +202,7 @@ func TestReportMetrics_Succeed(t *testing.T) {
got := pipelineFake.GetReportedMetricsRequest()
if diff := cmp.Diff(expectedMetricsRequest, got, cmpopts.EquateEmpty(), protocmp.Transform()); diff != "" {
t.Errorf("parseRuntimeInfo() = %+v, want %+v\nDiff (-want, +got)\n%s", got, expectedMetricsRequest, diff)
s, _ := json.MarshalIndent(expectedMetricsRequest ,"", " ")
s, _ := json.MarshalIndent(expectedMetricsRequest, "", " ")
fmt.Printf("Want %s", s)
}
}
Expand Down Expand Up @@ -230,6 +235,10 @@ func TestReportMetrics_EmptyArchive_Fail(t *testing.T) {
RunId: "run-1",
NodeId: "node-1",
ArtifactName: "mlpipeline-metrics",
ResourceReferenceKey: &api.ResourceKey{
Type: api.ResourceType_NAMESPACE,
Id: "MY_NAMESPACE",
},
},
&api.ReadArtifactResponse{
Data: []byte(artifactData),
Expand Down Expand Up @@ -273,6 +282,10 @@ func TestReportMetrics_MultipleFilesInArchive_Fail(t *testing.T) {
RunId: "run-1",
NodeId: "node-1",
ArtifactName: "mlpipeline-metrics",
ResourceReferenceKey: &api.ResourceKey{
Type: api.ResourceType_NAMESPACE,
Id: "MY_NAMESPACE",
},
},
&api.ReadArtifactResponse{
Data: []byte(artifactData),
Expand Down Expand Up @@ -315,6 +328,10 @@ func TestReportMetrics_InvalidMetricsJSON_Fail(t *testing.T) {
RunId: "run-1",
NodeId: "node-1",
ArtifactName: "mlpipeline-metrics",
ResourceReferenceKey: &api.ResourceKey{
Type: api.ResourceType_NAMESPACE,
Id: "MY_NAMESPACE",
},
},
&api.ReadArtifactResponse{
Data: []byte(artifactData),
Expand Down Expand Up @@ -367,6 +384,10 @@ func TestReportMetrics_InvalidMetricsJSON_PartialFail(t *testing.T) {
RunId: "run-1",
NodeId: "node-1",
ArtifactName: "mlpipeline-metrics",
ResourceReferenceKey: &api.ResourceKey{
Type: api.ResourceType_NAMESPACE,
Id: "MY_NAMESPACE",
},
},
&api.ReadArtifactResponse{
Data: []byte(invalidArtifactData),
Expand All @@ -376,6 +397,10 @@ func TestReportMetrics_InvalidMetricsJSON_PartialFail(t *testing.T) {
RunId: "run-1",
NodeId: "node-2",
ArtifactName: "mlpipeline-metrics",
ResourceReferenceKey: &api.ResourceKey{
Type: api.ResourceType_NAMESPACE,
Id: "MY_NAMESPACE",
},
},
&api.ReadArtifactResponse{
Data: []byte(validArtifactData),
Expand Down Expand Up @@ -404,7 +429,7 @@ func TestReportMetrics_InvalidMetricsJSON_PartialFail(t *testing.T) {
got := pipelineFake.GetReportedMetricsRequest()
if diff := cmp.Diff(expectedMetricsRequest, got, cmpopts.EquateEmpty(), protocmp.Transform()); diff != "" {
t.Errorf("parseRuntimeInfo() = %+v, want %+v\nDiff (-want, +got)\n%s", got, expectedMetricsRequest, diff)
s, _ := json.MarshalIndent(expectedMetricsRequest ,"", " ")
s, _ := json.MarshalIndent(expectedMetricsRequest, "", " ")
fmt.Printf("Want %s", s)
}
}
Expand Down Expand Up @@ -436,6 +461,10 @@ func TestReportMetrics_CorruptedArchiveFile_Fail(t *testing.T) {
RunId: "run-1",
NodeId: "node-1",
ArtifactName: "mlpipeline-metrics",
ResourceReferenceKey: &api.ResourceKey{
Type: api.ResourceType_NAMESPACE,
Id: "MY_NAMESPACE",
},
},
&api.ReadArtifactResponse{
Data: []byte("invalid tgz content"),
Expand Down Expand Up @@ -479,6 +508,10 @@ func TestReportMetrics_MultiplMetricErrors_TransientErrowWin(t *testing.T) {
RunId: "run-1",
NodeId: "node-1",
ArtifactName: "mlpipeline-metrics",
ResourceReferenceKey: &api.ResourceKey{
Type: api.ResourceType_NAMESPACE,
Id: "MY_NAMESPACE",
},
},
&api.ReadArtifactResponse{
Data: []byte(artifactData),
Expand Down
Loading