Skip to content

install pre-check#12787

Closed
irisdingbj wants to merge 5 commits intoistio:release-1.1from
irisdingbj:install-precheck
Closed

install pre-check#12787
irisdingbj wants to merge 5 commits intoistio:release-1.1from
irisdingbj:install-precheck

Conversation

@irisdingbj
Copy link
Copy Markdown
Member

@irisdingbj irisdingbj commented Mar 26, 2019

istioctl experimental verify-install

Perfom pre-check if no installation file is specified which includes below pre-check:

  • The istio-system namespace does not exist.
  • The Kubernetes cluster has met the minimum version requirement 1.11.
  • Can initialize the kubernetes client and query the kubernetes API server.
  • Can create related k8s resources in the cluster
    Namespace, ClusterRole, CustomResourceDefinition, ConfigMap, ServiceAccount , ClusterRoleBinding , Service , Deployment , Role
  • Check whether automatic sidecar injection is supported for the cluster

Example output:

istioctl experimental verify-install 

Checking the cluster to make sure it is ready for Istio installation...

kubernetes-api
-----------------------
can initialize the k8s client
can query the Kubernetes API Server

kubernetes-version
-----------------------
is running the minimum Kubernetes API version

Istio-existence
-----------------------
control plane namespace does not already exist

kubernetes-setup
-----------------------
Can create Namespace 
Can create ClusterRole 
Can create ClusterRoleBinding 
Can create CustomResourceDefinition 
Can create Role 
Can create ServiceAccount 
Can create Service 
Can create Deployments 
Can create ConfigMap 

SideCar-Injector
-----------------------
The Cluster has enabled admission webhook. Automatic sidecar injection is supported.

-----------------------
Install Pre-Check passed! The cluster is ready for Istio installation.

@istio-testing
Copy link
Copy Markdown
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: irisdingbj
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approver: costinm

If they are not already assigned, you can assign the PR to them by writing /assign @costinm in a comment when ready.

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@esnible
Copy link
Copy Markdown
Contributor

esnible commented Mar 26, 2019

The message "The Cluster has enabled admission webhook. Automatic sidecar injection is supported." does not explain enough for a new user.

I propose these messages:

@esnible
Copy link
Copy Markdown
Contributor

esnible commented Mar 26, 2019

Some of the messages (for example "Can create Namespace") are capitalized. Others (example: "can initialize the k8s client") are not. Please use the same capitalization for each sub-message.

@esnible
Copy link
Copy Markdown
Contributor

esnible commented Mar 26, 2019

Can you create a Go test that uses mock client for several of the correct and incorrect cases the new function detects?

@irisdingbj
Copy link
Copy Markdown
Member Author

irisdingbj commented Mar 27, 2019

@esnible Testing added and messages has been adjusted according to the comments.

istioctl experimental verify-install

`
Checking the cluster to make sure it is ready for Istio installation...

Kubernetes-api

Can initialize the Kubernetes client.
Can query the Kubernetes API Server.

Kubernetes-version

Istio is compatible with Kubernetes: v1.13.3.

Istio-existence

Istio will be installed in the istio-system namespace.

Kubernetes-setup

Can create necessary Kubernetes configurations: Namespace,ClusterRole,ClusterRoleBinding,CustomResourceDefinition,Role,ServiceAccount,Service,Deployments,ConfigMap.

SideCar-Injector

Istio Configured to use automatic sidecar injection for 'default' namespace.To enable injection for other namespaces see https://istio.io/docs/setup/kubernetes/additional-setup/sidecar-injection/#deploying-an-app


Install Pre-Check passed! The cluster is ready for Istio installation.`


}

func (m *mockClientExecPreCheckConfig) checkAuthorization(s *authorizationapi.SelfSubjectAccessReview) (result *authorizationapi.SelfSubjectAccessReview, err error) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line is 166 characters (from lll)

type testcase struct {
description string
config *mockClientExecPreCheckConfig
expectedResult string
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expectedResult is unused (from structcheck)

fmt.Fprintf(writer, "-----------------------\n")
ns, _ := c.getNameSpace(*istioNamespaceFlag)
if ns != nil {
return fmt.Errorf("Istio cannot be installed because the Istio namespace '%v' is already in use", *istioNamespaceFlag)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error strings should not be capitalized or end with punctuation or a newline (from golint)


if !response.Status.Allowed {
if len(response.Status.Reason) > 0 {
return fmt.Errorf("Istio installation will not succeed.Create permission lacking for:%s: %v", name, response.Status.Reason)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error strings should not be capitalized or end with punctuation or a newline (from golint)

if len(response.Status.Reason) > 0 {
return fmt.Errorf("Istio installation will not succeed.Create permission lacking for:%s: %v", name, response.Status.Reason)
}
return fmt.Errorf("Istio installation will not succeed. Create permission lacking for:%s", name)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error strings should not be capitalized or end with punctuation or a newline (from golint)

@istio-testing
Copy link
Copy Markdown
Collaborator

@irisdingbj: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
prow/istio-integ-k8s-tests.sh f643b7e link /test istio-integ-k8s-tests
prow/istio-pilot-multicluster-e2e.sh f643b7e link /test istio-pilot-multicluster-e2e
Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@irisdingbj
Copy link
Copy Markdown
Member Author

@esnible ^^^

@linsun
Copy link
Copy Markdown
Member

linsun commented Apr 2, 2019

@irisdingbj could we do master instead? Trying to limit 1.1 for critical fixes.

For master (1.2), I would like to graduate this verify-install cmd from an experimental cmd (this can be a separate PR).

@esnible any objections?

@irisdingbj
Copy link
Copy Markdown
Member Author

@esnible @linsun The PR against master is in: #12988 Thanks!

@irisdingbj irisdingbj closed this Apr 2, 2019
@irisdingbj irisdingbj deleted the install-precheck branch May 28, 2019 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants