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

chore: secret generator add more comments #712

Merged
merged 1 commit into from
Dec 21, 2023
Merged
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
8 changes: 8 additions & 0 deletions pkg/modules/generators/workload/secret/secret_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ func generateSecret(project *project.Project, secretName string, secretRef workl
}
}

// generateBasic generates secret used for basic authentication. The basic secret type
// is used for username / password pairs.
func generateBasic(project *project.Project, secretName string, secretRef workload.Secret) (*v1.Secret, error) {
secret := &v1.Secret{
TypeMeta: metav1.TypeMeta{
Expand All @@ -110,6 +112,8 @@ func generateBasic(project *project.Project, secretName string, secretRef worklo
return secret, nil
}

// generateToken generates secret used for password. Token secrets are useful for generating
// a password or secure string used for passwords when the user is already known or not required.
func generateToken(project *project.Project, secretName string, secretRef workload.Secret) (*v1.Secret, error) {
secret := &v1.Secret{
TypeMeta: metav1.TypeMeta{
Expand All @@ -133,6 +137,7 @@ func generateToken(project *project.Project, secretName string, secretRef worklo
return secret, nil
}

// generateOpaque generates secret used for arbitrary user-defined data.
func generateOpaque(project *project.Project, secretName string, secretRef workload.Secret) (*v1.Secret, error) {
secret := &v1.Secret{
TypeMeta: metav1.TypeMeta{
Expand All @@ -151,6 +156,9 @@ func generateOpaque(project *project.Project, secretName string, secretRef workl
return secret, nil
}

// generateCertificate generates secret used for storing a certificate and its associated key.
// One common use for TLS Secrets is to configure encryption in transit for an Ingress, but
// you can also use it with other resources or directly in your workload.
func generateCertificate(project *project.Project, secretName string, secretRef workload.Secret) (*v1.Secret, error) {
secret := &v1.Secret{
TypeMeta: metav1.TypeMeta{
Expand Down
Loading