crossplane / crossplane-cli

Tools and commands for managing and developing Crossplane
Apache License 2.0
14 stars 12 forks source link

Add imagePullSecret option for package install #60

Closed hasheddan closed 4 years ago

hasheddan commented 4 years ago

This adds a flag for specifying an --imagePullSecret flag that will get added to the generated stack install.

Partially addresses #59, secret creation will follow in separate PR. Note that this only allows for one imagePullSecret to be added, as the issue requests. If multiple are specified the last one gets used (see final test case).

Signed-off-by: hasheddan georgedanielmangum@gmail.com

Testing Scenarios ```shell 🤖 (crossplane-cli) kubectl crossplane package install coolimage stackinstall.stacks.crossplane.io/coolimage created apiVersion: stacks.crossplane.io/v1alpha1 kind: StackInstall metadata: annotations: kubectl.kubernetes.io/last-applied-configuration: | {"apiVersion":"stacks.crossplane.io/v1alpha1","kind":"StackInstall","metadata":{"annotations":{},"name":"coolimage","namespace":"default"},"spec":{"package":"coolimage"}} creationTimestamp: "2020-05-05T18:10:06Z" generation: 1 name: coolimage namespace: default resourceVersion: "6627" selfLink: /apis/stacks.crossplane.io/v1alpha1/namespaces/default/stackinstalls/coolimage uid: f0506bc2-99e7-44ae-8812-96161338eb31 spec: package: coolimage ``` ```shell 🤖 (crossplane-cli) kubectl crossplane package install -c coolimage clusterstackinstall.stacks.crossplane.io/coolimage created apiVersion: stacks.crossplane.io/v1alpha1 kind: ClusterStackInstall metadata: annotations: kubectl.kubernetes.io/last-applied-configuration: | {"apiVersion":"stacks.crossplane.io/v1alpha1","kind":"ClusterStackInstall","metadata":{"annotations":{},"name":"coolimage","namespace":"default"},"spec":{"package":"coolimage"}} creationTimestamp: "2020-05-05T18:11:18Z" generation: 1 name: coolimage namespace: default resourceVersion: "6822" selfLink: /apis/stacks.crossplane.io/v1alpha1/namespaces/default/clusterstackinstalls/coolimage uid: 56d67ff8-cf88-44f2-a08f-b328144c412d spec: package: coolimage ``` ```shell 🤖 (crossplane-cli) kubectl crossplane package install -c -n crossplane-system coolimage clusterstackinstall.stacks.crossplane.io/coolimage created apiVersion: stacks.crossplane.io/v1alpha1 kind: ClusterStackInstall metadata: annotations: kubectl.kubernetes.io/last-applied-configuration: | {"apiVersion":"stacks.crossplane.io/v1alpha1","kind":"ClusterStackInstall","metadata":{"annotations":{},"name":"coolimage","namespace":"crossplane-system"},"spec":{"package":"coolimage"}} creationTimestamp: "2020-05-05T18:12:09Z" generation: 1 name: coolimage namespace: crossplane-system resourceVersion: "6964" selfLink: /apis/stacks.crossplane.io/v1alpha1/namespaces/crossplane-system/clusterstackinstalls/coolimage uid: ecc79dd8-bb0d-4eaa-a754-1c0a24492a2f spec: package: coolimage ``` ```shell 🤖 (crossplane-cli) kubectl crossplane package install -c -n crossplane-system --imagePullSecret mysecret coolimage2 clusterstackinstall.stacks.crossplane.io/coolimage2 created apiVersion: stacks.crossplane.io/v1alpha1 kind: ClusterStackInstall metadata: annotations: kubectl.kubernetes.io/last-applied-configuration: | {"apiVersion":"stacks.crossplane.io/v1alpha1","kind":"ClusterStackInstall","metadata":{"annotations":{},"name":"coolimage2","namespace":"crossplane-system"},"spec":{"imagePullSecrets":[{"name":"mysecret"}],"package":"coolimage2"}} creationTimestamp: "2020-05-05T18:13:38Z" generation: 1 name: coolimage2 namespace: crossplane-system resourceVersion: "7204" selfLink: /apis/stacks.crossplane.io/v1alpha1/namespaces/crossplane-system/clusterstackinstalls/coolimage2 uid: 0f5c6bd0-c9ad-447d-ad41-7d9cb74991bd spec: imagePullSecrets: - name: mysecret package: coolimage2 ``` ```shell 🤖 (crossplane-cli) kubectl crossplane package install -c -n crossplane-system --imagePullSecret mysecret coolimage3 myname mysource clusterstackinstall.stacks.crossplane.io/myname created apiVersion: stacks.crossplane.io/v1alpha1 kind: ClusterStackInstall metadata: annotations: kubectl.kubernetes.io/last-applied-configuration: | {"apiVersion":"stacks.crossplane.io/v1alpha1","kind":"ClusterStackInstall","metadata":{"annotations":{},"name":"myname","namespace":"crossplane-system"},"spec":{"imagePullSecrets":[{"name":"mysecret"}],"package":"coolimage3","source":"mysource"}} creationTimestamp: "2020-05-05T18:19:10Z" generation: 1 name: myname namespace: crossplane-system resourceVersion: "8095" selfLink: /apis/stacks.crossplane.io/v1alpha1/namespaces/crossplane-system/clusterstackinstalls/myname uid: 474ca1fc-9c78-44e7-b66e-abdcae6b9d65 spec: imagePullSecrets: - name: mysecret package: coolimage3 source: mysource ``` ```shell 🤖 (crossplane-cli) kubectl crossplane package install -c -n crossplane-system coolimage4 myname mysource clusterstackinstall.stacks.crossplane.io/myname configured apiVersion: stacks.crossplane.io/v1alpha1 kind: ClusterStackInstall metadata: annotations: kubectl.kubernetes.io/last-applied-configuration: | {"apiVersion":"stacks.crossplane.io/v1alpha1","kind":"ClusterStackInstall","metadata":{"annotations":{},"name":"myname","namespace":"crossplane-system"},"spec":{"package":"coolimage4","source":"mysource"}} creationTimestamp: "2020-05-05T18:19:10Z" generation: 2 name: myname namespace: crossplane-system resourceVersion: "8165" selfLink: /apis/stacks.crossplane.io/v1alpha1/namespaces/crossplane-system/clusterstackinstalls/myname uid: 474ca1fc-9c78-44e7-b66e-abdcae6b9d65 spec: package: coolimage4 source: mysource ``` ```shell 🤖 (crossplane-cli) kubectl crossplane package install -c -n crossplane-system --imagePullSecret mysecret --imagePullSecret myothersecret coolimage3 myname5 mysource clusterstackinstall.stacks.crossplane.io/myname5 created apiVersion: stacks.crossplane.io/v1alpha1 kind: ClusterStackInstall metadata: annotations: kubectl.kubernetes.io/last-applied-configuration: | {"apiVersion":"stacks.crossplane.io/v1alpha1","kind":"ClusterStackInstall","metadata":{"annotations":{},"name":"myname5","namespace":"crossplane-system"},"spec":{"imagePullSecrets":[{"name":"myothersecret"}],"package":"coolimage3","source":"mysource"}} creationTimestamp: "2020-05-05T18:24:00Z" generation: 1 name: myname5 namespace: crossplane-system resourceVersion: "8876" selfLink: /apis/stacks.crossplane.io/v1alpha1/namespaces/crossplane-system/clusterstackinstalls/myname5 uid: 49754169-91bd-4518-b0db-b1b694a02095 spec: imagePullSecrets: - name: myothersecret package: coolimage3 source: mysource ```