Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update ui #279

Merged
merged 4 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions examples/expose_services/deep/deep_expose.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
functions:
oscar:
- oscar-cluster:
name: plant
name: dogs-breed
memory: 3Gi
cpu: '2.0'
image: deephdc/deep-oc-plants-classification-tf
image: ai4oshub/dogs-breed-detector
log_level: CRITICAL
script: script.sh
script: deepscript.sh
environment:
Variables:
basePath: /system/services/dogs-breed/exposed/main
expose:
min_scale: 1
max_scale: 1
api_port: 5000
rewrite_target: true
cpu_threshold: 90
set_auth: true
15 changes: 0 additions & 15 deletions examples/expose_services/deep/deep_expose2.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion examples/expose_services/deep/deepscript.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
deepaas-run --openwhisk-detect --listen-ip 0.0.0.0 --listen-port 5000
deepaas-run --listen-ip 0.0.0.0 --listen-port 5000 --base-path $basePath
2 changes: 1 addition & 1 deletion pkg/handlers/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ func deletePrivateBuckets(service *types.Service, minIOAdminClient *utils.MinIOA
log.Printf("Error disabling MinIO input notifications for service \"%s\": %v\n", service.Name, err)
}
//Delete bucket and unset the associated policy
err := minIOAdminClient.EmptyPolicy(service.AllowedUsers[i])
err := minIOAdminClient.EmptyPolicy(service.AllowedUsers[i], false)
if err != nil {
fmt.Println(err)
}
Expand Down
7 changes: 6 additions & 1 deletion pkg/types/expose.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ func DeleteExpose(name string, kubeClientset kubernetes.Interface, cfg *Config)
ingressType := existsIngress(name, cfg.ServicesNamespace, kubeClientset)
if ingressType {
err = deleteIngress(getIngressName(name), kubeClientset, cfg)
if existsSecret(name, kubeClientset, cfg) {
deleteSecret(name, kubeClientset, cfg)
}
if err != nil {
return fmt.Errorf("error deleting ingress for exposed service '%s': %v", name, err)
}
Expand Down Expand Up @@ -125,6 +128,9 @@ func UpdateExpose(service Service, kubeClientset kubernetes.Interface, cfg *Conf
// New service config if NodePort
if service.Expose.NodePort != 0 {
err = deleteIngress(getIngressName(service.Name), kubeClientset, cfg)
if existsSecret(service.Name, kubeClientset, cfg) {
deleteSecret(service.Name, kubeClientset, cfg)
}
if err != nil {
log.Printf("error deleting ingress service: %v\n", err)
return err
Expand Down Expand Up @@ -547,7 +553,6 @@ func deleteIngress(name string, kubeClientset kubernetes.Interface, cfg *Config)
if err != nil {
return err
}
deleteSecret(name, kubeClientset, cfg)
return nil
}

Expand Down
17 changes: 12 additions & 5 deletions pkg/utils/minio.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,8 @@ func (minIOAdminClient *MinIOAdminClient) CreateAddPolicy(bucketName string, pol
actualPolicy.Statement = []Statement{
{
Resource: []string{rs},
Action: []string{"s3:*"},
Effect: "Allow",
},
}

Expand Down Expand Up @@ -401,10 +403,15 @@ func (minIOAdminClient *MinIOAdminClient) RemoveFromPolicy(bucketName string, po
actualPolicy := &Policy{}
json.Unmarshal(policyInfo.Policy, actualPolicy)
if len(actualPolicy.Statement[0].Resource) == 1 {
if err := minIOAdminClient.adminClient.RemoveCannedPolicy(context.TODO(), policyName); err != nil {
return fmt.Errorf("error removing canned policy: %v", err)
if policyName == ALL_USERS_GROUP {
actualPolicy.Statement[0].Effect = "Deny"
} else {
if err := minIOAdminClient.adminClient.RemoveCannedPolicy(context.TODO(), policyName); err != nil {
return fmt.Errorf("error removing canned policy: %v", err)
}
return nil
}
return nil

} else {
for i, r := range actualPolicy.Statement[0].Resource {
if r == rs {
Expand All @@ -431,8 +438,8 @@ func (minIOAdminClient *MinIOAdminClient) RemoveFromPolicy(bucketName string, po
return nil
}

func (minIOAdminClient *MinIOAdminClient) EmptyPolicy(policyName string) error {
err := minIOAdminClient.adminClient.SetPolicy(context.TODO(), "", policyName, false)
func (minIOAdminClient *MinIOAdminClient) EmptyPolicy(policyName string, group bool) error {
err := minIOAdminClient.adminClient.SetPolicy(context.TODO(), "", policyName, group)
if err != nil {
return fmt.Errorf("error setting MinIO policy for group %s: %v", policyName, err)
}
Expand Down
2 changes: 1 addition & 1 deletion ui