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

Licensing support #1337

Merged
merged 166 commits into from
Aug 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
166 commits
Select commit Hold shift + click to select a range
ff83a10
Null check on crd object list in mutating webhook delete
devdattakulkarni Dec 18, 2023
bcd1fbc
Removing previous chart if one exists (helmer and kubeconfiggenerator)
devdattakulkarni Dec 18, 2023
1e52294
README and examples updates to use KubePlus 3.0.31
devdattakulkarni Dec 18, 2023
3bcf670
Plugins update
devdattakulkarni Dec 18, 2023
87afcc1
Added utility to parse API server URL of the current context
devdattakulkarni Dec 21, 2023
f4ac45d
For metrics and logs using Pods within the NS of the instance
devdattakulkarni Dec 30, 2023
49d68ad
Merging kubeplus-kubectl-plugins.tar.gz from master branch
devdattakulkarni Dec 30, 2023
d36b7f0
Adding a label to identify CRDs registered by KubePlus
devdattakulkarni Jan 7, 2024
ea2f55b
KubePlus chart - 3.0.32
devdattakulkarni Jan 7, 2024
42722a7
Application upgrade improvements
devdattakulkarni Jan 10, 2024
3ee39d0
KubePlus chart - 3.0.33
devdattakulkarni Jan 10, 2024
2c293f1
Examples and README updates to use KubePlus chart - 3.0.33
devdattakulkarni Jan 10, 2024
b5f3c50
Service CRD name check
devdattakulkarni Feb 7, 2024
0dda834
KubePlus chart update - 3.0.34
devdattakulkarni Feb 7, 2024
5b16f8b
Merge branch 'master' into develop
devdattakulkarni Feb 7, 2024
df33fd1
Resourcecomposition upgrade update
devdattakulkarni Feb 16, 2024
75c946b
KubePlus chart - 3.0.35
devdattakulkarni Feb 16, 2024
7b63caa
Merge branch 'master' into develop
devdattakulkarni Feb 16, 2024
e68b41c
Merge branch 'master' into develop
devdattakulkarni Feb 16, 2024
fd82ecc
Examples and README updated to refer to 3.0.35 chart
devdattakulkarni Feb 16, 2024
e48af2e
Update to parse-api-server-url.sh
devdattakulkarni Feb 16, 2024
5b37719
Merge branch 'master' into develop
devdattakulkarni Feb 16, 2024
5612568
Merge branch 'master' of https://github.com/cloud-ark/kubeplus into d…
devdattakulkarni Apr 7, 2024
10b29e1
README updates
devdattakulkarni Apr 7, 2024
a2aebd7
Added slack channel on CNCF workspace
devdattakulkarni Apr 12, 2024
9ea2f19
KubePlus control center script removal
devdattakulkarni Apr 17, 2024
2193c12
Contributing doc updates
devdattakulkarni Apr 17, 2024
056fc08
README updates
devdattakulkarni Apr 17, 2024
a52b7b1
Merge branch 'master' into develop
devdattakulkarni Apr 17, 2024
1f138ed
Merge branch 'master' into develop
devdattakulkarni Apr 18, 2024
20ae0db
Wordpress example steps update
devdattakulkarni Apr 18, 2024
a18bad3
Merge branch 'master' into develop
devdattakulkarni Apr 25, 2024
086899c
Test suite update
devdattakulkarni Apr 25, 2024
1c9f87a
Tests update
devdattakulkarni Apr 25, 2024
74487fc
Merge branch 'master' into develop
devdattakulkarni Apr 26, 2024
5ae6bf0
Added README in tests folder
devdattakulkarni Apr 26, 2024
f9f9ca4
Merge branch 'master' into develop
devdattakulkarni Apr 26, 2024
b2c3510
KubePlus Helm chart update - 3.0.36
devdattakulkarni Apr 26, 2024
373b29c
Merge branch 'master' into develop
devdattakulkarni Apr 28, 2024
c9adc75
Updated command-line flag help messages in provider kubeconfiggenerator
devdattakulkarni Apr 28, 2024
e1fe830
Tests update
devdattakulkarni Apr 28, 2024
26cc793
Merge branch 'master' into develop
devdattakulkarni Apr 29, 2024
0ce98ec
Modified provider-kubeconfig.py to extract kubeconfig from a cluster
devdattakulkarni Apr 7, 2024
116e8d7
provider-kubeconfig.py cleanup
devdattakulkarni Apr 29, 2024
b55c41d
Merge branch 'master' into develop
devdattakulkarni Apr 29, 2024
c29f03e
Merge branch 'master' into develop
devdattakulkarni Apr 30, 2024
8e7ba93
Updated Contributing guidelines
devdattakulkarni Apr 30, 2024
800903f
Merge branch 'master' into develop
devdattakulkarni Apr 30, 2024
0e13271
hello-world example update
devdattakulkarni Apr 30, 2024
3084fe8
wordpress example update
devdattakulkarni Apr 30, 2024
67ddf3a
Merge branch 'master' into develop
devdattakulkarni Apr 30, 2024
a822683
Documentation updates
devdattakulkarni May 1, 2024
7b1ea4d
Merge branch 'master' into develop
devdattakulkarni May 1, 2024
1623dae
README updates
devdattakulkarni May 1, 2024
c6f195c
Merge branch 'master' into develop
devdattakulkarni May 1, 2024
1ca86a8
Consumer UI updates
devdattakulkarni May 4, 2024
7b7a19b
Merge branch 'master' into develop
devdattakulkarni May 4, 2024
a7cd13a
KubePlus chart update - 3.0.37
devdattakulkarni May 4, 2024
e22b0a5
Link to Slack invitation and includes missing updates to Chart.yaml
devdattakulkarni May 6, 2024
d1e8a00
Merge branch 'master' into develop
devdattakulkarni May 6, 2024
e86b689
Application upgrade
devdattakulkarni May 8, 2024
ff5db0c
Merge branch 'master' into develop
devdattakulkarni May 8, 2024
a602470
KubePlus chart - 3.0.38
devdattakulkarni May 8, 2024
e90d28f
Merge branch 'master' into develop
devdattakulkarni May 8, 2024
6a7d383
Merge branch 'master' into develop
devdattakulkarni May 8, 2024
0d26fb0
Added Use cases
devdattakulkarni May 8, 2024
a124418
Merge branch 'master' into develop
devdattakulkarni May 8, 2024
74d6767
Use cases - correct links
devdattakulkarni May 8, 2024
186da0b
Merge branch 'master' into develop
devdattakulkarni May 9, 2024
ed510d8
README updated
devdattakulkarni May 9, 2024
cf2e0dc
Merge branch 'master' into develop
devdattakulkarni May 9, 2024
47d084a
Examples - cleanup
devdattakulkarni May 10, 2024
0b2b896
Merge branch 'master' into develop
devdattakulkarni May 10, 2024
8ffb393
Docs cleanup
devdattakulkarni May 10, 2024
93e8eb5
mutating-webhook - folder cleanup
devdattakulkarni May 10, 2024
c192a2c
Merge branch 'master' into develop
devdattakulkarni May 10, 2024
9243351
platform-operator cleanup
devdattakulkarni May 10, 2024
5099a47
Merge branch 'master' into develop
devdattakulkarni May 10, 2024
57fac82
plugins folder cleanup
devdattakulkarni May 10, 2024
0e41c1a
Merge branch 'master' into develop
devdattakulkarni May 10, 2024
52626c0
More cleanup
devdattakulkarni May 10, 2024
e42a952
Merge branch 'master' into develop
devdattakulkarni May 10, 2024
14d5e9f
Cleanup ++
devdattakulkarni May 10, 2024
56e5b86
Dockerfile updates to download kubectl and helm binaries
devdattakulkarni May 11, 2024
49b4d8e
KubePlus chart - 3.0.39
devdattakulkarni May 11, 2024
007654e
Merge branch 'master' into develop
devdattakulkarni May 11, 2024
07f4eda
Added link to KubePlus mailing list
devdattakulkarni May 14, 2024
1685579
Merge branch 'master' into develop
devdattakulkarni May 16, 2024
dd0ec71
README updates
devdattakulkarni May 16, 2024
13fdc8e
README update
devdattakulkarni May 31, 2024
753bdf2
Merge branch 'master' into develop
devdattakulkarni Jun 3, 2024
9053ff7
GitHub Actions
devdattakulkarni Jun 3, 2024
03d789b
Github actions - take 2
devdattakulkarni Jun 3, 2024
c2c7506
Github actions - take 4
devdattakulkarni Jun 3, 2024
94b44ba
Github actions - take 5
devdattakulkarni Jun 3, 2024
1bc0b62
Github actions - take 6
devdattakulkarni Jun 3, 2024
3d7e0e9
Github actions - take 7
devdattakulkarni Jun 3, 2024
df0b3c7
Github actions - trial 8
devdattakulkarni Jun 3, 2024
dee417f
Github actions - trial 9
devdattakulkarni Jun 3, 2024
b69a489
Github actions - trial 10
devdattakulkarni Jun 3, 2024
181688e
README update
devdattakulkarni Jun 3, 2024
35ef449
Merge branch 'master' into develop
devdattakulkarni Jun 4, 2024
1952e6f
Github actions update - running tests
devdattakulkarni Jun 4, 2024
7c3e246
Github actions - enabling detailed logs
devdattakulkarni Jun 4, 2024
af80362
Github action - Added sleep and enabling test output
devdattakulkarni Jun 4, 2024
b9a027b
Tests update
devdattakulkarni Jun 4, 2024
ce04dd5
Tests update
devdattakulkarni Jun 4, 2024
c60a03e
Github action - running tests
devdattakulkarni Jun 4, 2024
0beca73
Github action update - installing KubePlus chart from deploy dir
devdattakulkarni Jun 4, 2024
f81c66a
Github action update - installing KubePlus chart from deploy dir
devdattakulkarni Jun 4, 2024
f0c326c
Merge branch 'master' into develop
devdattakulkarni Jun 4, 2024
8b39592
Merge branch 'develop' of github.com:cloud-ark/kubeplus into develop
devdattakulkarni Jun 4, 2024
9d75c5b
Updates to helmer and tests
devdattakulkarni Jun 5, 2024
782fff0
KubePlus chart - 3.0.40
devdattakulkarni Jun 5, 2024
6493a81
Support for application force delete
devdattakulkarni Jun 6, 2024
2cf8401
Merge branch 'master' into develop
devdattakulkarni Jun 6, 2024
d474c4a
KubePlus chart update - 3.0.41
devdattakulkarni Jun 6, 2024
ae89314
Merge branch 'master' into develop
devdattakulkarni Jun 10, 2024
48a7897
README update - Referencing GitHub pages site
devdattakulkarni Jun 10, 2024
680538a
Updating import
devdattakulkarni Jun 11, 2024
85f3021
Merge branch 'master' into develop
devdattakulkarni Jun 11, 2024
0c60975
GitHub Action update
devdattakulkarni Jun 11, 2024
9be6cb7
GitHub action update
devdattakulkarni Jun 11, 2024
14c565d
GitHub action update
devdattakulkarni Jun 11, 2024
6d0717c
GitHub action update - take 4
devdattakulkarni Jun 11, 2024
27fd4c2
GitHub action update - take 5
devdattakulkarni Jun 11, 2024
e5f60ba
GitHub action update - take 6
devdattakulkarni Jun 12, 2024
d798544
GitHub action update - take 7
devdattakulkarni Jun 12, 2024
009001c
GitHub action update - take 8
devdattakulkarni Jun 12, 2024
ad4a657
GitHub action update - take 9
devdattakulkarni Jun 12, 2024
bde3617
GitHub action update - take 10
devdattakulkarni Jun 12, 2024
c4dfabf
GitHub action update - take 11
devdattakulkarni Jun 12, 2024
b07fd98
GitHub action update - take 12
devdattakulkarni Jun 12, 2024
156f16f
GitHub action update - take 13
devdattakulkarni Jun 12, 2024
bd4dc71
GitHub action update - take 14
devdattakulkarni Jun 12, 2024
7b8467f
Merge branch 'master' into develop
devdattakulkarni Jun 12, 2024
88cebd5
platform-operator updates
devdattakulkarni Jun 12, 2024
445ca2c
KubePlus chart - 3.0.42
devdattakulkarni Jun 12, 2024
5e138c7
Merge branch 'master' into develop
devdattakulkarni Jun 12, 2024
f08e7f8
Removing kubediscovery as submodule
devdattakulkarni Jun 12, 2024
87ca40b
Merge branch 'master' into develop
devdattakulkarni Jun 12, 2024
bdec5a8
Merge branch 'master' into develop
devdattakulkarni Jun 13, 2024
ac5606b
Added ephemeral-storage request to component containers
devdattakulkarni Jun 13, 2024
ffcb794
Merge branch 'master' into develop
devdattakulkarni Jun 16, 2024
3cfef41
Day2 operation example update
devdattakulkarni Jun 16, 2024
c222e72
Example updates
devdattakulkarni Jun 19, 2024
b5c485b
Examples update - cleanup
devdattakulkarni Jun 19, 2024
20b234d
Merge branch 'master' into develop
devdattakulkarni Jun 19, 2024
56bf569
Merge branch 'master' into develop
devdattakulkarni Jun 22, 2024
af51633
KubePlus chart update - version 3.0.44
devdattakulkarni Jun 22, 2024
65bdcfe
Merge branch 'master' into develop
devdattakulkarni Jul 25, 2024
66578a1
Ignoring Succeeded Pods when calculating num_of_not_running pods
devdattakulkarni Jul 25, 2024
8d858ca
Rejecting cr instance creation if previous NS is in Terminating state
devdattakulkarni Jul 25, 2024
71408e2
Merge branch 'master' into develop
devdattakulkarni Jul 25, 2024
15f457c
AdmissionResponse cannot be empty string
devdattakulkarni Jul 25, 2024
71d7f6d
Correctly checking if previous NS not in Terminating state
devdattakulkarni Jul 26, 2024
1039bc2
Merge branch 'master' into develop
devdattakulkarni Jul 26, 2024
fce2971
Merge branch 'master' into develop
devdattakulkarni Jul 26, 2024
55a2165
KubePlus chart - 3.0.45
devdattakulkarni Jul 26, 2024
3f9d5cb
WIP: Licensing support
devdattakulkarni Aug 2, 2024
dbd5e8f
Merge branch 'master' into develop
devdattakulkarni Aug 2, 2024
e41ec1b
License support - tests
devdattakulkarni Aug 3, 2024
6c4f032
License support - GH action typo fix
devdattakulkarni Aug 3, 2024
432f2de
License support - Test cleanup and README update
devdattakulkarni Aug 3, 2024
18f016a
License support - tests and README update
devdattakulkarni Aug 3, 2024
a5e62f8
License support - review feedback update
devdattakulkarni Aug 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ jobs:
cd $KUBEPLUS_HOME/platform-operator
./build-artifact.sh latest

