Skip to content

Commit

Permalink
chore: imageRepositiry is empty by default instead of banzaicloud
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Balogh <[email protected]>
  • Loading branch information
pbalogh-sa committed Feb 2, 2022
1 parent 7817b97 commit 515804c
Show file tree
Hide file tree
Showing 23 changed files with 32 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func certificateAutoApproverTemplate() string {
" priorityClassName: system-cluster-critical\n" +
" containers:\n" +
" - name: kubelet-csr-approver\n" +
" {{ if ne .ImageRepository \"banzaicloud\" }}\n" +
" {{ if ne .ImageRepository \"\" }}\n" +
" image: \"{{ .ImageRepository }}/kubelet-csr-approver:v0.1.2\"\n" +
" {{ else }}\n" +
" image: \"postfinance/kubelet-csr-approver:v0.1.2\"\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ spec:
priorityClassName: system-cluster-critical
containers:
- name: kubelet-csr-approver
{{ if ne .ImageRepository "banzaicloud" }}
{{ if ne .ImageRepository "" }}
image: "{{ .ImageRepository }}/kubelet-csr-approver:v0.1.2"
{{ else }}
image: "postfinance/kubelet-csr-approver:v0.1.2"
Expand Down
6 changes: 3 additions & 3 deletions cmd/pke/app/phases/kubeadm/controlplane/cilium.yaml.go
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ func ciliumTemplate() string {
" key: custom-cni-conf\n" +
" name: cilium-config\n" +
" optional: true\n" +
" {{ if ne .ImageRepository \"banzaicloud\" }}\n" +
" {{ if ne .ImageRepository \"\" }}\n" +
" image: \"{{ .ImageRepository }}/cilium:v1.9.1\"\n" +
" {{ else }}\n" +
" image: \"cilium/cilium:{{ .Version }}\"\n" +
Expand Down Expand Up @@ -546,7 +546,7 @@ func ciliumTemplate() string {
" key: wait-bpf-mount\n" +
" name: cilium-config\n" +
" optional: true\n" +
" {{ if ne .ImageRepository \"banzaicloud\" }}\n" +
" {{ if ne .ImageRepository \"\" }}\n" +
" image: \"{{ .ImageRepository }}/cilium:{{ .Version }}\"\n" +
" {{ else }}\n" +
" image: \"cilium/cilium:{{ .Version }}\"\n" +
Expand Down Expand Up @@ -685,7 +685,7 @@ func ciliumTemplate() string {
" key: debug\n" +
" name: cilium-config\n" +
" optional: true\n" +
" {{ if ne .ImageRepository \"banzaicloud\" }}\n" +
" {{ if ne .ImageRepository \"\" }}\n" +
" image: \"{{ .ImageRepository }}/cilium-operator:{{ .Version }}\"\n" +
" {{ else }}\n" +
" image: \"cilium/operator:{{ .Version }}\"\n" +
Expand Down
6 changes: 3 additions & 3 deletions cmd/pke/app/phases/kubeadm/controlplane/cilium.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ spec:
key: custom-cni-conf
name: cilium-config
optional: true
{{ if ne .ImageRepository "banzaicloud" }}
{{ if ne .ImageRepository "" }}
image: "{{ .ImageRepository }}/cilium:v1.9.1"
{{ else }}
image: "cilium/cilium:{{ .Version }}"
Expand Down Expand Up @@ -528,7 +528,7 @@ spec:
key: wait-bpf-mount
name: cilium-config
optional: true
{{ if ne .ImageRepository "banzaicloud" }}
{{ if ne .ImageRepository "" }}
image: "{{ .ImageRepository }}/cilium:{{ .Version }}"
{{ else }}
image: "cilium/cilium:{{ .Version }}"
Expand Down Expand Up @@ -667,7 +667,7 @@ spec:
key: debug
name: cilium-config
optional: true
{{ if ne .ImageRepository "banzaicloud" }}
{{ if ne .ImageRepository "" }}
image: "{{ .ImageRepository }}/cilium-operator:{{ .Version }}"
{{ else }}
image: "cilium/operator:{{ .Version }}"
Expand Down
3 changes: 1 addition & 2 deletions cmd/pke/app/phases/kubeadm/controlplane/controlplane.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ func (c *ControlPlane) RegisterFlags(flags *pflag.FlagSet) {
flags.String(constants.FlagOIDCIssuerURL, "", "URL of the OIDC provider which allows the API server to discover public signing keys")
flags.String(constants.FlagOIDCClientID, "", "A client ID that all OIDC tokens must be issued for")
// Image repository
flags.String(constants.FlagImageRepository, "banzaicloud", "Prefix for image repository")
flags.String(constants.FlagImageRepository, "", "Prefix for image repository")
// Use defined image repository for K8s images as well
flags.Bool(constants.FlagUseImageRepositoryToK8s, false, "Use defined image repository for K8s Images as well")
// PodSecurityPolicy admission plugin
Expand Down Expand Up @@ -277,7 +277,6 @@ func (c *ControlPlane) Validate(cmd *cobra.Command) error {
constants.FlagPodNetworkCIDR: c.podNetworkCIDR,
constants.FlagClusterName: c.clusterName,
constants.FlagClusterMode: c.clusterMode,
constants.FlagImageRepository: c.imageRepository,
constants.FlagUseImageRepositoryToK8s: c.useImageRepositoryToK8s,
}); err != nil {
return err
Expand Down
4 changes: 3 additions & 1 deletion cmd/pke/app/phases/kubeadm/controlplane/kubeadm.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,9 @@ func (c ControlPlane) WriteKubeadmConfig(out io.Writer, filename string) error {

imageRepository := "k8s.gcr.io"
if c.useImageRepositoryToK8s {
imageRepository = c.imageRepository
if c.imageRepository != "" {
imageRepository = c.imageRepository
}
}

d := data{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func storageClassLocalPathStorageTemplate() string {
" serviceAccountName: local-path-provisioner-service-account\n" +
" containers:\n" +
" - name: local-path-provisioner\n" +
" {{ if ne .ImageRepository \"banzaicloud\" }}\n" +
" {{ if ne .ImageRepository \"\" }}\n" +
" image: \"{{ .ImageRepository }}/local-path-provisioner:v0.0.21\"\n" +
" {{ else }}\n" +
" image: \"rancher/local-path-provisioner:v0.0.21\"\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ spec:
serviceAccountName: local-path-provisioner-service-account
containers:
- name: local-path-provisioner
{{ if ne .ImageRepository "banzaicloud" }}
{{ if ne .ImageRepository "" }}
image: "{{ .ImageRepository }}/local-path-provisioner:v0.0.21"
{{ else }}
image: "rancher/local-path-provisioner:v0.0.21"
Expand Down
7 changes: 4 additions & 3 deletions cmd/pke/app/phases/kubeadm/images/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (i *Image) RegisterFlags(flags *pflag.FlagSet) {
// Kubernetes version
flags.String(constants.FlagKubernetesVersion, i.config.Kubernetes.Version, "Kubernetes version")
// Image repository
flags.String(constants.FlagImageRepository, "banzaicloud", "Prefix for image repository")
flags.String(constants.FlagImageRepository, "", "Prefix for image repository")
// Use defined image repository for K8s images as well
flags.Bool(constants.FlagUseImageRepositoryToK8s, false, "Use defined image repository for K8s Images as well")
}
Expand All @@ -90,7 +90,6 @@ func (i *Image) Validate(cmd *cobra.Command) error {
}
if err := validator.NotEmpty(map[string]interface{}{
constants.FlagKubernetesVersion: i.kubernetesVersion,
constants.FlagImageRepository: i.imageRepository,
constants.FlagUseImageRepositoryToK8s: i.useImageRepositoryToK8s,
}); err != nil {
return err
Expand All @@ -104,7 +103,9 @@ func (i *Image) Run(out io.Writer) error {

imageRepository := "k8s.gcr.io"
if i.useImageRepositoryToK8s {
imageRepository = i.imageRepository
if i.imageRepository != "" {
imageRepository = i.imageRepository
}
}
c := controlplane.NewDefault(i.kubernetesVersion, imageRepository)

Expand Down
3 changes: 1 addition & 2 deletions cmd/pke/app/phases/runtime/container/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (r *Runtime) RegisterFlags(flags *pflag.FlagSet) {
flags.String(constants.FlagContainerRuntime, r.config.ContainerRuntime.Type, "Kubernetes container runtime")

// Image repository
flags.String(constants.FlagImageRepository, "banzaicloud", "Prefix for image repository")
flags.String(constants.FlagImageRepository, "", "Prefix for image repository")

// Use defined image repository for K8s images as well
flags.Bool(constants.FlagUseImageRepositoryToK8s, false, "Use defined image repository for K8s Images as well")
Expand All @@ -81,7 +81,6 @@ func (r *Runtime) Validate(cmd *cobra.Command) (err error) {
}
if err := validator.NotEmpty(map[string]interface{}{
constants.FlagContainerRuntime: r.containerRuntime,
constants.FlagImageRepository: r.imageRepository,
constants.FlagUseImageRepositoryToK8s: r.useImageRepositoryToK8s,
}); err != nil {
return err
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package container
// containerdConfigTemplate is a generated function returning the template as a string.
func containerdConfigTemplate() string {
var tmpl = "[plugins.cri]\n" +
"{{ if ne .ImageRepository \"banzaicloud\" }}\n" +
"{{ if ne .ImageRepository \"\" }}\n" +
"sandbox_image = \"{{ .ImageRepository }}/pause:3.1\"\n" +
"{{ else }}\n" +
"sandbox_image = \"k8s.gcr.io/pause:3.6\"\n" +
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[plugins.cri]
{{ if ne .ImageRepository "banzaicloud" }}
{{ if ne .ImageRepository "" }}
sandbox_image = "{{ .ImageRepository }}/pause:3.1"
{{ else }}
sandbox_image = "k8s.gcr.io/pause:3.6"
Expand Down
2 changes: 1 addition & 1 deletion cmd/pke/docs/pke_install_master.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pke install master [flags]
--etcd-key-file string An SSL key file used to secure etcd communication
--etcd-prefix string The prefix to prepend to all resource paths in etcd
-h, --help help for master
--image-repository string Prefix for image repository (default "banzaicloud")
--image-repository string Prefix for image repository
--kubelet-certificate-authority string Path to a cert file for the certificate authority. Used for kubelet server certificate verify. (default "/etc/kubernetes/pki/ca.crt")
--kubernetes-advertise-address string Kubernetes API Server advertise address
--kubernetes-api-server string Kubernetes API Server host port
Expand Down
2 changes: 1 addition & 1 deletion cmd/pke/docs/pke_install_master_container-runtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pke install master container-runtime [flags]

```
-h, --help help for container-runtime
--image-repository string Prefix for image repository (default "banzaicloud")
--image-repository string Prefix for image repository
--kubernetes-container-runtime string Kubernetes container runtime (default "containerd")
--use-image-repo-for-k8s Use defined image repository for K8s Images as well
```
Expand Down
2 changes: 1 addition & 1 deletion cmd/pke/docs/pke_install_master_kubernetes-controlplane.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pke install master kubernetes-controlplane [flags]
--etcd-key-file string An SSL key file used to secure etcd communication
--etcd-prefix string The prefix to prepend to all resource paths in etcd
-h, --help help for kubernetes-controlplane
--image-repository string Prefix for image repository (default "banzaicloud")
--image-repository string Prefix for image repository
--kubelet-certificate-authority string Path to a cert file for the certificate authority. Used for kubelet server certificate verify. (default "/etc/kubernetes/pki/ca.crt")
--kubernetes-advertise-address string Kubernetes API Server advertise address
--kubernetes-api-server string Kubernetes API Server host port
Expand Down
2 changes: 1 addition & 1 deletion cmd/pke/docs/pke_install_single.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pke install single [flags]
--etcd-key-file string An SSL key file used to secure etcd communication
--etcd-prefix string The prefix to prepend to all resource paths in etcd
-h, --help help for single
--image-repository string Prefix for image repository (default "banzaicloud")
--image-repository string Prefix for image repository
--kubelet-certificate-authority string Path to a cert file for the certificate authority. Used for kubelet server certificate verify. (default "/etc/kubernetes/pki/ca.crt")
--kubernetes-advertise-address string Kubernetes API Server advertise address
--kubernetes-api-server string Kubernetes API Server host port
Expand Down
2 changes: 1 addition & 1 deletion cmd/pke/docs/pke_install_single_container-runtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pke install single container-runtime [flags]

```
-h, --help help for container-runtime
--image-repository string Prefix for image repository (default "banzaicloud")
--image-repository string Prefix for image repository
--kubernetes-container-runtime string Kubernetes container runtime (default "containerd")
--use-image-repo-for-k8s Use defined image repository for K8s Images as well
```
Expand Down
2 changes: 1 addition & 1 deletion cmd/pke/docs/pke_install_single_kubernetes-controlplane.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pke install single kubernetes-controlplane [flags]
--etcd-key-file string An SSL key file used to secure etcd communication
--etcd-prefix string The prefix to prepend to all resource paths in etcd
-h, --help help for kubernetes-controlplane
--image-repository string Prefix for image repository (default "banzaicloud")
--image-repository string Prefix for image repository
--kubelet-certificate-authority string Path to a cert file for the certificate authority. Used for kubelet server certificate verify. (default "/etc/kubernetes/pki/ca.crt")
--kubernetes-advertise-address string Kubernetes API Server advertise address
--kubernetes-api-server string Kubernetes API Server host port
Expand Down
2 changes: 1 addition & 1 deletion cmd/pke/docs/pke_install_worker.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pke install worker [flags]
--azure-vnet-name string The name of the VNet that the cluster is deployed in
--azure-vnet-resource-group string The name of the resource group that the Vnet is deployed in
-h, --help help for worker
--image-repository string Prefix for image repository (default "banzaicloud")
--image-repository string Prefix for image repository
--kubernetes-api-server string Kubernetes API Server host port
--kubernetes-api-server-ca-cert-hash string CA cert hash
--kubernetes-cloud-provider string cloud provider. example: aws
Expand Down
2 changes: 1 addition & 1 deletion cmd/pke/docs/pke_install_worker_container-runtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pke install worker container-runtime [flags]

```
-h, --help help for container-runtime
--image-repository string Prefix for image repository (default "banzaicloud")
--image-repository string Prefix for image repository
--kubernetes-container-runtime string Kubernetes container runtime (default "containerd")
--use-image-repo-for-k8s Use defined image repository for K8s Images as well
```
Expand Down
2 changes: 1 addition & 1 deletion cmd/pke/docs/pke_machine-image.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pke machine-image [flags]

```
-h, --help help for machine-image
--image-repository string Prefix for image repository (default "banzaicloud")
--image-repository string Prefix for image repository
--kubernetes-container-runtime string Kubernetes container runtime (default "containerd")
--kubernetes-version string Kubernetes version (default "1.22.1")
--use-image-repo-for-k8s Use defined image repository for K8s Images as well
Expand Down
2 changes: 1 addition & 1 deletion cmd/pke/docs/pke_machine-image_container-runtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pke machine-image container-runtime [flags]

```
-h, --help help for container-runtime
--image-repository string Prefix for image repository (default "banzaicloud")
--image-repository string Prefix for image repository
--kubernetes-container-runtime string Kubernetes container runtime (default "containerd")
--use-image-repo-for-k8s Use defined image repository for K8s Images as well
```
Expand Down
2 changes: 1 addition & 1 deletion cmd/pke/docs/pke_machine-image_image-pull.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pke machine-image image-pull [flags]

```
-h, --help help for image-pull
--image-repository string Prefix for image repository (default "banzaicloud")
--image-repository string Prefix for image repository
--kubernetes-version string Kubernetes version (default "1.22.1")
--use-image-repo-for-k8s Use defined image repository for K8s Images as well
```
Expand Down

0 comments on commit 515804c

Please sign in to comment.