Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ [0.4] Support use of AWS Secrets Manager for userdata privacy #1517

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions Makefile
Expand Up @@ -136,10 +136,10 @@ $(RELEASE_NOTES) : $(TOOLS_DIR)/go.mod

.PHONY: lint
lint: $(GOLANGCI_LINT) ## Lint codebase
$(GOLANGCI_LINT) run -v
$(GOLANGCI_LINT) run -v --deadline=5m

lint-full: $(GOLANGCI_LINT) ## Run slower linters to detect possible issues
$(GOLANGCI_LINT) run -v --fast=false
$(GOLANGCI_LINT) run -v --fast=false --deadline=5m

## --------------------------------------
## Generate
Expand All @@ -157,8 +157,7 @@ generate: ## Generate code
$(MAKE) generate-manifests

.PHONY: generate-go
generate-go: $(CONTROLLER_GEN) $(MOCKGEN) $(CONVERSION_GEN) ## Runs Go related generate targets
go generate ./...
generate-go: $(CONTROLLER_GEN) $(CONVERSION_GEN) $(MOCKGEN) ## Runs Go related generate targets
$(CONTROLLER_GEN) \
paths=./api/... \
object:headerFile=./hack/boilerplate/boilerplate.generatego.txt
Expand All @@ -167,6 +166,7 @@ generate-go: $(CONTROLLER_GEN) $(MOCKGEN) $(CONVERSION_GEN) ## Runs Go related g
--input-dirs=./api/v1alpha2 \
--output-file-base=zz_generated.conversion \
--go-header-file=./hack/boilerplate/boilerplate.generatego.txt
go generate ./...

.PHONY: generate-manifests
generate-manifests: $(CONTROLLER_GEN) ## Generate manifests e.g. CRD, RBAC etc.
Expand Down
21 changes: 21 additions & 0 deletions api/v1alpha2/awsmachine_types.go
Expand Up @@ -88,6 +88,27 @@ type AWSMachineSpec struct {
// +optional
// +kubebuilder:validation:MaxItems=2
NetworkInterfaces []string `json:"networkInterfaces,omitempty"`

// CloudInit defines options related to the bootstrapping systems where
// CloudInit is used.
// +optional
CloudInit *CloudInit `json:"cloudInit,omitempty"`
}

// CloudInit defines options related to the bootstrapping systems where
// CloudInit is used.
type CloudInit struct {
// enableSecureSecretsManager, when set to true will use AWS Secrets Manager to ensure
// userdata privacy. A cloud-init boothook shell script is prepended to download
// the userdata from Secrets Manager and additionally delete the secret.
// +optional
EnableSecureSecretsManager bool `json:"enableSecureSecretsManager,omitempty"`

// SecretARN is the Amazon Resource Name of the secret. This is stored
// temporarily, and deleted when the machine registers as a node against
// the workload cluster.
// +optional
SecretARN string `json:"secretARN,omitempty"`
}

// AWSMachineStatus defines the observed state of AWSMachine
Expand Down
19 changes: 19 additions & 0 deletions api/v1alpha2/types.go
Expand Up @@ -20,6 +20,8 @@ import (
"fmt"
"sort"
"time"

"k8s.io/apimachinery/pkg/util/sets"
)

// AWSResourceReference is a reference to a specific AWS resource by ID, ARN, or filters.
Expand Down Expand Up @@ -474,6 +476,23 @@ var (
// InstanceStateStopped is the string representing an instance
// that has been stopped and can be restarted
InstanceStateStopped = InstanceState("stopped")

// InstanceOperationalStates defines the set of states in which an EC2 instance is
// or can return to running, and supports all EC2 operations
InstanceOperationalStates = sets.NewString(
string(InstanceStatePending),
string(InstanceStateRunning),
string(InstanceStateStopping),
string(InstanceStateStopped),
)

// InstanceKnownStates represents all known EC2 instance states
InstanceKnownStates = InstanceOperationalStates.Union(
sets.NewString(
string(InstanceStateShuttingDown),
string(InstanceStateTerminated),
),
)
)

// Instance describes an AWS instance.
Expand Down
20 changes: 20 additions & 0 deletions api/v1alpha2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions config/crd/bases/infrastructure.cluster.x-k8s.io_awsmachines.yaml
Expand Up @@ -121,6 +121,22 @@ spec:
to use for this instance. If multiple subnets are matched for the
availability zone, the first one return is picked.
type: string
cloudInit:
description: CloudInit defines options related to the bootstrapping
systems where CloudInit is used.
properties:
enableSecureSecretsManager:
description: enableSecureSecretsManager, when set to true will use
AWS Secrets Manager to ensure userdata privacy. A cloud-init boothook
shell script is prepended to download the userdata from Secrets
Manager and additionally delete the secret.
type: boolean
secretARN:
description: SecretARN is the Amazon Resource Name of the secret.
This is stored temporarily, and deleted when the machine registers
as a node against the workload cluster.
type: string
type: object
iamInstanceProfile:
description: IAMInstanceProfile is a name of an IAM instance profile
to assign to the instance
Expand Down
Expand Up @@ -132,6 +132,23 @@ spec:
zone to use for this instance. If multiple subnets are matched
for the availability zone, the first one return is picked.
type: string
cloudInit:
description: CloudInit defines options related to the bootstrapping
systems where CloudInit is used.
properties:
enableSecureSecretsManager:
description: enableSecureSecretsManager, when set to true
will use AWS Secrets Manager to ensure userdata privacy.
A cloud-init boothook shell script is prepended to download
the userdata from Secrets Manager and additionally delete
the secret.
type: boolean
secretARN:
description: SecretARN is the Amazon Resource Name of the
secret. This is stored temporarily, and deleted when the
machine registers as a node against the workload cluster.
type: string
type: object
iamInstanceProfile:
description: IAMInstanceProfile is a name of an IAM instance
profile to assign to the instance
Expand Down