#echo "Building kubeconfiggenerator..."
#cd $KUBEPLUS_HOME/deploy
#./build-artifact-kubeconfiggenerator.sh latest
echo "Building kubeconfiggenerator..."
cd $KUBEPLUS_HOME/deploy
./build-artifact-kubeconfiggenerator.sh latest
#echo "Building webhook_init_container..."
#./build-artifact.sh latest
#echo "Building resource cleaner..."
Expand All @@ -87,7 +87,7 @@ jobs:
docker images

echo "Installing KubePlus..."
helm install kubeplus ./deploy/kubeplus-chart --kubeconfig=kubeplus-saas-provider.json --set MUTATING_WEBHOOK=gcr.io/cloudark-kubeplus/pac-mutating-admission-webhook:latest --set PLATFORM_OPERATOR=gcr.io/cloudark-kubeplus/platform-operator:latest --set HELMER=gcr.io/cloudark-kubeplus/helm-pod:latest -n $KUBEPLUS_NS
helm install kubeplus ./deploy/kubeplus-chart --kubeconfig=kubeplus-saas-provider.json --set MUTATING_WEBHOOK=gcr.io/cloudark-kubeplus/pac-mutating-admission-webhook:latest --set PLATFORM_OPERATOR=gcr.io/cloudark-kubeplus/platform-operator:latest --set HELMER=gcr.io/cloudark-kubeplus/helm-pod:latest --set CRD_REGISTRATION_HELPER=gcr.io/cloudark-kubeplus/kubeconfiggenerator:latest -n $KUBEPLUS_NS

