Skip to content

Commit

Permalink
Merge branch 'dev' into partition-autobalancer-planner
Browse files Browse the repository at this point in the history
  • Loading branch information
ZeDRoman committed Jul 19, 2022
2 parents 0cfcd63 + 3c02b03 commit 143db2c
Show file tree
Hide file tree
Showing 308 changed files with 8,289 additions and 2,427 deletions.
2 changes: 1 addition & 1 deletion cmake/oss.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ ExternalProject_Add(fmt

ExternalProject_Add(seastar
GIT_REPOSITORY https://github.com/redpanda-data/seastar.git
GIT_TAG 16d4456f86e344d6c240c431045957e111ec213f
GIT_TAG 8f98d69bcbd2473eb9915204bd8fd1665e609739
INSTALL_DIR @REDPANDA_DEPS_INSTALL_DIR@
CMAKE_COMMAND ${CMAKE_COMMAND} -E env ${cmake_build_env} ${CMAKE_COMMAND}
CMAKE_ARGS
Expand Down
4 changes: 2 additions & 2 deletions conf/redpanda.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ redpanda:
developer_mode: true

# Enable Pandaproxy
pandaproxy:
pandaproxy: {}

# Enable Schema Registry
schema_registry:
schema_registry: {}

rpk:
# TLS configuration.
Expand Down
20 changes: 10 additions & 10 deletions src/go/k8s/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Official Kubernetes quick start documentation can be found at
* kustomize v3.8.7 or newer
* cert-manager v1.0.0 or newer

Optionaly to run operator locally:
Optionally to run operator locally:

* kind v0.9.0 or newer

Expand All @@ -30,7 +30,7 @@ Optionaly to run operator locally:

Create local Kubernetes cluster using KIND

```
```bash
export KUBECONFIG=your/path/to/kubeconfig.yaml
kind create cluster --config kind.yaml
```
Expand All @@ -47,19 +47,19 @@ resources. To verify that cert manager is ready please follow

You can simply deploy the Redpanda operator with webhook (recommended) by running the following command

```
```bash
kubectl apply -k https://github.com/redpanda-data/redpanda/src/go/k8s/config/default
```

You can deploy the Redpanda operator without webhook by running the following command:

```
```bash
kubectl apply -k https://github.com/redpanda-data/redpanda/src/go/k8s/config/without-webhook
```

Install sample RedpandaCluster custom resource

```
```bash
kubectl apply -f https://raw.githubusercontent.com/redpanda-data/redpanda/dev/src/go/k8s/config/samples/one_node_cluster.yaml
```

Expand All @@ -68,26 +68,26 @@ kubectl apply -f https://raw.githubusercontent.com/redpanda-data/redpanda/dev/sr

Create kind cluster

```
```bash
make kind-create
```

Install cert manager

```
```bash
make certmanager-install
```

Build docker images for manager and configurator

```
```bash
make docker-build
make docker-build-configurator
```

Deploy operator to kind

```
```bash
make deploy-to-kind
```

Expand All @@ -96,6 +96,6 @@ make deploy-to-kind
To remove all resources even the running Redpanda cluster
please run the following command:

```
```bash
kubectl delete -k https://github.com/redpanda-data/redpanda/src/go/k8s/config/default
```
19 changes: 13 additions & 6 deletions src/go/rpk/pkg/api/admin/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -499,16 +499,23 @@ func maybeUnmarshalRespInto(

// sendAndReceive sends a request and returns the response. If body is
// non-nil, this json encodes the body and sends it with the request.
// If the body is already an io.Reader, the reader is used directly
// without marshaling.
func (a *AdminAPI) sendAndReceive(
ctx context.Context, method, url string, body interface{}, retryable bool,
) (*http.Response, error) {
var r io.Reader
if body != nil {
bs, err := json.Marshal(body)
if err != nil {
return nil, fmt.Errorf("unable to encode request body for %s %s: %w", method, url, err) // should not happen
// We might be passing io reader already as body, e.g: license file.
if v, ok := body.(io.Reader); ok {
r = v
} else {
bs, err := json.Marshal(body)
if err != nil {
return nil, fmt.Errorf("unable to encode request body for %s %s: %w", method, url, err) // should not happen
}
r = bytes.NewBuffer(bs)
}
r = bytes.NewBuffer(bs)
}

req, err := http.NewRequestWithContext(ctx, method, url, r)
Expand Down Expand Up @@ -549,7 +556,7 @@ func (a *AdminAPI) sendAndReceive(
if err != nil {
return nil, fmt.Errorf("request %s %s failed: %s, unable to read body: %w", method, url, status, err)
}
return nil, &HTTPResponseError{Response: res, Body: resBody}
return nil, &HTTPResponseError{Response: res, Body: resBody, Method: method, URL: url}
}

return res, nil
Expand All @@ -562,6 +569,6 @@ func (he HTTPResponseError) DecodeGenericErrorBody() (GenericErrorBody, error) {
}

func (he HTTPResponseError) Error() string {
return fmt.Sprintf("request %s %s failed: %s, body: %q",
return fmt.Sprintf("request %s %s failed: %s, body: %q\n",
he.Method, he.URL, http.StatusText(he.Response.StatusCode), he.Body)
}
21 changes: 21 additions & 0 deletions src/go/rpk/pkg/api/admin/api_features.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,18 @@ type FeaturesResponse struct {
Features []Feature `json:"features"`
}

type License struct {
Loaded bool `json:"loaded"`
Properties LicenseProperties `json:"license"`
}

type LicenseProperties struct {
Version int `json:"format_version"`
Organization string `json:"org"`
Type string `json:"type"`
Expires int `json:"expires"`
}

// GetFeatures returns information about the available features.
func (a *AdminAPI) GetFeatures(ctx context.Context) (FeaturesResponse, error) {
var features FeaturesResponse
Expand All @@ -48,3 +60,12 @@ func (a *AdminAPI) GetFeatures(ctx context.Context) (FeaturesResponse, error) {
nil,
&features)
}

func (a *AdminAPI) GetLicenseInfo(ctx context.Context) (License, error) {
var license License
return license, a.sendAny(ctx, http.MethodGet, "/v1/features/license", nil, &license)
}

func (a *AdminAPI) SetLicense(ctx context.Context, license interface{}) error {
return a.sendToLeader(ctx, http.MethodPut, "/v1/features/license", license, nil)
}
4 changes: 2 additions & 2 deletions src/go/rpk/pkg/cli/cmd/acl.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func NewACLCommand(fs afero.Fs) *cobra.Command {
)
command := &cobra.Command{
Use: "acl",
Short: "Manage ACLs and SASL users.",
Short: "Manage ACLs and SASL users",
Long: helpACLs,
Args: cobra.ExactArgs(0),
Run: func(cmd *cobra.Command, _ []string) {
Expand All @@ -50,7 +50,7 @@ func NewACLCommand(fs afero.Fs) *cobra.Command {
},
}

command.Flags().BoolVar(&helpOperations, "help-operations", false, "Print more help about ACL operations.")
command.Flags().BoolVar(&helpOperations, "help-operations", false, "Print more help about ACL operations")

common.AddKafkaFlags(
command,
Expand Down
22 changes: 11 additions & 11 deletions src/go/rpk/pkg/cli/cmd/acl/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func NewCreateCommand(fs afero.Fs) *cobra.Command {
var a acls
cmd := &cobra.Command{
Use: "create",
Short: "Create ACLs.",
Short: "Create ACLs",
Long: `Create ACLs.
See the 'rpk acl' help text for a full write up on ACLs. Following the
Expand Down Expand Up @@ -88,17 +88,17 @@ Allow write permissions to user buzz to transactional id "txn":
func (a *acls) addCreateFlags(cmd *cobra.Command) {
a.addDeprecatedFlags(cmd)

cmd.Flags().StringSliceVar(&a.topics, topicFlag, nil, "topic to grant ACLs for (repeatable)")
cmd.Flags().StringSliceVar(&a.groups, groupFlag, nil, "group to grant ACLs for (repeatable)")
cmd.Flags().BoolVar(&a.cluster, clusterFlag, false, "whether to grant ACLs to the cluster")
cmd.Flags().StringSliceVar(&a.txnIDs, txnIDFlag, nil, "transactional IDs to grant ACLs for (repeatable)")
cmd.Flags().StringSliceVar(&a.topics, topicFlag, nil, "Topic to grant ACLs for (repeatable)")
cmd.Flags().StringSliceVar(&a.groups, groupFlag, nil, "Group to grant ACLs for (repeatable)")
cmd.Flags().BoolVar(&a.cluster, clusterFlag, false, "Whether to grant ACLs to the cluster")
cmd.Flags().StringSliceVar(&a.txnIDs, txnIDFlag, nil, "Transactional IDs to grant ACLs for (repeatable)")

cmd.Flags().StringVar(&a.resourcePatternType, patternFlag, "literal", "pattern to use when matching resource names (literal or prefixed)")
cmd.Flags().StringVar(&a.resourcePatternType, patternFlag, "literal", "Pattern to use when matching resource names (literal or prefixed)")

cmd.Flags().StringSliceVar(&a.operations, operationFlag, nil, "operation to grant (repeatable)")
cmd.Flags().StringSliceVar(&a.operations, operationFlag, nil, "Operation to grant (repeatable)")

cmd.Flags().StringSliceVar(&a.allowPrincipals, allowPrincipalFlag, nil, "principals for which these permissions will be granted (repeatable)")
cmd.Flags().StringSliceVar(&a.allowHosts, allowHostFlag, nil, "hosts from which access will be granted (repeatable)")
cmd.Flags().StringSliceVar(&a.denyPrincipals, denyPrincipalFlag, nil, "principal for which these permissions will be denied (repeatable)")
cmd.Flags().StringSliceVar(&a.denyHosts, denyHostFlag, nil, "hosts from from access will be denied (repeatable)")
cmd.Flags().StringSliceVar(&a.allowPrincipals, allowPrincipalFlag, nil, "Principals for which these permissions will be granted (repeatable)")
cmd.Flags().StringSliceVar(&a.allowHosts, allowHostFlag, nil, "Hosts from which access will be granted (repeatable)")
cmd.Flags().StringSliceVar(&a.denyPrincipals, denyPrincipalFlag, nil, "Principal for which these permissions will be denied (repeatable)")
cmd.Flags().StringSliceVar(&a.denyHosts, denyHostFlag, nil, "Hosts from from access will be denied (repeatable)")
}
28 changes: 14 additions & 14 deletions src/go/rpk/pkg/cli/cmd/acl/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func NewDeleteCommand(fs afero.Fs) *cobra.Command {
)
cmd := &cobra.Command{
Use: "delete",
Short: "Delete ACLs.",
Short: "Delete ACLs",
Long: `Delete ACLs.
See the 'rpk acl' help text for a full write up on ACLs. Delete flags work in a
Expand Down Expand Up @@ -94,28 +94,28 @@ resource names:
},
}
a.addDeleteFlags(cmd)
cmd.Flags().BoolVarP(&printAllFilters, "print-filters", "f", false, "print the filters that were requested (failed filters are always printed)")
cmd.Flags().BoolVarP(&dry, "dry", "d", false, "dry run: validate what would be deleted")
cmd.Flags().BoolVar(&noConfirm, "no-confirm", false, "disable confirmation prompt")
cmd.Flags().BoolVarP(&printAllFilters, "print-filters", "f", false, "Print the filters that were requested (failed filters are always printed)")
cmd.Flags().BoolVarP(&dry, "dry", "d", false, "Dry run: validate what would be deleted")
cmd.Flags().BoolVar(&noConfirm, "no-confirm", false, "Disable confirmation prompt")
return cmd
}

func (a *acls) addDeleteFlags(cmd *cobra.Command) {
a.addDeprecatedFlags(cmd)

cmd.Flags().StringSliceVar(&a.topics, topicFlag, nil, "topic to remove ACLs for (repeatable)")
cmd.Flags().StringSliceVar(&a.groups, groupFlag, nil, "group to remove ACLs for (repeatable)")
cmd.Flags().BoolVar(&a.cluster, clusterFlag, false, "whether to remove ACLs to the cluster")
cmd.Flags().StringSliceVar(&a.txnIDs, txnIDFlag, nil, "transactional IDs to remove ACLs for (repeatable)")
cmd.Flags().StringSliceVar(&a.topics, topicFlag, nil, "Topic to remove ACLs for (repeatable)")
cmd.Flags().StringSliceVar(&a.groups, groupFlag, nil, "Group to remove ACLs for (repeatable)")
cmd.Flags().BoolVar(&a.cluster, clusterFlag, false, "Whether to remove ACLs to the cluster")
cmd.Flags().StringSliceVar(&a.txnIDs, txnIDFlag, nil, "Transactional IDs to remove ACLs for (repeatable)")

cmd.Flags().StringVar(&a.resourcePatternType, patternFlag, "any", "pattern to use when matching resource names (any, match, literal, or prefixed)")
cmd.Flags().StringVar(&a.resourcePatternType, patternFlag, "any", "Pattern to use when matching resource names (any, match, literal, or prefixed)")

cmd.Flags().StringSliceVar(&a.operations, operationFlag, nil, "operation to remove (repeatable)")
cmd.Flags().StringSliceVar(&a.operations, operationFlag, nil, "Operation to remove (repeatable)")

cmd.Flags().StringSliceVar(&a.allowPrincipals, allowPrincipalFlag, nil, "allowed principal ACLs to remove (repeatable)")
cmd.Flags().StringSliceVar(&a.allowHosts, allowHostFlag, nil, "allowed host ACLs to remove (repeatable)")
cmd.Flags().StringSliceVar(&a.denyPrincipals, denyPrincipalFlag, nil, "denied principal ACLs to remove (repeatable)")
cmd.Flags().StringSliceVar(&a.denyHosts, denyHostFlag, nil, "denied host ACLs to remove (repeatable)")
cmd.Flags().StringSliceVar(&a.allowPrincipals, allowPrincipalFlag, nil, "Allowed principal ACLs to remove (repeatable)")
cmd.Flags().StringSliceVar(&a.allowHosts, allowHostFlag, nil, "Allowed host ACLs to remove (repeatable)")
cmd.Flags().StringSliceVar(&a.denyPrincipals, denyPrincipalFlag, nil, "Denied principal ACLs to remove (repeatable)")
cmd.Flags().StringSliceVar(&a.denyHosts, denyHostFlag, nil, "Denied host ACLs to remove (repeatable)")
}

func deleteReqResp(
Expand Down
24 changes: 12 additions & 12 deletions src/go/rpk/pkg/cli/cmd/acl/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func NewListCommand(fs afero.Fs) *cobra.Command {
cmd := &cobra.Command{
Use: "list",
Aliases: []string{"ls", "describe"},
Short: "List ACLs.",
Short: "List ACLs",
Long: `List ACLs.
See the 'rpk acl' help text for a full write up on ACLs. List flags work in a
Expand Down Expand Up @@ -64,7 +64,7 @@ resource names:
},
}
a.addListFlags(cmd)
cmd.Flags().BoolVarP(&printAllFilters, "print-filters", "f", false, "print the filters that were requested (failed filters are always printed)")
cmd.Flags().BoolVarP(&printAllFilters, "print-filters", "f", false, "Print the filters that were requested (failed filters are always printed)")
return cmd
}

