diff --git a/backend/src/v2/driver/driver.go b/backend/src/v2/driver/driver.go index 6cccc1a1f21..8323cceef9a 100644 --- a/backend/src/v2/driver/driver.go +++ b/backend/src/v2/driver/driver.go @@ -17,12 +17,13 @@ import ( "context" "encoding/json" "fmt" - "github.com/kubeflow/pipelines/backend/src/v2/objectstore" "path" "strconv" "strings" "time" + "github.com/kubeflow/pipelines/backend/src/v2/objectstore" + "github.com/golang/glog" "github.com/golang/protobuf/ptypes/timestamp" "github.com/google/uuid" @@ -488,11 +489,51 @@ func extendPodSpecPatch( podSpec.Containers[0].VolumeMounts = append(podSpec.Containers[0].VolumeMounts, volumeMounts...) } + // Get image pull policy + pullPolicy := kubernetesExecutorConfig.GetImagePullPolicy() + if pullPolicy != "" { + policies := []string{"Always", "Never", "IfNotPresent"} + found := false + for _, value := range policies { + if value == pullPolicy { + found = true + break + } + } + if !found { + return fmt.Errorf("unsupported value: %s. ImagePullPolicy should be one of 'Always', 'Never' or 'IfNotPresent'", pullPolicy) + } + // We assume that the user container always gets executed first within a pod. + podSpec.Containers[0].ImagePullPolicy = k8score.PullPolicy(pullPolicy) + } + // Get node selector information if kubernetesExecutorConfig.GetNodeSelector() != nil { podSpec.NodeSelector = kubernetesExecutorConfig.GetNodeSelector().GetLabels() } + if tolerations := kubernetesExecutorConfig.GetTolerations(); tolerations != nil { + var k8sTolerations []k8score.Toleration + + glog.Infof("Tolerations passed: %+v", tolerations) + + for _, toleration := range tolerations { + if toleration != nil { + k8sToleration := k8score.Toleration{ + Key: toleration.Key, + Operator: k8score.TolerationOperator(toleration.Operator), + Value: toleration.Value, + Effect: k8score.TaintEffect(toleration.Effect), + TolerationSeconds: toleration.TolerationSeconds, + } + + k8sTolerations = append(k8sTolerations, k8sToleration) + } + } + + podSpec.Tolerations = k8sTolerations + } + // Get secret mount information for _, secretAsVolume := range kubernetesExecutorConfig.GetSecretAsVolume() { secretVolume := k8score.Volume{ @@ -525,6 +566,63 @@ func extendPodSpecPatch( } } + // Get config map mount information + for _, configMapAsVolume := range kubernetesExecutorConfig.GetConfigMapAsVolume() { + configMapVolume := k8score.Volume{ + Name: configMapAsVolume.GetConfigMapName(), + VolumeSource: k8score.VolumeSource{ + ConfigMap: &k8score.ConfigMapVolumeSource{ + LocalObjectReference: k8score.LocalObjectReference{Name: configMapAsVolume.GetConfigMapName()}}, + }, + } + configMapVolumeMount := k8score.VolumeMount{ + Name: configMapAsVolume.GetConfigMapName(), + MountPath: configMapAsVolume.GetMountPath(), + } + podSpec.Volumes = append(podSpec.Volumes, configMapVolume) + podSpec.Containers[0].VolumeMounts = append(podSpec.Containers[0].VolumeMounts, configMapVolumeMount) + } + + // Get config map env information + for _, configMapAsEnv := range kubernetesExecutorConfig.GetConfigMapAsEnv() { + for _, keyToEnv := range configMapAsEnv.GetKeyToEnv() { + configMapEnvVar := k8score.EnvVar{ + Name: keyToEnv.GetEnvVar(), + ValueFrom: &k8score.EnvVarSource{ + ConfigMapKeyRef: &k8score.ConfigMapKeySelector{ + Key: keyToEnv.GetConfigMapKey(), + }, + }, + } + configMapEnvVar.ValueFrom.ConfigMapKeyRef.LocalObjectReference.Name = configMapAsEnv.GetConfigMapName() + podSpec.Containers[0].Env = append(podSpec.Containers[0].Env, configMapEnvVar) + } + } + + // Get image pull secret information + for _, imagePullSecret := range kubernetesExecutorConfig.GetImagePullSecret() { + podSpec.ImagePullSecrets = append(podSpec.ImagePullSecrets, k8score.LocalObjectReference{Name: imagePullSecret.GetSecretName()}) + } + + // Get Kubernetes FieldPath Env information + for _, fieldPathAsEnv := range kubernetesExecutorConfig.GetFieldPathAsEnv() { + fieldPathEnvVar := k8score.EnvVar{ + Name: fieldPathAsEnv.GetName(), + ValueFrom: &k8score.EnvVarSource{ + FieldRef: &k8score.ObjectFieldSelector{ + FieldPath: fieldPathAsEnv.GetFieldPath(), + }, + }, + } + podSpec.Containers[0].Env = append(podSpec.Containers[0].Env, fieldPathEnvVar) + } + + // Get container timeout information + timeout := kubernetesExecutorConfig.GetActiveDeadlineSeconds() + if timeout > 0 { + podSpec.ActiveDeadlineSeconds = &timeout + } + return nil } diff --git a/backend/src/v2/driver/driver_test.go b/backend/src/v2/driver/driver_test.go index ec8516fb34d..4e5df946380 100644 --- a/backend/src/v2/driver/driver_test.go +++ b/backend/src/v2/driver/driver_test.go @@ -605,3 +605,505 @@ func Test_extendPodSpecPatch_Secret(t *testing.T) { }) } } + +func Test_extendPodSpecPatch_ConfigMap(t *testing.T) { + tests := []struct { + name string + k8sExecCfg *kubernetesplatform.KubernetesExecutorConfig + podSpec *k8score.PodSpec + expected *k8score.PodSpec + }{ + { + "Valid - config map as volume", + &kubernetesplatform.KubernetesExecutorConfig{ + ConfigMapAsVolume: []*kubernetesplatform.ConfigMapAsVolume{ + { + ConfigMapName: "cm1", + MountPath: "/data/path", + }, + }, + }, + &k8score.PodSpec{ + Containers: []k8score.Container{ + { + Name: "main", + }, + }, + }, + &k8score.PodSpec{ + Containers: []k8score.Container{ + { + Name: "main", + VolumeMounts: []k8score.VolumeMount{ + { + Name: "cm1", + MountPath: "/data/path", + }, + }, + }, + }, + Volumes: []k8score.Volume{ + { + Name: "cm1", + VolumeSource: k8score.VolumeSource{ + ConfigMap: &k8score.ConfigMapVolumeSource{ + LocalObjectReference: k8score.LocalObjectReference{Name: "cm1"}}, + }, + }, + }, + }, + }, + { + "Valid - config map not specified", + &kubernetesplatform.KubernetesExecutorConfig{}, + &k8score.PodSpec{ + Containers: []k8score.Container{ + { + Name: "main", + }, + }, + }, + &k8score.PodSpec{ + Containers: []k8score.Container{ + { + Name: "main", + }, + }, + }, + }, + { + "Valid - config map as env", + &kubernetesplatform.KubernetesExecutorConfig{ + ConfigMapAsEnv: []*kubernetesplatform.ConfigMapAsEnv{ + { + ConfigMapName: "my-cm", + KeyToEnv: []*kubernetesplatform.ConfigMapAsEnv_ConfigMapKeyToEnvMap{ + { + ConfigMapKey: "foo", + EnvVar: "CONFIG_MAP_VAR", + }, + }, + }, + }, + }, + &k8score.PodSpec{ + Containers: []k8score.Container{ + { + Name: "main", + }, + }, + }, + &k8score.PodSpec{ + Containers: []k8score.Container{ + { + Name: "main", + Env: []k8score.EnvVar{ + { + Name: "CONFIG_MAP_VAR", + ValueFrom: &k8score.EnvVarSource{ + ConfigMapKeyRef: &k8score.ConfigMapKeySelector{ + k8score.LocalObjectReference{Name: "my-cm"}, + "foo", + nil, + }, + }, + }, + }, + }, + }, + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := extendPodSpecPatch(tt.podSpec, tt.k8sExecCfg, nil, nil) + assert.Nil(t, err) + assert.Equal(t, tt.expected, tt.podSpec) + }) + } +} + +func Test_extendPodSpecPatch_ImagePullSecrets(t *testing.T) { + tests := []struct { + name string + k8sExecCfg *kubernetesplatform.KubernetesExecutorConfig + expected *k8score.PodSpec + }{ + { + "Valid - SecretA and SecretB", + &kubernetesplatform.KubernetesExecutorConfig{ + ImagePullSecret: []*kubernetesplatform.ImagePullSecret{ + {SecretName: "SecretA"}, + {SecretName: "SecretB"}, + }, + }, + &k8score.PodSpec{ + Containers: []k8score.Container{ + { + Name: "main", + }, + }, + ImagePullSecrets: []k8score.LocalObjectReference{ + {Name: "SecretA"}, + {Name: "SecretB"}, + }, + }, + }, + { + "Valid - No ImagePullSecrets", + &kubernetesplatform.KubernetesExecutorConfig{ + ImagePullSecret: []*kubernetesplatform.ImagePullSecret{}, + }, + &k8score.PodSpec{ + Containers: []k8score.Container{ + { + Name: "main", + }, + }, + }, + }, + { + "Valid - empty", + &kubernetesplatform.KubernetesExecutorConfig{}, + &k8score.PodSpec{ + Containers: []k8score.Container{ + { + Name: "main", + }, + }, + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got := &k8score.PodSpec{Containers: []k8score.Container{ + { + Name: "main", + }, + }} + err := extendPodSpecPatch(got, tt.k8sExecCfg, nil, nil) + assert.Nil(t, err) + assert.NotNil(t, got) + assert.Equal(t, tt.expected, got) + }) + } +} + +func Test_extendPodSpecPatch_Tolerations(t *testing.T) { + tests := []struct { + name string + k8sExecCfg *kubernetesplatform.KubernetesExecutorConfig + expected *k8score.PodSpec + }{ + { + "Valid - toleration", + &kubernetesplatform.KubernetesExecutorConfig{ + Tolerations: []*kubernetesplatform.Toleration{ + { + Key: "key1", + Operator: "Equal", + Value: "value1", + Effect: "NoSchedule", + }, + }, + }, + &k8score.PodSpec{ + Containers: []k8score.Container{ + { + Name: "main", + }, + }, + Tolerations: []k8score.Toleration{ + { + Key: "key1", + Operator: "Equal", + Value: "value1", + Effect: "NoSchedule", + TolerationSeconds: nil, + }, + }, + }, + }, + { + "Valid - no tolerations", + &kubernetesplatform.KubernetesExecutorConfig{}, + &k8score.PodSpec{ + Containers: []k8score.Container{ + { + Name: "main", + }, + }, + }, + }, + { + "Valid - only pass operator", + &kubernetesplatform.KubernetesExecutorConfig{ + Tolerations: []*kubernetesplatform.Toleration{ + { + Operator: "Contains", + }, + }, + }, + &k8score.PodSpec{ + Containers: []k8score.Container{ + { + Name: "main", + }, + }, + Tolerations: []k8score.Toleration{ + { + Operator: "Contains", + }, + }, + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got := &k8score.PodSpec{Containers: []k8score.Container{ + { + Name: "main", + }, + }} + err := extendPodSpecPatch(got, tt.k8sExecCfg, nil, nil) + assert.Nil(t, err) + assert.NotNil(t, got) + assert.Equal(t, tt.expected, got) + }) + } +} + +func Test_extendPodSpecPatch_FieldPathAsEnv(t *testing.T) { + tests := []struct { + name string + k8sExecCfg *kubernetesplatform.KubernetesExecutorConfig + expected *k8score.PodSpec + }{ + { + "Valid - FieldPathAsEnv", + &kubernetesplatform.KubernetesExecutorConfig{ + FieldPathAsEnv: []*kubernetesplatform.FieldPathAsEnv{ + {Name: "KFP_RUN_NAME", FieldPath: "metadata.annotations['pipelines.kubeflow.org/run_name']"}, + }, + }, + &k8score.PodSpec{ + Containers: []k8score.Container{ + { + Name: "main", + Env: []k8score.EnvVar{ + { + Name: "KFP_RUN_NAME", + ValueFrom: &k8score.EnvVarSource{ + FieldRef: &k8score.ObjectFieldSelector{ + FieldPath: "metadata.annotations['pipelines.kubeflow.org/run_name']", + }, + }, + }, + }, + }, + }, + }, + }, + { + "Valid - Mix env values", + &kubernetesplatform.KubernetesExecutorConfig{ + SecretAsEnv: []*kubernetesplatform.SecretAsEnv{ + { + SecretName: "my-secret", + KeyToEnv: []*kubernetesplatform.SecretAsEnv_SecretKeyToEnvMap{ + { + SecretKey: "password", + EnvVar: "SECRET_VAR", + }, + }, + }, + }, + FieldPathAsEnv: []*kubernetesplatform.FieldPathAsEnv{ + {Name: "KFP_RUN_NAME", FieldPath: "metadata.annotations['pipelines.kubeflow.org/run_name']"}, + }, + }, + &k8score.PodSpec{ + Containers: []k8score.Container{ + { + Name: "main", + Env: []k8score.EnvVar{ + { + Name: "SECRET_VAR", + ValueFrom: &k8score.EnvVarSource{ + SecretKeyRef: &k8score.SecretKeySelector{ + k8score.LocalObjectReference{Name: "my-secret"}, + "password", + nil, + }, + }, + }, + { + Name: "KFP_RUN_NAME", + ValueFrom: &k8score.EnvVarSource{ + FieldRef: &k8score.ObjectFieldSelector{ + FieldPath: "metadata.annotations['pipelines.kubeflow.org/run_name']", + }, + }, + }, + }, + }, + }, + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got := &k8score.PodSpec{Containers: []k8score.Container{ + { + Name: "main", + }, + }} + err := extendPodSpecPatch(got, tt.k8sExecCfg, nil, nil) + assert.Nil(t, err) + assert.NotNil(t, got) + assert.Equal(t, tt.expected, got) + }) + } +} + +func Test_extendPodSpecPatch_ActiveDeadlineSeconds(t *testing.T) { + var timeoutSeconds int64 = 20 + var NegativeTimeoutSeconds int64 = -20 + tests := []struct { + name string + k8sExecCfg *kubernetesplatform.KubernetesExecutorConfig + expected *k8score.PodSpec + }{ + { + "Valid - With ActiveDeadlineSeconds", + &kubernetesplatform.KubernetesExecutorConfig{ + ActiveDeadlineSeconds: timeoutSeconds, + }, + &k8score.PodSpec{ + Containers: []k8score.Container{ + { + Name: "main", + }, + }, + ActiveDeadlineSeconds: &timeoutSeconds, + }, + }, + { + "Valid - Negative input ignored", + &kubernetesplatform.KubernetesExecutorConfig{ + ActiveDeadlineSeconds: NegativeTimeoutSeconds, + }, + &k8score.PodSpec{ + Containers: []k8score.Container{ + { + Name: "main", + }, + }, + }, + }, + { + "Valid - No ActiveDeadlineSeconds", + &kubernetesplatform.KubernetesExecutorConfig{}, + &k8score.PodSpec{ + Containers: []k8score.Container{ + { + Name: "main", + }, + }, + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got := &k8score.PodSpec{Containers: []k8score.Container{ + { + Name: "main", + }, + }} + err := extendPodSpecPatch(got, tt.k8sExecCfg, nil, nil) + assert.Nil(t, err) + assert.NotNil(t, got) + assert.Equal(t, tt.expected, got) + }) + } +} + +func Test_extendPodSpecPatch_ImagePullPolicy(t *testing.T) { + tests := []struct { + name string + k8sExecCfg *kubernetesplatform.KubernetesExecutorConfig + podSpec *k8score.PodSpec + expected *k8score.PodSpec + }{ + { + "Valid - Always", + &kubernetesplatform.KubernetesExecutorConfig{ + ImagePullPolicy: "Always", + }, + &k8score.PodSpec{ + Containers: []k8score.Container{ + { + Name: "main", + }, + }, + }, + &k8score.PodSpec{ + Containers: []k8score.Container{ + { + Name: "main", + ImagePullPolicy: "Always", + }, + }, + }, + }, + { + "Valid - IfNotPresent", + &kubernetesplatform.KubernetesExecutorConfig{ + ImagePullPolicy: "IfNotPresent", + }, + &k8score.PodSpec{ + Containers: []k8score.Container{ + { + Name: "main", + }, + }, + }, + &k8score.PodSpec{ + Containers: []k8score.Container{ + { + Name: "main", + ImagePullPolicy: "IfNotPresent", + }, + }, + }, + }, + { + "Valid - Never", + &kubernetesplatform.KubernetesExecutorConfig{ + ImagePullPolicy: "Never", + }, + &k8score.PodSpec{ + Containers: []k8score.Container{ + { + Name: "main", + }, + }, + }, + &k8score.PodSpec{ + Containers: []k8score.Container{ + { + Name: "main", + ImagePullPolicy: "Never", + }, + }, + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := extendPodSpecPatch(tt.podSpec, tt.k8sExecCfg, nil, nil) + assert.Nil(t, err) + assert.Equal(t, tt.expected, tt.podSpec) + }) + } +} diff --git a/backend/third_party_licenses/apiserver.csv b/backend/third_party_licenses/apiserver.csv index f07e30106b5..611ffbd7ae5 100644 --- a/backend/third_party_licenses/apiserver.csv +++ b/backend/third_party_licenses/apiserver.csv @@ -62,6 +62,7 @@ github.com/klauspost/cpuid,https://github.com/klauspost/cpuid/blob/v1.3.1/LICENS github.com/klauspost/pgzip,https://github.com/klauspost/pgzip/blob/v1.2.5/LICENSE,MIT github.com/kubeflow/pipelines/api/v2alpha1/go,https://github.com/kubeflow/pipelines/blob/758c91f76784/api/LICENSE,Apache-2.0 github.com/kubeflow/pipelines/backend,https://github.com/kubeflow/pipelines/blob/HEAD/LICENSE,Apache-2.0 +github.com/kubeflow/pipelines/kubernetes_platform/go/kubernetesplatform,https://github.com/kubeflow/pipelines/blob/19a24e3e99db/kubernetes_platform/LICENSE,Apache-2.0 github.com/kubeflow/pipelines/third_party/ml-metadata/go/ml_metadata,https://github.com/kubeflow/pipelines/blob/e1f0c010f800/third_party/ml-metadata/LICENSE,Apache-2.0 github.com/lann/builder,https://github.com/lann/builder/blob/47ae307949d0/LICENSE,MIT github.com/lann/ps,https://github.com/lann/ps/blob/62de8c46ede0/LICENSE,MIT diff --git a/backend/third_party_licenses/driver.csv b/backend/third_party_licenses/driver.csv index 229163d0cc5..003615248f2 100644 --- a/backend/third_party_licenses/driver.csv +++ b/backend/third_party_licenses/driver.csv @@ -32,7 +32,7 @@ github.com/josharian/intern,https://github.com/josharian/intern/blob/v1.0.0/lice github.com/json-iterator/go,https://github.com/json-iterator/go/blob/v1.1.12/LICENSE,MIT github.com/kubeflow/pipelines/api/v2alpha1/go,https://github.com/kubeflow/pipelines/blob/758c91f76784/api/LICENSE,Apache-2.0 github.com/kubeflow/pipelines/backend,https://github.com/kubeflow/pipelines/blob/HEAD/LICENSE,Apache-2.0 -github.com/kubeflow/pipelines/kubernetes_platform/go/kubernetesplatform,https://github.com/kubeflow/pipelines/blob/bd9f74e34de6/kubernetes_platform/LICENSE,Apache-2.0 +github.com/kubeflow/pipelines/kubernetes_platform/go/kubernetesplatform,https://github.com/kubeflow/pipelines/blob/e129b0501379/kubernetes_platform/LICENSE,Apache-2.0 github.com/kubeflow/pipelines/third_party/ml-metadata/go/ml_metadata,https://github.com/kubeflow/pipelines/blob/e1f0c010f800/third_party/ml-metadata/LICENSE,Apache-2.0 github.com/mailru/easyjson,https://github.com/mailru/easyjson/blob/v0.7.7/LICENSE,MIT github.com/modern-go/concurrent,https://github.com/modern-go/concurrent/blob/bacd9c7ef1dd/LICENSE,Apache-2.0 diff --git a/go.mod b/go.mod index 8f0be7e08e5..2122513e846 100644 --- a/go.mod +++ b/go.mod @@ -30,7 +30,7 @@ require ( github.com/jinzhu/inflection v1.0.0 // indirect github.com/jinzhu/now v1.1.4 // indirect github.com/kubeflow/pipelines/api v0.0.0-20230331215358-758c91f76784 - github.com/kubeflow/pipelines/kubernetes_platform v0.0.0-20230404213301-bd9f74e34de6 + github.com/kubeflow/pipelines/kubernetes_platform v0.0.0-20240305195700-19a24e3e99db github.com/kubeflow/pipelines/third_party/ml-metadata v0.0.0-20230810215105-e1f0c010f800 github.com/lestrrat-go/strftime v1.0.4 github.com/mattn/go-sqlite3 v1.14.18 diff --git a/go.sum b/go.sum index bbf4bd5014c..e028fdc2543 100644 --- a/go.sum +++ b/go.sum @@ -1526,8 +1526,8 @@ github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/ktrysmt/go-bitbucket v0.9.32/go.mod h1:FWxy2UK7GlK5b0NSJGc5hPqnssVlkNnsChvyuOf/Xno= github.com/kubeflow/pipelines/api v0.0.0-20230331215358-758c91f76784 h1:ZVCoqnKnC2vctD7AqAHbWf05qw15VO5XSxCqkjObwtw= github.com/kubeflow/pipelines/api v0.0.0-20230331215358-758c91f76784/go.mod h1:T7TOQB36gGe97yUdfVAnYK5uuT0+uQbLNHDUHxYkmE4= -github.com/kubeflow/pipelines/kubernetes_platform v0.0.0-20230404213301-bd9f74e34de6 h1:ApWW5ZH45ruvQCmkp7RewHlPKGwqBNSSRxEHGJFiAOA= -github.com/kubeflow/pipelines/kubernetes_platform v0.0.0-20230404213301-bd9f74e34de6/go.mod h1:CJkKr356RlpZP/gQRuHf3Myrn1qJtoUVe4EMCmtwarg= +github.com/kubeflow/pipelines/kubernetes_platform v0.0.0-20240305195700-19a24e3e99db h1:fnuYUNy9r96oujmJaBOICcom1SUZl9CVONa8pKZAA2Q= +github.com/kubeflow/pipelines/kubernetes_platform v0.0.0-20240305195700-19a24e3e99db/go.mod h1:CJkKr356RlpZP/gQRuHf3Myrn1qJtoUVe4EMCmtwarg= github.com/kubeflow/pipelines/third_party/ml-metadata v0.0.0-20230810215105-e1f0c010f800 h1:YAW+X9xCW8Yq5tQaBBQaLTNU9CJj8Nr7lx1+k66ZHJ0= github.com/kubeflow/pipelines/third_party/ml-metadata v0.0.0-20230810215105-e1f0c010f800/go.mod h1:chIDffBaVQ/asNl1pTTdbAymYcuBKf8BR3YtSP+3FEU= github.com/labstack/echo v3.2.1+incompatible/go.mod h1:0INS7j/VjnFxD4E2wkz67b8cVwCLbBmJyDaka6Cmk1s= diff --git a/kubernetes_platform/go/kubernetesplatform/kubernetes_executor_config.pb.go b/kubernetes_platform/go/kubernetesplatform/kubernetes_executor_config.pb.go index bff68860500..a349891a8da 100644 --- a/kubernetes_platform/go/kubernetesplatform/kubernetes_executor_config.pb.go +++ b/kubernetes_platform/go/kubernetesplatform/kubernetes_executor_config.pb.go @@ -40,10 +40,19 @@ type KubernetesExecutorConfig struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - SecretAsVolume []*SecretAsVolume `protobuf:"bytes,1,rep,name=secret_as_volume,json=secretAsVolume,proto3" json:"secret_as_volume,omitempty"` - SecretAsEnv []*SecretAsEnv `protobuf:"bytes,2,rep,name=secret_as_env,json=secretAsEnv,proto3" json:"secret_as_env,omitempty"` - PvcMount []*PvcMount `protobuf:"bytes,3,rep,name=pvc_mount,json=pvcMount,proto3" json:"pvc_mount,omitempty"` - NodeSelector *NodeSelector `protobuf:"bytes,4,opt,name=node_selector,json=nodeSelector,proto3" json:"node_selector,omitempty"` + SecretAsVolume []*SecretAsVolume `protobuf:"bytes,1,rep,name=secret_as_volume,json=secretAsVolume,proto3" json:"secret_as_volume,omitempty"` + SecretAsEnv []*SecretAsEnv `protobuf:"bytes,2,rep,name=secret_as_env,json=secretAsEnv,proto3" json:"secret_as_env,omitempty"` + PvcMount []*PvcMount `protobuf:"bytes,3,rep,name=pvc_mount,json=pvcMount,proto3" json:"pvc_mount,omitempty"` + NodeSelector *NodeSelector `protobuf:"bytes,4,opt,name=node_selector,json=nodeSelector,proto3" json:"node_selector,omitempty"` + PodMetadata *PodMetadata `protobuf:"bytes,5,opt,name=pod_metadata,json=podMetadata,proto3" json:"pod_metadata,omitempty"` + ImagePullSecret []*ImagePullSecret `protobuf:"bytes,6,rep,name=image_pull_secret,json=imagePullSecret,proto3" json:"image_pull_secret,omitempty"` + // One of Always, Never, IfNotPresent. + ImagePullPolicy string `protobuf:"bytes,7,opt,name=image_pull_policy,json=imagePullPolicy,proto3" json:"image_pull_policy,omitempty"` + ConfigMapAsVolume []*ConfigMapAsVolume `protobuf:"bytes,8,rep,name=config_map_as_volume,json=configMapAsVolume,proto3" json:"config_map_as_volume,omitempty"` + ConfigMapAsEnv []*ConfigMapAsEnv `protobuf:"bytes,9,rep,name=config_map_as_env,json=configMapAsEnv,proto3" json:"config_map_as_env,omitempty"` + ActiveDeadlineSeconds int64 `protobuf:"varint,10,opt,name=active_deadline_seconds,json=activeDeadlineSeconds,proto3" json:"active_deadline_seconds,omitempty"` + FieldPathAsEnv []*FieldPathAsEnv `protobuf:"bytes,11,rep,name=field_path_as_env,json=fieldPathAsEnv,proto3" json:"field_path_as_env,omitempty"` + Tolerations []*Toleration `protobuf:"bytes,12,rep,name=tolerations,proto3" json:"tolerations,omitempty"` } func (x *KubernetesExecutorConfig) Reset() { @@ -106,6 +115,62 @@ func (x *KubernetesExecutorConfig) GetNodeSelector() *NodeSelector { return nil } +func (x *KubernetesExecutorConfig) GetPodMetadata() *PodMetadata { + if x != nil { + return x.PodMetadata + } + return nil +} + +func (x *KubernetesExecutorConfig) GetImagePullSecret() []*ImagePullSecret { + if x != nil { + return x.ImagePullSecret + } + return nil +} + +func (x *KubernetesExecutorConfig) GetImagePullPolicy() string { + if x != nil { + return x.ImagePullPolicy + } + return "" +} + +func (x *KubernetesExecutorConfig) GetConfigMapAsVolume() []*ConfigMapAsVolume { + if x != nil { + return x.ConfigMapAsVolume + } + return nil +} + +func (x *KubernetesExecutorConfig) GetConfigMapAsEnv() []*ConfigMapAsEnv { + if x != nil { + return x.ConfigMapAsEnv + } + return nil +} + +func (x *KubernetesExecutorConfig) GetActiveDeadlineSeconds() int64 { + if x != nil { + return x.ActiveDeadlineSeconds + } + return 0 +} + +func (x *KubernetesExecutorConfig) GetFieldPathAsEnv() []*FieldPathAsEnv { + if x != nil { + return x.FieldPathAsEnv + } + return nil +} + +func (x *KubernetesExecutorConfig) GetTolerations() []*Toleration { + if x != nil { + return x.Tolerations + } + return nil +} + type SecretAsVolume struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -115,6 +180,8 @@ type SecretAsVolume struct { SecretName string `protobuf:"bytes,1,opt,name=secret_name,json=secretName,proto3" json:"secret_name,omitempty"` // Container path to mount the Secret data. MountPath string `protobuf:"bytes,2,opt,name=mount_path,json=mountPath,proto3" json:"mount_path,omitempty"` + // An optional boolean value indicating whether the Secret must be defined. + Optional *bool `protobuf:"varint,3,opt,name=optional,proto3,oneof" json:"optional,omitempty"` } func (x *SecretAsVolume) Reset() { @@ -163,6 +230,13 @@ func (x *SecretAsVolume) GetMountPath() string { return "" } +func (x *SecretAsVolume) GetOptional() bool { + if x != nil && x.Optional != nil { + return *x.Optional + } + return false +} + type SecretAsEnv struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -674,6 +748,369 @@ func (x *NodeSelector) GetLabels() map[string]string { return nil } +type PodMetadata struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // values of metadata spec such as labels and annotations for the pod object + // corresponds to Pod.metadata field https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#Pod + Labels map[string]string `protobuf:"bytes,1,rep,name=labels,proto3" json:"labels,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Annotations map[string]string `protobuf:"bytes,2,rep,name=annotations,proto3" json:"annotations,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (x *PodMetadata) Reset() { + *x = PodMetadata{} + if protoimpl.UnsafeEnabled { + mi := &file_kubernetes_executor_config_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PodMetadata) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PodMetadata) ProtoMessage() {} + +func (x *PodMetadata) ProtoReflect() protoreflect.Message { + mi := &file_kubernetes_executor_config_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PodMetadata.ProtoReflect.Descriptor instead. +func (*PodMetadata) Descriptor() ([]byte, []int) { + return file_kubernetes_executor_config_proto_rawDescGZIP(), []int{8} +} + +func (x *PodMetadata) GetLabels() map[string]string { + if x != nil { + return x.Labels + } + return nil +} + +func (x *PodMetadata) GetAnnotations() map[string]string { + if x != nil { + return x.Annotations + } + return nil +} + +type ConfigMapAsVolume struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Name of the ConfigMap. + ConfigMapName string `protobuf:"bytes,1,opt,name=config_map_name,json=configMapName,proto3" json:"config_map_name,omitempty"` + // Container path to mount the ConfigMap data. + MountPath string `protobuf:"bytes,2,opt,name=mount_path,json=mountPath,proto3" json:"mount_path,omitempty"` + // An optional boolean value indicating whether the ConfigMap must be defined. + Optional *bool `protobuf:"varint,3,opt,name=optional,proto3,oneof" json:"optional,omitempty"` +} + +func (x *ConfigMapAsVolume) Reset() { + *x = ConfigMapAsVolume{} + if protoimpl.UnsafeEnabled { + mi := &file_kubernetes_executor_config_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ConfigMapAsVolume) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConfigMapAsVolume) ProtoMessage() {} + +func (x *ConfigMapAsVolume) ProtoReflect() protoreflect.Message { + mi := &file_kubernetes_executor_config_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ConfigMapAsVolume.ProtoReflect.Descriptor instead. +func (*ConfigMapAsVolume) Descriptor() ([]byte, []int) { + return file_kubernetes_executor_config_proto_rawDescGZIP(), []int{9} +} + +func (x *ConfigMapAsVolume) GetConfigMapName() string { + if x != nil { + return x.ConfigMapName + } + return "" +} + +func (x *ConfigMapAsVolume) GetMountPath() string { + if x != nil { + return x.MountPath + } + return "" +} + +func (x *ConfigMapAsVolume) GetOptional() bool { + if x != nil && x.Optional != nil { + return *x.Optional + } + return false +} + +type ConfigMapAsEnv struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Name of the ConfigMap. + ConfigMapName string `protobuf:"bytes,1,opt,name=config_map_name,json=configMapName,proto3" json:"config_map_name,omitempty"` + KeyToEnv []*ConfigMapAsEnv_ConfigMapKeyToEnvMap `protobuf:"bytes,2,rep,name=key_to_env,json=keyToEnv,proto3" json:"key_to_env,omitempty"` +} + +func (x *ConfigMapAsEnv) Reset() { + *x = ConfigMapAsEnv{} + if protoimpl.UnsafeEnabled { + mi := &file_kubernetes_executor_config_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ConfigMapAsEnv) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConfigMapAsEnv) ProtoMessage() {} + +func (x *ConfigMapAsEnv) ProtoReflect() protoreflect.Message { + mi := &file_kubernetes_executor_config_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ConfigMapAsEnv.ProtoReflect.Descriptor instead. +func (*ConfigMapAsEnv) Descriptor() ([]byte, []int) { + return file_kubernetes_executor_config_proto_rawDescGZIP(), []int{10} +} + +func (x *ConfigMapAsEnv) GetConfigMapName() string { + if x != nil { + return x.ConfigMapName + } + return "" +} + +func (x *ConfigMapAsEnv) GetKeyToEnv() []*ConfigMapAsEnv_ConfigMapKeyToEnvMap { + if x != nil { + return x.KeyToEnv + } + return nil +} + +type ImagePullSecret struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Name of the image pull secret. + SecretName string `protobuf:"bytes,1,opt,name=secret_name,json=secretName,proto3" json:"secret_name,omitempty"` +} + +func (x *ImagePullSecret) Reset() { + *x = ImagePullSecret{} + if protoimpl.UnsafeEnabled { + mi := &file_kubernetes_executor_config_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ImagePullSecret) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ImagePullSecret) ProtoMessage() {} + +func (x *ImagePullSecret) ProtoReflect() protoreflect.Message { + mi := &file_kubernetes_executor_config_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ImagePullSecret.ProtoReflect.Descriptor instead. +func (*ImagePullSecret) Descriptor() ([]byte, []int) { + return file_kubernetes_executor_config_proto_rawDescGZIP(), []int{11} +} + +func (x *ImagePullSecret) GetSecretName() string { + if x != nil { + return x.SecretName + } + return "" +} + +type FieldPathAsEnv struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Name of the environment variable + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Value of the field path string + FieldPath string `protobuf:"bytes,2,opt,name=field_path,json=fieldPath,proto3" json:"field_path,omitempty"` +} + +func (x *FieldPathAsEnv) Reset() { + *x = FieldPathAsEnv{} + if protoimpl.UnsafeEnabled { + mi := &file_kubernetes_executor_config_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FieldPathAsEnv) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FieldPathAsEnv) ProtoMessage() {} + +func (x *FieldPathAsEnv) ProtoReflect() protoreflect.Message { + mi := &file_kubernetes_executor_config_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FieldPathAsEnv.ProtoReflect.Descriptor instead. +func (*FieldPathAsEnv) Descriptor() ([]byte, []int) { + return file_kubernetes_executor_config_proto_rawDescGZIP(), []int{12} +} + +func (x *FieldPathAsEnv) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *FieldPathAsEnv) GetFieldPath() string { + if x != nil { + return x.FieldPath + } + return "" +} + +type Toleration struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Operator string `protobuf:"bytes,2,opt,name=operator,proto3" json:"operator,omitempty"` + Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` + Effect string `protobuf:"bytes,4,opt,name=effect,proto3" json:"effect,omitempty"` + TolerationSeconds *int64 `protobuf:"varint,5,opt,name=toleration_seconds,json=tolerationSeconds,proto3,oneof" json:"toleration_seconds,omitempty"` +} + +func (x *Toleration) Reset() { + *x = Toleration{} + if protoimpl.UnsafeEnabled { + mi := &file_kubernetes_executor_config_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Toleration) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Toleration) ProtoMessage() {} + +func (x *Toleration) ProtoReflect() protoreflect.Message { + mi := &file_kubernetes_executor_config_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Toleration.ProtoReflect.Descriptor instead. +func (*Toleration) Descriptor() ([]byte, []int) { + return file_kubernetes_executor_config_proto_rawDescGZIP(), []int{13} +} + +func (x *Toleration) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *Toleration) GetOperator() string { + if x != nil { + return x.Operator + } + return "" +} + +func (x *Toleration) GetValue() string { + if x != nil { + return x.Value + } + return "" +} + +func (x *Toleration) GetEffect() string { + if x != nil { + return x.Effect + } + return "" +} + +func (x *Toleration) GetTolerationSeconds() int64 { + if x != nil && x.TolerationSeconds != nil { + return *x.TolerationSeconds + } + return 0 +} + type SecretAsEnv_SecretKeyToEnvMap struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -688,7 +1125,7 @@ type SecretAsEnv_SecretKeyToEnvMap struct { func (x *SecretAsEnv_SecretKeyToEnvMap) Reset() { *x = SecretAsEnv_SecretKeyToEnvMap{} if protoimpl.UnsafeEnabled { - mi := &file_kubernetes_executor_config_proto_msgTypes[8] + mi := &file_kubernetes_executor_config_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -701,7 +1138,7 @@ func (x *SecretAsEnv_SecretKeyToEnvMap) String() string { func (*SecretAsEnv_SecretKeyToEnvMap) ProtoMessage() {} func (x *SecretAsEnv_SecretKeyToEnvMap) ProtoReflect() protoreflect.Message { - mi := &file_kubernetes_executor_config_proto_msgTypes[8] + mi := &file_kubernetes_executor_config_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -731,6 +1168,63 @@ func (x *SecretAsEnv_SecretKeyToEnvMap) GetEnvVar() string { return "" } +type ConfigMapAsEnv_ConfigMapKeyToEnvMap struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Corresponds to a key of the ConfigMap. + ConfigMapKey string `protobuf:"bytes,1,opt,name=config_map_key,json=configMapKey,proto3" json:"config_map_key,omitempty"` + // Env var to which configmap_key's data should be set. + EnvVar string `protobuf:"bytes,2,opt,name=env_var,json=envVar,proto3" json:"env_var,omitempty"` +} + +func (x *ConfigMapAsEnv_ConfigMapKeyToEnvMap) Reset() { + *x = ConfigMapAsEnv_ConfigMapKeyToEnvMap{} + if protoimpl.UnsafeEnabled { + mi := &file_kubernetes_executor_config_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ConfigMapAsEnv_ConfigMapKeyToEnvMap) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConfigMapAsEnv_ConfigMapKeyToEnvMap) ProtoMessage() {} + +func (x *ConfigMapAsEnv_ConfigMapKeyToEnvMap) ProtoReflect() protoreflect.Message { + mi := &file_kubernetes_executor_config_proto_msgTypes[18] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ConfigMapAsEnv_ConfigMapKeyToEnvMap.ProtoReflect.Descriptor instead. +func (*ConfigMapAsEnv_ConfigMapKeyToEnvMap) Descriptor() ([]byte, []int) { + return file_kubernetes_executor_config_proto_rawDescGZIP(), []int{10, 0} +} + +func (x *ConfigMapAsEnv_ConfigMapKeyToEnvMap) GetConfigMapKey() string { + if x != nil { + return x.ConfigMapKey + } + return "" +} + +func (x *ConfigMapAsEnv_ConfigMapKeyToEnvMap) GetEnvVar() string { + if x != nil { + return x.EnvVar + } + return "" +} + var File_kubernetes_executor_config_proto protoreflect.FileDescriptor var file_kubernetes_executor_config_proto_rawDesc = []byte{ @@ -739,7 +1233,7 @@ var file_kubernetes_executor_config_proto_rawDesc = []byte{ 0x74, 0x6f, 0x12, 0x0e, 0x6b, 0x66, 0x70, 0x5f, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x22, 0x9f, 0x02, 0x0a, 0x18, 0x4b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x45, + 0x22, 0xb8, 0x06, 0x0a, 0x18, 0x4b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x6f, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x48, 0x0a, 0x10, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x5f, 0x61, 0x73, 0x5f, 0x76, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6b, 0x66, 0x70, 0x5f, 0x6b, 0x75, @@ -757,96 +1251,186 @@ var file_kubernetes_executor_config_proto_rawDesc = []byte{ 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6b, 0x66, 0x70, 0x5f, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x52, 0x0c, 0x6e, 0x6f, 0x64, 0x65, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, - 0x6f, 0x72, 0x22, 0x50, 0x0a, 0x0e, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x41, 0x73, 0x56, 0x6f, - 0x6c, 0x75, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x5f, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x65, 0x63, 0x72, 0x65, - 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x70, + 0x6f, 0x72, 0x12, 0x3e, 0x0a, 0x0c, 0x70, 0x6f, 0x64, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6b, 0x66, 0x70, 0x5f, 0x6b, + 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x2e, 0x50, 0x6f, 0x64, 0x4d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x0b, 0x70, 0x6f, 0x64, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0x12, 0x4b, 0x0a, 0x11, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x5f, 0x70, 0x75, 0x6c, 0x6c, + 0x5f, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, + 0x6b, 0x66, 0x70, 0x5f, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x2e, 0x49, + 0x6d, 0x61, 0x67, 0x65, 0x50, 0x75, 0x6c, 0x6c, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x52, 0x0f, + 0x69, 0x6d, 0x61, 0x67, 0x65, 0x50, 0x75, 0x6c, 0x6c, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, + 0x2a, 0x0a, 0x11, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x5f, 0x70, 0x75, 0x6c, 0x6c, 0x5f, 0x70, 0x6f, + 0x6c, 0x69, 0x63, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x69, 0x6d, 0x61, 0x67, + 0x65, 0x50, 0x75, 0x6c, 0x6c, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x52, 0x0a, 0x14, 0x63, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x6d, 0x61, 0x70, 0x5f, 0x61, 0x73, 0x5f, 0x76, 0x6f, 0x6c, + 0x75, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6b, 0x66, 0x70, 0x5f, + 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x4d, 0x61, 0x70, 0x41, 0x73, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x52, 0x11, 0x63, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x4d, 0x61, 0x70, 0x41, 0x73, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x12, + 0x49, 0x0a, 0x11, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x6d, 0x61, 0x70, 0x5f, 0x61, 0x73, + 0x5f, 0x65, 0x6e, 0x76, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6b, 0x66, 0x70, + 0x5f, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x4d, 0x61, 0x70, 0x41, 0x73, 0x45, 0x6e, 0x76, 0x52, 0x0e, 0x63, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x4d, 0x61, 0x70, 0x41, 0x73, 0x45, 0x6e, 0x76, 0x12, 0x36, 0x0a, 0x17, 0x61, 0x63, + 0x74, 0x69, 0x76, 0x65, 0x5f, 0x64, 0x65, 0x61, 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x73, 0x65, + 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x15, 0x61, 0x63, 0x74, + 0x69, 0x76, 0x65, 0x44, 0x65, 0x61, 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x53, 0x65, 0x63, 0x6f, 0x6e, + 0x64, 0x73, 0x12, 0x49, 0x0a, 0x11, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x70, 0x61, 0x74, 0x68, + 0x5f, 0x61, 0x73, 0x5f, 0x65, 0x6e, 0x76, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, + 0x6b, 0x66, 0x70, 0x5f, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x2e, 0x46, + 0x69, 0x65, 0x6c, 0x64, 0x50, 0x61, 0x74, 0x68, 0x41, 0x73, 0x45, 0x6e, 0x76, 0x52, 0x0e, 0x66, + 0x69, 0x65, 0x6c, 0x64, 0x50, 0x61, 0x74, 0x68, 0x41, 0x73, 0x45, 0x6e, 0x76, 0x12, 0x3c, 0x0a, + 0x0b, 0x74, 0x6f, 0x6c, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x0c, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6b, 0x66, 0x70, 0x5f, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, + 0x74, 0x65, 0x73, 0x2e, 0x54, 0x6f, 0x6c, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0b, + 0x74, 0x6f, 0x6c, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x50, 0x0a, 0x0e, 0x53, + 0x65, 0x63, 0x72, 0x65, 0x74, 0x41, 0x73, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x12, 0x1f, 0x0a, + 0x0b, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0a, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1d, + 0x0a, 0x0a, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x09, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x50, 0x61, 0x74, 0x68, 0x22, 0xc8, 0x01, + 0x0a, 0x0b, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x41, 0x73, 0x45, 0x6e, 0x76, 0x12, 0x1f, 0x0a, + 0x0b, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0a, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x4b, + 0x0a, 0x0a, 0x6b, 0x65, 0x79, 0x5f, 0x74, 0x6f, 0x5f, 0x65, 0x6e, 0x76, 0x18, 0x02, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6b, 0x66, 0x70, 0x5f, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, + 0x74, 0x65, 0x73, 0x2e, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x41, 0x73, 0x45, 0x6e, 0x76, 0x2e, + 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x54, 0x6f, 0x45, 0x6e, 0x76, 0x4d, 0x61, + 0x70, 0x52, 0x08, 0x6b, 0x65, 0x79, 0x54, 0x6f, 0x45, 0x6e, 0x76, 0x1a, 0x4b, 0x0a, 0x11, 0x53, + 0x65, 0x63, 0x72, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x54, 0x6f, 0x45, 0x6e, 0x76, 0x4d, 0x61, 0x70, + 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x12, + 0x17, 0x0a, 0x07, 0x65, 0x6e, 0x76, 0x5f, 0x76, 0x61, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x06, 0x65, 0x6e, 0x76, 0x56, 0x61, 0x72, 0x22, 0x70, 0x0a, 0x17, 0x54, 0x61, 0x73, 0x6b, + 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, + 0x70, 0x65, 0x63, 0x12, 0x23, 0x0a, 0x0d, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x72, 0x5f, + 0x74, 0x61, 0x73, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x70, 0x72, 0x6f, 0x64, + 0x75, 0x63, 0x65, 0x72, 0x54, 0x61, 0x73, 0x6b, 0x12, 0x30, 0x0a, 0x14, 0x6f, 0x75, 0x74, 0x70, + 0x75, 0x74, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x5f, 0x6b, 0x65, 0x79, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x22, 0xf5, 0x01, 0x0a, 0x08, 0x50, + 0x76, 0x63, 0x4d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x5d, 0x0a, 0x15, 0x74, 0x61, 0x73, 0x6b, 0x5f, + 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6b, 0x66, 0x70, 0x5f, 0x6b, 0x75, 0x62, + 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x4f, 0x75, 0x74, 0x70, + 0x75, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, 0x70, 0x65, 0x63, 0x48, + 0x00, 0x52, 0x13, 0x74, 0x61, 0x73, 0x6b, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, + 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x73, + 0x74, 0x61, 0x6e, 0x74, 0x12, 0x3c, 0x0a, 0x19, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, + 0x74, 0x5f, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, + 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x17, 0x63, 0x6f, 0x6d, 0x70, 0x6f, + 0x6e, 0x65, 0x6e, 0x74, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, + 0x65, 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x70, 0x61, 0x74, 0x68, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x50, 0x61, 0x74, + 0x68, 0x42, 0x0f, 0x0a, 0x0d, 0x70, 0x76, 0x63, 0x5f, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, + 0x63, 0x65, 0x22, 0xcf, 0x02, 0x0a, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x76, 0x63, + 0x12, 0x1b, 0x0a, 0x08, 0x70, 0x76, 0x63, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x48, 0x00, 0x52, 0x07, 0x70, 0x76, 0x63, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x28, 0x0a, + 0x0f, 0x70, 0x76, 0x63, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x5f, 0x73, 0x75, 0x66, 0x66, 0x69, 0x78, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0d, 0x70, 0x76, 0x63, 0x4e, 0x61, 0x6d, + 0x65, 0x53, 0x75, 0x66, 0x66, 0x69, 0x78, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, + 0x73, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x61, + 0x63, 0x63, 0x65, 0x73, 0x73, 0x4d, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, + 0x7a, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x12, 0x32, + 0x0a, 0x15, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, + 0x65, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x13, 0x64, + 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x43, 0x6c, 0x61, + 0x73, 0x73, 0x12, 0x2c, 0x0a, 0x12, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6c, + 0x61, 0x73, 0x73, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, + 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x4e, 0x61, 0x6d, 0x65, + 0x12, 0x1f, 0x0a, 0x0b, 0x76, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x76, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x4e, 0x61, 0x6d, + 0x65, 0x12, 0x39, 0x0a, 0x0b, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, + 0x0b, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x06, 0x0a, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x22, 0xd7, 0x01, 0x0a, 0x09, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, + 0x76, 0x63, 0x12, 0x5d, 0x0a, 0x15, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x6f, 0x75, 0x74, 0x70, 0x75, + 0x74, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x27, 0x2e, 0x6b, 0x66, 0x70, 0x5f, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, + 0x65, 0x73, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, 0x70, 0x65, 0x63, 0x48, 0x00, 0x52, 0x13, 0x74, 0x61, + 0x73, 0x6b, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, + 0x72, 0x12, 0x1c, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x12, + 0x3c, 0x0a, 0x19, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x6e, 0x70, + 0x75, 0x74, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x48, 0x00, 0x52, 0x17, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x49, + 0x6e, 0x70, 0x75, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x42, 0x0f, 0x0a, + 0x0d, 0x70, 0x76, 0x63, 0x5f, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x22, 0x8b, + 0x01, 0x0a, 0x0c, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x12, + 0x40, 0x0a, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x28, 0x2e, 0x6b, 0x66, 0x70, 0x5f, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, + 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x2e, 0x4c, 0x61, + 0x62, 0x65, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, + 0x73, 0x1a, 0x39, 0x0a, 0x0b, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, + 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x99, 0x02, 0x0a, + 0x0b, 0x50, 0x6f, 0x64, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x3f, 0x0a, 0x06, + 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6b, + 0x66, 0x70, 0x5f, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x2e, 0x50, 0x6f, + 0x64, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, + 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x12, 0x4e, 0x0a, + 0x0b, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6b, 0x66, 0x70, 0x5f, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, + 0x74, 0x65, 0x73, 0x2e, 0x50, 0x6f, 0x64, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, + 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x52, 0x0b, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x39, 0x0a, + 0x0b, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, + 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3e, 0x0a, 0x10, 0x41, 0x6e, 0x6e, 0x6f, + 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, + 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x5a, 0x0a, 0x11, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x4d, 0x61, 0x70, 0x41, 0x73, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x12, 0x26, 0x0a, + 0x0f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x6d, 0x61, 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x4d, 0x61, + 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6d, 0x6f, 0x75, 0x6e, 0x74, - 0x50, 0x61, 0x74, 0x68, 0x22, 0xc8, 0x01, 0x0a, 0x0b, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x41, - 0x73, 0x45, 0x6e, 0x76, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x5f, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x65, 0x63, 0x72, 0x65, - 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x4b, 0x0a, 0x0a, 0x6b, 0x65, 0x79, 0x5f, 0x74, 0x6f, 0x5f, - 0x65, 0x6e, 0x76, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6b, 0x66, 0x70, 0x5f, - 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x2e, 0x53, 0x65, 0x63, 0x72, 0x65, - 0x74, 0x41, 0x73, 0x45, 0x6e, 0x76, 0x2e, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x4b, 0x65, 0x79, + 0x50, 0x61, 0x74, 0x68, 0x22, 0xe2, 0x01, 0x0a, 0x0e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x4d, + 0x61, 0x70, 0x41, 0x73, 0x45, 0x6e, 0x76, 0x12, 0x26, 0x0a, 0x0f, 0x63, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x5f, 0x6d, 0x61, 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x4d, 0x61, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x12, + 0x51, 0x0a, 0x0a, 0x6b, 0x65, 0x79, 0x5f, 0x74, 0x6f, 0x5f, 0x65, 0x6e, 0x76, 0x18, 0x02, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x6b, 0x66, 0x70, 0x5f, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, + 0x65, 0x74, 0x65, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x4d, 0x61, 0x70, 0x41, 0x73, + 0x45, 0x6e, 0x76, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x4d, 0x61, 0x70, 0x4b, 0x65, 0x79, 0x54, 0x6f, 0x45, 0x6e, 0x76, 0x4d, 0x61, 0x70, 0x52, 0x08, 0x6b, 0x65, 0x79, 0x54, 0x6f, 0x45, - 0x6e, 0x76, 0x1a, 0x4b, 0x0a, 0x11, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x54, - 0x6f, 0x45, 0x6e, 0x76, 0x4d, 0x61, 0x70, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x63, 0x72, 0x65, - 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x63, - 0x72, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x12, 0x17, 0x0a, 0x07, 0x65, 0x6e, 0x76, 0x5f, 0x76, 0x61, - 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x65, 0x6e, 0x76, 0x56, 0x61, 0x72, 0x22, - 0x70, 0x0a, 0x17, 0x54, 0x61, 0x73, 0x6b, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x50, 0x61, 0x72, - 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, 0x70, 0x65, 0x63, 0x12, 0x23, 0x0a, 0x0d, 0x70, 0x72, - 0x6f, 0x64, 0x75, 0x63, 0x65, 0x72, 0x5f, 0x74, 0x61, 0x73, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0c, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x72, 0x54, 0x61, 0x73, 0x6b, 0x12, - 0x30, 0x0a, 0x14, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, - 0x74, 0x65, 0x72, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x6f, - 0x75, 0x74, 0x70, 0x75, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x4b, 0x65, - 0x79, 0x22, 0xf5, 0x01, 0x0a, 0x08, 0x50, 0x76, 0x63, 0x4d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x5d, - 0x0a, 0x15, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x70, 0x61, - 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, - 0x6b, 0x66, 0x70, 0x5f, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x2e, 0x54, - 0x61, 0x73, 0x6b, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, - 0x65, 0x72, 0x53, 0x70, 0x65, 0x63, 0x48, 0x00, 0x52, 0x13, 0x74, 0x61, 0x73, 0x6b, 0x4f, 0x75, - 0x74, 0x70, 0x75, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x1c, 0x0a, - 0x08, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, - 0x00, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x12, 0x3c, 0x0a, 0x19, 0x63, - 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x5f, 0x70, - 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, - 0x52, 0x17, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x49, 0x6e, 0x70, 0x75, 0x74, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x6f, 0x75, - 0x6e, 0x74, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6d, - 0x6f, 0x75, 0x6e, 0x74, 0x50, 0x61, 0x74, 0x68, 0x42, 0x0f, 0x0a, 0x0d, 0x70, 0x76, 0x63, 0x5f, - 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x22, 0xcf, 0x02, 0x0a, 0x09, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x65, 0x50, 0x76, 0x63, 0x12, 0x1b, 0x0a, 0x08, 0x70, 0x76, 0x63, 0x5f, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x07, 0x70, 0x76, 0x63, - 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x28, 0x0a, 0x0f, 0x70, 0x76, 0x63, 0x5f, 0x6e, 0x61, 0x6d, 0x65, - 0x5f, 0x73, 0x75, 0x66, 0x66, 0x69, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, - 0x0d, 0x70, 0x76, 0x63, 0x4e, 0x61, 0x6d, 0x65, 0x53, 0x75, 0x66, 0x66, 0x69, 0x78, 0x12, 0x21, - 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x03, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4d, 0x6f, 0x64, 0x65, - 0x73, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x73, 0x69, 0x7a, 0x65, 0x12, 0x32, 0x0a, 0x15, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, - 0x5f, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x13, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x53, 0x74, 0x6f, - 0x72, 0x61, 0x67, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x12, 0x2c, 0x0a, 0x12, 0x73, 0x74, 0x6f, - 0x72, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x43, 0x6c, - 0x61, 0x73, 0x73, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x76, 0x6f, 0x6c, 0x75, 0x6d, - 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x76, 0x6f, - 0x6c, 0x75, 0x6d, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x39, 0x0a, 0x0b, 0x61, 0x6e, 0x6e, 0x6f, - 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x0b, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x42, 0x06, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0xd7, 0x01, 0x0a, 0x09, - 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x76, 0x63, 0x12, 0x5d, 0x0a, 0x15, 0x74, 0x61, 0x73, - 0x6b, 0x5f, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, - 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6b, 0x66, 0x70, 0x5f, 0x6b, - 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x4f, 0x75, - 0x74, 0x70, 0x75, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, 0x70, 0x65, - 0x63, 0x48, 0x00, 0x52, 0x13, 0x74, 0x61, 0x73, 0x6b, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x73, - 0x74, 0x61, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x08, 0x63, 0x6f, - 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x12, 0x3c, 0x0a, 0x19, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, - 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, - 0x74, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x17, 0x63, 0x6f, 0x6d, - 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x65, 0x74, 0x65, 0x72, 0x42, 0x0f, 0x0a, 0x0d, 0x70, 0x76, 0x63, 0x5f, 0x72, 0x65, 0x66, 0x65, - 0x72, 0x65, 0x6e, 0x63, 0x65, 0x22, 0x8b, 0x01, 0x0a, 0x0c, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x65, - 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x12, 0x40, 0x0a, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6b, 0x66, 0x70, 0x5f, 0x6b, 0x75, 0x62, - 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x65, 0x6c, 0x65, - 0x63, 0x74, 0x6f, 0x72, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, - 0x52, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x1a, 0x39, 0x0a, 0x0b, 0x4c, 0x61, 0x62, 0x65, - 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, - 0x02, 0x38, 0x01, 0x42, 0x49, 0x5a, 0x47, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x6b, 0x75, 0x62, 0x65, 0x66, 0x6c, 0x6f, 0x77, 0x2f, 0x70, 0x69, 0x70, 0x65, 0x6c, - 0x69, 0x6e, 0x65, 0x73, 0x2f, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x5f, - 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x2f, 0x67, 0x6f, 0x2f, 0x6b, 0x75, 0x62, 0x65, - 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6e, 0x76, 0x1a, 0x55, 0x0a, 0x14, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x4d, 0x61, 0x70, 0x4b, + 0x65, 0x79, 0x54, 0x6f, 0x45, 0x6e, 0x76, 0x4d, 0x61, 0x70, 0x12, 0x24, 0x0a, 0x0e, 0x63, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x6d, 0x61, 0x70, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x4d, 0x61, 0x70, 0x4b, 0x65, 0x79, + 0x12, 0x17, 0x0a, 0x07, 0x65, 0x6e, 0x76, 0x5f, 0x76, 0x61, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x65, 0x6e, 0x76, 0x56, 0x61, 0x72, 0x22, 0x32, 0x0a, 0x0f, 0x49, 0x6d, 0x61, + 0x67, 0x65, 0x50, 0x75, 0x6c, 0x6c, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, 0x1f, 0x0a, 0x0b, + 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0a, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x43, 0x0a, + 0x0e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x50, 0x61, 0x74, 0x68, 0x41, 0x73, 0x45, 0x6e, 0x76, 0x12, + 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x70, 0x61, 0x74, + 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x50, 0x61, + 0x74, 0x68, 0x22, 0xb3, 0x01, 0x0a, 0x0a, 0x54, 0x6f, 0x6c, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, + 0x6b, 0x65, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x12, + 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, 0x12, 0x32, 0x0a, + 0x12, 0x74, 0x6f, 0x6c, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x65, 0x63, 0x6f, + 0x6e, 0x64, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x11, 0x74, 0x6f, 0x6c, + 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x88, 0x01, + 0x01, 0x42, 0x15, 0x0a, 0x13, 0x5f, 0x74, 0x6f, 0x6c, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x5f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x42, 0x49, 0x5a, 0x47, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6b, 0x75, 0x62, 0x65, 0x66, 0x6c, 0x6f, 0x77, 0x2f, + 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x2f, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, + 0x65, 0x74, 0x65, 0x73, 0x5f, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x2f, 0x67, 0x6f, + 0x2f, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x70, 0x6c, 0x61, 0x74, 0x66, + 0x6f, 0x72, 0x6d, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -861,7 +1445,7 @@ func file_kubernetes_executor_config_proto_rawDescGZIP() []byte { return file_kubernetes_executor_config_proto_rawDescData } -var file_kubernetes_executor_config_proto_msgTypes = make([]protoimpl.MessageInfo, 10) +var file_kubernetes_executor_config_proto_msgTypes = make([]protoimpl.MessageInfo, 19) var file_kubernetes_executor_config_proto_goTypes = []interface{}{ (*KubernetesExecutorConfig)(nil), // 0: kfp_kubernetes.KubernetesExecutorConfig (*SecretAsVolume)(nil), // 1: kfp_kubernetes.SecretAsVolume @@ -871,25 +1455,43 @@ var file_kubernetes_executor_config_proto_goTypes = []interface{}{ (*CreatePvc)(nil), // 5: kfp_kubernetes.CreatePvc (*DeletePvc)(nil), // 6: kfp_kubernetes.DeletePvc (*NodeSelector)(nil), // 7: kfp_kubernetes.NodeSelector - (*SecretAsEnv_SecretKeyToEnvMap)(nil), // 8: kfp_kubernetes.SecretAsEnv.SecretKeyToEnvMap - nil, // 9: kfp_kubernetes.NodeSelector.LabelsEntry - (*structpb.Struct)(nil), // 10: google.protobuf.Struct + (*PodMetadata)(nil), // 8: kfp_kubernetes.PodMetadata + (*ConfigMapAsVolume)(nil), // 9: kfp_kubernetes.ConfigMapAsVolume + (*ConfigMapAsEnv)(nil), // 10: kfp_kubernetes.ConfigMapAsEnv + (*ImagePullSecret)(nil), // 11: kfp_kubernetes.ImagePullSecret + (*FieldPathAsEnv)(nil), // 12: kfp_kubernetes.FieldPathAsEnv + (*Toleration)(nil), // 13: kfp_kubernetes.Toleration + (*SecretAsEnv_SecretKeyToEnvMap)(nil), // 14: kfp_kubernetes.SecretAsEnv.SecretKeyToEnvMap + nil, // 15: kfp_kubernetes.NodeSelector.LabelsEntry + nil, // 16: kfp_kubernetes.PodMetadata.LabelsEntry + nil, // 17: kfp_kubernetes.PodMetadata.AnnotationsEntry + (*ConfigMapAsEnv_ConfigMapKeyToEnvMap)(nil), // 18: kfp_kubernetes.ConfigMapAsEnv.ConfigMapKeyToEnvMap + (*structpb.Struct)(nil), // 19: google.protobuf.Struct } var file_kubernetes_executor_config_proto_depIdxs = []int32{ 1, // 0: kfp_kubernetes.KubernetesExecutorConfig.secret_as_volume:type_name -> kfp_kubernetes.SecretAsVolume 2, // 1: kfp_kubernetes.KubernetesExecutorConfig.secret_as_env:type_name -> kfp_kubernetes.SecretAsEnv 4, // 2: kfp_kubernetes.KubernetesExecutorConfig.pvc_mount:type_name -> kfp_kubernetes.PvcMount 7, // 3: kfp_kubernetes.KubernetesExecutorConfig.node_selector:type_name -> kfp_kubernetes.NodeSelector - 8, // 4: kfp_kubernetes.SecretAsEnv.key_to_env:type_name -> kfp_kubernetes.SecretAsEnv.SecretKeyToEnvMap - 3, // 5: kfp_kubernetes.PvcMount.task_output_parameter:type_name -> kfp_kubernetes.TaskOutputParameterSpec - 10, // 6: kfp_kubernetes.CreatePvc.annotations:type_name -> google.protobuf.Struct - 3, // 7: kfp_kubernetes.DeletePvc.task_output_parameter:type_name -> kfp_kubernetes.TaskOutputParameterSpec - 9, // 8: kfp_kubernetes.NodeSelector.labels:type_name -> kfp_kubernetes.NodeSelector.LabelsEntry - 9, // [9:9] is the sub-list for method output_type - 9, // [9:9] is the sub-list for method input_type - 9, // [9:9] is the sub-list for extension type_name - 9, // [9:9] is the sub-list for extension extendee - 0, // [0:9] is the sub-list for field type_name + 8, // 4: kfp_kubernetes.KubernetesExecutorConfig.pod_metadata:type_name -> kfp_kubernetes.PodMetadata + 11, // 5: kfp_kubernetes.KubernetesExecutorConfig.image_pull_secret:type_name -> kfp_kubernetes.ImagePullSecret + 9, // 6: kfp_kubernetes.KubernetesExecutorConfig.config_map_as_volume:type_name -> kfp_kubernetes.ConfigMapAsVolume + 10, // 7: kfp_kubernetes.KubernetesExecutorConfig.config_map_as_env:type_name -> kfp_kubernetes.ConfigMapAsEnv + 12, // 8: kfp_kubernetes.KubernetesExecutorConfig.field_path_as_env:type_name -> kfp_kubernetes.FieldPathAsEnv + 13, // 9: kfp_kubernetes.KubernetesExecutorConfig.tolerations:type_name -> kfp_kubernetes.Toleration + 14, // 10: kfp_kubernetes.SecretAsEnv.key_to_env:type_name -> kfp_kubernetes.SecretAsEnv.SecretKeyToEnvMap + 3, // 11: kfp_kubernetes.PvcMount.task_output_parameter:type_name -> kfp_kubernetes.TaskOutputParameterSpec + 19, // 12: kfp_kubernetes.CreatePvc.annotations:type_name -> google.protobuf.Struct + 3, // 13: kfp_kubernetes.DeletePvc.task_output_parameter:type_name -> kfp_kubernetes.TaskOutputParameterSpec + 15, // 14: kfp_kubernetes.NodeSelector.labels:type_name -> kfp_kubernetes.NodeSelector.LabelsEntry + 16, // 15: kfp_kubernetes.PodMetadata.labels:type_name -> kfp_kubernetes.PodMetadata.LabelsEntry + 17, // 16: kfp_kubernetes.PodMetadata.annotations:type_name -> kfp_kubernetes.PodMetadata.AnnotationsEntry + 18, // 17: kfp_kubernetes.ConfigMapAsEnv.key_to_env:type_name -> kfp_kubernetes.ConfigMapAsEnv.ConfigMapKeyToEnvMap + 18, // [18:18] is the sub-list for method output_type + 18, // [18:18] is the sub-list for method input_type + 18, // [18:18] is the sub-list for extension type_name + 18, // [18:18] is the sub-list for extension extendee + 0, // [0:18] is the sub-list for field type_name } func init() { file_kubernetes_executor_config_proto_init() } @@ -995,6 +1597,78 @@ func file_kubernetes_executor_config_proto_init() { } } file_kubernetes_executor_config_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PodMetadata); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_kubernetes_executor_config_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ConfigMapAsVolume); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_kubernetes_executor_config_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ConfigMapAsEnv); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_kubernetes_executor_config_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ImagePullSecret); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_kubernetes_executor_config_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FieldPathAsEnv); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_kubernetes_executor_config_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Toleration); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_kubernetes_executor_config_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SecretAsEnv_SecretKeyToEnvMap); i { case 0: return &v.state @@ -1006,7 +1680,20 @@ func file_kubernetes_executor_config_proto_init() { return nil } } + file_kubernetes_executor_config_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ConfigMapAsEnv_ConfigMapKeyToEnvMap); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } + file_kubernetes_executor_config_proto_msgTypes[1].OneofWrappers = []interface{}{} file_kubernetes_executor_config_proto_msgTypes[4].OneofWrappers = []interface{}{ (*PvcMount_TaskOutputParameter)(nil), (*PvcMount_Constant)(nil), @@ -1021,13 +1708,14 @@ func file_kubernetes_executor_config_proto_init() { (*DeletePvc_Constant)(nil), (*DeletePvc_ComponentInputParameter)(nil), } + file_kubernetes_executor_config_proto_msgTypes[13].OneofWrappers = []interface{}{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_kubernetes_executor_config_proto_rawDesc, NumEnums: 0, - NumMessages: 10, + NumMessages: 19, NumExtensions: 0, NumServices: 0, }, diff --git a/kubernetes_platform/proto/kubernetes_executor_config.proto b/kubernetes_platform/proto/kubernetes_executor_config.proto index 8bba56463c8..b05a59a637e 100644 --- a/kubernetes_platform/proto/kubernetes_executor_config.proto +++ b/kubernetes_platform/proto/kubernetes_executor_config.proto @@ -25,6 +25,15 @@ message KubernetesExecutorConfig { repeated SecretAsEnv secret_as_env = 2; repeated PvcMount pvc_mount = 3; NodeSelector node_selector = 4; + PodMetadata pod_metadata = 5; + repeated ImagePullSecret image_pull_secret = 6; + // One of Always, Never, IfNotPresent. + string image_pull_policy = 7; + repeated ConfigMapAsVolume config_map_as_volume = 8; + repeated ConfigMapAsEnv config_map_as_env = 9; + int64 active_deadline_seconds = 10; + repeated FieldPathAsEnv field_path_as_env = 11; + repeated Toleration tolerations = 12; } message SecretAsVolume { @@ -32,6 +41,8 @@ message SecretAsVolume { string secret_name = 1; // Container path to mount the Secret data. string mount_path = 2; + // An optional boolean value indicating whether the Secret must be defined. + optional bool optional = 3; } message SecretAsEnv { @@ -114,3 +125,54 @@ message NodeSelector { // corresponds to Pod.spec.nodeSelector field https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#scheduling map labels = 1; } + +message PodMetadata { + // values of metadata spec such as labels and annotations for the pod object + // corresponds to Pod.metadata field https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#Pod + map labels = 1; + map annotations = 2; +} + +message ConfigMapAsVolume { + // Name of the ConfigMap. + string config_map_name = 1; + // Container path to mount the ConfigMap data. + string mount_path = 2; + // An optional boolean value indicating whether the ConfigMap must be defined. + optional bool optional = 3; +} + +message ConfigMapAsEnv { + // Name of the ConfigMap. + string config_map_name = 1; + + message ConfigMapKeyToEnvMap { + // Corresponds to a key of the ConfigMap. + string config_map_key = 1; + // Env var to which configmap_key's data should be set. + string env_var = 2; + } + + repeated ConfigMapKeyToEnvMap key_to_env = 2; +} + +message ImagePullSecret { + // Name of the image pull secret. + string secret_name = 1; +} + +message FieldPathAsEnv { + // Name of the environment variable + string name = 1; + + // Value of the field path string + string field_path = 2; +} + +message Toleration { + string key = 1; + string operator = 2; + string value = 3; + string effect = 4; + optional int64 toleration_seconds = 5; +} diff --git a/kubernetes_platform/python/README.md b/kubernetes_platform/python/README.md index df575b196a6..9491ddb03c3 100644 --- a/kubernetes_platform/python/README.md +++ b/kubernetes_platform/python/README.md @@ -4,6 +4,7 @@ The `kfp-kubernetes` Python library enables authoring [Kubeflow pipelines](https * [Secrets](https://kubernetes.io/docs/concepts/configuration/secret/) * [PersistentVolumeClaims](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims) +* [ImagePullPolicy](https://kubernetes.io/docs/concepts/containers/images/#image-pull-policy) See the [`kfp-kubernetes` reference documentation](https://kfp-kubernetes.readthedocs.io/). @@ -57,6 +58,44 @@ def pipeline(): mount_path='/mnt/my_vol') ``` +### ConfigMap: As environment variable +```python +from kfp import dsl +from kfp import kubernetes + +@dsl.component +def print_config_map(): + import os + print(os.environ['my-cm']) + +@dsl.pipeline +def pipeline(): + task = print_config_map() + kubernetes.use_config_map_as_env(task, + config_map_name='my-cm', + secret_key_to_env={'foo': 'CM_VAR'}) +``` + +### ConfigMap: As mounted volume +```python +from kfp import dsl +from kfp import kubernetes + +@dsl.component +def print_config_map(): + with open('/mnt/my_vol') as f: + print(f.read()) + +@dsl.pipeline +def pipeline(): + task = print_config_map() + kubernetes.use_secret_as_volume(task, + config_map_name='my-cm', + mount_path='/mnt/my_vol') +``` + + + ### PersistentVolumeClaim: Dynamically create PVC, mount, then delete ```python from kfp import dsl @@ -102,3 +141,80 @@ def my_pipeline(): delete_pvc1 = kubernetes.DeletePVC( pvc_name=pvc1.outputs['name']).after(task2) ``` + +### Pod Metadata: Add pod labels and annotations to the container pod's definition +```python +from kfp import dsl +from kfp import kubernetes + + +@dsl.component +def comp(): + pass + + +@dsl.pipeline +def my_pipeline(): + task = comp() + kubernetes.add_pod_label( + task, + label_key='kubeflow.com/kfp', + label_value='pipeline-node', + ) + kubernetes.add_pod_annotation( + task, + annotation_key='run_id', + annotation_value='123456', + ) +``` + +# Kubernetes Field: Use Kubernetes Field Path as enviornment variable +```python +from kfp import dsl +from kfp import kubernetes + + +@dsl.component +def comp(): + pass + + +@dsl.pipeline +def my_pipeline(): + task = comp() + kubernetes.use_field_path_as_env( + task, + env_name='KFP_RUN_NAME', + field_path="metadata.annotations['pipelines.kubeflow.org/run_name']" + ) +``` + +### Timeout: Set timeout in seconds defined as pod spec's activeDeadlineSeconds +```python +from kfp import dsl +from kfp import kubernetes + +@dsl.component +def comp(): + pass + +@dsl.pipeline +def my_pipeline(): + task = comp() + kubernetes.set_timeout(task, 20) +``` + +### ImagePullPolicy: One of "Always" "Never", "IfNotPresent". +```python +from kfp import dsl +from kfp import kubernetes + +@dsl.component +def simple_task(): + print("hello-world") + +@dsl.pipeline +def pipeline(): + task = simple_task() + kubernetes.set_image_pull_policy(task, "Always") +``` diff --git a/kubernetes_platform/python/kfp/kubernetes/__init__.py b/kubernetes_platform/python/kfp/kubernetes/__init__.py index 587e5132b07..8359943dbf5 100644 --- a/kubernetes_platform/python/kfp/kubernetes/__init__.py +++ b/kubernetes_platform/python/kfp/kubernetes/__init__.py @@ -15,17 +15,42 @@ __version__ = '1.0.0' __all__ = [ + 'add_node_selector', + 'add_pod_annotation', + 'add_pod_label', + 'add_toleration', 'CreatePVC', 'DeletePVC', 'mount_pvc', + 'set_image_pull_policy', + 'use_field_path_as_env', + 'set_image_pull_secrets', + 'set_timeout', + 'use_config_map_as_env', + 'use_config_map_as_volume', 'use_secret_as_env', 'use_secret_as_volume', 'add_node_selector', + 'set_image_pull_secrets' ] +from kfp.kubernetes.config_map import use_config_map_as_env +from kfp.kubernetes.config_map import use_config_map_as_volume +from kfp.kubernetes.field import use_field_path_as_env +from kfp.kubernetes.image import set_image_pull_policy +from kfp.kubernetes.image import set_image_pull_secrets +from kfp.kubernetes.config_map import use_config_map_as_volume +from kfp.kubernetes.config_map import use_config_map_as_env from kfp.kubernetes.node_selector import add_node_selector +from kfp.kubernetes.pod_metadata import add_pod_annotation +from kfp.kubernetes.pod_metadata import add_pod_label from kfp.kubernetes.secret import use_secret_as_env from kfp.kubernetes.secret import use_secret_as_volume +<<<<<<< HEAD +from kfp.kubernetes.timeout import set_timeout +======= +>>>>>>> 2983a7d49 (feat(Backend + SDK): Update kfp backend and kubernetes sdk to support tolerations (#10471)) +from kfp.kubernetes.toleration import add_toleration from kfp.kubernetes.volume import CreatePVC from kfp.kubernetes.volume import DeletePVC from kfp.kubernetes.volume import mount_pvc diff --git a/kubernetes_platform/python/kfp/kubernetes/config_map.py b/kubernetes_platform/python/kfp/kubernetes/config_map.py new file mode 100644 index 00000000000..7b5c3f19356 --- /dev/null +++ b/kubernetes_platform/python/kfp/kubernetes/config_map.py @@ -0,0 +1,87 @@ +# Copyright 2024 The Kubeflow Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from typing import Dict + +from google.protobuf import json_format +from kfp.dsl import PipelineTask +from kfp.kubernetes import common +from kfp.kubernetes import kubernetes_executor_config_pb2 as pb + + +def use_config_map_as_env( + task: PipelineTask, + config_map_name: str, + config_map_key_to_env: Dict[str, str], +) -> PipelineTask: + """Use a Kubernetes ConfigMap as an environment variable as described by the `Kubernetes documentation + https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/#define-container-environment-variables-using-configmap-data` _. + + Args: + task: Pipeline task. + config_map_name: Name of the ConfigMap. + config_map_key_to_env: Dictionary of ConfigMap key to environment variable name. For example, ``{'foo': 'FOO'}`` sets the value of the ConfigMap's foo field to the environment variable ``FOO``. + + Returns: + Task object with updated ConfigMap configuration. + """ + + msg = common.get_existing_kubernetes_config_as_message(task) + + key_to_env = [ + pb.ConfigMapAsEnv.ConfigMapKeyToEnvMap( + config_map_key=config_map_key, + env_var=env_var, + ) for config_map_key, env_var in config_map_key_to_env.items() + ] + config_map_as_env = pb.ConfigMapAsEnv( + config_map_name=config_map_name, + key_to_env=key_to_env, + ) + + msg.config_map_as_env.append(config_map_as_env) + + task.platform_config['kubernetes'] = json_format.MessageToDict(msg) + + return task + + +def use_config_map_as_volume( + task: PipelineTask, + config_map_name: str, + mount_path: str, +) -> PipelineTask: + """Use a Kubernetes ConfigMap by mounting its data to the task's container as + described by the `Kubernetes documentation `_. + + Args: + task: Pipeline task. + config_map_name: Name of the ConfigMap. + mount_path: Path to which to mount the ConfigMap data. + + Returns: + Task object with updated ConfigMap configuration. + """ + + msg = common.get_existing_kubernetes_config_as_message(task) + + config_map_as_vol = pb.ConfigMapAsVolume( + config_map_name=config_map_name, + mount_path=mount_path, + ) + msg.config_map_as_volume.append(config_map_as_vol) + + task.platform_config['kubernetes'] = json_format.MessageToDict(msg) + + return task diff --git a/kubernetes_platform/python/kfp/kubernetes/image.py b/kubernetes_platform/python/kfp/kubernetes/image.py new file mode 100644 index 00000000000..57ea958486d --- /dev/null +++ b/kubernetes_platform/python/kfp/kubernetes/image.py @@ -0,0 +1,69 @@ +# Copyright 2024 The Kubeflow Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from typing import List + +from google.protobuf import json_format +from kfp.dsl import PipelineTask +from kfp.kubernetes import common +from kfp.kubernetes import kubernetes_executor_config_pb2 as pb + + +def set_image_pull_secrets( + task: PipelineTask, + secret_names: List[str], +) -> PipelineTask: + """Set image pull secrets for a Kubernetes task. + + Args: + task: Pipeline task. + secret_names: List of image pull secret names. + + Returns: + Task object with updated image pull secret configuration. + """ + + msg = common.get_existing_kubernetes_config_as_message(task) + + # Assuming secret_names is a list of strings + image_pull_secret = [ + pb.ImagePullSecret(secret_name=secret_name) for secret_name in secret_names + ] + + msg.image_pull_secret.extend(image_pull_secret) + + task.platform_config['kubernetes'] = json_format.MessageToDict(msg) + + return task + + +def set_image_pull_policy(task: PipelineTask, policy: str) -> PipelineTask: + """Set image pull policy for the container. + + Args: + task: Pipeline task. + policy: One of `Always`, `Never`, `IfNotPresent`. + + Returns: + Task object with an added ImagePullPolicy specification. + """ + if policy not in ['Always', 'Never', 'IfNotPresent']: + raise ValueError( + 'Invalid imagePullPolicy. Must be one of `Always`, `Never`, `IfNotPresent`.' + ) + msg = common.get_existing_kubernetes_config_as_message(task) + msg.image_pull_policy = policy + task.platform_config['kubernetes'] = json_format.MessageToDict(msg) + + return task diff --git a/kubernetes_platform/python/kfp/kubernetes/secret.py b/kubernetes_platform/python/kfp/kubernetes/secret.py index 9472d6d7ff7..dfc678f277f 100644 --- a/kubernetes_platform/python/kfp/kubernetes/secret.py +++ b/kubernetes_platform/python/kfp/kubernetes/secret.py @@ -25,9 +25,8 @@ def use_secret_as_env( secret_name: str, secret_key_to_env: Dict[str, str], ) -> PipelineTask: - """Use a Kubernetes Secret as an environment variable as described in - https://kubernetes.io/docs/concepts/configuration/secret/#using-secrets-as- - environment-variables. + """Use a Kubernetes Secret as an environment variable as described by the `Kubernetes documentation + https://kubernetes.io/docs/concepts/configuration/secret/#using-secrets-as-environment-variables `_. Args: task: Pipeline task. diff --git a/kubernetes_platform/python/kfp/kubernetes/timeout.py b/kubernetes_platform/python/kfp/kubernetes/timeout.py new file mode 100644 index 00000000000..34f519013fb --- /dev/null +++ b/kubernetes_platform/python/kfp/kubernetes/timeout.py @@ -0,0 +1,47 @@ +# Copyright 2024 The Kubeflow Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from google.protobuf import json_format +from kfp.dsl import PipelineTask +from kfp.kubernetes import common + + +def set_timeout( + task: PipelineTask, + seconds: int, +) -> PipelineTask: + """Add timeout to the task Pod's `active_deadline_seconds + `_. + + Timeout an integer greater than 0, corresponding to the podspec active_deadline_seconds = 0: + msg.active_deadline_seconds = seconds + else: + raise ValueError( + f'Argument for "seconds" must be an integer greater or equals to 0. Got invalid input: {seconds}. ' + ) + task.platform_config['kubernetes'] = json_format.MessageToDict(msg) + + return task diff --git a/kubernetes_platform/python/kfp/kubernetes/toleration.py b/kubernetes_platform/python/kfp/kubernetes/toleration.py new file mode 100644 index 00000000000..3cf1bc97e49 --- /dev/null +++ b/kubernetes_platform/python/kfp/kubernetes/toleration.py @@ -0,0 +1,81 @@ +# Copyright 2024 The Kubeflow Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from typing import Optional + +from google.protobuf import json_format +from kfp.dsl import PipelineTask +from kfp.kubernetes import common +from kfp.kubernetes import kubernetes_executor_config_pb2 as pb + +try: + from typing import Literal +except ImportError: + from typing_extensions import Literal + + +def add_toleration( + task: PipelineTask, + key: Optional[str] = None, + operator: Optional[Literal["Equal", "Exists"]] = None, + value: Optional[str] = None, + effect: Optional[Literal["NoExecute", "NoSchedule", "PreferNoSchedule"]] = None, + toleration_seconds: Optional[int] = None, +): + """Add a `toleration`_. to a task. + + Args: + task: + Pipeline task. + key: + key is the taint key that the toleration applies to. Empty means + match all taint keys. If the key is empty, operator must be Exists; + this combination means to match all values and all keys. + operator: + operator represents a key's relationship to the value. Valid + operators are Exists and Equal. Defaults to Equal. Exists is + equivalent to wildcard for value, so that a pod can tolerate all + taints of a particular category. + value: + value is the taint value the toleration matches to. If the operator + is Exists, the value should be empty, otherwise just a regular + string. + effect: + effect indicates the taint effect to match. Empty means match all + taint effects. When specified, allowed values are NoSchedule, + PreferNoSchedule and NoExecute. + toleration_seconds: + toleration_seconds represents the period of time the toleration + (which must be of effect NoExecute, otherwise this field is ignored) + tolerates the taint. By default, it is not set, which means tolerate + the taint forever (do not evict). Zero and negative values will be + treated as 0 (evict immediately) by the system. + + Returns: + Task object with added toleration. + """ + + msg = common.get_existing_kubernetes_config_as_message(task) + msg.tolerations.append( + pb.Toleration( + key=key, + operator=operator, + value=value, + effect=effect, + toleration_seconds=toleration_seconds, + ) + ) + task.platform_config["kubernetes"] = json_format.MessageToDict(msg) + + return task diff --git a/kubernetes_platform/python/test/snapshot/data/config_map_as_env.py b/kubernetes_platform/python/test/snapshot/data/config_map_as_env.py new file mode 100644 index 00000000000..3e03f3101a2 --- /dev/null +++ b/kubernetes_platform/python/test/snapshot/data/config_map_as_env.py @@ -0,0 +1,35 @@ +# Copyright 2024 The Kubeflow Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from kfp import dsl +from kfp import kubernetes + + +@dsl.component +def comp(): + pass + + +@dsl.pipeline +def my_pipeline(): + task = comp() + kubernetes.use_config_map_as_env( + task, + config_map_name='my-cm', + config_map_key_to_env={'foo': 'CONFIG_MAP_VAR'}) + + +if __name__ == '__main__': + from kfp import compiler + compiler.Compiler().compile(my_pipeline, __file__.replace('.py', '.yaml')) diff --git a/kubernetes_platform/python/test/snapshot/data/config_map_as_env.yaml b/kubernetes_platform/python/test/snapshot/data/config_map_as_env.yaml new file mode 100644 index 00000000000..51a63574a07 --- /dev/null +++ b/kubernetes_platform/python/test/snapshot/data/config_map_as_env.yaml @@ -0,0 +1,60 @@ +# PIPELINE DEFINITION +# Name: my-pipeline +components: + comp-comp: + executorLabel: exec-comp +deploymentSpec: + executors: + exec-comp: + container: + args: + - --executor_input + - '{{$}}' + - --function_to_execute + - comp + command: + - sh + - -c + - "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip ||\ + \ python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1\ + \ python3 -m pip install --quiet --no-warn-script-location 'kfp==2.4.0'\ + \ '--no-deps' 'typing-extensions>=3.7.4,<5; python_version<\"3.9\"' && \"\ + $0\" \"$@\"\n" + - sh + - -ec + - 'program_path=$(mktemp -d) + + + printf "%s" "$0" > "$program_path/ephemeral_component.py" + + _KFP_RUNTIME=true python3 -m kfp.dsl.executor_main --component_module_path "$program_path/ephemeral_component.py" "$@" + + ' + - "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import\ + \ *\n\ndef comp():\n pass\n\n" + image: python:3.7 +pipelineInfo: + name: my-pipeline +root: + dag: + tasks: + comp: + cachingOptions: + enableCache: true + componentRef: + name: comp-comp + taskInfo: + name: comp +schemaVersion: 2.1.0 +sdkVersion: kfp-2.4.0 +--- +platforms: + kubernetes: + deploymentSpec: + executors: + exec-comp: + configMapAsEnv: + - keyToEnv: + - envVar: CONFIG_MAP_VAR + configMapKey: foo + configMapName: my-cm diff --git a/kubernetes_platform/python/test/snapshot/data/config_map_as_vol.py b/kubernetes_platform/python/test/snapshot/data/config_map_as_vol.py new file mode 100644 index 00000000000..76ee922fdc7 --- /dev/null +++ b/kubernetes_platform/python/test/snapshot/data/config_map_as_vol.py @@ -0,0 +1,33 @@ +# Copyright 2024 The Kubeflow Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from kfp import dsl +from kfp import kubernetes + + +@dsl.component +def comp(): + pass + + +@dsl.pipeline +def my_pipeline(): + task = comp() + kubernetes.use_config_map_as_volume( + task, config_map_name='my-cm', mount_path='/mnt/my_vol') + + +if __name__ == '__main__': + from kfp import compiler + compiler.Compiler().compile(my_pipeline, __file__.replace('.py', '.yaml')) diff --git a/kubernetes_platform/python/test/snapshot/data/config_map_as_vol.yaml b/kubernetes_platform/python/test/snapshot/data/config_map_as_vol.yaml new file mode 100644 index 00000000000..80be94504f1 --- /dev/null +++ b/kubernetes_platform/python/test/snapshot/data/config_map_as_vol.yaml @@ -0,0 +1,58 @@ +# PIPELINE DEFINITION +# Name: my-pipeline +components: + comp-comp: + executorLabel: exec-comp +deploymentSpec: + executors: + exec-comp: + container: + args: + - --executor_input + - '{{$}}' + - --function_to_execute + - comp + command: + - sh + - -c + - "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip ||\ + \ python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1\ + \ python3 -m pip install --quiet --no-warn-script-location 'kfp==2.4.0'\ + \ '--no-deps' 'typing-extensions>=3.7.4,<5; python_version<\"3.9\"' && \"\ + $0\" \"$@\"\n" + - sh + - -ec + - 'program_path=$(mktemp -d) + + + printf "%s" "$0" > "$program_path/ephemeral_component.py" + + _KFP_RUNTIME=true python3 -m kfp.dsl.executor_main --component_module_path "$program_path/ephemeral_component.py" "$@" + + ' + - "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import\ + \ *\n\ndef comp():\n pass\n\n" + image: python:3.7 +pipelineInfo: + name: my-pipeline +root: + dag: + tasks: + comp: + cachingOptions: + enableCache: true + componentRef: + name: comp-comp + taskInfo: + name: comp +schemaVersion: 2.1.0 +sdkVersion: kfp-2.4.0 +--- +platforms: + kubernetes: + deploymentSpec: + executors: + exec-comp: + configMapAsVolume: + - mountPath: /mnt/my_vol + configMapName: my-cm diff --git a/kubernetes_platform/python/test/snapshot/data/image_pull_secrets.py b/kubernetes_platform/python/test/snapshot/data/image_pull_secrets.py new file mode 100644 index 00000000000..5f5ed0f6d4b --- /dev/null +++ b/kubernetes_platform/python/test/snapshot/data/image_pull_secrets.py @@ -0,0 +1,32 @@ +# Copyright 2024 The Kubeflow Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from kfp import dsl +from kfp import kubernetes + + +@dsl.component +def comp(): + pass + + +@dsl.pipeline +def my_pipeline(): + task = comp() + kubernetes.set_image_pull_secrets(task, ['my-secret']) + + +if __name__ == '__main__': + from kfp import compiler + compiler.Compiler().compile(my_pipeline, __file__.replace('.py', '.yaml')) diff --git a/kubernetes_platform/python/test/snapshot/data/image_pull_secrets.yaml b/kubernetes_platform/python/test/snapshot/data/image_pull_secrets.yaml new file mode 100644 index 00000000000..52c7f987a99 --- /dev/null +++ b/kubernetes_platform/python/test/snapshot/data/image_pull_secrets.yaml @@ -0,0 +1,57 @@ +# PIPELINE DEFINITION +# Name: my-pipeline +components: + comp-comp: + executorLabel: exec-comp +deploymentSpec: + executors: + exec-comp: + container: + args: + - --executor_input + - '{{$}}' + - --function_to_execute + - comp + command: + - sh + - -c + - "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip ||\ + \ python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1\ + \ python3 -m pip install --quiet --no-warn-script-location 'kfp==2.6.0'\ + \ '--no-deps' 'typing-extensions>=3.7.4,<5; python_version<\"3.9\"' && \"\ + $0\" \"$@\"\n" + - sh + - -ec + - 'program_path=$(mktemp -d) + + + printf "%s" "$0" > "$program_path/ephemeral_component.py" + + _KFP_RUNTIME=true python3 -m kfp.dsl.executor_main --component_module_path "$program_path/ephemeral_component.py" "$@" + + ' + - "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import\ + \ *\n\ndef comp():\n pass\n\n" + image: python:3.7 +pipelineInfo: + name: my-pipeline +root: + dag: + tasks: + comp: + cachingOptions: + enableCache: true + componentRef: + name: comp-comp + taskInfo: + name: comp +schemaVersion: 2.1.0 +sdkVersion: kfp-2.6.0 +--- +platforms: + kubernetes: + deploymentSpec: + executors: + exec-comp: + imagePullSecret: + - secretName: my-secret diff --git a/kubernetes_platform/python/test/snapshot/data/timeout.py b/kubernetes_platform/python/test/snapshot/data/timeout.py new file mode 100644 index 00000000000..094bf4470b8 --- /dev/null +++ b/kubernetes_platform/python/test/snapshot/data/timeout.py @@ -0,0 +1,32 @@ +# Copyright 2024 The Kubeflow Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from kfp import dsl +from kfp import kubernetes + + +@dsl.component +def comp(): + pass + + +@dsl.pipeline +def my_pipeline(): + task = comp() + kubernetes.set_timeout(task, 20) + + +if __name__ == '__main__': + from kfp import compiler + compiler.Compiler().compile(my_pipeline, __file__.replace('.py', '.yaml')) diff --git a/kubernetes_platform/python/test/snapshot/data/timeout.yaml b/kubernetes_platform/python/test/snapshot/data/timeout.yaml new file mode 100644 index 00000000000..9102a0c1a40 --- /dev/null +++ b/kubernetes_platform/python/test/snapshot/data/timeout.yaml @@ -0,0 +1,56 @@ +# PIPELINE DEFINITION +# Name: my-pipeline +components: + comp-comp: + executorLabel: exec-comp +deploymentSpec: + executors: + exec-comp: + container: + args: + - --executor_input + - '{{$}}' + - --function_to_execute + - comp + command: + - sh + - -c + - "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip ||\ + \ python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1\ + \ python3 -m pip install --quiet --no-warn-script-location 'kfp==2.6.0'\ + \ '--no-deps' 'typing-extensions>=3.7.4,<5; python_version<\"3.9\"' && \"\ + $0\" \"$@\"\n" + - sh + - -ec + - 'program_path=$(mktemp -d) + + + printf "%s" "$0" > "$program_path/ephemeral_component.py" + + _KFP_RUNTIME=true python3 -m kfp.dsl.executor_main --component_module_path "$program_path/ephemeral_component.py" "$@" + + ' + - "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import\ + \ *\n\ndef comp():\n pass\n\n" + image: python:3.7 +pipelineInfo: + name: my-pipeline +root: + dag: + tasks: + comp: + cachingOptions: + enableCache: true + componentRef: + name: comp-comp + taskInfo: + name: comp +schemaVersion: 2.1.0 +sdkVersion: kfp-2.6.0 +--- +platforms: + kubernetes: + deploymentSpec: + executors: + exec-comp: + activeDeadlineSeconds: '20' diff --git a/kubernetes_platform/python/test/snapshot/data/toleration.py b/kubernetes_platform/python/test/snapshot/data/toleration.py new file mode 100644 index 00000000000..8342ea53a34 --- /dev/null +++ b/kubernetes_platform/python/test/snapshot/data/toleration.py @@ -0,0 +1,41 @@ +# Copyright 2024 The Kubeflow Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from kfp import dsl +from kfp import kubernetes +from kubernetes.client import V1Toleration + + +@dsl.component +def comp(): + pass + + +@dsl.pipeline +def my_pipeline(): + task = comp() + kubernetes.add_toleration( + task, + key="key1", + operator="Equal", + value="value1", + effect="NoExecute", + toleration_seconds=10, + ) + + +if __name__ == "__main__": + from kfp import compiler + + compiler.Compiler().compile(my_pipeline, __file__.replace(".py", ".yaml")) diff --git a/kubernetes_platform/python/test/snapshot/data/toleration.yaml b/kubernetes_platform/python/test/snapshot/data/toleration.yaml new file mode 100644 index 00000000000..f8f23798c61 --- /dev/null +++ b/kubernetes_platform/python/test/snapshot/data/toleration.yaml @@ -0,0 +1,61 @@ +# PIPELINE DEFINITION +# Name: my-pipeline +components: + comp-comp: + executorLabel: exec-comp +deploymentSpec: + executors: + exec-comp: + container: + args: + - --executor_input + - '{{$}}' + - --function_to_execute + - comp + command: + - sh + - -c + - "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip ||\ + \ python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1\ + \ python3 -m pip install --quiet --no-warn-script-location 'kfp==2.6.0'\ + \ '--no-deps' 'typing-extensions>=3.7.4,<5; python_version<\"3.9\"' && \"\ + $0\" \"$@\"\n" + - sh + - -ec + - 'program_path=$(mktemp -d) + + + printf "%s" "$0" > "$program_path/ephemeral_component.py" + + _KFP_RUNTIME=true python3 -m kfp.dsl.executor_main --component_module_path "$program_path/ephemeral_component.py" "$@" + + ' + - "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import\ + \ *\n\ndef comp():\n pass\n\n" + image: python:3.7 +pipelineInfo: + name: my-pipeline +root: + dag: + tasks: + comp: + cachingOptions: + enableCache: true + componentRef: + name: comp-comp + taskInfo: + name: comp +schemaVersion: 2.1.0 +sdkVersion: kfp-2.6.0 +--- +platforms: + kubernetes: + deploymentSpec: + executors: + exec-comp: + tolerations: + - effect: NoExecute + key: key1 + operator: Equal + tolerationSeconds: '10' + value: value1 diff --git a/kubernetes_platform/python/test/unit/test_config_map.py b/kubernetes_platform/python/test/unit/test_config_map.py new file mode 100644 index 00000000000..b607d587177 --- /dev/null +++ b/kubernetes_platform/python/test/unit/test_config_map.py @@ -0,0 +1,345 @@ +# Copyright 2023 The Kubeflow Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from google.protobuf import json_format +from kfp import dsl +from kfp import kubernetes + + +class TestUseConfigMapAsVolume: + + def test_use_one(self): + + @dsl.pipeline + def my_pipeline(): + task = comp() + kubernetes.use_config_map_as_volume( + task, + config_map_name='cm-name', + mount_path='cmpath', + ) + + assert json_format.MessageToDict(my_pipeline.platform_spec) == { + 'platforms': { + 'kubernetes': { + 'deploymentSpec': { + 'executors': { + 'exec-comp': { + 'configMapAsVolume': [{ + 'configMapName': 'cm-name', + 'mountPath': 'cmpath' + }] + } + } + } + } + } + } + + def test_use_two(self): + + @dsl.pipeline + def my_pipeline(): + task = comp() + kubernetes.use_config_map_as_volume( + task, + config_map_name='cm-name1', + mount_path='cmpath1', + ) + kubernetes.use_config_map_as_volume( + task, + config_map_name='cm-name2', + mount_path='cmpath2', + ) + + assert json_format.MessageToDict(my_pipeline.platform_spec) == { + 'platforms': { + 'kubernetes': { + 'deploymentSpec': { + 'executors': { + 'exec-comp': { + 'configMapAsVolume': [ + { + 'configMapName': 'cm-name1', + 'mountPath': 'cmpath1' + }, + { + 'configMapName': 'cm-name2', + 'mountPath': 'cmpath2' + }, + ] + } + } + } + } + } + } + + def test_preserves_config_map_as_env(self): + # checks that use_config map_as_volume respects previously set config maps as env + + @dsl.pipeline + def my_pipeline(): + task = comp() + kubernetes.use_config_map_as_env( + task, + config_map_name='cm-name1', + config_map_key_to_env={'foo': 'CM_VAR'}, + ) + kubernetes.use_config_map_as_volume( + task, + config_map_name='cm-name2', + mount_path='cmpath2', + ) + + assert json_format.MessageToDict(my_pipeline.platform_spec) == { + 'platforms': { + 'kubernetes': { + 'deploymentSpec': { + 'executors': { + 'exec-comp': { + 'configMapAsEnv': [{ + 'configMapName': + 'cm-name1', + 'keyToEnv': [{ + 'configMapKey': 'foo', + 'envVar': 'CM_VAR' + }] + }], + 'configMapAsVolume': [{ + 'configMapName': 'cm-name2', + 'mountPath': 'cmpath2' + },] + } + } + } + } + } + } + + def test_alongside_pvc_mount(self): + # checks that use_config_map_as_volume respects previously set pvc + @dsl.pipeline + def my_pipeline(): + task = comp() + kubernetes.mount_pvc( + task, + pvc_name='pvc-name', + mount_path='path', + ) + kubernetes.use_config_map_as_volume( + task, + config_map_name='cm-name', + mount_path='cmpath', + ) + + assert json_format.MessageToDict(my_pipeline.platform_spec) == { + 'platforms': { + 'kubernetes': { + 'deploymentSpec': { + 'executors': { + 'exec-comp': { + 'pvcMount': [{ + 'constant': 'pvc-name', + 'mountPath': 'path' + }], + 'configMapAsVolume': [{ + 'configMapName': 'cm-name', + 'mountPath': 'cmpath' + }] + } + } + } + } + } + } + + +class TestUseConfigMapAsEnv: + + def test_use_one(self): + + @dsl.pipeline + def my_pipeline(): + task = comp() + kubernetes.use_config_map_as_env( + task, + config_map_name='cm-name', + config_map_key_to_env={ + 'foo': 'FOO', + 'bar': 'BAR', + }, + ) + + assert json_format.MessageToDict(my_pipeline.platform_spec) == { + 'platforms': { + 'kubernetes': { + 'deploymentSpec': { + 'executors': { + 'exec-comp': { + 'configMapAsEnv': [{ + 'configMapName': + 'cm-name', + 'keyToEnv': [ + { + 'configMapKey': 'foo', + 'envVar': 'FOO' + }, + { + 'configMapKey': 'bar', + 'envVar': 'BAR' + }, + ] + }] + } + } + } + } + } + } + + def test_use_two(self): + + @dsl.pipeline + def my_pipeline(): + task = comp() + kubernetes.use_config_map_as_env( + task, + config_map_name='cm-name1', + config_map_key_to_env={'foo1': 'CM_VAR1'}, + ) + kubernetes.use_config_map_as_env( + task, + config_map_name='cm-name2', + config_map_key_to_env={'foo2': 'CM_VAR2'}, + ) + + assert json_format.MessageToDict(my_pipeline.platform_spec) == { + 'platforms': { + 'kubernetes': { + 'deploymentSpec': { + 'executors': { + 'exec-comp': { + 'configMapAsEnv': [ + { + 'configMapName': + 'cm-name1', + 'keyToEnv': [{ + 'configMapKey': 'foo1', + 'envVar': 'CM_VAR1' + }] + }, + { + 'configMapName': + 'cm-name2', + 'keyToEnv': [{ + 'configMapKey': 'foo2', + 'envVar': 'CM_VAR2' + }] + }, + ] + } + } + } + } + } + } + + def test_preserves_config_map_as_volume(self): + # checks that use_config_map_as_env respects previously set ConfigMaps as vol + + @dsl.pipeline + def my_pipeline(): + task = comp() + kubernetes.use_config_map_as_volume( + task, + config_map_name='cm-name2', + mount_path='cmpath2', + ) + kubernetes.use_config_map_as_env( + task, + config_map_name='cm-name1', + config_map_key_to_env={'foo': 'CM_VAR'}, + ) + + assert json_format.MessageToDict(my_pipeline.platform_spec) == { + 'platforms': { + 'kubernetes': { + 'deploymentSpec': { + 'executors': { + 'exec-comp': { + 'configMapAsEnv': [{ + 'configMapName': + 'cm-name1', + 'keyToEnv': [{ + 'configMapKey': 'foo', + 'envVar': 'CM_VAR' + }] + }], + 'configMapAsVolume': [{ + 'configMapName': 'cm-name2', + 'mountPath': 'cmpath2' + },] + } + } + } + } + } + } + + def test_preserves_pvc_mount(self): + # checks that use_config_map_as_env respects previously set pvc + @dsl.pipeline + def my_pipeline(): + task = comp() + kubernetes.mount_pvc( + task, + pvc_name='pvc-name', + mount_path='path', + ) + kubernetes.use_config_map_as_env( + task, + config_map_name='cm-name', + config_map_key_to_env={'foo': 'CM_VAR'}, + ) + + assert json_format.MessageToDict(my_pipeline.platform_spec) == { + 'platforms': { + 'kubernetes': { + 'deploymentSpec': { + 'executors': { + 'exec-comp': { + 'pvcMount': [{ + 'constant': 'pvc-name', + 'mountPath': 'path' + }], + 'configMapAsEnv': [{ + 'configMapName': + 'cm-name', + 'keyToEnv': [{ + 'configMapKey': 'foo', + 'envVar': 'CM_VAR' + }] + }] + } + } + } + } + } + } + + +@dsl.component +def comp(): + pass diff --git a/kubernetes_platform/python/test/unit/test_image_pull_policy.py b/kubernetes_platform/python/test/unit/test_image_pull_policy.py new file mode 100644 index 00000000000..df7f8467a14 --- /dev/null +++ b/kubernetes_platform/python/test/unit/test_image_pull_policy.py @@ -0,0 +1,88 @@ +# Copyright 2024 The Kubeflow Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from google.protobuf import json_format +from kfp import dsl +from kfp import kubernetes + + +class TestImagePullPolicy: + + def test_always(self): + + @dsl.pipeline + def my_pipeline(): + task = comp() + kubernetes.set_image_pull_policy(task, 'Always') + + assert json_format.MessageToDict(my_pipeline.platform_spec) == { + 'platforms': { + 'kubernetes': { + 'deploymentSpec': { + 'executors': { + 'exec-comp': { + 'imagePullPolicy': 'Always' + } + } + } + } + } + } + + def test_if_not_present(self): + + @dsl.pipeline + def my_pipeline(): + task = comp() + kubernetes.set_image_pull_policy(task, 'IfNotPresent') + + assert json_format.MessageToDict(my_pipeline.platform_spec) == { + 'platforms': { + 'kubernetes': { + 'deploymentSpec': { + 'executors': { + 'exec-comp': { + 'imagePullPolicy': 'IfNotPresent' + } + } + } + } + } + } + + def test_never(self): + + @dsl.pipeline + def my_pipeline(): + task = comp() + kubernetes.set_image_pull_policy(task, 'Never') + + assert json_format.MessageToDict(my_pipeline.platform_spec) == { + 'platforms': { + 'kubernetes': { + 'deploymentSpec': { + 'executors': { + 'exec-comp': { + 'imagePullPolicy': 'Never' + } + } + } + } + } + } + + +@dsl.component +def comp(): + pass diff --git a/kubernetes_platform/python/test/unit/test_image_pull_secrets.py b/kubernetes_platform/python/test/unit/test_image_pull_secrets.py new file mode 100644 index 00000000000..3aff349af82 --- /dev/null +++ b/kubernetes_platform/python/test/unit/test_image_pull_secrets.py @@ -0,0 +1,111 @@ +# Copyright 2024 The Kubeflow Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from google.protobuf import json_format +from kfp import dsl +from kfp import kubernetes + + +class TestImagePullSecret: + + def test_add_one(self): + + @dsl.pipeline + def my_pipeline(): + task = comp() + kubernetes.set_image_pull_secrets(task, ['secret-name']) + + assert json_format.MessageToDict(my_pipeline.platform_spec) == { + 'platforms': { + 'kubernetes': { + 'deploymentSpec': { + 'executors': { + 'exec-comp': { + 'imagePullSecret': [{ + 'secretName': + 'secret-name' + }] + } + } + } + } + } + } + + def test_add_two(self): + + @dsl.pipeline + def my_pipeline(): + task = comp() + kubernetes.set_image_pull_secrets(task, ['secret-name1', 'secret-name2']) + + assert json_format.MessageToDict(my_pipeline.platform_spec) == { + 'platforms': { + 'kubernetes': { + 'deploymentSpec': { + 'executors': { + 'exec-comp': { + 'imagePullSecret': [{ + 'secretName': + 'secret-name1' + }, { + 'secretName': + 'secret-name2' + }, + ] + } + } + } + } + } + } + + def test_respects_other_configuration(self): + + @dsl.pipeline + def my_pipeline(): + task = comp() + + # Load the secret as a volume + kubernetes.use_secret_as_volume( + task, secret_name='secret-name', mount_path='/mnt/my_vol') + + # Set image pull secrets for a task using secret names + kubernetes.set_image_pull_secrets(task, ['secret-name']) + + assert json_format.MessageToDict(my_pipeline.platform_spec) == { + 'platforms': { + 'kubernetes': { + 'deploymentSpec': { + 'executors': { + 'exec-comp': { + 'secretAsVolume': [{ + 'secretName': 'secret-name', + 'mountPath': '/mnt/my_vol' + }], + 'imagePullSecret': [{ + 'secretName': + 'secret-name' + }] + } + } + } + } + } + } + + +@dsl.component +def comp(): + pass diff --git a/kubernetes_platform/python/test/unit/test_timeout.py b/kubernetes_platform/python/test/unit/test_timeout.py new file mode 100644 index 00000000000..0ff38fe70d8 --- /dev/null +++ b/kubernetes_platform/python/test/unit/test_timeout.py @@ -0,0 +1,92 @@ +# Copyright 2024 The Kubeflow Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from google.protobuf import json_format +from kfp import dsl +from kfp import kubernetes +import pytest + + +class TestTimeout: + + def test_timeout(self): + + @dsl.pipeline + def my_pipeline(): + task = comp() + kubernetes.set_timeout( + task, + seconds=20 + ) + + assert json_format.MessageToDict(my_pipeline.platform_spec) == { + 'platforms': { + 'kubernetes': { + 'deploymentSpec': { + 'executors': { + 'exec-comp': { + 'activeDeadlineSeconds': '20' + } + } + } + } + } + } + + def test_reset_timeout(self): + + @dsl.pipeline + def my_pipeline(): + task = comp() + kubernetes.set_timeout( + task, + seconds=20 + ) + kubernetes.set_timeout( + task, + seconds=0 + ) + + assert json_format.MessageToDict(my_pipeline.platform_spec) == { + 'platforms': { + 'kubernetes': { + 'deploymentSpec': { + 'executors': { + 'exec-comp': { + } + } + } + } + } + } + + def test_bad_value_timeout(self): + + with pytest.raises( + ValueError, + match=r'Argument for "seconds" must be an integer greater or equals to 0. Got invalid input: -20.', + ): + + @dsl.pipeline + def my_pipeline(): + task = comp() + kubernetes.set_timeout( + task, + seconds=-20 + ) + + +@dsl.component +def comp(): + pass diff --git a/kubernetes_platform/python/test/unit/test_tolerations.py b/kubernetes_platform/python/test/unit/test_tolerations.py new file mode 100644 index 00000000000..ebfe0a6ba58 --- /dev/null +++ b/kubernetes_platform/python/test/unit/test_tolerations.py @@ -0,0 +1,177 @@ +# Copyright 2024 The Kubeflow Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from google.protobuf import json_format +from kfp import compiler +from kfp import dsl +from kfp import kubernetes + + +class TestTolerations: + + def test_add_one(self): + + @dsl.pipeline + def my_pipeline(): + task = comp() + kubernetes.add_toleration( + task, + key='key1', + operator='Equal', + value='value1', + effect='NoSchedule', + ) + + compiler.Compiler().compile( + pipeline_func=my_pipeline, package_path='my_pipeline.yaml') + + assert json_format.MessageToDict(my_pipeline.platform_spec) == { + 'platforms': { + 'kubernetes': { + 'deploymentSpec': { + 'executors': { + 'exec-comp': { + 'tolerations': [{ + 'key': 'key1', + 'operator': 'Equal', + 'value': 'value1', + 'effect': 'NoSchedule', + }] + } + } + } + } + } + } + + def test_add_one_with_toleration_seconds(self): + + @dsl.pipeline + def my_pipeline(): + task = comp() + kubernetes.add_toleration( + task, + key='key1', + operator='Equal', + value='value1', + effect='NoExecute', + toleration_seconds=10, + ) + + compiler.Compiler().compile( + pipeline_func=my_pipeline, package_path='my_pipeline.yaml') + + assert json_format.MessageToDict(my_pipeline.platform_spec) == { + 'platforms': { + 'kubernetes': { + 'deploymentSpec': { + 'executors': { + 'exec-comp': { + 'tolerations': [{ + 'key': 'key1', + 'operator': 'Equal', + 'value': 'value1', + 'effect': 'NoExecute', + 'tolerationSeconds': '10', + }] + } + } + } + } + } + } + + def test_add_two(self): + + @dsl.pipeline + def my_pipeline(): + task = comp() + kubernetes.add_toleration( + task, + key='key1', + operator='Equal', + value='value1', + ) + kubernetes.add_toleration( + task, + key='key2', + operator='Equal', + value='value2', + ) + + assert json_format.MessageToDict(my_pipeline.platform_spec) == { + 'platforms': { + 'kubernetes': { + 'deploymentSpec': { + 'executors': { + 'exec-comp': { + 'tolerations': [ + { + 'key': 'key1', + 'operator': 'Equal', + 'value': 'value1', + }, + { + 'key': 'key2', + 'operator': 'Equal', + 'value': 'value2', + }, + ] + } + } + } + } + } + } + + def test_respects_other_configuration(self): + + @dsl.pipeline + def my_pipeline(): + task = comp() + kubernetes.use_secret_as_volume( + task, secret_name='my-secret', mount_path='/mnt/my_vol') + kubernetes.add_toleration( + task, + key='key1', + operator='Equal', + value='value1', + ) + + assert json_format.MessageToDict(my_pipeline.platform_spec) == { + 'platforms': { + 'kubernetes': { + 'deploymentSpec': { + 'executors': { + 'exec-comp': { + 'tolerations': [{ + 'key': 'key1', + 'operator': 'Equal', + 'value': 'value1', + },], + 'secretAsVolume': [{ + 'secretName': 'my-secret', + 'mountPath': '/mnt/my_vol', + },], + }, + } + } + } + } + } + + +@dsl.component +def comp(): + pass