kubectl get pods -A

Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ The KubePlus Operator does not need any admin-level permissions on a cluster for

### Resource utilization

KubePlus provides controls to set per-namespace resource quotas. It also monitors usage of CPU, memory, storage, and network traffic at the application instance level. The collected metrics are available in different formats and can be pulled into Prometheus for historical usage tracking.
KubePlus provides controls to set per-namespace resource quotas. It also monitors usage of CPU, memory, storage, and network traffic at the application instance level. The collected metrics are available in different formats and can be pulled into Prometheus for historical usage tracking. KubePlus also supports ability to define licenses for the CRDs. A license defines the number of application instances that can be created for that CRD, and an expiry date. KubePlus prevents creation of application instances if the license terms are not met.

### Upgrades

Expand All @@ -37,7 +37,8 @@ A new version of an application can be deployed by updating the application Helm

### Customization

The spec properties of the Kubernetes CRD wrapping the application Helm chart are the fields defined in the chart’s values.yaml file. Application deployments can be customized by specifying different values for these spec properties.
The spec properties of the Kubernetes CRD wrapping the application Helm chart are the fields defined in the chart’s values.yaml file. Application deployments can be customized by specifying different values for these spec properties.


## Demo

Expand Down
61 changes: 61 additions & 0 deletions deploy/kubeconfiggenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import os
import yaml
import time
from datetime import date