Expand All @@ -79,19 +79,19 @@ func (a *acls) addListFlags(cmd *cobra.Command) {
cmd.Flags().MarkDeprecated("principal", "use --{allow,deny}-{host,principal}")
cmd.Flags().MarkDeprecated("host", "use --{allow,deny}-{host,principal}")

cmd.Flags().StringSliceVar(&a.topics, topicFlag, nil, "topic to match ACLs for (repeatable)")
cmd.Flags().StringSliceVar(&a.groups, groupFlag, nil, "group to match ACLs for (repeatable)")
cmd.Flags().BoolVar(&a.cluster, clusterFlag, false, "whether to match ACLs to the cluster")
cmd.Flags().StringSliceVar(&a.txnIDs, txnIDFlag, nil, "transactional IDs to match ACLs for (repeatable)")
cmd.Flags().StringSliceVar(&a.topics, topicFlag, nil, "Topic to match ACLs for (repeatable)")
cmd.Flags().StringSliceVar(&a.groups, groupFlag, nil, "Group to match ACLs for (repeatable)")
cmd.Flags().BoolVar(&a.cluster, clusterFlag, false, "Whether to match ACLs to the cluster")
cmd.Flags().StringSliceVar(&a.txnIDs, txnIDFlag, nil, "Transactional IDs to match ACLs for (repeatable)")

cmd.Flags().StringVar(&a.resourcePatternType, patternFlag, "any", "pattern to use when matching resource names (any, match, literal, or prefixed)")
cmd.Flags().StringVar(&a.resourcePatternType, patternFlag, "any", "Pattern to use when matching resource names (any, match, literal, or prefixed)")

cmd.Flags().StringSliceVar(&a.operations, operationFlag, nil, "operation to match (repeatable)")
cmd.Flags().StringSliceVar(&a.operations, operationFlag, nil, "Operation to match (repeatable)")

cmd.Flags().StringSliceVar(&a.allowPrincipals, allowPrincipalFlag, nil, "allowed principal ACLs to match (repeatable)")
cmd.Flags().StringSliceVar(&a.allowHosts, allowHostFlag, nil, "allowed host ACLs to match (repeatable)")
cmd.Flags().StringSliceVar(&a.denyPrincipals, denyPrincipalFlag, nil, "denied principal ACLs to match (repeatable)")
cmd.Flags().StringSliceVar(&a.denyHosts, denyHostFlag, nil, "denied host ACLs to match (repeatable)")
cmd.Flags().StringSliceVar(&a.allowPrincipals, allowPrincipalFlag, nil, "Allowed principal ACLs to match (repeatable)")
cmd.Flags().StringSliceVar(&a.allowHosts, allowHostFlag, nil, "Allowed host ACLs to match (repeatable)")
cmd.Flags().StringSliceVar(&a.denyPrincipals, denyPrincipalFlag, nil, "Denied principal ACLs to match (repeatable)")
cmd.Flags().StringSliceVar(&a.denyHosts, denyHostFlag, nil, "Denied host ACLs to match (repeatable)")
}

func describeReqResp(
Expand Down
Loading

0 comments on commit 143db2c

Please sign in to comment.