// NewCmdCreateSecret groups subcommands to create various types of secrets. // This is the entry point of create_secret.go which will be called by create.go func NewCmdCreateSecret(f cmdutil.Factory, ioStreams genericiooptions.IOStreams) *cobra.Command { … } var secretLong … var secretForGenericLong … var secretForGenericExample … type CreateSecretOptions … // NewSecretOptions creates a new *CreateSecretOptions with default value func NewSecretOptions(ioStreams genericiooptions.IOStreams) *CreateSecretOptions { … } // NewCmdCreateSecretGeneric is a command to create generic secrets from files, directories, or literal values func NewCmdCreateSecretGeneric(f cmdutil.Factory, ioStreams genericiooptions.IOStreams) *cobra.Command { … } // Complete loads data from the command line environment func (o *CreateSecretOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error { … } // Validate checks if CreateSecretOptions has sufficient value to run func (o *CreateSecretOptions) Validate() error { … } // Run calls createSecret which will create secret based on CreateSecretOptions // and makes an API call to the server func (o *CreateSecretOptions) Run() error { … } // createSecret fills in key value pair from the information given in // CreateSecretOptions into *corev1.Secret func (o *CreateSecretOptions) createSecret() (*corev1.Secret, error) { … } // newSecretObj will create a new Secret Object given name, namespace and secretType func newSecretObj(name, namespace string, secretType corev1.SecretType) *corev1.Secret { … } // handleSecretFromLiteralSources adds the specified literal source // information into the provided secret func handleSecretFromLiteralSources(secret *corev1.Secret, literalSources []string) error { … } // handleSecretFromFileSources adds the specified file source information into the provided secret func handleSecretFromFileSources(secret *corev1.Secret, fileSources []string) error { … } // handleSecretFromEnvFileSources adds the specified env files source information // into the provided secret func handleSecretFromEnvFileSources(secret *corev1.Secret, envFileSources []string) error { … } // addKeyFromFileToSecret adds a key with the given name to a Secret, populating // the value with the content of the given file path, or returns an error. func addKeyFromFileToSecret(secret *corev1.Secret, keyName, filePath string) error { … } // addKeyFromLiteralToSecret adds the given key and data to the given secret, // returning an error if the key is not valid or if the key already exists. func addKeyFromLiteralToSecret(secret *corev1.Secret, keyName string, data []byte) error { … }