from logging.config import dictConfig

Expand Down Expand Up @@ -1181,6 +1182,66 @@ def create_network_policy():
return err_string


@app.route("/checklicense")
def check_license():
app.logger.info("Inside checklicense..")
namespace = request.args.get("namespace").strip()
kind = request.args.get("kind").strip()
app.logger.info("Namespace:" + namespace + " kind:" + kind)
license_cfgmap = kind.lower() + "-license"
app.logger.info("License configmap:" + license_cfgmap)
cmd = "kubectl get configmap " + license_cfgmap + " -n " + namespace + " -o json "
out, err = run_command(cmd)
if "NotFound" in err:
app.logger.info(str(err))
app.logger.info("License not defined. No checks are needed.")
return ""

json_op = json.loads(out)
allowed_instances = ""
expiry = ""
if "allowed_instances" in json_op["metadata"]["annotations"]:
allowed_instances = json_op["metadata"]["annotations"]["allowed_instances"]
app.logger.info("Allowed instances:" + allowed_instances)
if "expiry" in json_op["metadata"]["annotations"]:
expiry = json_op["metadata"]["annotations"]["expiry"]
app.logger.info("Expiry:" + expiry)

msg = ""

if allowed_instances != "":
cmd1 = "kubectl get " + kind
out1, err1 = run_command(cmd1)
created_instances = 0
for line in out1.split("\n"):
line = line.strip()
app.logger.info("Line:" + line + "\n")
if "NAME" not in line and "AGE" not in line and line != "":
created_instances = created_instances + 1
app.logger.info("Already created instances:" + str(created_instances))

