Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ pre-commit: all verify test
build: hypershift-operator control-plane-operator control-plane-pki-operator karpenter-operator hypershift product-cli

.PHONY: update
update: api-deps workspace-sync deps api api-docs clients docs-aggregate
update: api-deps workspace-sync deps api api-docs clients docs-aggregate cli-docs

GOLANGCI_LINT := $(abspath $(TOOLS_BIN_DIR)/golangci-lint)
$(GOLANGCI_LINT): $(TOOLS_DIR)/go.mod # Build golangci-lint from tools folder.
Expand Down Expand Up @@ -248,6 +248,10 @@ cluster-api-provider-openstack: $(CONTROLLER_GEN)
api-docs: $(GENAPIDOCS)
hack/gen-api-docs.sh $(GENAPIDOCS) $(DIR)

.PHONY: cli-docs
cli-docs: hypershift
$(OUT_DIR)/hypershift docs generate --platform aws --output docs/content/reference/cli-flags

.PHONY: clients
clients: delegating_client
GOWORK=off GO=GO111MODULE=on GOFLAGS=-mod=readonly hack/update-codegen.sh
Expand Down
3 changes: 3 additions & 0 deletions cmd/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ func NewCreateCommands() *cobra.Command {

core.BindDeveloperOptions(opts, cmd.PersistentFlags())

_ = cmd.MarkPersistentFlagRequired("name")
_ = cmd.MarkPersistentFlagRequired("pull-secret")

cmd.MarkFlagsMutuallyExclusive("service-cidr", "default-dual")
cmd.MarkFlagsMutuallyExclusive("cluster-cidr", "default-dual")

Expand Down
136 changes: 136 additions & 0 deletions cmd/docs/categories.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
package docs

// CategoryOrder defines the display order of categories
var CategoryOrder = []string{
"Required",
"Cluster Identity",
"Release Configuration",
"AWS Infrastructure",
"Networking",
"Proxy Configuration",
"Node Pool Configuration",
"Security & Encryption",
"AWS Credentials & IAM",
"Control Plane Configuration",
"OLM Configuration",
"Output & Execution",
"Developer-Only",
"Deprecated",
}

// FlagCategories maps flag names to their categories.
// Note: Required flags are auto-detected via cobra annotations (MarkFlagRequired),
// so they don't need to be listed here.
var FlagCategories = map[string]string{
// Cluster Identity
"namespace": "Cluster Identity",
"base-domain": "Cluster Identity",
"base-domain-prefix": "Cluster Identity",
"infra-id": "Cluster Identity",
"annotations": "Cluster Identity",
"labels": "Cluster Identity",

// Release Configuration
"release-image": "Release Configuration",
"release-stream": "Release Configuration",
"arch": "Release Configuration",
"feature-set": "Release Configuration",
"disable-cluster-capabilities": "Release Configuration",
"enable-cluster-capabilities": "Release Configuration",

// AWS Infrastructure
"region": "AWS Infrastructure",
"zones": "AWS Infrastructure",
"vpc-cidr": "AWS Infrastructure",
"additional-tags": "AWS Infrastructure",
"public-only": "AWS Infrastructure",
"private-zones-in-cluster-account": "AWS Infrastructure",

// Networking
"network-type": "Networking",
"service-cidr": "Networking",
"cluster-cidr": "Networking",
"machine-cidr": "Networking",
"default-dual": "Networking",
"endpoint-access": "Networking",
"external-dns-domain": "Networking",
"kas-dns-name": "Networking",
"disable-multi-network": "Networking",
"allocate-node-cidrs": "Networking",

// Proxy Configuration
"enable-proxy": "Proxy Configuration",
"enable-secure-proxy": "Proxy Configuration",
"proxy-vpc-endpoint-service-name": "Proxy Configuration",

// Node Pool Configuration
"node-pool-replicas": "Node Pool Configuration",
"instance-type": "Node Pool Configuration",
"root-volume-type": "Node Pool Configuration",
"root-volume-size": "Node Pool Configuration",
"root-volume-iops": "Node Pool Configuration",
"root-volume-kms-key": "Node Pool Configuration",
"auto-repair": "Node Pool Configuration",
"auto-node": "Node Pool Configuration",
"node-upgrade-type": "Node Pool Configuration",
"node-drain-timeout": "Node Pool Configuration",
"node-volume-detach-timeout": "Node Pool Configuration",

// Security & Encryption
"fips": "Security & Encryption",
"ssh-key": "Security & Encryption",
"generate-ssh": "Security & Encryption",
"kms-key-arn": "Security & Encryption",
"additional-trust-bundle": "Security & Encryption",
"image-content-sources": "Security & Encryption",
"oidc-issuer-url": "Security & Encryption",
"sa-token-issuer-private-key-path": "Security & Encryption",

// AWS Credentials & IAM
"role-arn": "AWS Credentials & IAM",
"sts-creds": "AWS Credentials & IAM",
"secret-creds": "AWS Credentials & IAM",
"use-rosa-managed-policies": "AWS Credentials & IAM",
"shared-role": "AWS Credentials & IAM",

// Control Plane Configuration
"control-plane-availability-policy": "Control Plane Configuration",
"infra-availability-policy": "Control Plane Configuration",
"node-selector": "Control Plane Configuration",
"pods-labels": "Control Plane Configuration",
"toleration": "Control Plane Configuration",
"etcd-storage-class": "Control Plane Configuration",
"etcd-storage-size": "Control Plane Configuration",

// OLM Configuration
"olm-catalog-placement": "OLM Configuration",
"olm-disable-default-sources": "OLM Configuration",

// Output & Execution
"render": "Output & Execution",
"render-into": "Output & Execution",
"render-sensitive": "Output & Execution",
"wait": "Output & Execution",
"timeout": "Output & Execution",
"pausedUntil": "Output & Execution",
"version-check": "Output & Execution",

// Developer-Only
"control-plane-operator-image": "Developer-Only",
"infra-json": "Developer-Only",
"iam-json": "Developer-Only",
"single-nat-gateway": "Developer-Only",
"aws-creds": "Developer-Only",
"vpc-owner-aws-creds": "Developer-Only",

// Deprecated
"multi-arch": "Deprecated",
}

// GetCategory returns the category for a flag, defaulting to "Other" if not found
func GetCategory(flagName string) string {
if cat, ok := FlagCategories[flagName]; ok {
return cat
}
return "Other"
}
19 changes: 19 additions & 0 deletions cmd/docs/docs.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package docs

import (
"github.com/spf13/cobra"
)

// NewCommand creates the docs command
func NewCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "docs",
Short: "Generate CLI documentation",
Long: "Commands for generating CLI flag documentation in various formats.",
SilenceUsage: true,
}

cmd.AddCommand(NewGenerateCommand())

return cmd
}
Loading