Skip to content

Commit b8b42d8

Browse files
committed
bump: to version 0.2.0
1 parent 94c91e6 commit b8b42d8

File tree

1 file changed

+1
-81
lines changed

1 file changed

+1
-81
lines changed

main.go

Lines changed: 1 addition & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -369,14 +369,6 @@ func createServiceAccount(clientset *kubernetes.Clientset) Result {
369369

370370
sa, err := clientset.CoreV1().ServiceAccounts(expectedNamespace).Get(context.TODO(), expectedServiceAccountName, metav1.GetOptions{})
371371

372-
if err != nil {
373-
return Result{
374-
TestName: "Question 14 - Create a service account america-sa in default namespace",
375-
Passed: false,
376-
Difficulty: "Easy",
377-
}
378-
}
379-
380372
passed := err == nil &&
381373
expectedServiceAccountName == sa.Name
382374

@@ -396,14 +388,6 @@ func addServiceAccountToDeployment(clientset *kubernetes.Clientset) Result {
396388

397389
deploy, err := clientset.AppsV1().Deployments(expectedNamespace).Get(context.TODO(), expectedDeploymentName, metav1.GetOptions{})
398390

399-
if err != nil {
400-
return Result{
401-
TestName: "Question 15 - Add service account america-sa to the deployment mark42",
402-
Passed: false,
403-
Difficulty: "Easy",
404-
}
405-
}
406-
407391
passed := err == nil &&
408392
expectedServiceAccountName == deploy.Spec.Template.Spec.ServiceAccountName
409393

@@ -423,14 +407,6 @@ func changeReplicaCount(clientset *kubernetes.Clientset) Result {
423407

424408
deploy, err := clientset.AppsV1().Deployments(expectedNamespace).Get(context.TODO(), expectedDeploymentName, metav1.GetOptions{})
425409

426-
if err != nil {
427-
return Result{
428-
TestName: "Question 16 - Change the replica count of the deployment mark42 to 5",
429-
Passed: false,
430-
Difficulty: "Easy",
431-
}
432-
}
433-
434410
passed := err == nil &&
435411
expectedReplicas == *deploy.Spec.Replicas
436412

@@ -452,14 +428,6 @@ func createHpa(clientset *kubernetes.Clientset) Result {
452428

453429
hpa, err := clientset.AutoscalingV2().HorizontalPodAutoscalers(expectedNamespace).Get(context.TODO(), expectedDeploymentName, metav1.GetOptions{})
454430

455-
if err != nil {
456-
return Result{
457-
TestName: "Question 17 - Create a horizontal pod autoscaler hpa-mark43 for deployment mark43 with cpu percent 80, min replicas 2 and max replicas 8",
458-
Passed: false,
459-
Difficulty: "Medium",
460-
}
461-
}
462-
463431
passed := err == nil &&
464432
expectedDeploymentName == hpa.Spec.ScaleTargetRef.Name &&
465433
expectedMinReplicas == *hpa.Spec.MinReplicas &&
@@ -482,14 +450,6 @@ func addSecurityContext(clientset *kubernetes.Clientset) Result {
482450

483451
deploy, err := clientset.AppsV1().Deployments(expectedNamespace).Get(context.TODO(), expectedDeploymentName, metav1.GetOptions{})
484452

485-
if err != nil {
486-
return Result{
487-
TestName: "Question 18 - Prevent privilege escalation in the deployment mark42",
488-
Passed: false,
489-
Difficulty: "Medium",
490-
}
491-
}
492-
493453
passed := deploy.Spec.Template.Spec.Containers[0].SecurityContext != nil &&
494454
*deploy.Spec.Template.Spec.Containers[0].SecurityContext.AllowPrivilegeEscalation == expectedPrivilegeEscalation
495455

@@ -513,14 +473,6 @@ func addLivenessProbe(clientset *kubernetes.Clientset) Result {
513473

514474
pod, err := clientset.CoreV1().Pods(expectedNamespace).Get(context.TODO(), expectedPodName, metav1.GetOptions{})
515475

516-
if err != nil || len(pod.Spec.Containers) == 0 || pod.Spec.Containers[0].LivenessProbe == nil {
517-
return Result{
518-
TestName: "Question 19 - Add a liveness probe to the pod mark50 with initial delay 5s, period 10s HttpGet, port 80 and path '/' in namespace shield",
519-
Passed: false,
520-
Difficulty: "Medium",
521-
}
522-
}
523-
524476
passed := err == nil &&
525477
expectedInitialDelaySeconds == pod.Spec.Containers[0].LivenessProbe.InitialDelaySeconds &&
526478
expectedPeriodSeconds == pod.Spec.Containers[0].LivenessProbe.PeriodSeconds &&
@@ -544,14 +496,6 @@ func createDeploymentYellow(clientset *kubernetes.Clientset) Result {
544496

545497
deployment, err := clientset.AppsV1().Deployments(expectedNamespace).Get(context.TODO(), expectedName, metav1.GetOptions{})
546498

547-
// if err != nil {
548-
// return Result{
549-
// TestName: "Question 20 - Create a deployment yellow-deployment with bonovoo/node-app:1.0 image and 2 replicas in namespace colors",
550-
// Passed: false,
551-
// Difficulty: "Easy",
552-
// }
553-
// }
554-
555499
passed := err == nil &&
556500
expectedImage == deployment.Spec.Template.Spec.Containers[0].Image &&
557501
expectedReplicas == *deployment.Spec.Replicas
@@ -574,14 +518,6 @@ func createServiceForYellow(clientset *kubernetes.Clientset) Result {
574518

575519
service, err := clientset.CoreV1().Services(expectedNamespace).Get(context.TODO(), expectedServiceName, metav1.GetOptions{})
576520

577-
if err != nil {
578-
return Result{
579-
TestName: "Question 21 - Create a service yellow-service for the deployment yellow-deployment in namespace colors with port 80 and target port 3000",
580-
Passed: false,
581-
Difficulty: "Hard",
582-
}
583-
}
584-
585521
passed := err == nil &&
586522
expectedPort == service.Spec.Ports[0].Port &&
587523
expectedTargetPort == service.Spec.Ports[0].TargetPort.IntVal
@@ -611,14 +547,6 @@ func createIngressYellow(clientset *kubernetes.Clientset) Result {
611547

612548
ingress, err := clientset.NetworkingV1().Ingresses(expectedNamespace).Get(context.TODO(), expectedName, metav1.GetOptions{})
613549

614-
if err != nil {
615-
return Result{
616-
TestName: "Question 22 - Create an ingress ingress-colors with host yellow.com, path /yellow and service yellow-service in namespace colors",
617-
Passed: false,
618-
Difficulty: "Hard",
619-
}
620-
}
621-
622550
ingressSpec := &ingress.Spec
623551
rules := ingressSpec.Rules
624552

@@ -646,14 +574,6 @@ func createRoleOne(clientset *kubernetes.Clientset) Result {
646574

647575
role, err := clientset.RbacV1().Roles(expectedNamespace).Get(context.TODO(), expectedName, metav1.GetOptions{})
648576

649-
if err != nil {
650-
return Result{
651-
TestName: "Question 23 - Create a role apple-one with verbs get, list, watch in namespace fruits",
652-
Passed: false,
653-
Difficulty: "Medium",
654-
}
655-
}
656-
657577
passed := err == nil &&
658578
expectedResource == role.Rules[0].Resources[0]
659579

@@ -752,7 +672,7 @@ func createStateFulSet(clientset *kubernetes.Clientset) Result {
752672
// render table of results
753673
func renderResultsTable(results []Result) {
754674
table := tablewriter.NewWriter(os.Stdout)
755-
table.SetHeader([]string{"KubeLearn - Test your knowledge of Kubernetes v0.1.8", "Result", "Difficulty"})
675+
table.SetHeader([]string{"KubeLearn - Test your knowledge of Kubernetes v0.2.0", "Result", "Difficulty"})
756676
table.SetAutoWrapText(false)
757677

758678
for _, result := range results {

0 commit comments

Comments
 (0)