if created_instances >= int(allowed_instances):
msg = msg + "Allowed number of instances reached."

if expiry != "":
parts = expiry.split("/")
if len(parts) == 3 :
month = int(parts[0].strip())
day = int(parts[1].strip())
year = int(parts[2].strip())

expiry_date = date(year, month, day)
today = date.today()
app.logger.info("Expiry date:" + str(expiry_date))
app.logger.info("Today:" + str(today))
if today > expiry_date:
msg = msg + " License expired (expiry date):" + str(expiry) + "."

app.logger.info("License check message:" + msg)

return msg


@app.route("/resource_quota")
def create_resource_quota():
app.logger.info("Inside create_resource_quota..")
Expand Down
3 changes: 2 additions & 1 deletion examples/multitenancy/hello-world/hs2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ kind: HelloWorldService
metadata:
name: hs2
spec:
greeting: Hello1 hello hello
greeting: Hello hello hello - hs2
replicas: 1

53 changes: 32 additions & 21 deletions mutating-webhook/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -814,10 +814,10 @@ func GetPlural(kind, group string) []byte {
}

func CheckResource(kind, plural string) []byte {
fmt.Printf("Inside CheckResource...\n")
//fmt.Printf("Inside CheckResource...\n")
args := fmt.Sprintf("kind=%s&plural=%s", kind, plural)
url1 := fmt.Sprintf("http://%s:%s/apis/kubeplus/checkResource?%s", serviceHost, servicePort, args)
fmt.Printf("Url:%s\n", url1)
//fmt.Printf("Url:%s\n", url1)
body := queryKubeDiscoveryService(url1)
return body
}
Expand Down Expand Up @@ -862,14 +862,25 @@ func QueryDeployEndpoint(platformworkflow, customresource, namespace, overrides,
CreateOverrides(platformworkflow, customresource)

args := fmt.Sprintf("platformworkflow=%s&customresource=%s&namespace=%s&overrides=%s&cpu_req=%s&cpu_lim=%s&mem_req=%s&mem_lim=%s&labels=%s", platformworkflow, customresource, namespace, encodedOverrides, cpu_req, cpu_lim, mem_req, mem_lim,labels)
fmt.Printf("Inside QueryDeployEndpoint...\n")
//fmt.Printf("Inside QueryDeployEndpoint...\n")
var url1 string
url1 = fmt.Sprintf("http://%s:%s/apis/kubeplus/deploy?%s", serviceHost, servicePort, args)
fmt.Printf("Url:%s\n", url1)
//fmt.Printf("Url:%s\n", url1)
body := queryKubeDiscoveryService(url1)
return body
}

