func checkMasterVersion(c *client.Client, want string) error { v, err := c.ServerVersion() if err != nil { return fmt.Errorf("checkMasterVersion() couldn't get the master version: %v", err) } // We do prefix trimming and then matching because: // want looks like: 0.19.3-815-g50e67d4 // got looks like: v0.19.3-815-g50e67d4034e858-dirty got := strings.TrimPrefix(v.GitVersion, "v") if !strings.HasPrefix(got, want) { return fmt.Errorf("master had kube-apiserver version %s which does not start with %s", got, want) } Logf("Master is at version %s", want) return nil }