func CheckLicense(kind, webhook_namespace string) string {
//fmt.Printf("Inside CheckLicense...\n")
args := fmt.Sprintf("kind=%s&namespace=%s", kind, webhook_namespace)
var url1 string
url1 = fmt.Sprintf("http://%s:%s/checklicense?%s", serviceHost, verificationServicePort, args)
//fmt.Printf("Url:%s\n", url1)
body := queryKubeDiscoveryService(url1)
bodyString := string(body)
return bodyString
}

func DryRunChart(platformworkflow, namespace string) []byte {
args := fmt.Sprintf("platformworkflow=%s&namespace=%s&dryrun=true", platformworkflow, namespace)
fmt.Printf("Inside DryRunChart...\n")
Expand All @@ -892,25 +903,25 @@ func TestChartDeployment(kind, namespace, chartName, chartURL string) []byte {
}

func CreateOverrides(platformworkflow, customresource string) []byte {
fmt.Printf("Inside CreateOverrides...\n")
//fmt.Printf("Inside CreateOverrides...\n")
args := fmt.Sprintf("platformworkflow=%s&customresource=%s", platformworkflow, customresource)
var url1 string
url1 = fmt.Sprintf("http://%s:%s/overrides?%s", serviceHost, verificationServicePort, args)
fmt.Printf("Url:%s\n", url1)
//fmt.Printf("Url:%s\n", url1)
body := queryKubeDiscoveryService(url1)
return body
}

func CheckClusterCapacity(cpuRequests, cpuLimits, memRequests, memLimits string) (bool, string) {
fmt.Printf("Inside CheckClusterCapacity...\n")
//fmt.Printf("Inside CheckClusterCapacity...\n")
var url1 string
url1 = fmt.Sprintf("http://%s:%s/cluster_capacity", serviceHost, verificationServicePort)
fmt.Printf("Url:%s\n", url1)
//fmt.Printf("Url:%s\n", url1)
body := queryKubeDiscoveryService(url1)

var clusterCapacity ClusterCapacity
json.Unmarshal(body, &clusterCapacity)
fmt.Printf("Cluster Capacity:%v\n", clusterCapacity)
//fmt.Printf("Cluster Capacity:%v\n", clusterCapacity)

bodyString := string(body)
//jsonresp := bodyString.(map[string]string)
Expand All @@ -926,9 +937,9 @@ func CheckClusterCapacity(cpuRequests, cpuLimits, memRequests, memLimits string)
memParts := strings.Split(parts[1],":")
totalAllocatableMemoryGB, _ := strconv.ParseFloat(strings.TrimSpace(memParts[1]), 64)

fmt.Printf("Total Allocatable CPU:%d\n", totalAllocatableCPU)
/*fmt.Printf("Total Allocatable CPU:%d\n", totalAllocatableCPU)
fmt.Printf("Total Allocatable Memory:%f\n", totalAllocatableMemoryGB)

*/
cpuRequestsI, _ := strconv.Atoi(strings.TrimSpace(strings.ReplaceAll(cpuRequests, "m", "")))
cpuLimitsI, _ := strconv.Atoi(strings.TrimSpace(strings.ReplaceAll(cpuLimits, "m", "")))

Expand Down Expand Up @@ -962,23 +973,23 @@ func GetExistingResourceCompositions() []byte {
}

func CheckChartExists(chartURL string) []byte {
fmt.Printf("Inside CheckChartExists...\n")
//fmt.Printf("Inside CheckChartExists...\n")
encodedChartURL := url.QueryEscape(chartURL)
args := fmt.Sprintf("chartURL=%s", encodedChartURL)
var url1 string
url1 = fmt.Sprintf("http://%s:%s/checkchartexists?%s", serviceHost, verificationServicePort, args)
fmt.Printf("Url:%s\n", url1)
//fmt.Printf("Url:%s\n", url1)
body := queryKubeDiscoveryService(url1)
return body
}

func LintChart(chartURL string) []byte {
fmt.Printf("Inside LintChart...\n")
//fmt.Printf("Inside LintChart...\n")
encodedChartURL := url.QueryEscape(chartURL)
args := fmt.Sprintf("chartURL=%s", encodedChartURL)
var url1 string
url1 = fmt.Sprintf("http://%s:%s/dryrunchart?%s", serviceHost, verificationServicePort, args)
fmt.Printf("Url:%s\n", url1)
//fmt.Printf("Url:%s\n", url1)
body := queryKubeDiscoveryService(url1)
return body
}
Expand Down Expand Up @@ -1015,10 +1026,10 @@ func QueryCompositionEndpoint(kind, namespace, crdKindName string) []byte {

func GetValuesYaml(platformworkflow, namespace string) []byte {
args := fmt.Sprintf("platformworkflow=%s&namespace=%s", platformworkflow, namespace)
fmt.Printf("Inside GetValuesYaml...\n")
//fmt.Printf("Inside GetValuesYaml...\n")
var url1 string
url1 = fmt.Sprintf("http://%s:%s/apis/kubeplus/getchartvalues?%s", serviceHost, servicePort, args)
fmt.Printf("Url:%s\n", url1)
//fmt.Printf("Url:%s\n", url1)
body := queryKubeDiscoveryService(url1)
return body
}
Expand Down Expand Up @@ -1052,7 +1063,7 @@ func getServiceEndpoint(servicename string) (string, string) {

// Rename this function to a more generic name since we use it to trigger Custom Resource deployment as well.
func queryKubeDiscoveryService(url1 string) []byte {
fmt.Printf("..inside queryKubeDiscoveryService")
//fmt.Printf("..inside queryKubeDiscoveryService")
u, err := url.Parse(url1)
//fmt.Printf("URL:%s\n",u)
if err != nil {
Expand All @@ -1074,9 +1085,9 @@ func queryKubeDiscoveryService(url1 string) []byte {
defer resp.Body.Close()
resp_body, _ := ioutil.ReadAll(resp.Body)

fmt.Println("Response status:%s\n",resp.Status)
fmt.Println("Response body:%s\n",string(resp_body))
fmt.Println("Exiting queryKubeDiscoveryService")
//fmt.Println("Response status:%s\n",resp.Status)
//fmt.Println("Response body:%s\n",string(resp_body))
//fmt.Println("Exiting queryKubeDiscoveryService")
return resp_body
}

Expand Down
Loading
Loading